Commit Graph

406 Commits

Author SHA1 Message Date
Daniel Marjamäki 45cf562212 matchcompiler: fixed find(simple)match compiler problems. 2013-06-02 13:57:25 +02:00
Daniel Marjamäki 35b13da3a5 matchcompiler: find(simple)match doesn't work well. the compiled functions are not static => the wrong function can be executed. this is a quick fix that just disable find(simple)match compiled patterns. 2013-06-02 12:41:34 +02:00
Frank Zingsheim 650027a07a Fixed #4797 (matchcompiler.py cannot handle overloaded findsimplematch and findmatch) 2013-05-15 18:18:58 +02:00
Daniel Marjamäki e1fd003e2d makefile: make it possible to turn on matchcompiler verifications with 'VERIFY=1' 2013-05-15 13:04:19 +02:00
XhmikosR ae73466f97 Python scripts: PEP8 fixes 2013-03-03 09:59:16 +01:00
PKEuS 2ad38c8701 Updated matchcompiler to support %cop% 2013-03-01 02:52:44 -08:00
Daniel Marjamäki c07576e07e dmake: generating unix makefile from windows. Ticket: #3887
When you commit the generated Makefile from windows you must probably be careful about the line endings.
2013-02-24 03:30:58 -08:00
Stefan Naewe 26ddf07366 tools/dmake: update with MINGW32 support
Signed-off-by: Stefan Naewe <stefan.naewe@googlemail.com>
2013-02-08 12:15:41 +01:00
Daniel Marjamäki 0a88a136ca Reduce: Added --cfg command 2013-01-27 03:20:24 +01:00
Daniel Marjamäki 89b54cb2c9 reduce: reduce structs/enums/etc better 2013-01-20 09:05:50 +01:00
Daniel Marjamäki d87d54339d reduce: fix output 2013-01-17 21:02:52 +01:00
Thomas Jarosch 4fb6751d08 MC: Enable compiled matches for Token::findmatch() and Token::findsimplematch()
Speed is exactly the same and the --verify mode of the
match compiler ensured everything works as expected.
2013-01-16 21:50:32 +01:00
Thomas Jarosch 9f9c654621 MC: Implement verify mode for compiled Token::findmatch patterns 2013-01-14 11:18:33 +01:00
Thomas Jarosch 63e18d6b1c MC: Split _replaceTokenFindMatch() into two small functions 2013-01-14 11:06:59 +01:00
Thomas Jarosch 017783a77e MC: Save one indentation level 2013-01-14 11:06:55 +01:00
Thomas Jarosch 06a7d301e2 MC: Switch to assertEqual function from python's unittest 2013-01-14 11:06:40 +01:00
Thomas Jarosch 3bb8237cdc MC: Turn MatchCompiler tests into python unit test 2013-01-14 11:06:33 +01:00
Thomas Jarosch c0044122f4 Add self test for _replaceTokenFindMatch 2013-01-12 15:28:38 +01:00
Thomas Jarosch ff9e864a07 Add self test for replaceTokenMatch 2013-01-12 15:28:38 +01:00
Thomas Jarosch a7377f180a Quote output of _assertEquals()
It's easier to detect trailing spaces this way.
2013-01-12 15:28:38 +01:00
Thomas Jarosch 4038d4b562 Place main code into own function 2013-01-12 15:28:38 +01:00
Thomas Jarosch fdcfbd5ff9 Add missing copyright header 2013-01-10 11:10:45 +01:00
Thomas Jarosch 6bd7463c54 Add local copy of argparse module to support python 2.6 / python 3.0 2013-01-09 21:30:53 +01:00
Edoardo Prezioso 6236e1dc38 Token::Match: removed harmless special code for initial '!!foo' patterns. 2013-01-09 20:13:33 +01:00
Thomas Jarosch de36324d62 Match compiler: Add cmdline handling 2013-01-09 19:41:03 +01:00
Thomas Jarosch 97e1e50139 Match compiler: Workaround broken code generation for "!!foo" patterns
This is just meant for the upcoming release.
2013-01-09 19:25:24 +01:00
Thomas Jarosch e1be85a552 Match compiler: Be more user friendly on how to invoke it 2013-01-09 19:22:40 +01:00
Thomas Jarosch ade0b741b7 Match compiler: Create 'build' directory if needed 2013-01-09 19:15:13 +01:00
Thomas Jarosch 982503f457 Match compiler: Workaround broken optimizations in verify mode
If the match compiler uses the 'verify' mode and we
compile with -O2, some tests comparing the on-the-fly-parser
to the compiled match fail.

Small functions are inlined by the -O2 compile flag.
If we disable function inlining and still compile with -O2,
everything is back to normal.

gdb didn't show anything useful during the mismatch
since the needed variables are optimized out. Once
we start printing them, the problem vanishes, too.
-> Can only be diagnosed at the x86 assembly level.

The problem vanished by switching the invocation order
of Token::Match() and the compiled match, so just swap them.

Also add commented out helper code
to better diagnose mismatch problems.
2013-01-09 19:03:42 +01:00
Daniel Marjamäki 9ecc74e845 tools/reduce: change default timeout to 5 minutes no matter if --hang is used or not. 2013-01-08 07:10:14 +01:00
Thomas Jarosch 9970414a2f Match compiler: Implement 'verify mode' for Token::Match
Verify mode runs the same ::Match pattern on a token
using the on-the-fly parser and the compiled match parser.
The result is compared and we abort on mismatch.

Already detected an error in our test suite, needs investigation.
2013-01-07 22:27:57 +01:00
Thomas Jarosch 9b51d81e99 Match compiler: Split _replaceTokenMatch() into two small functions 2013-01-07 21:39:49 +01:00
Daniel Marjamäki 7657b84c44 reduce: rename stdout to print to avoid name clash 2013-01-07 18:45:29 +01:00
Thomas Jarosch 3918948dd5 Match compiler: Aggregate match functions with the same pattern / function call signature
Reduces the number of generated functions from 2290 to 1916.
2013-01-04 04:47:01 +01:00
Thomas Jarosch 5f09cb2e4d Match compiler: Store matchFunctions and matchStrs in the class instead of passing it around 2013-01-04 03:56:21 +01:00
Thomas Jarosch 542c6e82d3 Match compiler: Cosmetic changes after running pylint 2013-01-04 03:44:04 +01:00
Thomas Jarosch 71a236b3df Match compiler: Turn code into a python class
This will make passing around internal states a lot easier
2013-01-04 03:38:40 +01:00
Thomas Jarosch f9c752667e Match compiler: Inline generated pattern match code for Token::findmatch
Verified the output in build/ stayed the same
if Token::findmatch support is disabled.
2013-01-04 03:13:22 +01:00
Thomas Jarosch 4b386986fc Match compiler: Check varid on first use like Token::Match does 2013-01-04 01:14:52 +01:00
Thomas Jarosch 5d5efdf99f Match compiler: Add support for Token::findmatch
(still disabled for performance reasons)
2013-01-04 01:01:57 +01:00
Thomas Jarosch 241d23ba8e Remove reduce tool in 'make clean' 2013-01-03 21:59:28 +01:00
Thomas Jarosch 4a2d2f78ef tools/reduce: Remove unused variable detected by cppcheck
[reduce.cpp:475]: (style) Variable 'decl' is assigned a value that is never used.
2013-01-03 21:38:47 +01:00
Thomas Jarosch 7417144784 Match compiler: Compile Token::findsimplematch() calls
Disabled for now as it runs slowers than before.
2013-01-03 19:33:37 +01:00
Daniel Marjamäki 76c8887f5f tools/reduce: remove cast in function parameter 2013-01-03 18:28:20 +01:00
Daniel Marjamäki 16612d010d tools/reduce: improvements to make it possible to reduce code that hangs 2013-01-03 15:22:54 +01:00
Daniel Marjamäki ed803b302b reduce: remove more stuff. unneeded #define , unneeded constructors, unneeded #ifndef etc 2013-01-02 17:08:04 +01:00
Daniel Marjamäki 1f3628a2fe reduce: remove more code blocks 2013-01-02 15:37:41 +01:00
Daniel Marjamäki 28d5ad9d21 dmake: fixed reduce compilation 2013-01-02 15:36:17 +01:00
Daniel Marjamäki 7f2d9cb7eb dmake: fixed compilation of reduce 2013-01-02 14:43:31 +01:00
Daniel Marjamäki 9877b77291 dmake: use 'make reduce' to compile the reduce program 2013-01-02 13:30:06 +01:00
Daniel Marjamäki e0a902e071 tools/reduce: various improvements to remove more code 2013-01-01 20:18:31 +01:00
Reijo Tomperi 5d5f7085bf Updating year 2012 -> 2013 to .cpp and .h files and man page. 2013-01-01 18:29:08 +02:00
Daniel Marjamäki f2f8780504 tools/reduce: better handling of #include 2013-01-01 16:18:06 +01:00
Daniel Marjamäki e824f76ed7 tools/reduce: removing blocks of code that contain #if,#else,#endif 2013-01-01 14:33:32 +01:00
Daniel Marjamäki 6ee32943f2 tools/reduce: speedup, terminate checking when error is found 2013-01-01 13:56:37 +01:00
Thomas Jarosch 62b05193c4 MC: Split convertFile() function into smaller pieces
Output of build/ stayed the same.
2012-12-31 15:30:27 +01:00
Thomas Jarosch 311630ac1c Match compiler: Python syntax simplification
Output in build/ stayed the same
2012-12-31 15:03:00 +01:00
Thomas Jarosch 51cff0cb9b Match compiler: Speed up Token comparison with string literals. Ticket #4451
"Cache" string literals as C++ std::string objects.
The string length gets cached and so we don't need to
call strlen() on the literals at runtime.
2012-12-31 14:45:16 +01:00
Daniel Marjamäki 676b5a15a6 reduce: Added simple command line tool that reduces code for a false positive. 2012-12-31 12:41:36 +01:00
Thomas Jarosch 3c915b534d Match compiler: Collect and cache plain C-strings
Profiler runs with gperftools showed we were spending
a lot of time in strlen() even with compiled match patterns.

If you compare a std::string with a plain C-string,
the comparison operator needs to calculate the length
of the C-string via strlen().

We can avoid this by turning all C-strings into C++ strings,
which cache the string length internally.

The match compiler has been adapted to collect all
C-strings during compilation and aggregate them.

Benchmark on the 'rpm' code base on a Core i7 920 box:

cppcheck without matchcompiler:
real    0m30.977s

cppcheck with previous matchcompiler:
real    0m28.157s

cppcheck with cached C-strings:
real    0m17.823s
2012-12-30 23:24:28 +01:00
Thomas Jarosch fe5ee76165 Match compiler: No need to handle %num% twice 2012-12-30 20:33:49 +01:00
Thomas Jarosch 33f4bd0298 Silence cppcheck warning 2012-12-25 15:28:58 +01:00
Thomas Jarosch 3d0b4a9f7e Add execute permissions to matchcompiler.py on linux 2012-12-25 13:18:24 +01:00
Thomas Jarosch a2885a1759 Python 3 compatibility for the helper scripts
print() is a function in python 3.
Works with pyhton 2.x, too.
2012-12-25 13:12:58 +01:00
Daniel Marjamäki 3b3fe1c616 matchcompiler: throw InternalError if Token::Match is called with the varid 0 2012-12-19 06:45:05 +01:00
XhmikosR 9f11c01450 apply astyle 2012-12-15 09:46:02 +01:00
Daniel Marjamäki b6786c87b4 matchcompiler: handle %varid% 2012-12-14 16:59:37 +01:00
Daniel Marjamäki 7c931960bd Merge pull request #123 from Keruspe/master
build: Fix sources location
2012-12-11 11:13:39 -08:00
Marc-Antoine Perennou cd9782472f build: rename LIBDIR to SRCDIR
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2012-12-11 09:30:37 +01:00
Daniel Marjamäki 2d8ed65d43 compiled Token::Match patterns: refactorings,improvements 2012-12-10 20:28:11 +01:00
Daniel Marjamäki a11ec4a5ee matchcompiler: replaced regular expression with simple code that parses the code better 2012-12-08 19:29:16 +01:00
Daniel Marjamäki 9fcfb38a1c matchcompiler: merged regular expressions to a single expression 2012-12-08 16:22:55 +01:00
Daniel Marjamäki bef0cf149b matchcompiler: reverted changes so the 'make test' works again 2012-12-08 07:41:18 +01:00
Daniel Marjamäki 9bd222970e matchcompiler: fixed hang. don't know why it hangs. 2012-12-04 23:38:49 +01:00
Daniel Marjamäki ae7846bf7e matchcompiler: added some selftests for findMatchPattern 2012-12-04 22:57:52 +01:00
Daniel Marjamäki 514d06b015 Makefile: minor cleanup 2012-12-03 06:34:43 +01:00
Daniel Marjamäki 94930c3bd7 Compiled Token::Match patterns: let 'make clean' cleanup compiled patterns 2012-12-02 13:42:48 +01:00
Daniel Marjamäki ef5eece286 Compiled Token::Match patterns: extended match patterns and refactored the script a little 2012-12-02 13:39:59 +01:00
Daniel Marjamäki d630d34b62 Compiled Token::Match patterns. Added python script solution. Python is required to build with compiled patterns. To build cppcheck with compiled patterns use 'make LIBDIR=build'. 2012-12-02 12:36:55 +01:00
Daniel Marjamäki 29263e63fe times: added shell script that executes previous tags 2012-11-30 12:12:04 +01:00
Daniel Marjamäki ea9f0718b0 tools/times: minor tweaks 2012-11-27 12:20:23 +01:00
Daniel Marjamäki b200e1c430 tools/times: tweaked shell script to work better 2012-11-27 07:24:18 +01:00
Daniel Marjamäki 1ebab4a442 tools/times: added simple scripts to generate time stats for cppcheck 2012-11-27 06:08:26 +01:00
XhmikosR 941945bf42 missing tab to space 2012-09-29 18:02:34 +02:00
XhmikosR 9b5c245899 tabs to spaces, remove trailing spaces and extra empty lines at the end of files 2012-09-29 13:49:16 +02:00
Daniel Marjamäki ce862e02aa dmake: New version of TinyXml needs -DTIXML_USE_STL define in linux 2012-09-09 13:08:04 +02:00
Edoardo Prezioso 826d5bb00b Since the GCC -Wconversion warnings are fixed (at least on a x86-64 environment), enable it in the Makefile. 2012-07-18 00:50:30 +02:00
Kimmo Varis fe9e6130cf Add general PRO file for console builds.
It is easier to maintain PRO files when we keep all the console-
build specific general options in one file. For example changes to
compiler options affect to all console builds.
2012-06-18 09:28:32 +03:00
Daniel Marjamäki f98179a835 astyle formatting 2012-06-18 06:41:04 +02:00
Kimmo Varis 7b603813d7 dmake: Apply small fix from Dan.
This fixes the potential (but not likely to happen) case when
file list is empty. Dan suggested this change when reviewing my
earlier patch.
2012-06-11 22:09:09 +03:00
Kimmo Varis 734d4af007 Tests: Generate test file listing with dmake.
Use dmake to generate a test/testfiles.pri with all the files
containing tests. The testfiles.pri is included by the test/test.pro,
which compiles the test runner. This automates the test file listing
instead of former way to hand-edit the file list.

Fixes ticket #3885 (dmake needs to create a list of test files for qmake)
2012-06-11 22:05:55 +03:00
Kimmo Varis be21a44dd2 Tools: Adding a tools.pro to build dmake. 2012-06-11 14:45:32 +03:00
Daniel Marjamäki 16427b40b9 dmake: move . this fixes compiler errors when compiling with some old gcc 3.X compiler 2012-02-26 10:18:21 +01:00
Edoardo Prezioso f37f13c3ad Fixed typo in make file generation. 2012-02-17 20:12:41 +01:00
Daniel Marjamäki f183954150 dmake: keep some dummy debug code in release Makefiles to make the debug/release more similar 2012-02-12 03:30:58 +01:00
Edoardo Prezioso f20e88fcc5 tools/dmake.cpp: nitpicky reorder of commented warnings in alphabet order with uncommented ones. 2012-01-03 15:10:32 +01:00
Reijo Tomperi 8cae17fda8 Update year to 2012 2012-01-01 01:05:37 +02:00
Daniel Marjamäki 5cc5330d95 extracttests.py: reverted last change. see comments on github. 2011-12-07 21:49:34 +01:00
Daniel Marjamäki ab348387b5 extracttests.py: python 3 compatibility updates 2011-12-07 17:05:24 +01:00
Daniel Marjamäki e9546c5042 extracttests.py: create output folders if they dont exist 2011-12-04 21:46:56 +01:00
Daniel Marjamäki 8e9097bce7 extractpython.py: cleanup 2011-12-02 19:08:04 +01:00
Daniel Marjamäki 712ca42985 extracttests: refactorings. dont include dynamic strings in the listing 2011-12-02 18:33:17 +01:00
Daniel Marjamäki ca9dbfc031 extracttests.py : improved errors.txt output 2011-11-29 21:35:57 +01:00
Akio Idehara baa97d53fc Fixed #3346 (cygwin detection for _GLIBCXX_DEBUG in Makefile) 2011-11-29 20:35:56 +01:00
Daniel Marjamäki 932680994d removed old extracttests.cpp 2011-11-29 17:43:23 +01:00
Daniel Marjamäki 16ae2f49ca extracttests.py: minor code fixes of --code handling 2011-11-29 10:13:37 +01:00
Daniel Marjamäki 7624313808 extracttests.py: added option to output test files 2011-11-28 22:17:06 +01:00
Daniel Marjamäki c0770f0823 extracttests.py: improved command line parser 2011-11-27 17:11:38 +01:00
Daniel Marjamäki ac06f34627 extracttests.py: cleaned up the code for parsing of command line 2011-11-27 15:24:13 +01:00
Daniel Marjamäki 681e4ba314 extracttests.py: exit if wrong command line is given 2011-11-27 14:11:15 +01:00
Daniel Marjamäki ce2be7cbe3 extracttests.py: reduce line lengths 2011-11-27 13:49:20 +01:00
Daniel Marjamäki 370018d313 extracttests.py: close input file 2011-11-27 11:43:13 +01:00
Daniel Marjamäki 54eeb76a71 extracttests.py: renamed 'str' to 'string' 2011-11-27 11:40:23 +01:00
Daniel Marjamäki 0c54f88dd0 extracttests.py: added docstrings. added navigation links. 2011-11-27 11:35:01 +01:00
Daniel Marjamäki db186b2c25 extracttests.py: allow user to see 'error cases only' 2011-11-27 10:26:35 +01:00
Daniel Marjamäki 315ce1db40 extracttests.py: added function 'trimname' 2011-11-27 08:32:07 +01:00
Daniel Marjamäki 52caadf957 extracttests.py: Added a little help info 2011-11-27 08:13:11 +01:00
Daniel Marjamäki 9c626b941a extracttests.py: Added tool for extracting test information 2011-11-27 08:06:11 +01:00
Edoardo Prezioso 433f4640a9 Fix some GCC warnings regarding the sign conversion. 2011-10-30 18:34:49 +01:00
Ville Skyttä b69ad0fefc Makefile: Use pcre-config to get include/lib paths etc 2011-10-28 21:20:19 +02:00
Daniel Marjamäki 17aea0a997 dmake: disabled -Wunreachable-code because there was too many warnings 2011-10-24 07:09:14 +02:00
Edoardo Prezioso df5d26901c Add new warning option to check for dead code and change the order of some struct members to reduce structure padding. 2011-10-24 03:02:00 +02:00
Edoardo Prezioso 12f6ce46f8 Add more warnings and fix the ones reported by them. 2011-10-22 15:05:43 +02:00
Daniel Marjamäki 34e2a2ad66 Makefile: Disable rules by default 2011-10-17 20:18:36 +02:00
Daniel Marjamäki 6f8e42a5af changed the astyle formatting flags 2011-10-13 20:53:06 +02:00
Kimmo Varis 80ba3d6a92 Merge pull request #32 from rpavlik/qmake-configure-rules
Qmake configure rules
2011-08-19 13:00:34 -07:00
Edoardo Prezioso f62d1d0122 Fixed #3017 (set HAVE_RULES to yes only if HAVE_RULES is undefined when executing make.) 2011-08-19 00:28:31 +02:00
Ryan Pavlik 50b0e95314 put the rules logic in its own .pri file, and allow easier override 2011-08-18 15:42:19 -05:00
Ryan Pavlik 33b5970c91 use the qmake config setting HAVE_RULES to enable/disable pcre rules support,
defaulting to on except on Windows.
2011-08-18 12:13:21 -05:00
Daniel Marjamäki d336e91049 Makefile: Added the -D_GLIBCXX_DEBUG flag again to get checked stl during debug 2011-08-14 18:57:48 +02:00
Kimmo Varis d698e24746 dmake: Fix build in Windows. 2011-08-11 23:41:35 +03:00
Kimmo Varis 3eb11e7bdf Tools: Update VS project file. 2011-08-11 23:40:10 +03:00
Kimmo Varis a382a6938b Tools: fix Makefile
tools/ Makefile contained errmsg target whose source does not
exist anymore. And it didn't have a target for extracttests.
Removed the errmsg target and added new target for extracttests.

Ticket: #2988 (In tools, make error: no rule to make target `errmsg.cpp', needed by `errmsg'.)
2011-08-10 23:58:54 +03:00
Felix Geyer e49763b14f Ticket: #2823 (cppcheck fails to build with system tinymxl and -Wl,--as-needed) 2011-06-19 20:56:12 +03:00
Kimmo Varis a6c35cb828 Fix tools/Makefile permissions. 2011-06-18 11:08:40 +03:00
seb777 c73506009b Merge branch 'master' of http://github.com/danmar/cppcheck 2011-05-02 19:55:34 +02:00
Kimmo Varis c7d99fe9a7 Remove ErrorLogger::reportStatus() method.
The ErrorLogger::reportStatus() is not lib code interface. The CLI
code does the looping through file list and gives one file at a
time for the core code. Hence lib has no any idea about the
progress and it can't provide such information.

Also the recent commit (6d858b6) caused a GUI build failure by
adding CLI code dependency to GUI. Which is big no-no.

This is admittedly a hack. But it allow us to build all modules
again.
2011-04-27 23:27:02 +03:00
Daniel Marjamäki 29a7b3bafd dmake: fixed compiler error 2011-04-27 17:57:03 +02:00
Greg Hewgill 7ae4896703 Makefile: handle case where LDFLAGS is already defined (in dmake) 2011-04-23 00:20:38 +12:00
Daniel Marjamäki 712e285bd6 Makefile: added option for compiling with/without rules 2011-04-19 20:53:40 +02:00
Reijo Tomperi 485ff0b472 "#ifndef" can't be used in Makefile (it is considered a commented line). Replaced it with "ifndef". 2011-04-11 22:54:29 +03:00
Daniel Marjamäki 5058cc6aa1 Reverted non-CMake changes in previous 'Added CMake files' commit 2011-03-25 07:59:48 +01:00
Markus Elfring 9301ee28a8 Added CMake files 2011-03-25 07:14:53 +01:00
Sebastien Debrard 48cc875bdf fix compilation error 2011-03-23 01:27:08 +01:00
Sebastien Debrard 8f6af5c6da fix compile error 2011-03-23 01:25:47 +01:00
Daniel Marjamäki 8caf96be63 FileLister: Moved back the code into a single cpp file 2011-03-20 14:25:11 +01:00
Daniel Marjamäki f5ebd779f8 GCC: Disabled the -Wsign-conversion. It is quite noisy. 2011-02-17 22:28:36 +01:00
Daniel Marjamäki 805773663e Build: Renamed HAVE_DEPENDENCIES to HAVE_RULES 2011-02-14 19:37:58 +01:00
Daniel Marjamäki 27febb062b cppcheck: Added HAVE_DEPENDENCIES define. Cppcheck cli can be compiled without dependencies. 2011-02-12 08:06:59 +01:00
Daniel Marjamäki 227a6100f7 astyle formatting 2011-02-11 19:31:37 +01:00