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
2f280332ef
Merge pull request #99 from kimmov/tests-generate-pri
...
Generate a test file listing with dmake.
2012-06-17 10:49:42 -07:00
Daniel Marjamäki
a37c3144ed
Fixed #3858 (Throw exception in destructor BUT inside a try-catch shouldn't be reported)
2012-06-17 14:33:18 +02:00
Daniel Marjamäki
62f92fe253
Fixed #3866 (false positive: memory leak (UNLIKELY))
2012-06-17 07:54:24 +02:00
Daniel Marjamäki
2481b80875
Code cleanup. Removed CheckLeakAutoVar::doubleDeallocationError since the same checking is already done by CheckOther::checkDoubleFree
2012-06-17 07:22:15 +02:00
Zachary Blair
fa2bca1e09
Ticket #3876 : Improved check by only bailing of loops that contain break or continue
2012-06-16 13:11:09 -07:00
Daniel Marjamäki
7d59d86ed6
Fixed #3893 (Improve check: Array index out of bounds not detected when down conting)
2012-06-16 17:44:51 +02:00
Daniel Marjamäki
89b1b4ea6e
Fixed #3892 (False positive: 'if (var >= 0.0) then if (var >= 0.0) always returns true
2012-06-15 16:54:02 +02:00
Daniel Marjamäki
f967142436
Fixed #3875 (Static member method called with class name is considered unused)
2012-06-14 22:04:21 +02:00
Daniel Marjamäki
5174f7ff5e
Fixed #3723 (Preprocessor evaluation order)
2012-06-14 21:47:03 +02:00
PKEuS
8b294a2d4f
Disabled C4512 in VS10 ( #3882 )
2012-06-14 09:39:31 -07:00
Daniel Marjamäki
4b6e1c6946
Fixed #3855 (false positive: (error) Instance of 'locale' object destroyed immediately)
2012-06-13 19:21:20 +02:00
Daniel Marjamäki
cc5e06b5d2
Fixed #3861 (uninitialized variables)
2012-06-13 19:09:51 +02:00
August Sodora
90f92250dd
Fixed #3618 (segmentation fault of cppcheck)
2012-06-12 21:07:17 +02:00
Daniel Marjamäki
54a66391d8
Fixed #3750 (false positive: C-style pointer casting)
2012-06-12 18:45:31 +02:00
Kimmo Varis
d1197315c1
Tests: Add generated testfiles.pri.
...
Add the generated testfiles.pri file. Previous commits modified
the dmake and test.pro to generate and use the testfiles.pri
containing listing of all source files with tests.
2012-06-11 22:11:29 +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
Daniel Marjamäki
08a3d0737e
Memory leaks: Write error message when deallocated pointer is returned
2012-06-11 18:28:31 +02:00
PKEuS
ef65202a79
Bugfix ( #3844 ): Added 3 missing files to testrunner
2012-06-11 03:55:33 -07:00
Zachary Blair
e2348560e4
Fixed Ticket #3876 (Error (double free) detected that can't possibly happen)
2012-06-10 17:50:31 -07:00
seb777
5b763a9f0a
Fixed #3579 (object destroyed immediately:False positive & negative)
2012-06-10 21:52:32 +02:00
Ettl Martin
c9cb492bc7
#3874 added missing testcase to avoid false positives
2012-06-10 18:36:19 +02:00
Daniel Marjamäki
160fa94a02
Visual Studio: Hide VS compiler warnings for '(char)0xff' and '(char)0xfe'
2012-06-10 15:51:56 +02:00
PKEuS
4b80e91145
Implemented support for building cppcheck lib into a dll
...
Updated VS9 solution
New VS10 solution that builds cppcheck into a dll used by cli and testrunner.
Functional changes and advantages of new solution:
- Share code between testrunner and cli; ability to share code with gui as well (not yet implemented)
- Files of /lib are no longer compiled twice (should improve build time on single core machines)
- Added configuration for building with PCRE support
- Executables are build into /bin (/bin/debug in debug mode) folder (Should no longer require rebuild when switching between debug and release)
- Completely x64 compatible (contains also x64-debug configuration now)
2012-06-10 05:19:09 -07:00
Daniel Marjamäki
171f570639
Handle UTF-16 files. Partial fix for ticket #2083
2012-06-10 11:00:27 +02:00
Daniel Marjamäki
905615e991
Fixed #3878 (Sign extension with unsigned char false positive)
2012-06-09 08:43:13 +02:00
PKEuS
c463d97386
Refactorization:
...
- Implemented consistent behaviour of Variable::typeStartToken/typeEndToken: Skip const and static on all variables.
- Simplified patterns containing "static|" or "const|" when matching typeStartToken.
2012-06-08 09:05:02 -07:00
Daniel Marjamäki
69846b2a06
Fixed #3872 ('char variables in bit operations' warning)
2012-06-08 17:24:54 +02:00
Daniel Marjamäki
c5da030674
Fixed #3869 (References to items in array result it 'Uninitialized variable' errors)
2012-06-08 16:17:55 +02:00
Daniel Marjamäki
2b3e5abef8
Fixed #3865 (Suspicious condition. The result of find is an iterator, but it is not properly checked.)
2012-06-07 19:33:18 +02:00
Daniel Marjamäki
74422e1258
Fixed TODO test case (replaced tabs with spaces in test code)
2012-06-06 13:37:56 +02:00
PKEuS
7c1b0a7602
Issue useInitializationList message only on variables of class types.
2012-06-06 03:03:51 -07:00
Ettl Martin
8a9d1048bf
#3370 changed testcase to TODO, because it is not fixed yet.
2012-06-05 09:36:23 +02:00
Daniel Marjamäki
3c103e520b
Fixed #3854 (false positive: (style) Variable '_S_c_name' is assigned a value that is never used)
2012-06-05 06:37:55 +02:00
Ettl Martin
c42b21c503
added additional tests to ticket #3862
2012-06-04 21:32:11 +02:00
Ettl Martin
1245abe094
added missing testcase for ticket #3370
2012-06-04 21:21:14 +02:00
August Sodora
e146591b5d
Fixed #3544 (segmentation fault of cppcheck)
2012-06-02 16:15:12 +02:00
Daniel Marjamäki
0cf2c2b327
Fixed #3862 (Double deallocation does not take throws into account)
2012-06-01 19:08:50 +02:00
Daniel Marjamäki
a823d29da3
Fixed #3809 (false positive: memory leak)
2012-06-01 19:01:19 +02:00
Daniel Marjamäki
d1b4bea304
Fixed #3807 (False positive: possible null pointer dereference)
2012-05-31 18:41:00 +02:00
Ettl Martin
d7c1907601
added tests for duplicated branches. Inspired by http://www.viva64.com/en/b/0149/ ( Comparision between PVS-Studio and cppcheck): Errors detected in Quake 3: Arena by PVS-Studio: Fragement 2
2012-05-30 01:30:37 +02:00
Ettl Martin
1620c5b797
added todo testcase for ticket #3809
2012-05-29 21:44:39 +02:00
Daniel Marjamäki
2e41510e30
Fixed #3806 (Possible leak in public function. The pointer '' is not deallocated before it is allocated)
2012-05-29 21:13:34 +02:00
Daniel Marjamäki
8d0f315097
Fixed #3851 (False positive memory leak (condition))
2012-05-29 21:10:19 +02:00
Ettl Martin
da5278f90c
Added testcase for ticket #3852
2012-05-29 13:20:51 +02:00
Ettl Martin
474dccf8ad
added a testcase for detecting duplicate if else branches.
2012-05-29 09:22:42 +02:00
Zachary Blair
2bd171dded
Fixed #3794 (New check: Missing break in switch (duplicate bitwise operation))
2012-05-28 21:19:22 -07:00
Ettl Martin
e584544915
added testcase for ticket #3844
2012-05-28 12:56:24 +02:00
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
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
Daniel Marjamäki
68e6511c87
Fixed #3532 (false positive : missing constructor)
2012-03-31 11:30:26 +02:00
Daniel Marjamäki
1309825bf1
Merge pull request #91 from HeisSpiter/e46c7eb32033b520374e9df8c13bc8589c0602d0
...
Handle Rtl memory functions in Tokenizer::simplifyMicrosoftMemoryFunctions()
2012-03-28 09:43:14 -07:00
Daniel Marjamäki
abcbe2e49f
Fixed #3594 (false positive: returning reference to auto variable)
2012-03-28 18:21:06 +02:00
PKEuS
4f1f6e1824
Improved simplification of calculations:
...
- Use more generic patterns
- Look on operator precedence more consequently
-> Made a TODO test case from a test case that worked previously, because the calculation is simplified so that the problem isn't detected any more.
Changed comment "Coding style checks" to "Checks", because it didn't fit
2012-03-27 21:29:50 +02:00
Pierre Schweitzer
e46c7eb320
Add the RTL memory functions for the simplifications on Windows code.
2012-03-27 21:24:46 +02:00
Daniel Marjamäki
2ffb3baaed
Preprocessor: fixed tests
2012-03-27 20:48:22 +02:00
PKEuS
b37cf11d20
Refactorizations:
...
- Increased encapsulation by making some functions private
- Removed redundant function CheckBufferOverrun::ArrayInfo::declare
- Avoided copy of ArrayInfo object
- Removed unnecessary and suspicious "if(sizeof(int) == 4)"
2012-03-27 19:40:39 +02:00
Daniel Marjamäki
01ddfb6f80
Fixed #3534 (Broken support for dollar signs in identifiers)
2012-03-27 19:35:41 +02:00
PKEuS
782cd5d228
Fixed #3687 : Don't treat catched variables as local ones.
2012-03-26 21:19:42 +02:00
Daniel Marjamäki
c07044b3d3
Fixed #3573 (Preprocessor: handle '!(X)' the same as '!X')
2012-03-26 19:01:45 +02:00
PKEuS
989ac449e4
Made invalidPointerCast message inconclusive for casting from floating point type* to char* ( Fixed #3639 )
2012-03-25 12:55:39 +02:00
Daniel Marjamäki
2e2fd77b83
xml: fixed test case.
2012-03-25 12:51:10 +02:00
Daniel Marjamäki
ca6a93816b
Merge pull request #89 from HeisSpiter/master
...
Merged two checks to get a better one regarding sizeof
2012-03-25 02:38:04 -07:00
PKEuS
e4d92055e7
Improved sizeofCalculation check:
...
- Bailout on expanded macros for conclusive checking
- Support for more operators
- Removed indendation counter
Improved checkSignOfUnsignedVariable:
- Made the patterns more generic
- Improved verbose error message (-> Fixed #3080 )
2012-03-25 11:32:00 +02:00
PKEuS
0338153de9
Added test case for #3619
2012-03-25 10:33:18 +02:00
PKEuS
e6bcab7c35
Fixed #3360 : "type const* var;" is now recognized as variable declaration.
2012-03-24 15:10:06 +01:00
PKEuS
b964551424
Fixed #3252
...
Make use of std::isupper instead of custom implementation
2012-03-24 13:48:33 +01:00
Daniel Marjamäki
4076c46a33
Merge pull request #88 from leg0/ticket_3675
...
Fixed ticket #3675 .
2012-03-24 00:36:37 -07:00
Pierre Schweitzer
2b5ddb7858
Merge the strncmp & malloc sizeof checks into a more generic test that handles several cases where sizeof is misused, or could be misused
2012-03-23 21:47:13 +01:00
PKEuS
e938235385
Store functions which are declared but not implemented in the function list of the containing scope -> Fixed #3679
...
Refactorizations:
- Simplified some code
- Improved condition in findVariableType to reduce unnecessary comparisions of empty strings.
2012-03-23 17:59:51 +01:00
Ahti Legonkov
780481e82a
Fixed ticket #3675 .
2012-03-23 01:45:47 +02:00
Daniel Marjamäki
d04698df13
Merge pull request #87 from HeisSpiter/master
...
Fix a bug introduced with a previous commit and add a new check
2012-03-21 13:20:39 -07:00
Pierre Schweitzer
ec44967e13
Add a new test to check improper sizeof usage. It's for the moment limited to malloc calls.
2012-03-21 21:13:09 +01:00
PKEuS
002389f836
Fixed #3677
...
Added forgotten testcase for #3672
2012-03-21 18:40:32 +01:00
Pierre Schweitzer
9d002916f4
Fix line number displayed on leakNoVarr error
2012-03-20 22:28:56 +01:00
Daniel Marjamäki
a2351ba44f
Fixed #3648 (Internal error: Token::Match called with varid 0)
2012-03-20 19:05:24 +01:00
Daniel Marjamäki
d6c8de104c
Revert "Fixed #3648 (Internal error: Token::Match called with varid 0)"
...
This reverts commit 1fa1ddccba
.
2012-03-20 19:00:16 +01:00
Daniel Marjamäki
1fa1ddccba
Fixed #3648 (Internal error: Token::Match called with varid 0)
2012-03-20 18:58:27 +01:00
PKEuS
cb2a754983
Implemented support for C++11 right angle brackets (>>)
...
Implemented support for linkage between < and > (Information: It is possible that under certain circumstances comparision operators are linked, since its sometimes difficult to separate between them.)
2012-03-19 18:45:47 +01:00
PKEuS
7055526f4a
Fixed #3672 : bitwise and operator in if/while does no longer confuse setVarId code
...
Improvements to CheckUnusedVar:
- Improved handling of arrays of struct/class instances
- Differ between addressof and bitwise-and operator
- Made some members private to improve encapsulation
- Replaced some simple patterns by direct function calls
- Removed an unnecessary condition
2012-03-19 17:41:16 +01:00
Stefan Weil
f079ee7c31
test: Fix preprocessor code in test data
...
This is not valid preprocessor code: #ifdef A == 1
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2012-03-18 16:50:16 +01:00
Pierre Schweitzer
544a1f714e
Updated error message about not taking return value from function that returns allocated memory
2012-03-18 13:45:50 +01:00
Daniel Marjamäki
1e125dc017
Fixed #3671 (False positive: Resource leak: fd)
2012-03-18 11:54:09 +01:00
Daniel Marjamäki
29063098bf
Fixed #3670 (false positive: Allocation with open never assigned)
2012-03-18 07:49:22 +01:00
Daniel Marjamäki
2757229064
Fixed #3666 (False positive: Uninitialized variable (taking address))
2012-03-16 17:28:05 +01:00
PKEuS
0340764726
Improved nullpointer check: Detect dereferences by streams ( #410 )
...
Refactorizations:
- Replaced || by %oror% in Token::Match patterns
- Replaced some simple patterns by direct comparisions, replaced Match call with simpleMatch
- Increased data encapsulation by making more members private in CheckNullpointer
2012-03-16 17:24:03 +01:00
PKEuS
b6057a1148
Improved CheckOther::checkIncorrectLogicOperator:
...
- Added a lot of additional pattern
- Rewrote error messages to make them more understandable and better fitting to the situation. (Fixed #3664 )
- Cleanup in unit tests
Improved message of static string comparision check
2012-03-15 20:38:28 +01:00
Daniel Marjamäki
fc84f55f80
Fixed #3536 (Preprocessor #if fails to correctly compare two #defined values)
2012-03-15 20:04:34 +01:00
Daniel Marjamäki
813a193bb6
Merge pull request #84 from HeisSpiter/master
...
Fix for bug #3439
2012-03-15 11:37:42 -07:00
Daniel Marjamäki
555e8c6efc
Fixed #36221 (Input streams: Wrong token list simplification)
2012-03-15 19:09:36 +01:00
Pierre Schweitzer
5dc4fcaa0a
Add two tests for the new memory leak detection
2012-03-14 23:45:20 +01:00
PKEuS
7cfffc9c9d
Improved CheckOther::checkIncorrectLogicOperator:
...
- Implemented automatic swapping of conditions and operands
- Added several patterns
- Added support for conditions outside of if/while
2012-03-12 19:06:30 +01:00
Daniel Marjamäki
a9d56f2738
Tokenizer: simplify known variable value inside conditional block
2012-03-12 17:32:30 +01:00
PKEuS
6f164de609
Improved static string comparision check: Implemented #3214
...
Fixed false negative on argument count of fnprintf/snprintf when first variable argument is a string. (#3655 )
Uncommented call of virtualDestructorError in getErrorMessages in checkclass.h
Refactorizations:
- Rearranged code in checkother.h to make ordering more consistent and to increase encapsulation of private data
- Replaced some single-token-patterns
2012-03-11 11:01:39 +01:00
Daniel Marjamäki
3f1ab5af9b
charvar: dont write warning about char type array index when array is small and the full valid range is accessible with the char type. If there are out of bounds access then, it is not because the type of the variable.
2012-03-10 12:19:28 +01:00
August Sodora
e0bee0e037
Fixed #3567 (False positives in boolean expressions)
2012-03-07 20:31:23 +01:00
Daniel Marjamäki
680883a6a7
fixed #3649 (False Positive: Uninitialized variable using operator assignment)
2012-03-06 18:51:50 +01:00
PKEuS
ef6e381d47
Improved bitwise on boolean check to make it working on more code patterns
...
Refactorizations in checkother.cpp:
- Make use of symboldabase instead of: indentation counters, manual detection of variable declarations
- Removed some indexing variables to reduce calls to tokAt and the numbers given to this function
- Use tok->nextArgument() to jump to a specific argument
2012-03-03 21:14:20 +01:00
PKEuS
1ef99e2f21
Improved checkautovariables:
...
- Added support for checking a few more code patterns
- Simplified code by using more information from the symboldatabase
- Moved redundant part of c_str-check to checkstl
Two fixes according to output of pvs studio in testsimplifytokens.cpp
2012-03-01 18:38:20 +01:00
Daniel Marjamäki
db1205cdb3
Preprocessor: better handling of '#if A==1'
2012-02-29 19:08:01 +01:00
Daniel Marjamäki
527d3791e6
Fixed #3596 (memory leak false positive on libedit sources)
2012-02-27 18:55:36 +01:00
PKEuS
1747813a8b
Added check for invalid pointer casts ( #1255 )
...
Detect sign extension problems when variable is a reference (#3637 )
Refactorizations:
- Tokenizer::getFiles returns a reference instead of a pointer, because its guaranteed that no nullpointer is returned
- Remove signed/unsigned in one step for "%type% signed|unsigned"
- Fixed recently introduced compiler warning in symboldatabase.cpp
2012-02-26 11:56:32 +01:00
Daniel Marjamäki
385c9d341d
Fixed #3633 (False positive: struct array not assigned a value)
2012-02-26 08:29:02 +01:00
Edoardo Prezioso
4d3013d43d
Improve 'Tokenizer::elseif' code in order to not touch 'else if' inside a macro parenthesis.
2012-02-26 02:50:48 +01:00
Daniel Marjamäki
bbfae8e3ae
Fixed #3583 (False positive Variable X is assigned a value that is never used)
2012-02-25 12:56:33 +01:00
PKEuS
9431fb1b7e
Improved STL checks:
...
- Added performance checking for .c_str() for return values and function parameters (#1079 )
- Added more containers (basic_string, C++11 containers) and more functions to checking (.at, .resize, .reserve, ...)
- Make use of symboldatabase in missingComparision check
2012-02-25 12:43:27 +01:00
PKEuS
9a5f66030c
Improved unused private function check:
...
- Fixed #3628
- Added support for friend
Improved symbol database:
- friend scopes are now set
- Added findScopeByName function
Refactorizations:
- Removed some unnecessary "virtual" keywords
- Removed unnecessary _filename member variable, pass it as argument instead
- Made CppCheck::replaceAll static, since it is independant from a specific CppCheck instance, Pass string to be modified by reference
2012-02-24 20:45:56 +01:00
PKEuS
9f42ce91a1
Refactored STL container usage in CLI.
...
Pathmatcher masks are converted to lowercase only once when instance is created
2012-02-19 17:22:59 +01:00
Daniel Marjamäki
39b0f1ba95
Fixed #3608 (unreadVariable when variable used in inline assembly)
2012-02-19 16:04:35 +01:00
Daniel Marjamäki
69d03bac34
Fixed #3603 (False Positive: Variable is assigned a value that is never used)
2012-02-19 15:25:46 +01:00
Zachary Blair
0e791929b5
Ticket #3598 - Added a missing ASSERT_EQUALS() statement to the end of checkDoubleFree()
2012-02-18 12:13:21 -08:00
Edoardo Prezioso
d7a918e549
Fixed ticket #3616 (segmentation fault of cppcheck).
2012-02-18 17:58:50 +01:00
Daniel Marjamäki
a118f82ca7
Tokenizer::simplifyVarDecl: Don't simplify inside parenhteses
2012-02-18 15:05:29 +01:00
PKEuS
4b52df675a
Some refactorizations
2012-02-18 14:44:04 +01:00
Daniel Marjamäki
0705dbd34a
Tokenizer::simplifyCasts: don't simplify 'f((double)(v1)*v2)' to 'f(*v2)'
2012-02-18 14:26:00 +01:00
PKEuS
2ba2a4e6ae
Some refactorizations
2012-02-18 11:55:05 +01:00
Daniel Marjamäki
bfb4dd6425
Fixed #3529 (False 'Boolean result is used in bitwise operation' in a template)
2012-02-18 08:51:09 +01:00
Edoardo Prezioso
17cd5ec906
Fixed ticket #3604 (cppcheck(1.53) crash).
2012-02-17 21:14:38 +01:00
PKEuS
485e836535
Refactorizations in MathLib.
...
Fixed recently introduced bug on floating point numbers with multiple preceding zeros (for example 004.123)
2012-02-17 19:54:53 +01:00
PKEuS
bf776044d8
Fixed compiler error
2012-02-17 16:09:24 +01:00
PKEuS
8ea5df62c4
- Improved support for numbers in code:
...
-- Use MathLib::toLongNumber for conversion in tokenizer (Fix #3610 )
-- Handle octal numbers in tokenizer
- Refactorizations in MathLib::toLongNumber and Settings
2012-02-17 15:47:08 +01:00
Zachary Blair
9d75641ef8
Fixed #3598 (false positive: (error) Memory pointed to by 'a' is freed twice.)
2012-02-16 21:03:38 -08:00
PKEuS
2e13a51d08
Fixed #3591
2012-02-13 19:46:45 +01:00
PKEuS
bb319c1c96
Improved Tokens and Tokenizer:
...
- Better handling of deleteThis() as last element of token list
- Code simplified
2012-02-13 17:44:08 +01:00
Daniel Marjamäki
da8abeb63c
Fixed #3584 (2 internal errors : Token::Match called with varid 0)
2012-02-12 17:30:47 +01:00
Erik Lax
f1dbd1a89a
Fixed #3518 (False negative: Possible null pointer dereference (in the same condition))
2012-02-11 16:15:38 +01:00
PKEuS
42f418db54
- Improved nullpointer check: Fixed #1171
...
- Improved accuracy of function analysis in symboldatabase
- Code cleanups
2012-02-11 12:26:48 +01:00
Daniel Marjamäki
bbb707c460
Fixed #3587 (Wrong tokenizer simplification - variable assigned by operator>>)
2012-02-07 08:05:50 +01:00
Daniel Marjamäki
47c7e346aa
Uninitialized variables: Another fix for false positives when it's known that inner conditions are true
2012-02-06 19:26:28 +01:00
Daniel Marjamäki
05fc77c347
Revert "Uninit var: Added TODO test case"
...
The test case was not valid because the variable assignment is redundant and is therefore removed by the tokenizer.
This reverts commit 548a43fc49
.
2012-02-06 07:41:48 +01:00
Daniel Marjamäki
d6a887e1f9
Uninitialized variables: Fixed false positives when goto is simplified and inner condition is known to be true/false
2012-02-06 07:32:29 +01:00
Daniel Marjamäki
548a43fc49
Uninit var: Added TODO test case
2012-02-06 07:17:39 +01:00
Daniel Marjamaki
fbb5ebe3c6
Fixed #3577 (Preprocessor: Defines given on command line are not used in the code)
2012-02-05 20:48:28 +01:00
Zachary Blair
69567515ce
Ticket #3581 - added missing newlines to the test code
2012-02-04 11:39:29 -08:00
Zachary Blair
8f827aa65f
FIxed #3581 (double free false positive when exception rethrown)
2012-02-04 11:24:40 -08:00
PKEuS
d5c2c7db88
- Moved checkCatchExceptionByValue from CheckOther to CheckExceptionSafety
...
- Fixed false positive: throw outerCatchVar; in inner catch is now correctly handled
- Added eTry and eCatch to Scope::isLocal -> Scopes inside catch are now detected by symbol database
2012-02-02 16:17:42 +01:00
Daniel Marjamäki
2be85e9d37
Fixed #3538 (false positive caused by bad tokenizer simplification)
2012-02-01 21:13:26 +01:00
Daniel Marjamäki
036b2a84bf
Fixed #3570 (False Postive for 'nullPointer' check)
2012-02-01 20:38:47 +01:00
Edoardo Prezioso
f9ade9562c
Fixed ticket #3572 (segmentation fault).
2012-01-31 22:32:28 +01:00
Edoardo Prezioso
bc034095f1
Fixed ticket #3543 (segmentation fault of cppcheck).
2012-01-31 19:34:55 +01:00
Edoardo Prezioso
aaa6070fc9
Run astyle.
2012-01-31 18:43:11 +01:00
Edoardo Prezioso
66e1761ffe
Fixed ticket #3571 (segmentation fault of cppcheck while scanning gcc-testsuite).
2012-01-31 18:42:19 +01:00
Edoardo Prezioso
f8578a380a
Added test case from #3533 (segmentation fault of cppcheck).
2012-01-31 18:23:02 +01:00
Ettl Martin
86a5a9a7bf
fixed wrong testcase
2012-01-31 16:48:05 +01:00
Ettl Martin
c1e2802175
ticket 3569: added further testcases
2012-01-31 16:25:57 +01:00
Ettl Martin
7110fa2c0c
added tests for ticket #3569
2012-01-31 16:13:28 +01:00
PKEuS
22c1ce8a68
Fixes for #3480 and #3568 .
2012-01-31 15:49:34 +01:00
Edoardo Prezioso
9f81b48dc1
Fixed ticket #3558 (Tokenizer: improve simplifyVarDecl to take count of undefined size VLA's).
2012-01-30 23:41:43 +01:00
Edoardo Prezioso
0fd7504295
Related to ticket #3560 (conditional pointer user): remove also dead code in the lower scope if the actual scope isn't special.
2012-01-30 21:43:23 +01:00
Daniel Marjamäki
9df6088ddd
Revert "really fix #3527 (Internal error. Token::Match called with varid 0. Please report this to Cppcheck developers)"
...
This reverts commit a37031944e
.
I don't want this hard coding of macro names. Feel free to come with a more generic solution if you want.
2012-01-30 06:15:41 +01:00
Robert Reif
a37031944e
really fix #3527 (Internal error. Token::Match called with varid 0. Please report this to Cppcheck developers)
2012-01-28 20:58:51 -05:00
PKEuS
91a01a0a0d
- checkUnsignedDivision checks for variable/variable (inconclusive). General bailout for if-statements.
...
- Make use of recently implemented symboldatabase functions (catch-support, reference-support)
- Other refactorizations
2012-01-28 12:32:28 +01:00
Daniel Marjamäki
01f6bbda62
Null pointers: fixed false positive when '?' is used in return statement. Ticket: #3560
2012-01-28 08:06:03 +01:00
Robert Reif
42afd2d63a
fix #3561 (SymbolDatabase: throw foo; creates a variable with type throw)
2012-01-27 19:24:01 -05:00
Edoardo Prezioso
0dd4b9ad3a
Temporary workaround to ticket #3459 (Simplify goto before loop) :
...
don't simplify code which contains the label pointed by 'goto'.
2012-01-27 16:56:12 +01:00
Edoardo Prezioso
ca8e8d26c7
Tokenizer: extract realloc simplification and simplify also when each argument is done by more than one token.
...
Restyling of a comment in tokenize.h.
2012-01-27 13:56:06 +01:00
Edoardo Prezioso
421ae9df03
simplifyCondition: handle also '( a || true || b)' -> '(true)' and '( a && false && b)' -> '(false)'.
...
Clarify a comment about previous commit.
2012-01-26 23:14:44 +01:00
Edoardo Prezioso
7cf8e5dfff
TestTokenizer: moved test to proper place.
2012-01-26 22:25:19 +01:00
Edoardo Prezioso
6e164ae7ed
Fixed ticket #3557 (Tokenizer: simplification of '[]' doesn't work well):
...
extract undefined size array simplification and handle multiple arrays and combos between pointers and arrays, don't handle the definitions as arguments of function.
2012-01-26 17:25:52 +01:00
PKEuS
6906001366
Added support for references to symboldatabase
2012-01-26 17:04:25 +01:00
PKEuS
5c2af0b2e3
- initialising std::string with 0 in initialisation list is partially detected in nullpointer check ( #3520 )
...
- executionpath checking makes use of symboldatabase
- CheckExceptionSafety::checkRethrowCopy makes use of symboldatabase
2012-01-26 16:50:59 +01:00
Edoardo Prezioso
f428a29d8e
Improve simplifyReturnStrncat when each argument is not composed by one token.
2012-01-26 16:09:32 +01:00
Robert Reif
4d56395504
symbol database: add simple try/catch tests
2012-01-25 22:48:18 -05:00
PKEuS
42a75692d4
Improved nullpointer check:
...
- More accurate checking for dereferences and non-dereferences
- improved checking for nullpointer dereferences after return statement
- Supports pointer dereferences by std::string
- Code optimization/refactorization
2012-01-25 15:16:22 +01:00
Zachary Blair
589a2461bd
Fixed ticket #3550 (false positive: (error) Memory pointed to by 'pxpm' is freed twice)
2012-01-24 22:43:44 -08:00
Daniel Marjamäki
8e2c40b4b3
Fixed #3323 (#undef needs different handling)
2012-01-24 07:43:26 +01:00
Edoardo Prezioso
5953ed7318
Fixed ticket #3528 (Tokenizer: improve simplifyFunctionParameters to take count of square brackets)
2012-01-23 16:10:15 +01:00
Daniel Marjamäki
9f139cf414
Fixed #3509 (FP: Variable 'itemList' is not assigned a value, when << operator is used)
2012-01-23 08:02:59 +01:00
Daniel Marjamäki
9eb1a5864b
Fixed #3502 (segmentation fault of cppcheck (struct{x y:};))
2012-01-23 07:39:31 +01:00
Daniel Marjamäki
f81557da50
Fixed #3508 (Symbol database: mixing up constructors and destructors)
2012-01-22 19:48:36 +01:00
Daniel Marjamäki
b8faee9d30
Fixed #3497 (False positive: Uninitialized variable)
2012-01-21 20:42:41 +01:00
PKEuS
87e19d2552
Refactorized check for dead pointers after throw:
...
- Less bailouts for inconclusive checking
- Support for static variables
- Changed severity to warning (error is not certain)
2012-01-21 19:11:06 +01:00
Ahti Legonkov
78461093f0
Fixed #3531 (When macro definition contains parenthesis, the #defined symbol does not get #defined.)
2012-01-21 12:51:54 +01:00
PKEuS
96ae010e48
- Correctly set Scope::function variable in symboldatabase
...
- Refactorizations
- Fixed some cppcheck warnings
2012-01-21 10:08:09 +01:00
Edoardo Prezioso
2a2d01a870
Remove some redundant 'errout.str("")' in some checks because it's already done inside tok call.
2012-01-21 00:59:12 +01:00
Zachary Blair
0415444e28
Merge branch 'master' of github.com:danmar/cppcheck
2012-01-19 23:02:33 -08:00
Zachary Blair
b89adff9fd
Fixed Ticket #3300 (false negative: doublefree of pointer)
2012-01-19 22:59:54 -08:00
Daniel Marjamäki
525e7fba20
Fixed #3490 (False positive: sscanf with %c)
2012-01-18 23:57:08 +01:00
Stefan Weil
7607e4c68d
Fixed #3519 (Wrong line number in warning charBitOpError)
2012-01-18 13:09:46 +01:00
seb777
0be8af5214
Fix ticket #3530 (Add some windows data types to tokenizer)
2012-01-18 12:57:41 +01:00
Edoardo Prezioso
c5f7db0645
TestTokenizer: Remove redundant ';' in 'inlineasm' testcases.
2012-01-15 19:49:17 +01:00
Edoardo Prezioso
4d239d0bf7
Run astyle.
2012-01-15 19:47:51 +01:00
Edoardo Prezioso
963f6ce3ef
Tokenizer: report syntaxError if there's nothing after 'if|for|while ()' and if there's nothing inside round brackets;
...
TestTokenizer: change test cases accordingly;
TestSimplifyTokens: ditto.
2012-01-15 14:50:01 +01:00
Daniel Marjamäki
a6d96f5b72
Fixed #3496 (false positive: syntax error)
2012-01-15 14:33:53 +01:00
PKEuS
461565c50a
Fixed #3517 and #3513
2012-01-15 12:32:02 +01:00
Reijo Tomperi
dd18f595b1
Fix #3516 (inaccurate warning: "An unsigned variable will always be positive" (unsigned n; if (n >=0);))
...
http://sourceforge.net/apps/trac/cppcheck/ticket/3516
2012-01-14 12:50:09 +02:00
Edoardo Prezioso
6a248c35b5
Fixed ticket #3512 (segmentation fault of cppcheck ( 1 *p = const))
2012-01-14 00:43:58 +01:00
Edoardo Prezioso
37f3aa1528
Fixed ticket #3486 (segmentation fault of cppcheck)
2012-01-13 23:53:53 +01:00
Daniel Marjamäki
0648b3ed5e
Fixed #3504 (segmentation fault of cppcheck)
2012-01-13 07:57:12 +01:00
Daniel Marjamäki
47716ee4ca
Fixed #3497 (False positive: Uninitialized variable)
2012-01-13 07:26:56 +01:00
seb777
8754caa36d
Fix ticket #3483 (POSIX.1-2008 - obsolete functions)
...
From POSIX.1-2008 specification (see http://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xsh_chap01.html#tag_22_01_01_04 ):
- remove obsolete functions ctime, asctime, rand, tmpnam (non reentrant functions check)
- add obsolete base functions (obsolete functions check):
- rand_r
- tmpnam, tmpnam_r
- utime
- asctime, asctime_r
- ctime, ctime_r
- update unit tests (non reentrant function)
- update messages (cosmetic) (obsolete functions check)
2012-01-12 22:28:12 +01:00
Reijo Tomperi
da09adc583
Fix #3510 (Improve error message for --suppressions-list)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/3510
Print additional info to error message if we suspect that multiple files were given.
2012-01-12 22:21:51 +02:00
Kimmo Varis
42b7a4fadd
Update VS2008 project files.
2012-01-10 19:48:25 +02:00
Edoardo Prezioso
2dd53ec966
Fixed ticket #3485 (segmentation fault of cppcheck ( {a:1;}; ))
2012-01-09 16:24:11 +01:00
Edoardo Prezioso
54f54761b4
Fixed ticket #3482 (segmentation fault of cppcheck ( switch(){case} ))
2012-01-09 14:37:20 +01:00
Edoardo Prezioso
57fcde8090
Fixed ticket #3481 (segmentation fault of cppcheck)
2012-01-09 13:39:02 +01:00
Edoardo Prezioso
a951d34aa8
Fixed ticket #3480 (segmentation fault of cppcheck)
2012-01-09 12:48:52 +01:00
Reijo Tomperi
194327048a
Add InternalError and change MathLib to throw it in case of an error.
...
- Previously MathLib errors did not provide a filename, but after this change at least source file name should be printed
and if token is provided, also line number should be printed.
- Change also Token to use InternalError
- Modify Cppcheck-class to catch InternalError instead of Token
- Run dmake to update Makefile
2012-01-08 22:19:44 +02:00
PKEuS
c273d6d31d
Refactorized checkautovariables.cpp. Removed indendation counters.
...
Fixed #3478
2012-01-08 15:32:22 +01:00
Kamil Dudka
e09b0330e4
Class: Don't warn about uninitialized union members because they are often combined with a second variable
2012-01-08 12:17:55 +01:00
Daniel Marjamäki
65ce55e675
Fixed #3472 (false positive: (error) Passing value 0 to log() leads to undefined result)
2012-01-08 12:07:25 +01:00
Daniel Marjamäki
ee55d3294a
Refactoring. Assume that .C files contain C code on case insensitive filesystems.
2012-01-08 10:34:31 +01:00
Daniel Marjamäki
304980848f
Fixed #3473 (False positive: variable is assigned value that is never used (used in return statement))
2012-01-08 08:44:18 +01:00
Daniel Marjamäki
70c83d9ca9
Fixed #3467 (False positive: Variable is not assigned a value (new))
2012-01-08 08:31:00 +01:00
Reijo Tomperi
93e3e7361e
In unix .C is considered C++. Changed isC() and isCPP() to work like they were before refactoring.
2012-01-07 10:47:15 +02:00
Daniel Marjamäki
36797a97ef
Symbol database: Fixed comments
2012-01-07 09:37:38 +01:00
Daniel Marjamäki
6a63104743
Fixed #3320 (False positive: Member variable is not initialized in the constructor (namespaces).)
2012-01-07 09:28:26 +01:00
Reijo Tomperi
e91d239ea5
Refactor: Move file extension checks from Tokenizer to Path class. This has also functional change as now also file.JAVA is considered a Java file.
2012-01-06 21:56:28 +02:00
Daniel Marjamäki
5ae7c4506f
Fixed #3015 (xml-style error output when running testrunner on particular tests)
2012-01-06 09:09:46 +01:00
Daniel Marjamäki
73d9dc870e
TestRunner: Make sure no xml output is reported when running TestToken ( #3015 )
2012-01-06 09:03:23 +01:00
Daniel Marjamäki
bd8c21fc6b
Refactoring: Made Preprocessor::simplifyCondition nonstatic
2012-01-06 08:42:07 +01:00
Daniel Marjamäki
66472b09c0
Refactoring: Made Preprocessor::match_cfg_def nonstatic
2012-01-06 08:15:48 +01:00
Daniel Marjamäki
94d220e370
Refactoring: Made Preprocessor::getcode nonstatic
2012-01-06 08:01:50 +01:00
Daniel Marjamäki
07776e90ad
Preprocessor: cleanup
2012-01-05 18:37:15 +01:00
Jussi Lehtola
55b65718c7
fix gcc-4.7 compiler error (missing include)
2012-01-05 14:36:30 +01:00
Edoardo Prezioso
a7029291fd
Tokenizer::simplifyGoto: process also derived class/structs.
2012-01-04 17:08:53 +01:00
Edoardo Prezioso
6f9cd110d0
Improve Tokenizer: improve 'simplifyDoublePlusAndDoubleMinus' when there are negative numbers.
2012-01-04 13:45:27 +01:00
Edoardo Prezioso
75fbe310ff
Extract various functions inside the Tokenizer class and fix tokenization of 'return __LINE__ ;'.
2012-01-04 12:57:58 +01:00
PKEuS
eabdc9082e
Fixed false positives related to %*[] in scanf format string ( #3468 )
2012-01-04 11:22:42 +01:00
Edoardo Prezioso
8d84e5f852
testrunner: assert-like functions should take linenr parameter as a 'unsigned int' (maybe in the future these should be converted to 'size_t'?);
...
fix discrepancy between 'todoAssertEquals' and 'AssertEquals' so that the parameters 'expected, wanted, actual and current' are 'long long' types.
2012-01-03 15:48:03 +01:00
Edoardo Prezioso
c76f06c01b
Fixed ticket #3447 (Improve void CheckStl::if_find())
2012-01-02 23:12:59 +01:00
Daniel Marjamäki
e4f3f91c18
Reverted 9aa8a496
. I don't know why I made this fix.
2012-01-02 19:45:20 +01:00
Edoardo Prezioso
38ee7523ad
Remove redundant testcase I forgot to remove in previous commit.
2012-01-02 19:41:08 +01:00
Daniel Marjamaki
cb22e04a36
Visual Studio: Generated new msvc2010 project files with qmake
2012-01-02 16:28:45 +01:00
PKEuS
621d43e9e4
Fixed #3461 : Support for %m* on scanf-functions
2012-01-02 14:05:58 +01:00
PKEuS
38ddcde7b0
- Refactorizations in preprocessor.cpp and tokenizer.cpp
...
- Bugfix: tok->stringify(tok) returns now "".
- Removed most of the inline-asm handling in preprocessor; improved the remaining handling of #asm/#endasm: Simplified to "asm(...);" statement
2012-01-02 12:58:34 +01:00
PKEuS
064e0ea0d0
Revert "- Refactorizations in preprocessor.cpp and tokenizer.cpp"
...
Committing with subversion seems to have issues. Sorry for that. I'll the changes again, now using git.
This reverts commit 69498de6ca
.
2012-01-02 12:10:53 +01:00
Philipp K
69498de6ca
- Refactorizations in preprocessor.cpp and tokenizer.cpp
...
- Bugfix: tok->stringify(tok) returns now "".
- Removed most of the inline-asm handling in preprocessor; improved the remaining handling of #asm/#endasm: Simplified to "asm(...);" statement
2012-01-02 03:15:02 -08:00
Daniel Marjamäki
01759b03f9
Fixed #3463 (Uninitialized variable variable pointer)
2012-01-02 11:25:13 +01:00
Daniel Marjamäki
112873e876
Revert "Fixed #3450 (CLI --report-progress is currently useless)"
...
This reverts commit e769fe6294
.
2012-01-02 07:42:39 +01:00
Daniel Marjamäki
e769fe6294
Fixed #3450 (CLI --report-progress is currently useless)
2012-01-02 07:27:45 +01:00
Edoardo Prezioso
eb657034ba
Handle also C# multidimensional arrays with no specified dimension.
2012-01-02 00:22:45 +01:00
Reijo Tomperi
8cae17fda8
Update year to 2012
2012-01-01 01:05:37 +02:00
Erik Lax
3d0c1a3301
Fix #3457 (Statement following goto can be executed)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/3457
2012-01-01 00:11:03 +02:00
Edoardo Prezioso
38e0e25ce0
Fixed ticket #3448 (segmentation fault of cppcheck).
...
Add testcase related to previous commit (add 'A f(&x);' as declaration of variable).
2011-12-31 21:44:07 +01:00
Daniel Marjamäki
8a6b1dc1c9
Fixed #3449 (segmentation fault of cppcheck)
2011-12-31 12:08:49 +01:00
Edoardo Prezioso
8f2ad53332
Add testcase for previous commit.
2011-12-30 18:47:42 +01:00
Edoardo Prezioso
873572d489
Improve C# simplification code with arrays of arrays.
2011-12-30 12:26:28 +01:00
Daniel Marjamäki
6a0c463ebd
#3382 (Clarify error message 'invalid deallocation')
2011-12-30 10:32:55 +01:00
Daniel Marjamäki
2ae48c7aef
Fixed #3454 (false positive: (style) Variable 'iFaktor' is assigned a value that is never used)
2011-12-30 09:47:15 +01:00
Marek Zmysłowski
dd8316474a
Fixed #3335 (new check: warn about potential missuse of isgraph-like functions)
2011-12-29 08:08:37 +01:00
Daniel Marjamäki
6d98406d71
Fixed #3444 (False positive using putenv)
2011-12-29 07:35:27 +01:00
Reijo Tomperi
0a588496a0
Fix astyle and test failures.
2011-12-28 22:05:10 +02:00
Reijo Tomperi
1afd923d34
Fix bug in C# detection code. The test had a bug also, so it was not detected by the test.
2011-12-27 22:50:56 +02:00
Daniel Marjamäki
32ed84f4c5
Uninitialized variables: Fixed false positives when using typeof()
2011-12-27 17:03:48 +01:00
Daniel Marjamäki
7c606c4e3b
Uninitialized variables: Fixed false positives for such code: 'if (cond1) { a=0; } if (cond1) { if (cond2) { use_a; } }'
2011-12-27 13:16:16 +01:00
Daniel Marjamäki
987392f254
Tokenizer: Better handling of array of function pointers
2011-12-27 11:56:40 +01:00
Daniel Marjamäki
0bf8e6206c
STL: Fixed false positive when using string::find
2011-12-27 11:02:43 +01:00
Daniel Marjamäki
f6b201bb3b
Uninitialized variables: Fixed false positives when pointer is dereferenced in unexpanded macro
2011-12-27 10:18:49 +01:00
Daniel Marjamäki
fdb6ee2ad7
Uninitialized variables: Fix false positives related to for loop
2011-12-27 08:18:05 +01:00
Daniel Marjamäki
5bac8eca37
Uninitialized variables: Fixed false positives (caused by my 'check more variables' commit)
2011-12-26 22:14:52 +01:00
Daniel Marjamäki
5aaec7adc5
Uninitialized variables: Better handling of variable usage in condition
2011-12-26 18:56:40 +01:00
Daniel Marjamäki
59cd099ba7
Uninitialized variables: Fixed false positives caused by recent commit when potentially uninitialized variable is read in condition
2011-12-26 18:32:42 +01:00
Daniel Marjamäki
481fa532a8
Uninitialized variables: Fixed false positives caused by recent improvement when variable is potentially initialized in else block.
2011-12-26 18:17:13 +01:00
Daniel Marjamäki
c56e2e7cf9
Uninitialized variables: Fixed false positives for unconditional inner scopes
2011-12-26 17:52:32 +01:00
Daniel Marjamäki
025518c474
Uninitialized variables: Fixed false positives when goto is used.
2011-12-26 16:46:10 +01:00
Daniel Marjamäki
8eb067358c
Uninitialized variables: check more variables
2011-12-26 14:01:46 +01:00