Daniel Marjamäki
92c5cffeb0
Memory leaks: Fixed false positive when allocated pointer is assigned
2012-05-26 21:28:35 +02:00
Daniel Marjamäki
200390e7ad
VS: Generated new VS project files
2012-05-26 10:48:04 +02:00
Daniel Marjamäki
bd8fb0a6b5
Memory leaks: Added new checking for memory leaks
2012-05-26 08:53:46 +02:00
PKEuS
f4bf94ca4f
Fixed #3845
2012-05-25 07:28:32 -07:00
PKEuS
e2bab4b6a3
Implemented Function::nestedIn to be able to identify the scope the function belongs to, even if Function::functionScope.functionOf is not available.
...
Refactorized usage of SymbolDatabase in checkOther:
- Don't copy Function instances in checkExpressionRange
- Simplifications by more accurate usage of information in database
2012-05-24 08:40:43 -07:00
PKEuS
97c4af44ca
Refactorizations in checkOther:
...
- More accurate usage of symbolDatabase to reduce code and false negatives
- Avoided unnecessary construction of pattern string
- Only search for class/struct definition before usage
2012-05-24 06:34:59 -07:00
Ettl Martin
ffb9342084
Added array index out of bounds tests to testsuite.
2012-05-23 23:59:14 +02:00
Ettl Martin
b3d862e27e
#3838 added todo-testcase
2012-05-23 23:32:58 +02:00
PKEuS
9ca7f6a8c3
Fixed crashes #3830 and #3832
2012-05-23 01:04:21 -07:00
PKEuS
dc64ac2918
Removed unnecessary variable Function::start - The value is already stored in Function::functionScope->classStart.
2012-05-22 12:58:46 -07:00
PKEuS
26f5f08614
Initialize Function::start when the function is implemented, not when its defined. ( Fixes #3826 )
2012-05-22 12:30:10 -07:00
Daniel Marjamäki
77e9106ec0
Fixed #3634 (False positive: compareBoolExpressionWithInt when using boost::tuples)
2012-05-22 19:01:21 +02:00
Daniel Marjamäki
5b0551054a
varid: better templates handling
2012-05-22 18:58:13 +02:00
PKEuS
a8382ea553
Implemented file pointer usage checking:
...
- File I/O without positioning function call (#1742 )
- Read/Write to a file that was opened for writing/reading (#463 )
- Operations on closed file
Old fflushOnInputStream check is now part of the new check.
2012-05-22 05:30:22 -07:00
PKEuS
f3f46b4861
Fixed #3820
2012-05-22 02:27:21 -07:00
PKEuS
f5ef6f255e
Hande try and do in initialization list usage check ( #3823 )
2012-05-22 01:35:56 -07:00
PKEuS
e8dfe2407a
Fixed crash in Variable::evaluate ( #3825 )
2012-05-22 01:29:33 -07:00
PKEuS
829a52dc51
Added testio.cpp (I forgot to add it in previous commit)
2012-05-20 12:26:48 -07:00
PKEuS
b81eafe0dc
Splitted CheckIO from CheckOther.
2012-05-20 02:57:07 -07:00
PKEuS
e77f348d82
New check: Suggest to use initialization list instead of assignment in constructor. ( #489 )
2012-05-18 07:54:58 -07:00
PKEuS
4825f78663
Fixed #2477 and #2669
2012-05-17 02:15:21 -07:00
PKEuS
3f5712bfb8
Fixed false positive "Function can be const" when 'this' is passed to a Memberfunction
2012-05-17 01:49:52 -07:00
PKEuS
4bb2a1b27b
Made some functions static or const according to cppcheck results
2012-05-17 01:33:24 -07:00
PKEuS
ea601ef2b0
Fixed false positives about const correctness caused by incorrect handling of default arguments
2012-05-17 01:05:36 -07:00
Daniel Marjamäki
f803a18d50
Fixed #3749 (false positive: same expression on both sides of operator)
2012-05-17 07:26:57 +02:00
PKEuS
6a05ad1cf8
Improved fix for #2698 and added test case
2012-05-16 12:36:05 -07:00
PKEuS
77df633904
Improved handling of function calls in const correctness check: Fixed #2702 , #2698 , #2729 .
2012-05-16 11:57:12 -07:00
Daniel Marjamäki
0bb0fdedc2
Fixed #3747 (False 'boolean result in bitwise' message with 'mask' enums)
2012-05-16 18:48:33 +02:00
PKEuS
c976325086
Refactorizations in test suite:
...
- Implement createOnly mode in givenACodeSampleToTokenize so that only createTokens is called instead of tokenize
-> Ensures that no simplifications are done which could make the testing basic functions (like Token::Match) less accurate. We often don't need this simplifications in testtoken.cpp.
-> Ensures that no validation of the source is done (Fix #2104 )
- reduced overhead of givenACodeSampleToTokenize: Don't store a std::istringstream instance, avoid creation of std::string when ctor is called
2012-05-16 09:04:03 -07:00
PKEuS
279b0c59bb
Don't set Preprocessor::missingIncludeFlag if missingInclude warning is suppressed ( #3487 ).
2012-05-16 02:59:45 -07:00
PKEuS
0157f937bf
Fixed #3760 : Added explicit to C++ keyword list in setVarId
...
Made some constant arrays static
2012-05-16 01:59:52 -07:00
PKEuS
e8cd119ebd
Improved parsing of functions that accept nullpointers but no uninitialized data ( Fixed #3811 )
2012-05-16 00:56:39 -07:00
PKEuS
132a95b5f2
Fixed bug in symboldatabase: Don't ignore const or static on variables declared that are declared with both keywords. ( Fixes #3805 )
2012-05-15 12:03:43 -07:00
Daniel Marjamäki
4ae8e4f382
Tokenizer::setVarId: Minor fix of sizeof handling
2012-05-15 18:40:24 +02:00
PKEuS
4871cef351
Refactorized test cases for uninitMemberVar check:
...
- Moved all test cases to a single file (testconstructors.cpp)
- Removed some redundant test cases that became unnecessary after the symbolDatabase was established as independant from this check
2012-05-15 02:36:27 -07:00
Daniel Marjamäki
a0e5fad6a9
Fixed #3776 (Tokenizer::setVarId: No varid set when unknown macro is used before variable declaration)
2012-05-15 07:17:31 +02:00
PKEuS
42fd19fb37
Refactorization in checkclass.cpp:
...
- Improved handling of pointers and constants in constructor checking (-> Fixed #3801 )
2012-05-14 12:50:23 -07:00
PKEuS
1dee3b04b9
Bugfixes in SymbolDatabase:
...
- Constant pointers are now detected as variable declarations
- Probably fixed #3802
2012-05-14 12:47:02 -07:00
Edoardo Prezioso
eacf74be8d
Changed the order of some structures in order to improve, even if for a bit, their padding.
2012-05-14 20:49:03 +02:00
Daniel Marjamäki
fc7f78244e
Fixed #3708 (False positive: uninitialized variable (allocation, unknown nonpointer type))
2012-05-14 18:34:39 +02:00
Ettl Martin
8a7b141246
added testcase for ticket 3689
2012-05-14 09:57:30 +02:00
Daniel Marjamäki
895ee61ed5
Visual Studio: Updated VS2008 project files
2012-05-13 18:07:22 +02:00
Daniel Marjamäki
62f9875f90
Fixed #3799 (Bug: Function gets varId)
2012-05-13 07:55:35 +02:00
PKEuS
06a77679d4
Refactorizations:
...
- Added support for pointers in self assignement check
- Removed redundant for loop in checknullpointer.cpp
- Fixed warning about signed/unsigned mismatch in cppcheck.cpp by making Settings::_maxConfig unsigned
2012-05-11 10:38:19 -07:00
PKEuS
0452b03f53
Refactorizations in SymbolDatabase:
...
- Moved complete evaluation of variables type into one function executed when the variable is constructed
- Moved SymbolDatabase::ArrayDimensions to Variable::ArrayDimensions
2012-05-11 17:56:47 +02:00
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