Commit Graph

9255 Commits

Author SHA1 Message Date
Daniel Marjamäki eebfea2b23 Fixed #4381 (Inline type declaration on statics causes warning) 2013-01-07 19:20:15 +01:00
Zachary Blair f3c3b7c910 Fixed #4405 (False positive: Memory in freed twice (throw)) 2013-01-05 19:02:19 -08:00
PKEuS f5ebbff0a3 Fixed #4460: Ensure that memset/memcpy is called on a pointer to a class instance. 2013-01-05 12:27:55 -08:00
Edoardo Prezioso 4c73c29cdd Revert partially the previous commit:
The two formulas are true iff 2n = 2 <=> n = 1.
2013-01-05 17:31:08 +01:00
Edoardo Prezioso c465cf4ab4 Related to the previous commit:
Use bit operator '&' instead of modulo operator '%'.
2013-01-04 14:20:15 +01:00
Edoardo Prezioso 1c0c0471df Simplify some generalized math formulas:
Now the 'sin^2+cos^2=1' and the 'sinh^2-cosh^2=-1' code can handle, for example: sin^4+cos^4=1, sinh^10-cosh^10=-1.
Also, the arguments can be also multitokens, so that it's possible to simplify, for example: 'sin^2(k())+cos^2(k())=1'.
2013-01-04 13:06:09 +01:00
Edoardo Prezioso 5485e6866f Fixed wrong tokenization of some math formulas:
The two formulas: sin^2+cos^2 = 1 and sinh^2-cosh^2 = -1 are true iff the two arguments are the same.
2013-01-04 11:28:01 +01:00
Robert Reif d37906041b Fixed #4458 (False positive: noCopyConstructor in template class) 2013-01-04 10:35:24 +01:00
Daniel Marjamäki d5dfd5a006 GUI: removed my clumpsy selectfiles dialog. use the standard file selection dialog instead. 2013-01-04 10:23:16 +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 7f0bc73e8e Simple constification (needed by the match compiler) 2013-01-04 03:17:52 +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
Edoardo Prezioso c9fb7f529d Use more Effective C++ code style in SymbolDatabase class:
1)The SymbolDatabase::findScope code is moved to the const-version. The non-const version is reimplemented as the combination with const_cast and static_cast.
2)Unrelated: change style of the declaration of some functions (the '*' is moved near the function name).
2013-01-04 01:19:17 +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
Edoardo Prezioso 1affb0c96b Use more Effective C++ code style in Token class:
1)The non-const version of Token::tokAt and Token::linkAt now will use a combination of const_cast and static_cast to remove duplicate code.
2)The non-const versions of Token::find(simple)match are added, in order to avoid the usage of const_cast outside the Token code.
3)As a consequence of 2), an useless const_cast applied to a call of Token::findsimplematch in Tokenizer code is removed.
2013-01-03 22:35:34 +01:00
Thomas Jarosch 7289b70eb1 Add reduce tool to .gitignore 2013-01-03 22:00:45 +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 a3ee72a51d Fixed #4409 (Cppcheck 1.58 dev hangs when checking mhz.c of lmbench3 (attached code)) 2013-01-03 19:14:44 +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 ded0d50591 Tokenizer: add reportProgress to Tokenizer::simplifyKnownVariables. Ticket: #4409 2013-01-03 15:22:06 +01:00
Daniel Marjamäki 70059c06de Fixed #4456 (std::string::compare(char const*) crash) 2013-01-03 08:44:32 +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
Edoardo Prezioso 9455542e81 Update cppcheck translations. 2013-01-02 15:43:54 +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 6e58ed3040 Fixed #4454 (False positive: class member (POD) not initialized (when initialized to 0 in initializer list)) 2013-01-02 13:59:57 +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
Robert Reif d2e8ab9c86 Fixed #4302 (Member variable not initialized in public delegate constructor) 2013-01-01 09:53:40 +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 d366b00eca Add myself to AUTHORS 2012-12-31 14:53:41 +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
Edoardo Prezioso 6612952dd4 Use 'simple' matching with normal patterns. 2012-12-31 13:30:06 +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
Daniel Marjamäki bf169e0c59 Replaced %name% with %type% 2012-12-31 10:45:37 +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