Daniel Marjamäki
8236cd4d50
Fixed #3785 (false positive: (style) Variable 'dinv' is assigned a value that is never used)
2012-05-08 12:04:54 -07:00
Daniel Marjamäki
dad2fb6db1
Fixed #3737 (Preprocessor: __cplusplus always defined for c++ code)
2012-05-08 11:49:43 -07:00
Daniel Marjamäki
99a29eafc9
Fixed #3691 (Tokenizer::simplifyKnownVariables: continue in switch)
2012-05-07 12:11:23 -07:00
Daniel Marjamäki
2fbd77c5a1
Fixed #3715 (false positive checking a map bounds)
2012-05-07 12:03:33 -07:00
PKEuS
ec00824fd3
Fixed #3357 :
...
- Print "inconclusive" tag in cli
- Fixed inconclusive handling in checkbufferoverrun.cpp
- Merged reportInconclusiveError into reportError by adding an additional parameter "bool inconclusive" which is false per default
2012-05-06 10:37:41 -07:00
PKEuS
6ef92c4fd7
Use recently implemented new constructor of ErrorLogger::ErrorMessage in checkmemoryleak.cpp and symboldatabase.cpp
...
Fixed test failure introduced in f105bf75a6
2012-05-06 04:01:56 -07:00
Daniel Marjamäki
37cdb515af
Generated new VS2008/VS2010 project files (testrunner)
2012-05-05 11:18:50 -07:00
PKEuS
1a5fbd61d2
Splitted class TokenList from Tokenizer
2012-05-05 09:33:26 -07:00
Daniel Marjamäki
11614021e8
Fixed #3768 (Tokenizer::setVarId: no varid for 'std::string' parameter after a 'std::string' parameter called 'string')
2012-05-05 09:59:43 +02:00
Daniel Marjamäki
005ce81689
Fixed #3640 (False positive: statement begins with numeric code)
2012-05-04 17:53:47 +02:00
Daniel Marjamäki
119b24e363
Fixed #3756 (False positive: uninitvar in malloc)
2012-05-03 19:10:51 +02:00
PKEuS
04704ac5fa
Refactorizations in checkmemoryleak.cpp:
...
- Use symbolDatabase more often to increase performance and accuracy.
- Replaced indendation counter
- Replaced custom stringify implementation
Benchmark results (sqlite checking):
4% complete, 7% on "Memory leaks (function variables)", 9% on "Memory leaks (address not taken)" and 82% on "Memory leaks (struct members)"
2012-05-03 10:43:47 +02:00
Ettl Martin
f01c244212
added testcase to ticket 3727
2012-05-01 14:36:42 +02:00
Ettl Martin
28510bdd38
added todo testcase for ticket 3597
2012-05-01 14:26:34 +02:00
Daniel Marjamäki
d5442280b1
Fixed #3597 (Errors in evaluation of chained assignment operators)
2012-05-01 07:06:14 +02:00
PKEuS
8e362ad5f7
Fixed #3771
...
Stronger testing for false positives in inconclusive checking in checknullpointer.cpp
2012-04-30 12:36:41 +02:00
Edoardo Prezioso
5d6a257c86
Fixed #3770 (Segmentation fault in K&R function parameters simplification)
2012-04-29 12:58:52 +02:00
Daniel Marjamäki
082e6d506b
#3744 (Unexpected unused value warning for char ptr types set in switch)
2012-04-28 15:43:42 +02:00
PKEuS
a0d92f5ed9
Refactorizations in SymbolDatabase:
...
- Skip struct keywords in argument list so that Variables declared like "Struct Foo bar" get a type
- Remvoved redundant argument from Function::addArguments
- Set Function::functionScope for global functions
- Replaced some indendation counters by Token::findClosingBracket
2012-04-27 21:51:13 +02:00
Edoardo Prezioso
6fd6f0998b
Improvement to 5b8840c6b02bd648dc2b75e60145474ae12f8e67: handle also 'const struct|union' types as template parameters.
2012-04-27 20:51:55 +02:00
Daniel Marjamäki
5b8840c6b0
Fixed #3764 (Tokenizer::setVarId: no varid for templated variables with const/struct/union types)
2012-04-27 18:02:07 +02:00
Ettl Martin
bf0ed17a16
added testcase for ticket #3602
2012-04-27 02:05:45 +02:00
Ettl Martin
bb8342fbb4
fixed misspelled word 'Comparision' --> 'Comparison'
2012-04-26 23:04:55 +02:00
Daniel Marjamäki
df6f88b4fe
Fixed #3755 (Tokenizer::setVarId: improve varid inside class for struct/class variables)
2012-04-26 18:38:47 +02:00
PKEuS
746beb98bf
Added support for delete and delete[] in invalidDeallocation check ( fixes #1773 )
2012-04-26 16:44:33 +02:00
PKEuS
5ac7552e4e
New check: Comparision of modulo results that are always true/false.
2012-04-26 15:23:47 +02:00
PKEuS
2a2d76749e
Improve check: Check for 64-bit portability issues when returning pointers/integers
2012-04-26 13:39:19 +02:00
Ettl Martin
2848c61e88
#3344 added missing testcase
2012-04-26 13:37:13 +02:00
Ettl Martin
8494df74e6
#2540 : added missing testcase.
2012-04-26 13:16:46 +02:00
PKEuS
30e8e389a7
Fixed #2980
2012-04-26 10:58:35 +02:00
PKEuS
1e708e10d0
Fixed #2875
2012-04-26 10:35:40 +02:00
PKEuS
a4c4c66a4c
Added test case for #3466
2012-04-25 21:14:25 +02:00
PKEuS
31a252b057
Fixed #3746 : Issue operatorEqToSelf error only if the operator takes an object of the class as argument.
2012-04-25 20:25:51 +02:00
Daniel Marjamäki
f84a4344ae
Fixed #3754 (Tokenizer::simplifyKnownVariables: wrong for loop simplification)
2012-04-25 19:23:17 +02:00
Edoardo Prezioso
08ae15e42d
Fixed the grammar in some reportError messages in the Tokenizer class, thanks to kimmov's suggestion.
2012-04-25 15:09:46 +02:00
Daniel Marjamäki
fb6c7f33f0
Fixed #3707 (Uninitialized variable with operator >> and templates)
2012-04-24 19:50:54 +02:00
PKEuS
e0a3ca0845
Refactorizations in class Token: changed handling of different types of tokens.
...
- Replace _isNumber, _isName, _isBoolean attributes by a single _type attribute (enum Token::Type), because not two of the old booleans could be true at the same time.
-> Add support for lots of different other kinds of tokens. (More precise checking of token type possible)
-> Replaced instant checking of type for Operators, etc. by a value calculated at creation time. (Faster checking)
2012-04-23 21:05:26 +02:00
Daniel Marjamäki
6ae135124e
Tokenizer::setVarId: better handling of initializer lists
2012-04-23 18:26:27 +02:00
Ettl Martin
d0b7a3514b
added unittest to fix sample code #3721
2012-04-22 17:28:27 +02:00
Daniel Marjamäki
706631f527
Fixed #3748 (False positive out of bounds with postincrement)
2012-04-22 12:22:49 +02:00
Daniel Marjamäki
d5f6cfcfa8
Tokenizer: Use new setVarId function. Removed the old one.
2012-04-22 11:36:31 +02:00
Daniel Marjamäki
aeac38b673
Tokenizer::setVarIdNew: Removed test case in TestUnusedVar that fails with the new setVarId function. The new setVarId function assumes that 'static int i(a);' is a variable declaration if it's in a executable scope (it is unknown if 'a' is a type or a variable so this assumption could be wrong).
2012-04-22 10:42:55 +02:00
Daniel Marjamäki
807f49ce83
testrunner: fixed test case when TestTokenizer::setVarIdOld is used
2012-04-22 09:56:02 +02:00
Daniel Marjamäki
71050bc586
Tokenizer::setVarIdNew: fixed TestTokenizer::varid_in_class2 test case
2012-04-22 08:51:19 +02:00
Ahti Legonkov
79af6f65d7
Fixed #3699 (cppcheck hangs with 100% cpu load on parsing preprocessor code)
2012-04-22 06:49:42 +02:00
Edoardo Prezioso
8dfde7def8
Added missing testcase from previous commit.
2012-04-22 02:41:51 +02:00
Edoardo Prezioso
be5a61b794
Fixed ticket #3721 (false positive: syntax error on valid C code ( K&R function style )).
2012-04-22 01:56:40 +02:00
Daniel Marjamäki
f3cbb3f05d
TestTokenizer: Removed varid test cases that have impossible source code
2012-04-21 19:07:35 +02:00
Daniel Marjamäki
bd60dd46d0
Tokenizer::setVarIdNew: handle special case when there is an unknown macro. Ticket #2638
2012-04-21 17:57:20 +02:00
Ettl Martin
2840b19fb3
removed some c++-comments within testcases ( from my last commit ). No functional change.
2012-04-19 10:15:29 +02:00
Ettl Martin
7699d5bf87
#3742 added testcases to ensure it works correctly.
2012-04-19 10:08:51 +02:00
PKEuS
af80344ab7
Refactorizations in checkclass.cpp:
...
- Removed local isVirtual implementation in checkclass.cpp, use Function::isImplicitlyVirtual instead
- Don't bailout when we see C++-style casts in checkConst
- Don't bailout for this pattern "any << member << any"
- Improved/Fixed some test cases (-> #1305 )
2012-04-18 18:51:38 +02:00
PKEuS
6a37c36ee8
Fixed #3741
...
Removed redundant nullpointer check (cppcheck catch)
2012-04-18 16:35:04 +02:00
PKEuS
cb064dc20e
Implemented generic mechanism for '<'-'>' "linkage" before link() works (Taken from Scope::findClosingBracket, but C++11 right angle bracket support added): Token::findClosingBracket
...
-> Replaced several indendation-counting mechanisms in tokenize.cpp
Fixed build failure in checkclass.cpp
2012-04-18 16:02:03 +02:00
PKEuS
f6fd44910a
Refactorizations in SymbolDatabase:
...
- Replaced Scope::access by a locally stored std::map, because its a temporary status variable that is only necessary when creating the symboldatabase
- Moved SymbolDatabase::argsMatch to Function::argsMatch, because its function specific
- Improved Scope::findClosingBracket: Improved reliability, made it static and faster
2012-04-18 13:00:34 +02:00
PKEuS
1793bf8928
Fixed false positive in stlBoundries check ( #3740 )
2012-04-18 10:08:59 +02:00
PKEuS
c6f6194008
Added Function::isImplicitlyVirtual to symboldatabase.cpp
...
Made SymbolDatabase::argsMatch static because its possible and necessary for Function::isImplicitlyVirtual
2012-04-17 19:50:44 +02:00
PKEuS
a971e1530b
Refactorizations in test suite:
...
- Removed another custom stringify implementation (testtoken.cpp)
- Removed unnecessary forward declaration (testsuite.h)
- Use std::ostringstream instead of std::stringstream (redirect.h)
2012-04-17 12:57:16 +02:00
PKEuS
8e5949c6ce
Added several C++11 algorithms and containers to CheckStl
...
Added pattern "> %varid%" to CheckStl::stlBoundries()
Fixed message in checkOther (#1320 )
2012-04-17 12:54:01 +02:00
PKEuS
82cd022646
Refactorized CheckStl::mismatchingContainersError:
...
- Improved error message
- Made patterns more generic by using Token::nextArgument()
2012-04-17 12:21:41 +02:00
PKEuS
88aa08e71b
Refactorizations in test suite:
...
- Removed redundant tokenization helper functions in testtokenize.cpp and testsimplifytokens.cpp
- Pass arguments as const char[] or const std::string& to avoid instanciation or at least copying of strings
- Removed redundant calls to Tokenizer::validate() - This function is already called implicitly by tokenize() and simplifyTokenList()
2012-04-17 09:51:08 +02:00
Ettl Martin
09d41b2f84
ticket 2669: added todo testcase
2012-04-17 00:31:32 +02:00
PKEuS
4dcb2ef57b
Refactorizations in test suite:
...
- Removed again one custom stringify implementation
- Avoided unnecessary std::string creation in testbufferoverrun.cpp
2012-04-16 20:02:52 +02:00
PKEuS
bac8ed7127
Refactorized stringification of tokens:
...
- Function that stringifies one token: Token::stringify()
- Functions that stringify a list of tokens: Token::stringifyList()
-- Single and powerful "base" function, used by several "light" functions
Refactorized
- testtokenize.cpp and testsimplifytokens.cpp: Use improved stringification functions instead of several local implementations
- Avoided redundand creation of std::string when using TestTokenizer::tokenizeAndStringify and in cmdlineparser.cpp
2012-04-16 19:51:07 +02:00
PKEuS
1c3c94dc67
New simplification: Remove 'extern "C"' from C++ code.
...
Refactorization in cppcheck.cpp: Catch exception as const reference instead of non-const reference.
2012-04-16 16:25:04 +02:00
Daniel Marjamäki
c58d02f146
Tokenizer::setVarIdNew: in C code, allow that variable declaration starts with delete and throw
2012-04-15 18:23:12 +02:00
Daniel Marjamäki
46bfe27831
Tokenizer::setVarIdNew: Better handling of function calls
2012-04-15 17:44:51 +02:00
Daniel Marjamäki
31f8a71f84
Tokenizer::setVarIdNew: Better handling for catch-exception-by-reference
2012-04-15 17:39:22 +02:00
Daniel Marjamäki
3c1dfc658c
Tokenizer::setVarIdNew: use the new setVarId with a few more test cases. Improved setVarId: references in executable scopes must be initialized.
2012-04-15 14:32:47 +02:00
Daniel Marjamäki
27c37896a0
Tokenizer::setVarIdNew : use new setVarId function in TestTokenizer::varidReturn2.
2012-04-15 14:19:17 +02:00
Daniel Marjamäki
95dafd30dd
Tokenizer::setVarIdNew : enable more testcases. better handling of unions and struct members.
2012-04-15 13:42:13 +02:00
Daniel Marjamäki
4c79a1af20
testrunner: use new Tokenizer::setVarId function in some unit tests
2012-04-15 12:49:53 +02:00
Daniel Marjamäki
c6ba3ba3ca
Fixed #3714 (segmentation fault of cppcheck checking libtiff)
2012-04-14 18:36:19 +02:00
PKEuS
9f054fbb3c
Fixed crash when "-rp=" or "--relative-paths=" is given - print Error.
2012-04-14 14:44:15 +02:00
PKEuS
62d5069387
Fixed #3722 : Handle associative law correctly for operator*
2012-04-13 11:55:09 +02:00
Edoardo Prezioso
51789d8e20
Fixed ticket #3712 (false positive: syntax error on valid C code ( K&R function style ))
2012-04-13 00:39:40 +02:00
Ettl Martin
7be01da8e9
fixed ticket 3693. Added modulus operator to Mathlib + unittests. Added a test to checkother to ensure the testcase of ticket 3693 does not trigger an error message.
2012-04-12 14:02:09 +02:00
Daniel Marjamäki
8e3f1702fd
Reverted 81318b3f
to get rid of #3669 false positives
2012-04-10 13:58:59 +02:00
Daniel Marjamäki
6bae724cb6
Fixed #3705 (cppcheck crash (null pointer exception))
2012-04-09 15:06:06 +02:00
Daniel Marjamäki
bbdeebafda
Fixed #3700 (false positive: (style) Variable 'H' is not assigned a value)
2012-04-09 12:55:26 +02:00
Daniel Marjamäki
26a9a1b571
Fixed #3661 (False positive: unusedPrivateFunction)
2012-04-09 11:19:19 +02:00
PKEuS
c12d82aeb9
Fixed false negative in unused functions check when function returns reference
...
Removed some unnecessary loops
2012-04-09 11:00:31 +02:00
Daniel Marjamäki
b8d233f1a2
false poitive - invalid iterator after break
2012-04-09 07:19:39 +02:00
Daniel Marjamäki
66227c4da0
Fixed #3609 (clarifyCondition delivers false positives when using Windows-Traits as a template)
2012-04-08 18:07:11 +02:00
PKEuS
6643e14d3c
Avoid copying Settings in CppCheckExecutor
2012-04-06 14:19:26 +02:00
PKEuS
25167b58a9
Implemented #2990 : Print relative paths if -rp or --relative-paths is given
2012-04-06 10:49:21 +02:00
PKEuS
b0f571b25c
Fixed #3383 : If there is an empty line between subsequent break statements, only issue a message for inconclusive checking
2012-04-05 10:38:29 +02:00
Daniel Marjamäki
823fc9ac04
Fixed #3650 (Variable declaration: Doesn't handle template usage well)
2012-04-05 08:53:10 +02:00
PKEuS
d6cfbc6483
Improved checks in CheckStl:
...
- Generalized check for inefficient emptiness check to detect !%var%.size() calls also outside of if and while; detect it also for %var%.size() when linked with && or ||.
Refactorizations in CheckStl:
- Removed an indendation counter and an offset variable
- Reduced distance given to tokAt calls in CheckStl::redundantCondition
- Rearranged code in CheckStl::missingComparison to use more efficient comparision of varIds instead of variable names. Use varId in pattern instead of variable name.
2012-04-04 19:44:57 +02:00
PKEuS
bef2caf489
Improved checks in CheckStl:
...
- Improved message of stlIfStrFind according to discussion on github (77d9ed1877
)
- Generalized pattern for substr in CheckStl::uselessCalls; added check for substr calls like ".substr(%any%,0)" which result in an empty string.
2012-04-04 19:40:28 +02:00
PKEuS
77d9ed1877
Fixed #3162 : Check whole condition for suspicious find calls.
2012-04-03 20:59:45 +02:00
Edoardo Prezioso
ecc5dea113
Fixed ticket #3703 (false positive: syntax error on valid C-code ( K&R - style )).
2012-04-03 20:12:34 +02:00
Edoardo Prezioso
5d91ef76fe
Fixed ticket #3701 (false positive: syntax error on valid C code ( K&R function style ).
2012-04-03 19:49:58 +02:00
PKEuS
c1fc7a2218
Improved CheckOther::checkComparisonOfBoolWithInt and CheckOther::checkComparisonOfBoolExpressionWithInt:
...
- Added support for comparision of bool constant with number constant (-> fixed #1877 ) and integer variable with boolean expression
- Moved a check from checkComparisonOfBoolWithInt to checkComparisonOfBoolExpressionWithInt
- Generalized some patterns
- Made error message more accurate concnerning the "neither 0 nor 1" part.
- Reduced number of Token::Match calls
2012-04-02 15:45:51 +02:00
PKEuS
fc8749e952
Improved nullpointer check:
...
- Fixed #3673
- Fixed potential issue with constructor calls (like #3697 )
- Added support for operator+ on std::string
2012-04-02 12:12:02 +02:00
PKEuS
033e4a2c1f
Fixed #3676 .
2012-04-02 11:21:04 +02:00
PKEuS
8492685531
Fixed #3697 .
2012-04-02 11:02:41 +02:00
Ettl Martin
8e9c09659f
astyle run
2012-04-01 15:56:48 +02:00
Ettl Martin
083954049f
#1927 added testcase.
2012-04-01 15:54:41 +02:00
Edoardo Prezioso
af02908d42
Fixed ticket #3580 (syntax error in multi variable declaration header).
2012-03-31 18:45:29 +02:00