Daniel Marjamäki
c32d0f1992
CheckInternal: Improved checking of multiCompare patterns. The multiCompare pattern can contain any %cmd% until there is non-%cmd% used. For instance %var%|%num% is handled ok.
2014-01-05 23:03:36 +01:00
Daniel Marjamäki
4620284cbf
astyle formatting
2014-01-05 22:06:11 +01:00
Daniel Marjamäki
62c608141d
CheckInternal: Improved checking of multiCompare patterns
2014-01-05 21:15:41 +01:00
Graham Whitted
86201c13cb
Fixed #5097 (TemplateSimplifier::expandTemplate assertion failure)
2014-01-05 19:19:52 +01:00
Alexander Mai
77362fd671
Fixed #5289 (Crash: Stack overflow in isImplicitlyVirtual_rec when checking SVN)
2014-01-05 19:10:16 +01:00
Daniel Marjamäki
29c64cc34c
Merge pull request #209 from simartin/ticket_5266
...
Ticket #5266 : Properly tokenize "complex" static variable declarations.
2014-01-05 04:44:22 -08:00
Daniel Marjamäki
deb3699bd8
value flow: Updated Visual Studio files
2014-01-05 09:52:37 +01:00
Daniel Marjamäki
d8270c710a
Add new experimental value flow analysis
2014-01-04 20:57:02 +01:00
Daniel Marjamäki
f1054a50f6
Merge pull request #208 from simartin/ticket_5201
...
Ticket #5201 : Get rid of internal error when checking valid C input for leaks
2014-01-04 05:18:44 -08:00
PKEuS
574c27b1b2
Removed VS9 solution
2014-01-04 10:55:27 +01:00
Simon Martin
d2cf9fd77c
Ticket #5266 : Properly tokenize "complex" static variable declarations.
2014-01-04 10:49:27 +01:00
Simon Martin
6019f45249
Ticket #5201 : Get rid of internal error when checking valid C input for memory leaks.
2014-01-03 23:27:56 +01:00
Daniel Marjamäki
7125682d1a
Fixed #5274 (TokenList: macro handling)
2014-01-03 18:53:37 +01:00
Robert Reif
cbe3862599
Fixed #5264 (Size specifier in printf functions is wrong for some types)
2014-01-03 15:58:45 +01:00
Zachary Blair
7a6386bc4b
Fixed #4867 (Memory Leak: Return value of malloc)
2014-01-03 10:12:32 +01:00
Daniel Marjamäki
372c29c24e
Fixed #5284 (duplicateExpression falsely reported by members of a union in some circumstances)
2014-01-02 16:58:07 +01:00
Daniel Marjamäki
2f91539d1d
Preprocessor: don't insert macroChar inside .1 and 1. tokens
2014-01-02 11:21:23 +01:00
Daniel Marjamäki
a1b0d190df
Fixed #3688 (false positive: (inconclusive, posix) (warning) The buffer 'cBuffer' is not zero-terminated after the call to readlink().)
2014-01-02 10:46:19 +01:00
Martin Ettl
5a5277f2fa
Tokenizer::simplifyVarDecl: Fixed crash when checking garbage code.
2014-01-01 19:15:32 +01:00
Martin Ettl
0dccd3a632
Tokenizer:simplifyFlowControl(): Fixed crash on garbage code.
2014-01-01 19:04:02 +01:00
Daniel Marjamäki
d62055277d
Fixed #4787 (False Positive: Unused private function)
2014-01-01 18:36:51 +01:00
Alexander Mai
5539e9ea0f
Fixed #5279 (False positive: warning (uninitMemberVar): Member variable 'ToDoubleArray::mfNaN' is not initialized in the constructor. (modified #5170 example))
2014-01-01 18:34:39 +01:00
Daniel Marjamäki
cd65d8e54f
Fixed #5169 (Preprocessor::removeComments : Bad handling of __asm)
2014-01-01 12:44:59 +01:00
Daniel Marjamäki
32be4094e7
Symbol database: only put variables in variable list
2013-12-31 17:51:56 +01:00
PKEuS
621cf6e777
Support arrays as template parameters in TemplateSimplifier::templateParameters
2013-12-31 13:59:32 +01:00
PKEuS
6f76dfcb22
Forward declare tinyxml type used in library.h to avoid problems with dynamic linked configuration.
2013-12-31 12:30:17 +01:00
Daniel Marjamäki
7e71c41ba7
Preprocessor: Don't insert macroChar inside 1.f and 1.e+7 as that mess it up later. Thanks ettlmartin for telling me about this.
2013-12-31 10:24:14 +01:00
Daniel Marjamäki
99703e1a3f
Preprocessor: make sure 1E-7, 1E+7, 1e+7 in macros is output as a single token. Putting a macroChar before the 7 mess it up later.
2013-12-30 18:03:24 +01:00
PKEuS
4f0121ee2f
Splitted simplification out of tokenize()
2013-12-30 17:45:28 +01:00
Daniel Marjamäki
582baa5648
Preprocessor: make sure 1e-7 is output as a single token. puttin a macroChar before the 7 mess it up later.
2013-12-29 21:51:01 +01:00
Daniel Marjamäki
41e4194573
Tokenizer: set links for <> in 'a=new b<c>;' code
2013-12-29 15:37:27 +01:00
Daniel Marjamäki
e13aa0dbc3
Fixed #5275 (FP mismatchAllocDealloc: user defined opendir()/closedir() on non-POSIX system)
2013-12-29 09:51:29 +01:00
Daniel Marjamäki
4b72f01e99
clarify calculation: Fixed FP for 'a = (*p ? 1 : 2)'
2013-12-28 11:02:39 +01:00
Daniel Marjamäki
e0eb000ac3
AST: Fixed problem with decrement
2013-12-27 14:40:59 +01:00
Daniel Marjamäki
872b6e8fcc
Fixed VS compiler warning. Using 'struct' for class. Thanks XhmikosR for reporting.
2013-12-26 17:48:25 +01:00
Daniel Marjamäki
742a6935ea
Calculation in sizeof: Fixed FP for sizeof(Fred**)
2013-12-26 13:52:58 +01:00
Daniel Marjamäki
29e74222fb
Sizeof calculation: Fixed FP for sizeof(int*[2])
2013-12-26 13:41:21 +01:00
Daniel Marjamäki
5d5e347418
AST: better handling of 'sizeof(void*)'
2013-12-25 22:08:53 +01:00
Daniel Marjamäki
915cb6c757
Fixed #5261 (AST: cast not handled well (a::b&)x)
2013-12-25 21:19:28 +01:00
Daniel Marjamäki
aa65799c19
pointerArithBool: Updated error message
2013-12-25 19:56:00 +01:00
Daniel Marjamäki
6182394966
Uninitialized variables: Fixed false positive taking value of pointer that is allocated but not initialized
2013-12-25 14:00:27 +01:00
Daniel Marjamäki
26dfddac6b
UninitVar: Fixed false positive when checking if allocated pointer is null
2013-12-24 12:48:17 +01:00
Daniel Marjamäki
4c44e62159
AST: Refactored CheckOther::clarifyCalculation
2013-12-24 10:07:20 +01:00
Daniel Marjamäki
753559fff3
Uninitialized variables: Don't warn about try/catch exception variables
2013-12-24 07:39:15 +01:00
Daniel Marjamäki
042d3afb80
CheckOther::checkDuplicateExpression: Readded warnings when there is a expression between the duplicate expressions 'X || Y || X'
2013-12-24 07:21:46 +01:00
Daniel Marjamäki
ac30a84c3a
Refactoring: Replaced CheckOther::checkCCTypeFunctions with configuration
2013-12-23 19:58:33 +01:00
Daniel Marjamäki
a3dd65caee
Fixed #5126 (new check: missing pointer dereference or pointer overflow 'if (p+1)')
2013-12-23 18:39:05 +01:00
Daniel Marjamäki
661784a170
Fixed #5255 (False positive (error) Uninitialized variable: ptr2 - calling a static member function)
2013-12-23 16:50:27 +01:00
Daniel Marjamäki
e2fa6a291c
Uninitialized variables: Fixed false negatives for loop variables / pointer dereference
2013-12-23 12:27:00 +01:00
Daniel Marjamäki
596b4bd405
astyle formatting
2013-12-23 12:26:12 +01:00
Daniel Marjamäki
e747b6c49b
Merge pull request #202 from simartin/ticket_5214
...
Ticket #5214 : Added test case (ticket already fixed in mainline).
2013-12-23 02:49:25 -08:00
Daniel Marjamäki
76b907fe65
Fixed #5252 (Improve check: use Library to validate function arguments in invalidFunctionUsage)
2013-12-23 10:06:45 +01:00
Daniel Marjamäki
be03d4718a
Library: Added <valid> element that is used to define valid input values for functions
2013-12-22 19:10:14 +01:00
Simon Martin
02dc49624d
Ticket #5214 : Don't read out of bounds upon invalid ternary operator.
2013-12-22 18:13:52 +01:00
Daniel Marjamäki
e2bc99aa24
Fixed #5154 (Tokenizer: wrong handling of msvc 'for each')
2013-12-17 06:34:27 +01:00
Daniel Marjamäki
762806499f
Fixed #5182 (Tokenizer::simplifyEnum: template function call as enum value)
2013-12-16 07:07:00 +01:00
Daniel Marjamäki
92305ed1f9
Fixed #5170 (False positive: warning (uninitMemberVar): Member variable 'ToDoubleArray::mfNaN' is not initialized in the constructor.)
2013-12-15 14:07:29 +01:00
Daniel Marjamäki
7938692b01
Fixed #5212 (Tokenizer::simplifyEnum bad simplification of enum value (1<<0)|(1<<1))
2013-12-15 07:47:04 +01:00
Daniel Marjamäki
f599e3184c
Fixed #5174 (Tokenizer: member function 'abort' returns)
2013-12-14 11:12:48 +01:00
Daniel Marjamäki
fdcb6634df
Fixed #5190 (FP Use const reference to avoid data copying)
2013-12-14 08:46:18 +01:00
Daniel Marjamäki
57ecdd693c
Fixed #5149 (false positive: (error) Dereferencing 'memory' after it is deallocated / released)
2013-12-14 07:37:24 +01:00
Daniel Marjamäki
80dec5a976
Uninitialized variables: Fixed FP when taking address of uninitialized variable
2013-12-13 20:10:22 +01:00
Daniel Marjamäki
7fe923bfc5
Uninitialized variables: Fixed FP when the variable is initialized in do-while condition
2013-12-13 13:27:01 +01:00
Daniel Marjamäki
3e6fbc6517
Fixed uninitialized variable FP after realloc if it fails. Related with ticket: #5240
2013-12-13 07:15:59 +01:00
Daniel Marjamäki
35189e80f2
Uninitialized variables: Fixed false positive for '*p=..'
2013-12-12 15:33:31 +01:00
Daniel Marjamäki
1b86615a69
Uninitialized variables: Fixed false positive for 'p=malloc; if (p) {}'
2013-12-12 11:44:07 +01:00
Daniel Marjamäki
4e7594748d
Uninitialized variables: Fixed false positive for 'p=malloc; if (python tools/daca2.py b)'
2013-12-12 09:17:41 +01:00
Daniel Marjamäki
9f62740e1d
Fixed #5236 (varid 0: vlc: src/misc/objects.c:126)
2013-12-12 08:44:00 +01:00
Daniel Marjamäki
a4f9cb78d5
Uninitialized variables: Fixed false positives when passing allocated pointer to function
2013-12-11 05:54:42 +01:00
Daniel Marjamäki
ef15e40de5
Uninitialized variables: error when passing uninit pointer to function
2013-12-10 18:36:16 +01:00
Daniel Marjamäki
5ba02d2fdd
AST: Always use AST
2013-12-09 18:06:19 +01:00
Daniel Marjamäki
be5c00d215
Uninitialized variables: check function arguments
2013-12-09 15:58:42 +01:00
Daniel Marjamäki
f686cd6516
astyle formatting
2013-12-04 20:54:37 +01:00
Daniel Marjamäki
14a00046a3
Fixed #5207 (Struct uninitialized members useage is not giving error (malloc).)
2013-12-04 20:32:20 +01:00
Simon Martin
fe75686595
Ticket #5203 : Don't crash when checking buffer overrun for invalid code.
2013-11-30 07:40:32 +01:00
Daniel Marjamäki
0c5282b1af
Fixed #5081 (False positive: (error) Uninitialized variable: f (handling of C-cast not correct))
2013-11-28 16:04:47 +01:00
Daniel Marjamäki
771dc2e1ad
AST: Improved handling when calling function through function pointer hidden within parantheses '(a.f)(1,2)'
2013-11-27 06:17:00 +01:00
Daniel Marjamäki
3b11ee9e0e
AST: Improved handling of brackets
2013-11-25 20:58:40 +01:00
Daniel Marjamäki
d8b25da73c
Fixed #4740 (False Positive: Uninitialised variable 'int *a[2][19]; int **b = a[0];')
2013-11-25 06:38:23 +01:00
Daniel Marjamäki
da540a3bb3
AST: Improved astIsFloat handling of expressions
2013-11-25 04:26:15 +01:00
Daniel Marjamäki
abdf2bb9d4
AST: fixed isSameExpressions handling of ({..})
2013-11-25 04:08:28 +01:00
Daniel Marjamäki
94e2bf7a11
AST: Handle ({..})
2013-11-25 04:07:44 +01:00
Robert Reif
43f00942dd
Fixed #5197 (SymbolDatabase: bad handling of unknown macros in function declaration)
2013-11-25 03:43:39 +01:00
Daniel Marjamäki
13cd0f41f6
AST: Fixed FP in isSameExpression when there are different casts
2013-11-24 15:17:08 +01:00
Alexander Mai
38b2f6b9b0
Fixed #5168 (segmentation fault (invalid code) in Tokenizer::simplifyVarDecl)
2013-11-24 11:07:11 +01:00
Daniel Marjamäki
8b77b7711c
Merge pull request #199 from simartin/ticket_5168
...
Ticket #5168 : Don't crash when simplifying bit-fields for invalid code.
2013-11-24 01:55:02 -08:00
Simon Martin
9817da00ec
Ticket #5168 : Don't crash when simplifying bit-fields for invalid code.
2013-11-23 20:33:03 +01:00
Daniel Marjamäki
4fe6951b4c
Library: Fixed loading of 'resource'
2013-11-23 18:16:40 +01:00
Daniel Marjamäki
7fc07989a7
UninitVar: Fixed false positive 'data is allocated but not initialized' when there is assignment
2013-11-23 10:24:29 +01:00
Robert Reif
0afdbc73da
Fixed #5195 (Crash below CheckIO::checkWrongPrintfScanfArguments())
2013-11-23 08:40:35 +01:00
Daniel Marjamäki
8cca41774d
Fixed #4446 (Crash on complex C++ template)
2013-11-21 20:27:24 +01:00
Daniel Marjamäki
2c1f579b3b
Library: Fixed formatstr handling
2013-11-21 16:32:53 +01:00
orbitcowboy
b74db1b791
Tokenize:simplifyFloatCast(): added corresponding suffix, incase of type 'float'.
2013-11-20 23:58:43 -08:00
Alexander Mai
7d45e9be73
Fixed #5122 (duplInheritedMember on private variables)
2013-11-21 05:39:23 +01:00
Daniel Marjamäki
ef108c49ec
Tokenizer: simplify enums better. add parentheses to enforce operator precedence.
2013-11-20 18:04:28 +01:00
Daniel Marjamäki
e8eeb90adb
AST: Fixed 'same expression' false positives (git merge --squash s, <<, >>)
2013-11-20 16:18:09 +01:00
orbitcowboy
1798fc3645
testtokenize:simplifyFloatCasts(): Added testcases for double and long double.
2013-11-17 08:44:05 -08:00
Daniel Marjamäki
27a40b10e1
AST/incorrectLogicOperator: Better handling of large doubles where x+1=>x
2013-11-20 06:33:34 +01:00
Daniel Marjamäki
6869d0de30
AST: Handle L'x'
2013-11-20 05:57:56 +01:00
Daniel Marjamäki
47b98470eb
Tokenizer: Simplify float casts of integer constants
2013-11-19 18:07:12 +01:00
Daniel Marjamäki
f8cf64afef
Fixed #4710 (Template parser bug: const in constructor changes template names)
2013-11-19 06:07:25 +01:00
Daniel Marjamäki
ff5f223a1d
Fixed #5116 (false positive: memset on class (nested struct))
2013-11-18 16:56:00 +01:00
Daniel Marjamäki
033cb19656
Same expression: Don't write warnings for same expression on both sides of arithmetical operators
2013-11-17 17:21:39 +01:00
Daniel Marjamäki
71e61fb1ed
Uninitialized variables: Fixed false positive when using ?:
2013-11-17 12:42:53 +01:00
Daniel Marjamäki
77e09d72a1
Uninitialized variables: Fixed false negatives when using ({})
2013-11-17 12:11:18 +01:00
Daniel Marjamäki
d342387b95
Uninitialized var: Fixed false negatives for self assignment
2013-11-16 18:07:33 +01:00
Daniel Marjamäki
2a640a59c2
Tokenizer: Improved handling of pointer aliases. This fixes some false negatives.
2013-11-16 17:30:04 +01:00
Daniel Marjamäki
cfd6b0c384
UninitVar: fixed false negatives for function calls
2013-11-16 12:02:21 +01:00
Daniel Marjamäki
8c7e3d14aa
Fixed #5119 (Preprocessor: Using -D suppresses __cplusplus for C++ files)
2013-11-15 19:21:21 +01:00
Daniel Marjamäki
30720affd6
Tokenizer::setVarId: Fixed hang when checking libgc
2013-11-15 16:16:22 +01:00
Daniel Marjamäki
5af2fe6e5b
AST: improved 'incorrect logic' checking when there are nested expressions
2013-11-15 06:51:35 +01:00
Daniel Marjamäki
d1721b9d1b
AST: Improved 'same expression on both sides of operator' checking for nested operators
2013-11-15 06:35:46 +01:00
Daniel Marjamäki
203d3e916b
Fixed #5173 (false positive Variable XX is reassigned a value before the old one has been used)
2013-11-14 16:10:00 +01:00
Daniel Marjamäki
673400920d
AST: Fixed 'a[1][2]'
2013-11-13 17:52:56 +01:00
Daniel Marjamäki
7fe51eb58b
Fixed #4989 (False positive: Wrong processing of __asm block)
2013-11-13 06:04:00 +01:00
Daniel Marjamäki
1ecade2657
AST: don't warn about duplicate expressions around '+' operator. It might be more efficient than using for instance '*2'
2013-11-11 20:03:59 +01:00
Daniel Marjamäki
58d7caded1
AST: improved handling of casts
2013-11-11 16:39:34 +01:00
Daniel Marjamäki
4027848761
incorrectLogicOperator: fixed FP when comparing char values. improved handling of float comparisons.
2013-11-10 18:06:51 +01:00
Daniel Marjamäki
807f62520c
Fixed crash caused by endless recursion in redundant assignments check
2013-11-10 17:20:40 +01:00
Alexander Mai
687aeb4f5f
Fixed #5158 (segmentation fault (valid code))
2013-11-10 16:22:52 +01:00
Daniel Marjamäki
bb746261d3
AST: Fixed crash
2013-11-10 15:51:33 +01:00
Daniel Marjamäki
0dd17f9fad
Merge pull request #198 from simartin/ticket_5073
...
Ticket #5073 : Don't crash upon invalid do-while loop.
2013-11-10 03:09:16 -08:00
Daniel Marjamäki
cadb284a3d
Refactored the AST checking of CheckOther::checkIncorrectLogicOperator()
2013-11-10 11:59:18 +01:00
Simon Martin
185b88c6e3
Ticket #5073 : Don't crash upon invalid do-while loop.
2013-11-08 23:13:21 +01:00
Daniel Marjamäki
20b84fcdee
Null pointers: Don't warn when first argument to freopen() is NULL
2013-11-08 13:22:07 +01:00
Robert Reif
52df31b501
Fixed #5153 ((debug) Scope::checkVariable found variable ')')
2013-11-08 12:56:32 +01:00
Robert Reif
a6ef3a224a
Fixed #5151 (false negative: improper formatstring - vector::at())
2013-11-08 12:44:05 +01:00
Daniel Marjamäki
b0ce42565e
AST: Added experimental new implementations for CheckAssignIf::comparison, CheckOther::checkIncorrectLogicOperator and CheckOther::checkDuplicateExpression
2013-11-07 14:38:08 +01:00
Daniel Marjamäki
fb04c8ff84
Fixed #5107 (redundantAssignment when pointer changes)
2013-11-04 23:46:07 +01:00
Daniel Marjamäki
7996d609be
Fixed #5108 (false positive: uninitialized variable (assignment in function parameter))
2013-11-04 23:09:15 +01:00
Daniel Marjamäki
6ad2491817
AST: uninstantiated template
2013-11-04 22:58:47 +01:00
Daniel Marjamäki
8ff412fcee
Fixed #5142 (False positive with floating-point special cases in conditions)
2013-11-04 11:56:43 +01:00
Daniel Marjamäki
de29991c11
AST: Rewrite using standard approach
2013-11-04 11:26:16 +01:00
Daniel Marjamki
9959c2866c
AST: fixed hang for ',&x..'
2013-11-03 15:05:58 +01:00
Daniel Marjamki
8910bae801
Fixed #5137 (Defining empty macro from commandline does not seem to work)
2013-11-03 09:46:03 +01:00
Daniel Marjamki
bcc8384a95
Fixed #5145 (False Positive: Variable 'A' hides enumerator with same name)
2013-11-03 09:34:48 +01:00
Daniel Marjamäki
5f0cfa0ee4
Fixed #4983 (False positive warning 'Possible null pointer dereference: lblList - otherwise it is redundant to check it against null.' with sizeof lblList[0])
2013-11-02 23:56:10 +01:00
Daniel Marjamäki
11abd23fa7
astyle formatting
2013-11-02 22:58:47 +01:00
Daniel Marjamäki
769b4617c3
Fixed #5142 (False positive with floating-point special cases in conditions)
2013-11-02 22:58:23 +01:00
Daniel Marjamäki
a50e5c2c23
Merge pull request #195 from simartin/ticket_5139
...
Ticket #5139 : Properly handle recursive macro definitions
2013-11-02 11:21:13 -07:00
Daniel Marjamäki
c505f5ea23
Fixed AST problem for 'if ((a.b&c)==d){}'
2013-11-02 19:18:58 +01:00
Daniel Marjamäki
bbdfd8b5c7
Make it possible to create AST, by using the --ast flag
2013-11-02 18:37:35 +01:00
Simon Martin
95c08d5613
Ticket #5139 : Properly simplify recursive macro definitions
2013-11-01 16:47:22 +01:00
Martin Ettl
5f89777182
testoptions: reverted commit 184db3900e
2013-11-01 01:28:05 +01:00
Martin Ettl
63d9fd4210
Merge branch 'master' of https://github.com/danmar/cppcheck
2013-10-29 01:48:58 +01:00
Daniel Marjamäki
e446a28b3d
Refactoring FileLister and Path so they don't depend on Library
2013-10-31 19:09:01 +01:00
Martin Ettl
184db3900e
testoptions: fixed buffer access out of bounds issue. The ctor of options requires an array of at least two elements, but.
2013-10-29 01:48:30 +01:00
Daniel Marjamäki
d3bd373798
Fixed #5131 (False Positive: %u in format string requires 'unsigned int' but the argument type is 'int'.)
2013-10-31 17:20:00 +01:00
Daniel Marjamäki
352c459e28
Merge pull request #194 from simartin/ticket_5121
...
Ticket #5121 : Handle static variable declarations depending on one another
2013-10-30 22:09:44 -07:00
Alexander Mai
14787cde99
Fixed #5129 (FP:arithOperationsOnVoidPointer on void**)
2013-10-31 06:04:51 +01:00
Daniel Marjamäki
06c5bd0daa
Fixed #5128 (False positive zerodivcond 'a ? 1 / a : 0')
2013-10-30 16:51:00 +01:00
Simon Martin
d67722ebdf
Ticket #5121 : Handle comma separated static variable declarations depending on one another
2013-10-30 15:48:00 +01:00
Simon Martin
463ef2e71e
Ticket #5120 : New test case, that works now that #5125 is fixed
2013-10-30 10:15:03 +01:00
Simon Martin
052be76635
Ticket #5125 : Avoid infinite recursion for recursive class definitions
2013-10-29 21:41:47 +01:00
orbitcowboy
097510c4ef
Tokenizer:simplifyMathFunctions_fma: added a todo testcase.
2013-10-29 09:26:26 -07:00
Daniel Marjamäki
5c072993e3
CheckBool: Fixed false negative when assigning bool to pointer '; s.p = true; '
2013-10-29 16:16:52 +01:00
orbitcowboy
e8fdf4cdd2
Tokenizer:simplifyMathExpressions: added more testcases.
2013-10-24 21:33:00 -07:00
PKEuS
bd752cabcf
Let TinyXML2 handle fopen/fclose. Added testlibrary.cpp to VS10 solution
2013-10-27 17:32:38 +01:00
Daniel Marjamäki
569a29bc4a
Library: Added simple testing
2013-10-27 17:10:43 +01:00
Robert Reif
94187c41c2
Fixed #5104 (False positive: Invalid argument in printf and scanf for vector template)
2013-10-27 10:48:49 +01:00
Daniel Marjamäki
4a6274dcc0
Merge pull request #183 from felipensp/null_ptr_typeof
...
- Fixed false positive when passing pointer to typeof()
2013-10-27 02:37:31 -07:00
Daniel Marjamäki
ec3ab74631
Preprocessor: Use set instead of list to track '#pragma once' usage
2013-10-27 10:33:37 +01:00
Daniel Marjamäki
51ad9ab6ac
Fixed #4896 (FP Uninitialized variable on template function)
2013-10-26 18:39:40 +02:00
Daniel Marjamäki
8687e85e56
Fixed #4850 (False positive: invalidIterator1 detected when iterator container is member of some struct)
2013-10-26 17:48:20 +02:00
Daniel Marjamäki
853d9dd7a9
Fixed #4956 (false positive: Variable 'myIsFirst' is assigned a value that is never used.)
2013-10-26 15:22:28 +02:00
XhmikosR
32e2a5b879
test/testother.cpp: Fix a C4800 MSVC warning.
2013-10-25 18:14:16 +03:00
Daniel Marjamäki
364757e1e1
Fixed #5089 ('inconclusive' output printed although --inconclusive not specified)
2013-10-23 06:42:52 +02:00
Daniel Marjamäki
d1b03d9c31
Fixed false positive for 'object is destroyed immediately' when there is no code after the object
2013-10-22 19:37:11 +02:00
Daniel Marjamäki
a55056c770
Fixed #5105 (false positive: (warning) Either the condition 'b!=0' is useless or there is division by zero)
2013-10-22 16:18:42 +02:00
Daniel Marjamäki
fd0f2d7900
Fixed #4929 (False positive: possible null pointer deref (checks dont handle && and || well))
2013-10-22 10:47:48 +02:00
Sam Truscott
6806fd8135
Extended Qt support through Library
2013-10-20 14:09:10 +02:00
Daniel Marjamäki
fc26de89a9
Fixed #5082 (False positive: (error) Possible null pointer dereference: p2)
2013-10-20 13:37:36 +02:00
Daniel Marjamäki
5d7e0aebf4
Fixed #5084 (False positive: (style) Same expression on both sides of '&&')
2013-10-19 18:04:53 +02:00
Daniel Marjamäki
6aa03efa2f
Fixed #5103 (Don't show 'The scope of the variable can be reduced' if there is no explicit block with { })
2013-10-19 17:27:02 +02:00
Daniel Marjamäki
f8710cb984
Fixed #5102 (Crash if -D is used when scanning simple preprocessor code.)
2013-10-18 06:47:55 +02:00
Robert Reif
b41ab8a4d5
Fixed #5088 (Token::Match called with varid 0. in libreoffice sd/source/ui/table/TableDesignPane.cxx)
2013-10-14 21:05:54 +02:00
Felipe Pena
ecb0e70250
- Fixed false positive when passing pointer to typeof()
2013-10-12 10:19:15 -03:00
Robert Reif
1fccfd50eb
Fixed #5080 ((error) Internal error. Token::Match called with varid 0. Please report this to Cppcheck developers)
2013-10-12 10:50:59 +02:00
orbitcowboy
9debeab47c
Tokenizer:simplifyMathExpressions: fixed false negative patterns for simplification.
2013-10-11 11:58:37 -07:00
Daniel Marjamäki
bb0385321f
Fixed #5074 (False positive: Duplicate expression (macro))
2013-10-13 17:42:06 +02:00
Martin Ettl
a674ed1aa9
Tokenizer:simplifyMathFunction: added simplifcation for fma[f|l]() functions.
2013-10-13 16:28:02 +02:00
Martin Ettl
e18ebf313f
Tokenizer:simplifyMathFunctions: added support for more math functions.
2013-10-13 15:41:47 +02:00
Martin Ettl
cdb47813d5
Tokenizer:simplifyMathFunctions: added support for cosh[f|l], cos[f|l] and erfc[f|l] functions.
2013-10-13 14:23:10 +02:00
Felipe Pena
c37ba4cbcf
- Fixed false positive when using typeof/__alignof__
2013-10-12 13:46:14 -03:00
Daniel Marjamäki
783bb6eb0b
Test that there is no segfault in CheckOther::checkZeroDivisionOrUselessCondition when the SymbolDatabase is invalid. Ticket: #5045
2013-10-10 22:23:52 +02:00
orbitcowboy
6eaa2f2444
Tokenizer:simplifyMathFunctions: added support for acos[f|l] functions.
2013-10-09 07:59:32 -07:00
orbitcowboy
58c09f80b6
Testother: split up a large testfunction, no functional change.
2013-10-09 07:48:46 -07:00
Daniel Marjamäki
682e68b1b6
Fixed #5077 (False positive: Comparison of boolean result with relational operator ((X + (Y < 0)) <= b))
2013-10-09 05:43:50 +02:00
Martin Ettl
f08325284c
Tokenizer:simplifyMathFunctions: added support for acosh[f|l]() functions.
2013-10-07 22:10:58 +02:00
Daniel Marjamäki
9ce7efc6e4
commaSeparatedReturn: made checking experimental for now because there are false positives ( #5076 )
2013-10-08 18:05:07 +02:00
orbitcowboy
90b2c5ddce
testtokenize: split up large testcases for simplifying math functions.
2013-10-08 07:05:05 -07:00
Daniel Marjamäki
4f88fdcf4a
Check64Bit: Fixed false positive about returning integer for 'p+(n*80)'
2013-10-08 06:36:45 +02:00
Robert Reif
1959377423
Fixed #4963 (cppcheck and testrunner Visual Studio 2008 build failure)
2013-10-08 05:36:52 +02:00
Daniel Marjamäki
f9cf148012
CheckBool: Skip 'bool' type checking in C code
2013-10-07 18:41:07 +02:00
Daniel Marjamäki
b81de5494e
CheckBool: Fixed false positive for calculation using bool result in rhs
2013-10-07 18:01:08 +02:00
Daniel Marjamäki
d2025363d0
CheckBool: Fix false positive for '(a != boolexpr || c)' if a is a int
2013-10-07 17:44:19 +02:00
Daniel Marjamäki
83f9503839
CheckBool: Fixed false positives for non-bool expressions that contain ! operator
2013-10-07 16:37:51 +02:00
Daniel Marjamäki
023d0e7cb8
Fixed #5072 (False positive: comparisonOfBoolWithInvalidComparator even without explicit bool type)
2013-10-07 16:16:07 +02:00
Daniel Marjamäki
4cd0108b93
Fixed #4976 (False positive: (style) A pointer can not be negative (git/sha1_file.c))
2013-10-06 16:52:27 +02:00
Daniel Marjamäki
0ef1529ba5
Fixed #5005 (false positive: (warning) Assignment of function parameter has no effect outside the function.)
2013-10-06 16:07:27 +02:00
Daniel Marjamäki
1234ec95f0
Fixed #4998 (False positive: Address of local auto-variable assigned to a function parameter)
2013-10-06 14:23:26 +02:00
Daniel Marjamäki
9f23b7a1b4
Fixed #5063 (False positive for comparisonOfBoolWithInvalidComparator)
2013-10-06 10:39:08 +02:00
Daniel Marjamäki
c234cace6d
Fixed #5064 (Tokenizer::simplifySizeof: Doesn't simplify 'sizeof !! (a==1);' properly)
2013-10-06 08:20:10 +02:00
Daniel Marjamäki
946722faf0
Fixed #4968 (False positive: Structure with 'read' member is confused with read() function.)
2013-10-05 18:25:44 +02:00
Robert Reif
7098fc6039
CheckIO: fixed handling of unknown types. Ticket #5051
2013-10-05 16:47:06 +02:00
Daniel Marjamäki
6830d5f7a4
Fixed #5042 (false positive: Redundant code (set filled in initialization list))
2013-10-05 12:26:09 +02:00
Daniel Marjamäki
f2fdd967f5
Fixed #5046 (False positive: Boolean value assigned to pointer)
2013-10-05 08:53:37 +02:00
Daniel Marjamäki
348f3fa97f
Fixed #5058 (False positive: (warning) Comparison of a boolean expression with an integer.)
2013-10-05 08:33:33 +02:00
Robert Reif
5dbc02250f
This patch adds pointer to format string support to printf. Ticket: #5051
2013-10-05 07:47:52 +02:00
Robert Reif
44559a1fb2
Fixed #5069 (sizeof(void) when variable name is override)
2013-10-05 07:40:59 +02:00
Robert Reif
6c06cdd24d
CheckIO fixes. Ticket: #5051
2013-10-04 17:30:55 +02:00
Martin Ettl
a8cf8f0984
Tokenizer:simplifyMathFunctions: fixed false positives when simplifying special pow() cases.
2013-10-03 22:54:45 +02:00
Martin Ettl
f8bd33f2bc
Tokenizer:simplifyMathFunctions: added support for log()-functions. Improved testcases and documentation. The function simplifyMathFunctions() returns now true in case a simplifcation is made. This function is called within a while loop to guarantee all simplifications are made.
2013-10-03 20:52:07 +02:00
Martin Ettl
548e2f3fbf
Tokenizer:simplifyMathExpression: fixed false negatives in simplifying Pythagorean and Hyperbolic identities.
2013-10-03 15:41:12 +02:00
Robert Reif
59de30823e
CheckIO: This patch adds support for fprintf_s, fscanf_s and %I. Ticket: #5051
2013-10-03 06:37:40 +02:00
Robert Reif
5aba841499
CheckIO: Handling of casts ( #4964 )
2013-10-02 04:12:46 +02:00
Martin Ettl
fa5ee8fd13
Tokenizer: simplifyMathFunctions: added more simplifications for exp(), exp2() and log2() functions.
2013-10-01 20:30:59 +02:00
orbitcowboy
b6d7e797a2
Testtoken:matchNumeric(): extended testing about some missing testcases.
2013-09-30 15:55:36 -07:00
orbitcowboy
5a158987ce
Added todo testcase for false positive: Comparison of boolean with expression with an integer.
2013-09-30 11:21:28 -07:00
Robert Reif
cc6745fef6
CheckIO: Fixed false positives when using _snprintf_s and _snwprintf_s. Ticket: #5057
2013-10-01 05:49:44 +02:00
Martin Ettl
f0cbeb5233
simplifyMathFunctions: added support for exp(),sqrt(),cbrt() functions.
2013-09-29 18:11:17 +02:00
Robert Reif
c37c6617d3
Fixed #5057 (Microsoft secure printf/scanf support.)
2013-09-30 19:55:21 +02:00
Daniel Marjamäki
e3b7bce72b
Fixed #4907 (False positive 'uninitStructMember' on structs with unions)
2013-09-30 06:35:31 +02:00
Daniel Marjamäki
1c513f330a
Fixed #5055 (False negatives when using -I (external source code))
2013-09-29 18:59:27 +02:00
Robert Reif
d3798958f4
CheckIO: Fixed false positive when using wchar_t ( #5051 )
2013-09-29 15:25:18 +02:00
Martin Ettl
0527aefb11
Improved simplifyMathFunctions when simplifying special cases of pow(x,y)-function.
2013-09-29 15:11:09 +02:00
Daniel Marjamäki
973bdcc6d8
Fixed #4929 (false positive: Division by zero (standard function div()))
2013-09-29 11:13:49 +02:00
Robert Reif
c5723ab46a
CheckIO: Clarify format check warnings
2013-09-29 10:42:47 +02:00
Martin Ettl
5aaaff46ee
Fixed #5049 : new check: (warning) Comparison of two identical variables with isgreater(result,result) evaluates always to false.
2013-09-26 07:07:48 +02:00
Martin Ettl
805d082cd1
Tokenizer:simplifyMathFunction: added support for [ll]div() functions and corresponding unittests. The simplifcation is only performed, if a division by 1 is detected.
2013-09-26 07:01:08 +02:00
Steve Duan
cf0c666d79
Fixed #5041 (Improve check: support 'auto' for 'Iterator used after element has been erased')
2013-09-28 11:50:45 +02:00
Daniel Marjamäki
4a02ca8202
SymbolDatabase: handle method with unknown macro 'void f() MACRO {..}'
2013-09-28 11:44:26 +02:00
Daniel Marjamäki
c2a8f6f59a
astyle formatting
2013-09-28 09:32:41 +02:00
Simon Martin
d67a0add47
Ticket #5024 : Don't crash upon invalid code when checking auto variables.
2013-09-28 00:14:12 +02:00
Frank Zingsheim
67915749b0
Fixed #4723 (False positive: Pure virtual call within conditional clause)
...
conditional clauses directly in constructor/destructor cannot prevent
pure virtual function call otherwise this part of the code would never been called
2013-09-27 09:25:38 +02:00
Martin Ettl
32e1831716
#5046 - Added todo testcase
2013-09-26 01:03:34 +02:00
Martin Ettl
ea5bcfaa35
Fixed #5040 - simplify more math functions.
2013-09-26 00:44:16 +02:00
Frank Zingsheim
445d08d082
Fixed #4723 (False positive: Pure virtual call within conditional clause)
2013-09-26 17:25:16 +02:00
Robert Reif
44d86e97c0
Fixed #4920 (Microsoft ATL/MFC CString::Format argument checking)
2013-09-26 16:20:01 +02:00
Robert Reif
2de3ebcb1e
CheckIO: fixed some more false negatives. Ticket: #4964
2013-09-24 06:43:03 +02:00
Daniel Marjamäki
17c0bb3cab
revert 027e5cc8
. the div() standard function should not be reimplemented. create a different fix. Ticket: #4929
2013-09-23 18:01:15 +02:00
Daniel Marjamäki
698e9e2b59
reverted ee14ea4f
. I think this fix was too generic. If there is a union in the struct then only the union members should be skipped.
2013-09-23 17:52:42 +02:00
Daniel Marjamäki
ee14ea4fc2
Fixed #4907 (False positive "uninitStructMember" on structs with unions)
2013-09-23 07:20:20 +02:00
Daniel Marjamäki
64454068ec
Fixed #4934 (false positive: Uninitialized variable (loop with inner condition '(x=1)'))
2013-09-23 06:07:01 +02:00
Daniel Marjamäki
027e5cc860
Fixed #4929 (false positive: Division by zero (standard function div()))
2013-09-22 09:52:12 +02:00
Robert Reif
5c4c397372
CheckIO: add scanf argument type checking. Floating point and integer checking is complete but string checking is incomplete and character checking is missing. Ticket #4099
2013-09-22 06:56:31 +02:00
Alexander Mai
6eab4abaf2
Fixed #5030 (Segmentation fault below CheckMemoryLeakStructMember::isMalloc())
2013-09-21 18:10:29 +02:00
Daniel Marjamäki
965d8f0ecc
Fixed #5033 (segmentation fault (valid code) in CheckOther::checkZeroDivisionOrUselessCondition)
2013-09-21 17:44:25 +02:00
Martin Ettl
4cc153a6f3
Fixed #5032 : fix wrong unittest case in testtoken::matchNumeric.
2013-09-21 17:40:18 +02:00
Martin Ettl
d5f514c820
Fixed #5031 : simplify labs|fabs|abs(-1) to 1.
2013-09-21 16:59:06 +02:00
Daniel Marjamki
3de9431507
Fixed #5022 (Improve check: Division by zero or useless condition, function call)
2013-09-15 17:46:52 +02:00
Robert Reif
19745bbb7d
Fixed #5021 (Confusing message about %lf format in printf())
2013-09-15 16:38:45 +02:00
Ettl Martin
5a671f8914
Fixed #5023 (Add support for asinf,acosf,asinl,acosl (...) functions)
2013-09-13 19:49:25 +02:00
Robert Reif
4d82e37078
Fixed #5021 (Confusing message about %lf format in printf())
2013-09-12 05:54:05 +02:00
PKEuS
0439f25bbd
Fixed wrong unittest introduced in b36a887608
2013-09-10 12:57:28 +02:00
Robert Reif
9be2f6b5d4
Fixed #4964 (printf format argument check only supports simple variables)
2013-09-08 20:21:00 +02:00
Daniel Marjamäki
4b1254bc8d
Merge pull request #168 from simartin/ticket_4994
...
Ticket #4994 : Don't crash when checking variable scope for invalid input
2013-09-08 06:57:42 -07:00
Simon Martin
843833f907
Ticket #4994 : Don't crash when checking variable scope for invalid input.
2013-09-07 21:16:25 +02:00
Daniel Marjamäki
51ad747317
Fixed false positive in new 'x>-1<5' check when using templates
2013-09-07 18:24:35 +02:00
Daniel Marjamäki
6bb6506ce2
checkZeroDivisionOrUselessCondition: Fixed false positive when function is called and variable is passed to it
2013-09-07 16:18:11 +02:00
Daniel Marjamäki
08556d071e
Fixed #5016 (false negative: condition is always true / comparing boolean result with '<' (x > -1 < 5))
2013-09-07 11:32:11 +02:00
Daniel Marjamäki
83c460fc56
Fixed #5017 (New check: division by zero, otherwise condition is redundant)
2013-09-07 07:40:10 +02:00
Daniel Marjamäki
40c5924292
CheckIO: Handle classes derived from STL
2013-09-07 07:20:06 +02:00
Robert Reif
489a3a6e53
Fixed #5015 (strings not being concatinated properly)
2013-09-06 05:36:33 +02:00
Daniel Marjamäki
9000c233fa
Fixed #5012 (Hang when there is syntax error 'else }')
2013-09-05 06:38:07 +02:00
Robert Reif
2fe91e290c
CheckIo: Improved %d handling
2013-09-05 06:04:41 +02:00
Robert Reif
921a1aaa4f
CheckIO: Improved handling of %u
2013-09-05 01:46:58 +02:00
Daniel Marjamäki
3b8e9f5a2a
Fixed #4899 (False positive on unused variable)
2013-09-03 17:02:46 +02:00
PKEuS
05af4f82ce
Test GetShowErrorMessages in testcmdlineparser.cpp
2013-09-03 11:41:16 +02:00
PKEuS
b36a887608
Fixed false positive #5004
2013-09-03 10:54:10 +02:00
PKEuS
6b47ed414a
Fixed Function::retDef initialization:
...
- Move/Copy Constructors and Destructors do not have a return type neither
- Fixed crash in SymbolDatabase::printOut
- Added testing
2013-09-03 10:48:01 +02:00
Daniel Marjamäki
5d7518aa57
simplifyCalculations: Improved handling of casts ( #4899 )
2013-09-03 06:27:11 +02:00
Robert Reif
0dddd424a4
CheckIO: Improved handling of function return type
2013-09-03 05:50:19 +02:00
Daniel Marjamäki
6819f5ed18
Fixed #4860 (Segfault with another Clucene file)
2013-09-02 05:58:55 +02:00
Daniel Marjamäki
a781a83822
Preprocessor: Quicker response for --check-config. No 'normal' code is needed so skip it.
2013-09-01 07:13:48 +02:00
Robert Reif
8790f6d73f
Fixed #4999 (Crash with simple code snipped in rev ab30fa3
)
2013-08-31 18:58:55 +02:00
Robert Reif
05f2f0e419
CheckIO: improved type info - keep track of original typename.
2013-08-31 06:26:39 +02:00
Lucas Manuel Rodriguez
92b7280d13
Fixed #4995 (False positive - Using 'memset' on class that contains a virtual method) - Better fix
2013-08-30 22:06:20 -03:00
Lucas Manuel Rodriguez
c26674dc97
Fixed #4995 (False positive - Using 'memset' on class that contains a virtual method)
2013-08-30 08:46:33 -03:00
Daniel Marjamäki
4a1d1ce1a1
Fixed #3471 (Unused functions: take __attribute__((constructor)) in to consideration)
2013-08-30 06:27:46 +02:00
Robert Reif
fc435ae9aa
CheckIO: fix false negative for a function in a base class not being found, fix false positives and negatives for std::vector operator []
2013-08-30 05:41:59 +02:00
Lucas Manuel Rodriguez
acd65a6829
Fixed #4991 : False Positive - Dangerous usage of 'arr' (not null-terminated)
2013-08-29 08:12:05 -03:00
Robert Reif
2950eb08cb
CheckIO: fix some %I64 related false positives. Ticket: #4964
2013-08-29 05:49:16 +02:00
Daniel Marjamäki
3bd1d53c75
Fixed #4941 (segmentation fault (invalid code) in Tokenizer::setVarId)
2013-08-28 19:52:41 +02:00
Daniel Marjamäki
2eca0a93a7
Fixed #4733 (defective unusedStructMember warning)
2013-08-28 06:46:32 +02:00
Robert Reif
5c3315db7a
CheckIO: improved handling of functions returning pointers. Ticket: #4964
2013-08-28 05:57:40 +02:00
Daniel Marjamäki
5d7ebadf25
Fixed ¤4596 (False positive, Variable 'value' is not assigned a value (x = x >> value))
2013-08-27 15:57:38 +02:00
Daniel Marjamäki
4189d7db46
test
2013-08-27 06:47:06 +02:00
Robert Reif
228f6b1a87
Fixed #4984 (False positive: (warning) %f in format string (no. 1) requires a floating point number given in the argument list.)
2013-08-27 05:46:09 +02:00
Daniel Marjamäki
80093f0a40
Fixed #4689 (False positive: Unused private function (used in default argument of constructor))
2013-08-26 16:41:23 +02:00
Robert Reif
a1b9bb0688
CheckIO: Fix false positives for functions returning unknown types and false negatives for functions returning record types
2013-08-26 06:03:26 +02:00
Alexander Mai
450442287c
Fixed #4974 (CheckBufferOverrun::writeOutsideBufferSize() too strict)
2013-08-25 18:46:07 +02:00
Daniel Marjamäki
acdbbeee44
Fixed #4913 (Tokenizer::simplifyKnownVariables: wrong handling of *--p=0;)
2013-08-25 08:54:33 +02:00
Robert Reif
3d9383aabb
Fixed #4975 (False positive: (warning) %s in format string (no. 3) requires a char* given in the argument list. (git/column.c))
2013-08-25 08:32:10 +02:00
Robert Reif
3c6ca35e09
Fixed #4977 (improve platform type tokenize performance)
2013-08-25 08:29:24 +02:00
Daniel Marjamäki
b20f44cf6a
Merge pull request #167 from simartin/ticket_4450
...
Fix Ticket #4450
2013-08-24 14:12:44 -07:00
Robert Reif
26de3646e9
CheckIo: Revised patch that fixes bug in class function return type. Ticket: #4964
2013-08-24 22:34:52 +02:00
Simon Martin
b713a69b30
Ticket #4450 : Handle comma separated static variable declarations with initializers in brackets.
2013-08-24 22:27:54 +02:00
Lucas Manuel Rodriguez
a70b0cd0f3
Fixed FP: Null pointer dereference
2013-08-24 16:50:19 -03:00
Daniel Marjamäki
5ce7189bc0
Merge pull request #166 from last5bits/ticket4213
...
Fixing #4213 arrayIndexThenCheck and adding tests
2013-08-23 22:36:30 -07:00
Robert Reif
01fd156852
CheckIO: Start to add checking of function return types. Ticket: #4964
2013-08-24 07:25:50 +02:00
Alexey Zhikhartsev
d24a321ba2
Fixing #4213 arrayIndexThenCheck and adding tests
2013-08-23 19:04:01 +04:00
Daniel Marjamäki
9b4f6a6b3d
Fixed #4701 (false positive unusedFunction when using templates)
2013-08-23 06:47:52 +02:00
Robert Reif
5ce1933687
CheckIo: handle more complex variables
2013-08-23 05:35:57 +02:00
Alexander Mai
7fc6b1344b
Added testcases for #4801 (Cppcheck fails to parse Posix (crash in CheckOther::checkPipeParameterSize()))
2013-08-22 21:33:02 +02:00
Alexander Mai
986ec42d79
Fixed #4937 (false positive: Assert calls a function which may have desired side effects)
2013-08-22 06:38:54 +02:00
Daniel Marjamäki
c96586b2a9
"automatic conversion from iso-8859-1 formatting to utf-8"
2013-08-21 19:31:01 +00:00
Daniel Marjamäki
ef086ee4a9
Merge pull request #164 from last5bits/master
...
Don't include tinyxml from both lib.pri and test.pro
2013-08-21 07:24:56 -07:00
Daniel Marjamäki
f257c62858
Fixed #4846 (false positive: (warning) Comparison of a boolean with an integer.)
2013-08-21 16:17:19 +02:00
Lucas Manuel Rodriguez
006b8055e5
Fixed #4676 (Duplicated inherited member check)
2013-08-20 06:29:19 +02:00
Lucas Manuel Rodriguez
14d3886e19
Fixed #4965 (sizeof(void) check - error in message)
2013-08-20 06:20:52 +02:00
Robert Reif
707dfb4eea
Fixed #4964 (printf format argument check only supports simple variables)
2013-08-20 06:16:31 +02:00
Alexey Zhikhartsev
298cbd77ff
Don't include tinyxml from both lib.pri and test.pro
2013-08-19 19:44:29 +04:00
Daniel Marjamäki
342142b783
Fixed #4256 (Preprocessor: '#pragma once' doesn't work properly when using -D)
2013-08-18 18:04:06 +02:00
Robert Reif
914893013e
Symbol Database: improved type handling. Ticket: #4952
2013-08-17 18:43:15 +02:00
Simon Martin
5743416d3e
Ticket #4959 : Simplify {in,de}crements of known variables.
2013-08-16 23:51:00 +02:00
Daniel Marjamäki
538e4bd798
astyle formatting
2013-08-16 18:27:54 +02:00
Robert Reif
b777388fb8
Symbol database: improved type handling (fix problems in previous commit). Ticket: #4952
2013-08-16 05:42:12 +02:00
Daniel Marjamäki
33a948f816
Merge pull request #162 from simartin/ticket_4708
...
Fixed #4708 : prefix {in,de}crement too eagerly computed.
2013-08-15 20:35:38 -07:00
Daniel Marjamäki
5d7f30b88f
reassign var: better handling of struct members
2013-08-15 16:13:58 +02:00
Simon Martin
bf09191b78
Fixed #4708 : prefix {in,de}crement too eagerly computed.
2013-08-15 15:53:08 +02:00
PKEuS
dc439f65f8
Added some unit tests to improve test coverage in cmdlineparser
2013-08-15 11:09:40 +02:00
Daniel Marjamäki
f95b29db06
Improved handling of the __FILE__ macro
2013-08-14 06:36:03 +02:00
Daniel Marjamäki
fd26bad6fa
AssignIf: Improved handling of function calls
2013-08-13 14:08:54 +02:00
Daniel Marjamäki
c58c9d80e1
astyle formatting
2013-08-13 06:36:03 +02:00
Daniel Marjamäki
ff71c94f6e
Fixed #4949 (define symbol used in code => 'Analysis failed' message is written.)
2013-08-12 18:12:49 +02:00
Robert Reif
d6ce072dc9
Fixed #4950 (Tokenizer: order of int modifiers)
2013-08-12 06:23:01 +02:00
Robert Reif
cd3044c808
Fixed #4952 (SymbolDatabase: unknown types in log file)
2013-08-12 06:21:03 +02:00
Simon Martin
40887ca99c
Ticket #4703 : Trim macro parameters.
2013-08-11 09:41:03 +02:00
Robert Reif
56d8073d0f
Fixed #4902 (printf and scanf format checks don't support microsoft %I, %I32 and %I64 extensions)
2013-08-10 12:37:31 +02:00
Robert Reif
5aa79198e6
Fixed #4948 (check printf %l and %ll arguments for long and long long)
2013-08-10 12:33:55 +02:00
Daniel Marjamäki
64733d9e63
astyle formatting
2013-08-10 12:32:59 +02:00
Daniel Marjamäki
3ac21ab1db
Merge pull request #158 from simartin/ticket_4764
...
Ticket #4764 : Handle template instantiations with only default parameters
2013-08-10 03:22:41 -07:00
Simon Martin
ad33d95ec1
Ticket #4764 : properly handle template instantiations with only default parameters.
2013-08-10 12:00:16 +02:00
Robert Reif
b940d0adc6
Fixed #4947 (Doesn't allow any ordering of int modifiers)
2013-08-09 23:13:04 +02:00
Daniel Marjamäki
3032dbabce
astyle formatting
2013-08-08 15:50:45 +02:00
PKEuS
298a33211f
Use static CmdLineParser instance where possible in testcmdlineparser.cpp, fixed wrong unit test.
2013-08-07 18:24:18 +02:00
PKEuS
36dba8373b
Reuse constant objects in testpathmatch.cpp, small simplification in testsuppressions.cpp and testthreadexecutor.cpp
2013-08-07 17:55:31 +02:00
PKEuS
a65e08b648
Simplified code in testerrorlogger by reusing constant object.
2013-08-07 17:02:35 +02:00
PKEuS
758d68519d
Use TinyXML to write XML files
2013-08-07 16:30:55 +02:00
PKEuS
a9a5dc0354
Updated to AStyle 2.03, require this version
2013-08-07 16:27:37 +02:00
PKEuS
dd82817752
Fixed #4943 and simplified CheckOther::checkCommaSeparatedReturn()
2013-08-06 11:27:09 -07:00
PKEuS
5e3ccda408
Added support for noreturn functions from library to CheckOther::checkUnreachableCode()
2013-08-06 02:11:59 -07:00
Simon Martin
c9884c30a1
Fix ticket #4922 (segmentation fault upon invalid code).
2013-08-05 20:28:22 +02:00
Daniel Marjamäki
2a78db4c06
Refactoring Token::findClosingBracket.
2013-07-31 10:30:20 +02:00
Daniel Marjamäki
6c05f78a8f
Reverted experimental changes for handling of lambda functions ( #4919 ).
2013-07-31 09:58:31 +02:00
Daniel Marjamäki
807204e580
Fixed #4237 (False positive: (error) Memory Leak: data (references and pointer aliases))
2013-07-30 11:30:14 +02:00
Daniel Marjamäki
1bebf1fd7e
AssignIf: added todo test case (pass variable by value to function)
2013-07-29 12:27:57 +02:00
Alexander Mai
39ba0d36c1
TestRunner: added test case for assignment simplification in do-while ( #4881 ).
2013-07-29 12:10:11 +02:00
Daniel Marjamäki
f59164302d
TestAssignIf: improved code coverage
2013-07-29 11:43:08 +02:00
Alexander Mai
3e9f6daa00
Added test cases for #4801 (Cppcheck fails to parse Posix (crash in CheckOther::checkPipeParameterSize()))
2013-07-29 10:57:41 +02:00
Daniel Marjamäki
9ff204f8bc
astyle formatting, use isEnabled("warning") instead of isEnabled("style")
2013-07-28 16:13:16 +02:00
Simon Martin
d01e3fa17a
Handle parameter positions format strings (POSIX extensions).
2013-07-28 15:00:28 +02:00
Daniel Marjamäki
239a0819e3
astyle formatting
2013-07-28 13:17:46 +02:00
Daniel Marjamäki
7fd12ee2b5
Merge pull request #153 from simartin/ticket_4930
...
Fixed #4930 ((error) Internal Error: Division by zero)
2013-07-28 04:17:03 -07:00
Daniel Marjamäki
2a1af1acda
CheckUninitVar: Assertion for '} while (' after 'do {..' in debug builds. Bail out in release builds to avoid segfaults.
2013-07-28 12:41:38 +02:00
Simon Martin
eb3bf571be
Avoid divisions by zero when simplifying numeric calculations.
2013-07-28 12:32:18 +02:00
Lucas Manuel Rodriguez
09f4d3732a
Fixed #4911 (segfault, assignment in do ... while, 1.61dev)
2013-07-28 11:58:14 +02:00
Daniel Marjamäki
36ef34a2cf
astyle formatting
2013-07-28 11:53:49 +02:00
Daniel Marjamäki
862eb351d5
Merge pull request #152 from simartin/ticket_4914
...
Fixed #4914 (memory freed twice, when in do {} while being shortcircuited via continue)
2013-07-28 01:43:45 -07:00
Alexander Mai
40fa474a5b
Fixed #4927 (Segfault in CheckOther::checkCommaSeparatedReturn() on invalid code)
2013-07-28 10:39:58 +02:00
Simon Martin
470a9a6c71
Take into account break and continue statements in CheckLeakAutoVar.
2013-07-28 10:26:46 +02:00
Daniel Marjamäki
44333f316a
Added terminate() handling to get quicker response when the user wants to terminate
2013-07-24 13:06:59 +02:00
Daniel Marjamäki
178467a578
astyle formatting
2013-07-24 11:20:28 +02:00
Carlo Marcelo Arenas Belon
aa0560fe3b
Fixed #4925 (False positive: checkother style)
...
When using a variable that is assigned a function pointer checks for
pointers are triggered which would complain if used in arithmetic
comparisions (eventhough it will be valid code if the function returns
an int)
2013-07-24 08:22:24 +02:00
Daniel Marjamäki
a1fafa7f06
Library: added <formatstr> and <strz> to argument checks
2013-07-22 20:21:45 +02:00
Robert Reif
20f81f92d9
CheckIO: Improved handling of h, hh, l, and ll.
2013-07-22 08:28:29 +02:00
Lucas Manuel Rodriguez
7e556c215e
Fixed #4861 (Improve check: object is destroyed immediately not detected when calling overloaded constructor)
2013-07-22 07:25:53 +02:00
Robert Reif
f11e54aa42
Fixed #4902 (printf and scanf format checks don't support microsoft %I, %I32 and %I64 extensions)
2013-07-21 08:35:01 +02:00
Daniel Marjamäki
37716fb8bb
Tokenizer: Set variable() pointer for array members
2013-07-20 17:46:39 +02:00
Lucas Manuel Rodriguez
59f448da8a
Fixed #4908 (False positive: void * calculation (struct member, cast))
2013-07-20 17:20:16 +02:00
Daniel Marjamäki
0c5e39a813
Library: Added configuration file std.cfg that clients should load.
2013-07-20 17:12:56 +02:00
Daniel Marjamäki
dfed6bbea0
Fixed #4445 (Token::Match called with varid 0)
2013-07-19 21:18:54 +02:00
Daniel Marjamäki
7eb1f36200
astyle formatting
2013-07-19 09:28:45 +02:00
Daniel Marjamäki
794aebe3cf
MathLib: Return inf.0 for NAN and INF calculations
2013-07-19 09:27:33 +02:00
Daniel Marjamäki
6fe1b92a47
Improved --check-library messages
2013-07-16 18:50:25 +02:00
Daniel Marjamäki
fa7f8ddc78
Library: Renamed Argument to ArgumentChecks to make it a bit more clear
2013-07-16 09:40:31 +02:00
Daniel Marjamäki
d25e7d4a21
Library: fixed problems
2013-07-16 08:21:38 +02:00
Daniel Marjamäki
24dfc052e2
astyle formatting
2013-07-15 21:57:58 +02:00
Daniel Marjamäki
7443883b9c
Library: Improved handling in CheckNullPointer::parseFunctionCall for Library data
2013-07-15 18:55:40 +02:00
Lucas Manuel Rodriguez
cfd697d6d4
Fixed #4042 (False Positive : Same expression on both sides of '&')
2013-07-11 07:13:47 +02:00
Daniel Marjamäki
8f332af849
Uninitialized variables: Avoid FP when using '?:'
2013-07-10 16:44:35 +02:00
Lucas Manuel Rodriguez
040c1e3a13
Fixed #4906 (False positive: void * calculation (cast))
2013-07-10 06:40:09 +02:00
Daniel Marjamäki
4106972fdc
Merge pull request #148 from JustRamires/master
...
Fixed segmentation fault in SymbolDatabase::SymbolDatabase(Ticket #4892 )
2013-07-09 02:55:46 -07:00
Roman Zaytsev Borisovich
295869a866
Fixed segmentation fault in SymbolDatabase::SymbolDatabase(Ticket #4892 )
2013-07-09 13:10:03 +04:00
Daniel Marjamäki
7d47fd65a2
Renamed --environment to --library. Added --check-library. Renamed Environment to Library
2013-07-08 18:26:18 +02:00
Lucas Manuel Rodriguez
d177c8fd03
Fixed #4824 (False positive: (warning) Member variable 'Foo::m_state' is not initialized in the constructor.)
2013-07-08 06:38:33 +02:00
Daniel Marjamäki
2875ee1ecf
astyle formatting
2013-07-07 10:26:20 +02:00
Simon Martin
d0d3ce50c9
Added testcase for (now working) ticket #4742 .
2013-07-06 18:02:04 +02:00
Daniel Marjamäki
2ef0a40aec
Fixed #4893 (FP Uninitialized variable on sizeof of itself)
2013-07-06 08:52:47 +02:00
Lucas Manuel Rodriguez
00886b4d06
Fixed #4876 (Checking for sizeof(void))
2013-07-05 21:07:07 +02:00
Daniel Marjamäki
61e1dd5096
Environment: Refactoring and cleanup
2013-07-05 20:55:31 +02:00
Daniel Marjamäki
d96fb577cd
CLI: Added --environment flag
2013-07-02 07:18:19 +02:00
Daniel Marjamäki
1a35241aa2
testrunner: removed redundant ';'
2013-06-30 19:44:12 +02:00
Daniel Marjamäki
582e0ee7e7
testrunner: Added REGISTER_TEST. Thanks lucasmrod.
2013-06-30 19:42:26 +02:00
Simon Martin
e2deb59f8a
Improved handling of syntax errors in Tokenizer::simplifyAddBracesPair.
2013-06-29 14:05:49 +02:00
Daniel Marjamäki
6b2bab535b
CLI,LIB: Added --std setting for GTK
2013-06-29 12:55:24 +02:00
Daniel Marjamäki
ba23b65179
Fixed #4885 (FP Uninitialized variable when using comma)
2013-06-29 09:33:51 +02:00
Daniel Marjamäki
6997d38881
Uninitialized variables: fixed false positive in while loop
2013-06-27 18:28:00 +02:00
Daniel Marjamäki
6b01d2d5a8
Fixed #4747 (Can not find uninitialized variable (variable used in rhs in assignment))
2013-06-27 16:53:15 +02:00
Daniel Marjamäki
da9e3b4f01
TestTokenizer: Added test cases for simplifyKnownVariables
2013-06-26 21:47:03 +02:00
Daniel Marjamäki
c389e08353
Fixed #4728 (simplify known variables better (%var% & %num%, bitwise and))
2013-06-26 18:13:28 +02:00
Daniel Marjamäki
2265c61734
Fixed #4879 (false positive: uninitialized variable in inner for inside while (regression))
2013-06-26 17:02:57 +02:00
Zachary Blair
a381170886
Fixed #4874 (Minor spelling corrections)
2013-06-26 00:47:02 -07:00
Daniel Marjamäki
7dd07472c1
Fixed #4530 (Tokenizer: improved simplification of strlen in calculation)
2013-06-25 20:10:40 +02:00
Daniel Marjamäki
cfd960d794
Fixed #3765 (false negative: unitialized variable)
2013-06-25 18:40:41 +02:00
Simon Martin
75c8dcc664
Fixed #4873 (Preprocessor: Cppcheck is unable to scan a file with a single quote in a comment inside assembler section)
2013-06-25 06:45:11 +02:00
Lucas Manuel Rodriguez
d6be4559cd
Fixed #4840 (false negative: buffer access out of bounds)
2013-06-25 06:37:51 +02:00
Alexander Mai
5a9975bbdd
Fixed #4869 (segmentation fault in Tokenizer::simplifyStructDecl (invalid code))
2013-06-22 14:05:49 +02:00
Daniel Marjamäki
bfc40ffe9f
Fixed #4868 (Segmentation fault in Preprocessor::handleIncludes())
2013-06-21 20:10:46 +02:00
Daniel Marjamäki
e4270bab78
Fixed #4863 (macros not propagated)
2013-06-19 21:29:39 +02:00
Andreas Bießmann
9b3a8774c5
Test case for unreachableCode ( #4756 )
2013-06-18 06:40:43 +02:00
Daniel Marjamäki
2fb8133e90
Fixed #4862 (False positive: Comma is used in return statement (template))
2013-06-18 00:13:45 +02:00
Alexander Mai
0be1892b92
Fixed #4806 (Crash in Type::initBaseInfo() in clang testcode)
2013-06-16 21:46:01 +02:00
Daniel Marjamäki
8ac2b4d516
Travis: Fixed failing test
2013-06-16 16:53:09 +02:00
Daniel Marjamäki
d3d7808a06
Fixed #4834 (FreeType: incorrect array boundary analysis)
2013-06-16 15:41:13 +02:00
Daniel Marjamäki
a9bd6cf3df
Fixed #4857 (False Positive: function argument hides enumerator of same type)
2013-06-16 08:13:41 +02:00
Abhishek Bharadwaj
d85c8e6782
Fixed #4104 (New check: comma separated statements in return statement from a function)
2013-06-15 17:49:10 +02:00
Daniel Marjamki
03f28e9c65
Fixed #4668 (Tokenizer: improve handling of 'if (x) MACRO() { ..')
2013-06-15 14:40:05 +02:00
Daniel Marjamäki
15c92384f4
Fixed #4851 (Preprocessor: problem when using #ifndef symbol in the code)
2013-06-15 12:08:18 +02:00
Daniel Marjamäki
722bfe7197
Fixed #4553 (Wrong calculation of known values)
2013-06-14 18:51:52 +02:00
Daniel Marjamäki
eac4ebf185
astyle formatting
2013-06-14 07:22:46 +02:00
Daniel Marjamäki
ae36472a1b
Fixed #4778 (FP: Uninitialized variable: av)
2013-06-14 07:21:53 +02:00
Robert Reif
870d29944b
Fixed #4852 (false positive: Member variable 'A::sz' is not initialized in the constructor)
2013-06-14 06:32:26 +02:00
Daniel Marjamäki
cd5e32446f
Fixed #4641 (False positive: Address of local auto-variable assigned to a function parameter)
2013-06-13 16:19:19 +02:00
PKEuS
876e9c0039
Fixed issue on C++11 right angle brackets ( #4832 )
2013-06-12 13:43:29 -07:00
Daniel Marjamäki
c4763b9010
Fixed #4463 (false positive: (style) Variable 'CHDERR_NOT_OPEN' hides enumerator with same name)
2013-06-12 06:45:26 +02:00
PKEuS
4efccc2c5d
Fixed #4420 : Prefix increment is only suspicious, if its return value is not used.
2013-06-10 13:02:02 -07:00
Zachary Blair
28c0045f36
Fixed #4173 : New check: arithmetical usage of inf/nan result
2013-06-09 23:13:08 -07:00
Daniel Marjamäki
4e816e2edf
astyle formatting
2013-06-09 16:04:59 +02:00
Daniel Marjamäki
616a693f1f
Merge pull request #139 from JustRamires/master
...
Ticket #4694
2013-06-08 07:46:08 -07:00
Daniel Marjamki
4e09b06bc1
Fixed #4827 (allow checking multiple configurations when using -D by also using --max-configs or --force)
2013-06-08 16:46:54 +02:00
Roman Zaytsev Borisovich
4610b135dc
Fixed #4694
2013-06-07 10:37:33 +04:00
Daniel Marjamäki
10849e220b
Fixed #4809 (Review CheckNullPointer::parseFunctionCall)
2013-06-07 06:37:53 +02:00
Daniel Marjamäki
9eac4489ac
Fixed #4838 (False positive for ... seems to be invalid)
2013-06-06 12:44:19 +02:00
Frank Zingsheim
f5a3492e3a
astyle formatting
2013-06-05 22:19:37 +02:00
Frank Zingsheim
aa25d1e0af
Fixed #4837 (False positive: Assert statement calls a function which may have desired side effects (local variable))
2013-06-05 22:10:43 +02:00
Daniel Marjamäki
dec520c507
Tokenizer::simplifyEnum: Fixed false positives
2013-06-04 21:18:20 +02:00
Daniel Marjamäki
8b5792a0f8
Tokenizer::simplifyEnum: Fixed internalErrors when building with compiled patterns.
2013-06-04 18:57:46 +02:00
Daniel Marjamäki
fa1fd31667
Tokenizer::simplifyEnum: Improved handling of shadow variables
2013-06-04 06:51:01 +02:00
Daniel Marjamäki
8954cc0984
Fixed #4280 (Tokenizer::simplifyEnum: don't simplify shadow variables)
2013-06-03 19:18:51 +02:00
Daniel Marjamäki
2d955bb9a6
Uninitvar: Added TODO test case for false negatives. Related with #4652
2013-06-02 18:26:03 +02:00
Daniel Marjamäki
a7da65a40b
Fixed #4618 (Unmatched suppression: don't show this information message unless --enable=information or --check-cfg is used)
2013-05-31 15:20:58 +02:00
Daniel Marjamäki
065853a59a
Fixed #4652 (False positive: variable value tracking into loop body)
2013-05-29 16:16:12 +02:00
Daniel Marjamäki
a861817a01
Fixed #4751 (CheckBufferOverrun: better handling when struct member instance doesn't have same varid as struct member declaration)
2013-05-28 16:52:23 +02:00
Daniel Marjamäki
ae7363fe54
Fixed #4599 (False positive with fopen/fclose test)
2013-05-23 06:34:22 +02:00
Daniel Marjamäki
1936eb8676
astyle formatting
2013-05-21 16:59:58 +02:00
Robert Reif
2c8360c607
Fixed #4789 (uninitMemberVar not found when constructor contains default parameters)
2013-05-18 18:33:24 +02:00
Frank Zingsheim
0943fecf03
Fixed #4799 (Segmentation fault in K&R simplification inside lambda expression)
2013-05-14 20:56:31 +02:00
PKEuS
b58e1241dc
Distinguish between different swprintf overloads. ( #4790 )
...
Fixed MSVC warning recently introduced
2013-05-14 02:06:16 -07:00
PKEuS
1903585ea3
Fixed bug in handling rvalue references: Scope has to be set everywhere. ( #4732 )
2013-05-14 01:43:32 -07:00
Frank Zingsheim
511f8a4c1f
More general fix to #4187 (False positive: Variable inside a lambda is reported as uninitialized)
2013-05-12 10:19:43 +02:00
Frank Zingsheim
d387e8b770
Fixed #4711 : (false positive: Consecutive return...)
2013-05-11 17:50:59 +02:00
Daniel Marjamäki
b6bcdf2936
Fixed #4520 (segmentation fault of cppcheck (preprocessing))
2013-05-09 18:50:24 +02:00
PKEuS
fb480ebb0a
Now really fixed #4604 .
2013-05-09 15:39:33 +02:00
PKEuS
881b47e79d
Revert "Improved handling of 0 initializations ( #4604 )"
...
This reverts commit 1201e417ec
.
2013-05-09 15:32:02 +02:00
PKEuS
0a104c40b7
Fixed "Improved handling of 0 initializations ( #4604 )"
...
This fixes commit 1201e417ec
.
2013-05-09 15:25:36 +02:00
PKEuS
982b9491d4
Improved handling of 0 initializations ( #4604 )
2013-05-09 06:23:25 -07:00
PKEuS
c42b89fb88
Revert "Improved handling of 0 initializations ( #4604 )"
...
This reverts commit 1201e417ec
.
2013-05-09 15:19:23 +02:00
PKEuS
1201e417ec
Improved handling of 0 initializations ( #4604 )
2013-05-09 06:17:10 -07:00
Daniel Marjamäki
cbe0a0825c
Fixed #4725 (Tokenizer: Replace block declaration (^{}) with asm())
2013-05-09 14:47:18 +02:00
XhmikosR
f32aa89da3
run tabspace
2013-05-08 18:36:47 +02:00
Lena Herscheid
e23038c4de
Fixed #4775 (Check for assert() with side effects)
2013-05-07 21:35:16 +02:00
Frank Zingsheim
bca751b9f4
Fixed #4773 (Regression: wrong detection of unitialized variable)
2013-05-06 18:45:00 +02:00
Daniel Marjamäki
4659745106
Fixed #4786 (segfault with one LibreOffice file)
2013-05-06 16:56:34 +02:00
Daniel Marjamäki
3f5a858800
dmake: update Makefile
2013-05-05 09:22:04 +02:00
Daniel Marjamäki
ea60c5b14b
CheckBufferOverrun: Code cleanup
2013-05-05 08:14:19 +02:00
Daniel Marjamäki
079d22fbee
Fixed #4734 (False 'Possible null pointer dereference')
2013-05-03 16:18:44 +02:00
Zachary Blair
de8ee5b042
Fixed #4554 (false negative: buffer access out of bounds)
2013-05-02 21:50:48 -07:00
Daniel Marjamäki
bfb1bc50e3
Fixed #4760 (false negative: (error) usage of uninitialized variable (struct member))
2013-05-02 20:34:15 +02:00
Alexander Mai
957e0790c6
Tokenizer::setVarId: assert that strange code with same type names and variable names work. Ticket: #3990
2013-05-01 18:50:35 +02:00
Daniel Marjamäki
44cb070e13
Fixed #4737 (False positive: Uninitialized variable 'do_something(&((char*)&var)[0],1);')
2013-05-01 13:52:28 +02:00
Frank Zingsheim
42068a3d60
Fixed #4767 (segmentation fault in expand template)
2013-05-01 13:28:01 +02:00
Daniel Marjamäki
287782a679
Fixed #4390 (False alarm 'Object pointed by an auto_ptr is destroyed using operator delete. You should not use auto_ptr for pointers obtained with operator new[].')
2013-05-01 11:11:57 +02:00
Daniel Marjamäki
b2798e929d
Improved fix for #4455 , no false negatives if variable is used before first memset
2013-04-30 16:56:44 +02:00
Daniel Marjamäki
cf75e2bb28
astyle formatting
2013-04-30 06:44:50 +02:00
Daniel Marjamäki
47ef8cf455
Fixed #4455 (redundantCopy when precleaning with memset)
2013-04-30 06:43:16 +02:00
Baris Demiray
548dd42aaf
Fixed #933 (Leaks with struct members not detected)
2013-04-26 16:11:57 +02:00
Zachary Blair
35668380cf
Fixed #4510 (False positive: "Possible null pointer dereference if the default parameter value is used" after init)
2013-04-25 00:25:56 -07:00
Daniel Marjamäki
c3d1274db3
Reverted 'simplify NOT' since there are problems related to signedness of numeric values.
2013-04-24 06:32:34 +02:00
Daniel Marjamäki
e1dd14626c
Fixed #4735 (FP: Mismatching assignment and comparison)
2013-04-23 06:47:15 +02:00
Daniel Marjamäki
a5b044a6e2
Fixed #4754 (False positive: Map literals trigger redundant code warning)
2013-04-20 07:51:44 +02:00
Daniel Marjamäki
9f8ce6f77f
Fixed #4729 (Tokenizer::setVarId: Varid not tracked properly after function declaration with 'shadow' parameter name)
2013-04-19 18:36:16 +02:00
Daniel Marjamäki
8d9ad2ae0d
TestTokenizer: Renamed test functions so they match the function names used in the Tokenizer (simplifyRoundCurlyParentheses)
2013-04-19 06:42:09 +02:00
Daniel Marjamäki
e3be600479
TestTokenizer: Renamed test functions so they match the function names used in the Tokenizer
2013-04-18 16:13:58 +02:00
Daniel Marjamäki
80cb2a9b20
Updated TestUninitVar test cases. They should not have unsimplified code.
2013-04-17 21:06:19 +02:00
Daniel Marjamäki
4e65800adf
TestRunner: Updated warning message when there is unsimplified code
2013-04-16 16:54:19 +02:00
Daniel Marjamäki
fdac502c39
Simplified TestNullPointer test cases
2013-04-15 19:00:15 +02:00
Daniel Marjamki
9007345221
Simplified TestOther test cases
2013-04-13 20:17:53 +02:00
Daniel Marjamäki
37a87d2f9d
Simplified TestClass test cases
2013-04-13 19:11:07 +02:00
Daniel Marjamäki
dd6a806ada
TestBoost: Warn if test case is not simplified properly
2013-04-13 18:42:56 +02:00
Daniel Marjamäki
8c6637c79c
TestBool: Warn if test case is not simplified properly
2013-04-13 18:41:06 +02:00
Daniel Marjamäki
25582dbde7
Simplify TestAutoVariables test cases
2013-04-13 18:38:15 +02:00
Daniel Marjamäki
b42ec0fe8b
Simplify TestAssignIf test cases (else if)
2013-04-13 18:23:53 +02:00
Daniel Marjamäki
393c75af70
Simplified remaining TestBufferOverrun test cases
2013-04-13 15:49:15 +02:00
Daniel Marjamäki
cbe2cdafcf
Simplify TestBufferOverrun test cases (casts, pointer addition, calculation)
2013-04-13 13:58:21 +02:00
Daniel Marjamäki
fe911f92e1
Simplify TestBufferOverrun test cases (known variable value)
2013-04-13 13:13:13 +02:00
PKEuS
6f9886a1b9
Removed more duplicate unit tests
2013-04-13 02:07:18 -07:00
Daniel Marjamäki
78d3aef40e
Simplified TestBufferOverrun test cases (sizeof, known variable value)
2013-04-13 11:01:19 +02:00
PKEuS
693c6e84cb
Removed more duplicate unit tests
2013-04-13 01:49:17 -07:00
PKEuS
8e4f99884b
Removed more duplicate unit tests
2013-04-13 00:49:00 -07:00
Daniel Marjamäki
3b880f9e2e
Simplified TestBufferOverrun test cases (sizeof, known variables, casts, etc)
2013-04-13 08:19:14 +02:00
Daniel Marjamäki
7871f16e9d
Simplified TestBufferOverrun::readlink test cases (sizeof)
2013-04-13 07:31:15 +02:00
Daniel Marjamäki
6afdd1b7c0
Simplified TestBufferOverrun::readlinkat test cases (sizeof, known variables)
2013-04-13 07:22:01 +02:00
PKEuS
cdce755471
Removed duplicate unit tests in testbufferoverrun.cpp
2013-04-12 12:17:08 -07:00
Daniel Marjamäki
9ad39ca4c0
Fixed #4544 (Crash with this line : class CD : public CC< class CB< CA > >)
2013-04-12 16:38:12 +02:00
Daniel Marjamäki
e8fbd39efd
Templates: better handling of 'X<class Y>' template instantiations. Ticket: #4544
2013-04-11 18:58:39 +02:00
Ettl Martin
e03a3946d0
avoid crash in checkother:wrongPipeParameterSize when a pointer with unknown size is provided.
2013-04-11 14:22:22 +02:00
Ettl Martin
33cfc1a52e
fixed #4726 : simplify bitwise Not (~ %num%)
2013-04-11 09:16:40 +02:00
Daniel Marjamäki
a49fc57e00
Tokenizer: don't simplify 'a!=(b!=0)' to 'a!=b'. Ticket: #4697
2013-04-11 07:19:32 +02:00
Frank Zingsheim
54e7c8f6a2
Implemented support for move constructors:
...
Adapt code to Function::eMoveConstructor
introduced in commit eb2962792f
2013-04-10 21:57:22 +02:00
Daniel Marjamäki
7fdaba43ed
Uninitialized variables: Fixed fp when initializing struct with function in loop body
2013-04-10 20:46:44 +02:00
Daniel Marjamäki
96a5429cee
Uninitialized variables: Assume that function initializes struct if it is unknown if it does
2013-04-10 20:04:32 +02:00
PKEuS
994c429b7d
Moved checks related to sizeof usage from checkother into new file
2013-04-10 09:49:38 -07:00
PKEuS
42fcb04d0c
Moved checks related to boolean type (not condition checking!) from checkother into new file
2013-04-10 09:25:50 -07:00
PKEuS
4e6d105cbd
Added support for complex patterns to CheckOther::checkIncorrectStringCompare()
2013-04-09 09:16:35 -07:00
XhmikosR
8ac9b8e7a9
remove duplicate ";" and fours dots
2013-04-09 17:49:09 +02:00
XhmikosR
700512a53f
use spaces in strings
2013-04-09 17:49:09 +02:00
PKEuS
c487ea843d
Better fix for #4706 : Use Token::nextArgument() properly. Removed redundant ' in message
2013-04-09 08:30:53 -07:00
Daniel Marjamäki
4c8b17c040
Fixed #4717 (False positive: Uninitialized variable inside ({..}))
2013-04-09 17:02:11 +02:00
Daniel Marjamäki
894a2435ae
Fixed #4718 (False positive: unititialized variable (value flow))
2013-04-08 19:34:39 +02:00
Alexander Mai
14fc140592
Fixed memory leaks in teststl
2013-04-07 18:43:18 +02:00
Daniel Marjamki
cd770fb106
Fixed #4310 (False positive 'boolean result in bitwise' message in template class (was #3818 ))
2013-04-07 16:48:42 +02:00
Daniel Marjamäki
f43d732f33
Fixed #4691 (False positive: Mismatching bitmasks in switch())
2013-04-07 04:25:10 +02:00
Daniel Marjamäki
38680e3440
Fixed #4677 (Message for 'possible null pointer dereference, otherwise it is redundant to check..' is warning but says error)
2013-04-07 03:41:02 +02:00
zblair
ecfe4eb5be
Fixed #3372 (New check: dereference iterator and then checking it)
2013-04-04 21:14:59 -07:00
PKEuS
eb2962792f
Implemented support for move constructors:
...
- Changed behaviour of Token::function - is now also set for declarations
- Resolved TODO in testclass.cpp
- removed redundant code in Scope::findFunction - it is safe to call nextArgument() on functions without arguments
- Use Token::function in checkother.cpp
2013-04-04 10:53:55 -07:00
PKEuS
188096665c
Implemented support for rvalue references (C++11):
...
- Split up && when it is part of an rvalue reference declaration
- Added support into symbol database
- Current implementation sets Variable::isReference() to true also for rvalue references - they can probably be treated like normal references in many checks.
Changed behaviour of symbol database: Insert argument Variable of functions that are not implemented into SymbolDatabase::_variableList
2013-04-04 09:47:44 -07:00
Ettl Martin
ba8cca8fa9
#4706 fix crash when a struct member is used as first argument. Replaced Token::nexArgument with %any% in Token::Match call. Added unittests in testing Token::nexArgument.
2013-04-04 15:12:18 +02:00
PKEuS
51685f24c5
Improved expression parsing in CheckNullPointer::isPointerDeRef() - fixed #4692
2013-04-03 01:27:08 -07:00
Ettl Martin
3e8eddc69e
cleanup testcases: moved testcases from #3888 into allocfunc13 which contains similar testcases already.
2013-04-03 10:12:36 +02:00
Ettl Martin
08ac48199e
#3103 added testcases.
2013-04-03 09:33:33 +02:00
Ettl Martin
9f25b618dc
#3888 added a testcase
2013-04-03 08:57:26 +02:00
PKEuS
7596282cba
Improved test coverage: Ensure that passing multiple <id> to --enable works. Check settings.isEnabled("warning").
2013-04-01 04:15:05 -07:00
PKEuS
fbe997ca80
Use global Settings instance in TestCmdlineParser, since most tests just need it to pass something to CmdlineParser class.
...
This change implies that we do not rely on any default state of the Settings class - as it should be, since CmdlineParser is tested, not Settings.
2013-04-01 04:12:56 -07:00
Frank Zingsheim
395a474ec2
Fixed #4695 : Infinite recursion inside isRecordTypeWithoutSideEffects()
2013-04-01 12:41:14 +02:00
PKEuS
12f5ccfb4e
Refactorized postfix operator check:
...
- Support class members
- Support references (removed wrong bailout)
- Removed wrong unit tests and wrong messages for std::cout << k-- << std::endl;
2013-03-31 04:17:23 -07:00
XhmikosR
a9955cce8e
run astyle
2013-03-30 19:06:13 +01:00
Frank Zingsheim
5d55d40361
Fixed #4656 (New check: Detect pure virtual function calls)
2013-03-30 15:09:22 +01:00
Robert Reif
a3f9b5c07d
Fixed #4686 (Prefer prefix ++/-- operators for non-primitive types with template iterator)
2013-03-30 13:49:56 +01:00
Alexander Mai
b9c27699b3
Fixed #4684 (cppcheck crash in template function call.)
2013-03-29 19:29:23 +01:00
Daniel Marjamäki
3301728c50
astyle formatting
2013-03-29 17:55:09 +01:00
Alexander Mai
7902cd0123
Fixed #4447 (false positive: (style) Variable 'X' is assigned a value that is never used (goto))
2013-03-28 06:44:37 +01:00
Robert Reif
3f57b5a6ca
Fixed #4682 (using 'struct' disables checking)
2013-03-28 06:36:49 +01:00
Daniel Marjamäki
2d70af2c82
Reverted fix. It might be possible to make a better fix
2013-03-25 19:55:35 +01:00
Daniel Marjamäki
2b02013fa7
Fixed #4668 (False positive: uninitialized Variable after unknown macro)
2013-03-25 19:52:33 +01:00
PKEuS
37ac86dec9
Fixed #4666 : Implemented proper variable scope checking for switch statements
2013-03-23 03:28:33 -07:00
Daniel Marjamäki
c9469993e2
Uninitialized variables: Fixed false positives when using sizeof inside loop
2013-03-22 08:10:46 +01:00
Daniel Marjamäki
a79354d51c
Uninitialized variables: Fixed false positive when taking address of uninitialized array that is a struct member
2013-03-20 16:59:45 +01:00
Ettl Martin
1b9c1c03fa
unittests: removed not needed '\n' at the end of testcases.
2013-03-20 15:36:16 +01:00
Daniel Marjamäki
dd155b57e4
Fixed #4487 (False positive: variable is not assigned a value (pointer alias))
2013-03-20 06:38:53 +01:00
Ettl Martin
54d398c7dd
unittests: removed not needed '\n' at the end of testcases.
2013-03-19 09:18:58 +01:00
Ettl Martin
7c0905cd4e
#4665 added todo unittest
2013-03-19 08:47:05 +01:00
Ettl Martin
ff826d7c62
#4664 : new check: (POSIX) write outside buffer size.
2013-03-19 08:22:48 +01:00
Daniel Marjamäki
1b18bfc93c
Fixed #3585 (errors not recognized when class has extra specification)
2013-03-18 19:09:04 +01:00
PKEuS
d9f7042992
Fixed false negative #4663
2013-03-18 08:17:53 -07:00
Daniel Marjamäki
a4a2f78a7a
Fixed #4659 (portability: address value / integer false positive)
2013-03-17 17:25:57 +01:00
PKEuS
1e66e0b931
Fixed false negative #4657
2013-03-15 05:00:51 -07:00
kchrist
740e790bf1
Fixed #4649 (false positive: Used file that is not opened; variables in struct)
2013-03-15 06:42:46 +01:00
Daniel Marjamäki
c0a34649c4
fixed 'duplicate expression' false positives for float-float. Ticket: #4639
2013-03-14 19:11:29 +01:00
Daniel Marjamäki
369e80b021
Fixed #4465 (syntax error on valid C++ source file)
2013-03-14 18:52:22 +01:00
PKEuS
096fa2f771
Fixed #4380
2013-03-14 10:18:48 -07:00
PKEuS
ed477ceb74
Fixed false negative mentioned in #4354 .
2013-03-14 09:27:42 -07:00
PKEuS
641ac5c02a
Fixed #4352 : Ensure that class provides an iterator interface.
2013-03-14 09:00:22 -07:00
Thomas Jarosch
61d9424631
astyle formatting
2013-03-14 11:10:12 +01:00
Ettl Martin
cd1392749c
Removed not needed '\n' at the end of testcases in testbufferoverrun.cpp. No functional changes.
2013-03-14 09:45:47 +01:00
Ettl Martin
c8798b2207
#3838 added more testcases.
2013-03-14 09:36:38 +01:00
Ettl Martin
19c430530f
#3838 added another testcase to avoid a FP.
2013-03-14 09:21:31 +01:00
Robert Reif
4b9b87e310
Fixed #4646 (false positive: (style, inconclusive) Technically the member function 'C<T>::operator+=' can be const.)
2013-03-14 06:34:12 +01:00
Alexander Mai
f43ea5c491
Fixed #4594 (Analyzing errors about system headers not being found)
2013-03-13 19:50:50 +01:00
Daniel Marjamäki
1f04e2c228
Fixed #4439 (False positive: Uninitialized variable (casting address))
2013-03-13 17:32:47 +01:00
Ettl Martin
34b3fe6af0
#1659 added TODO-testcases.
2013-03-13 10:55:20 +01:00
Alexander Mai
59d636742e
Fixed #4594 (Analyzing errors about system headers not being found)
2013-03-13 06:48:33 +01:00
Frank Zingsheim
e91e7148de
Test case for #4644 (Tokenizer: Wrong varId after typename):
...
Added equivalent test with "class"
2013-03-12 19:50:24 +01:00
PKEuS
796c3e101f
Implemented better fix for #4644
2013-03-12 08:05:03 -07:00
PKEuS
2333aa2cc7
Don't use native separators for suppression matching
2013-03-12 07:53:18 -07:00
PKEuS
14feaa8d39
Refactorizations:
...
- Fixed lots of cppcheck messages about functions that can be const or static
- Fixed possible nullpointer dereference message in symboldatabase.cpp
- Replaced tokAt(+-1) by next()/previous()
2013-03-12 07:42:00 -07:00
Alexander Mai
9d88cc63e8
Fixed #4642 (False positive: Returning an address value in a function with integer return type is not portable. (not returning address))
2013-03-12 06:49:13 +01:00
Ettl Martin
3d1cdd0eec
#4645 implemented correct range according manpage of usleep().
2013-03-11 17:38:03 +01:00
Ettl Martin
dde51f73ff
removed wrong line of testcode (introduced by my last commit).
2013-03-11 17:20:41 +01:00
Ettl Martin
bb115573f7
#4645 implemented new check: (POSIX) argument of function usleep() too big.
2013-03-11 17:04:30 +01:00
PKEuS
b3a9ac5c3b
Fixed #4644 : Don't assign varid to template parameter when 'typename' is used
2013-03-10 06:11:25 -07:00
Daniel Marjamäki
1f40af2ae2
Fixed #4637 (false positive: (error) Uninitialized member variable (missing function inlining))
2013-03-09 17:55:49 +01:00
Robert Reif
25c36b56fa
CheckClass: made warnings about uninitialized members in default constructors inconclusive. Ticket: #4639
2013-03-09 09:20:48 +01:00
PKEuS
99a73fe1d3
Don't assign a varid to a variadic function
2013-03-05 08:32:52 -08:00
PKEuS
2a312efd6e
Adapted testsymboldatabase.cpp to recent changes
2013-03-05 06:46:34 -08:00
PKEuS
66a3555897
Implement initial support for Types in Symboldatabase:
...
- For each class/struct/union, a Type instance is added to SymbolDatabase::typeList.
- A scope is no longer created for declared but not defined types
Fixed name detection for classes when they are declared like this: "class ::Foo::Sub {..."
2013-03-05 04:33:38 -08:00
PKEuS
6eed6b3cf3
Partially reverted 657e5d7ea2
because of trigraph issue.
2013-03-05 01:21:59 -08:00
PKEuS
657e5d7ea2
Fixed some small formatting issues in test suite
2013-03-04 11:14:56 -08:00
PKEuS
0f03995995
Added support for different containers, while-loops and if to CheckStl::stlOutOfBounds()
2013-03-04 10:59:46 -08:00
Daniel Marjamäki
78a3a58a5a
Fixed #4628 (False positive: Variable is assigned a value that is never used)
2013-03-04 19:13:49 +01:00
Ettl Martin
687c3a4654
Merge branch 'master' of github.com:danmar/cppcheck
2013-03-04 14:25:51 +01:00
Ettl Martin
c9b519bcd1
improved check: checkCastIntToCharAndBack. The check now handles (cin.get() != EOF) patterns.
2013-03-04 14:25:35 +01:00
PKEuS
34b1d75a10
Fixed handling of std::vector::insert() in CheckStl::pushback()
2013-03-04 02:57:09 -08:00
PKEuS
c24527dbde
Improved handling of dereferences in CheckClass::noMemset(), fixing false negatives and false positives related to multidimensional arrays and arrays of pointers.
2013-03-04 02:47:29 -08:00
PKEuS
8a18f9ec3b
Rewrote CheckOther::checkVariableScope()
2013-03-03 10:35:33 -08:00
PKEuS
5c1a05dcbe
Refactorizations in CheckOther:
...
- Make CheckOther::checkCastIntToCharAndBack() work for multiple variables at once
- Improved messages of CheckOther::checkSuspiciousSemicolon() and CheckOther::checkPipeParameterSize()
2013-03-03 09:54:44 -08:00
PKEuS
d78c06dc3f
Replaced _settings->isEnabled("style") by _settings->isEnabled("warning") wherever warnings are issued
2013-03-03 02:41:59 -08:00
Daniel Marjamäki
d7a52eaecd
Fixed #4608 (false positive: (style) struct or union member is never used.)
2013-03-01 16:13:04 +01:00
PKEuS
096aae4439
New check: Warn about using malloc() for classes containing virtual methods, std::-objects or constructors
2013-03-01 06:07:20 -08:00
PKEuS
75799446aa
Added unit test for #4619
2013-03-01 04:06:51 -08:00
PKEuS
f899e6ca30
Changed behaviour of %op% pattern accordingly to changes to Token::isOp(). Added %cop% as replacement for old %op%
2013-03-01 02:43:59 -08:00
PKEuS
670c4de8a9
Changed behaviour of Token::is*Op() functions:
...
- Rename Token::isOp() to Token::isConstOp() (indicating that the operator does _not_ modify the input variables)
- Create new Token::isOp(), returning true also for ++, -- and assignment operators
- Make Token::isExtendedOp() returning also true for all assignment and ++/-- operators
2013-02-28 12:50:29 -08:00
Daniel Marjamäki
ecafe7a129
Fixed #4624 (Wrong error for instances of std::unique_lock (variable is never used))
2013-02-28 17:02:58 +01:00
zblair
ed03e2c845
Fixed #4539 (False positive: Possible null pointer dereference)
2013-02-27 23:45:21 -08:00
Daniel Marjamäki
94da3bd57f
Fixed #4617 (False positive (style): noexcept for constructors)
2013-02-28 06:38:57 +01:00
Ettl Martin
8d682233d0
Implemented new check (Ticket #160 ): Storing getc() retun value in char variable and comparing to EOF.
2013-02-27 21:02:12 +01:00
Robert Reif
509061afff
Fixed #4620 (False positive: Uninitialized variable in constructor (1.58))
2013-02-27 06:59:04 +01:00
Daniel Marjamäki
df55ce14a0
Fixed #4503 (False positive: Incomplete statement (std::vector<int> v{1};))
2013-02-24 10:00:03 +01:00
Daniel Marjamäki
2edf95a1b9
Fixed #4367 (false positive: Class '...' is unsafe, '...' can leak by wrong usage)
2013-02-24 08:14:25 +01:00
Daniel Marjamki
5c7e1cf9ff
Fixed #4387 (false positive 'constStatement' in 1.57)
2013-02-23 16:26:25 +01:00
Daniel Marjamki
ee435bf885
Fixed #4600 (False positive Uninitialized struct member when using it as 'out parameter')
2013-02-23 15:57:58 +01:00
Daniel Marjamäki
bce99a9e2f
Fixed #4394 (FP: Variable 'a' is not assigned a value)
2013-02-20 17:43:16 +01:00
Daniel Marjamäki
71b66209b7
Fixed #4300 (segmentation fault of cppcheck (invalid code))
2013-02-20 06:58:27 +01:00
Alexander Mai
34c3697750
Added unit test for #4525
2013-02-19 21:56:13 +01:00
PKEuS
33cf561d85
Refactorized check for assigning function parameters:
...
- Fixed false negative: Check is also valid for all non-references, not only for pointers.
- Fixed false negative: Usage before assignment doesn't require bailout
- Fixed false positive #4598 caused by inadequate usage of CheckUninitVar::isVariableUsage
- Made several member functions static
2013-02-18 08:52:49 -08:00
Daniel Marjamäki
1c584208b4
Fixed #4329 (False duplicateBranch when branches use conditionally defined macros)
2013-02-18 17:18:33 +01:00
Robert Reif
e6915e7a78
Fixed #4536 (non-static member initializer causes false positive)
2013-02-18 06:33:53 +01:00
Ettl Martin
73e2a8fdb5
Merge branch 'master' of github.com:danmar/cppcheck
2013-02-17 17:34:44 +01:00
Ettl Martin
f451dd1137
#3521 implemented new check: wrong buffersize to pipe() function provided.
2013-02-17 17:33:32 +01:00
PKEuS
711d0d7a33
Warn about memset(this, 0, sizeof(*this)); ( #1285 )
2013-02-16 11:02:43 -08:00
PKEuS
167e11b645
Switch to TinyXml2
2013-02-16 10:01:34 -08:00
Daniel Marjamki
2a660fa3b4
Tokenizer: Fixed removeCast bug. Don't simplify (A)&b to A&b if A might be a type. Related with ticket: #4439
2013-02-16 16:58:36 +01:00
Daniel Marjamki
635b7d5a0e
Fixed #4423 (Variable is assigned a value that is never used.)
2013-02-16 16:07:05 +01:00
PKEuS
0d316af4f2
Fixed false positive stlSize for code like "foo + 1 > bar.size()" ( #4584 )
2013-02-16 02:50:25 -08:00
PKEuS
d3087602a1
Fixed false positive "function can be const" if a non-const expression is inside []-brackets ( #4406 )
2013-02-16 02:20:18 -08:00
PKEuS
afe45ff39f
Refactorized CheckClass::privateFunctions:
...
- Resolved todo about nested classes, fixed false negative, fixed wrong unit test
- Removed slow and unnecessary Token::findmatch
- Removed false positive when function implementation in friend class is not seen (#4384 )
2013-02-16 01:51:08 -08:00
PKEuS
27f7917349
Changed severity and message formatting of argumentSize message.
2013-02-16 00:52:27 -08:00
PKEuS
44887df04f
Fixed false positive redundantAssignment when calling function in assignment ( #4513 )
2013-02-15 09:40:34 -08:00
Daniel Marjamäki
382d7a10e8
Uninitialized variables: improved checking of c++ code
2013-02-15 18:13:47 +01:00
PKEuS
ccd95d1749
Make redundantAssignment message inconclusive when printed on global variables to avoid false warning on semaphores/mutexes ( #4467 )
2013-02-15 09:01:10 -08:00
PKEuS
e2655da1ec
Properly handle return/break/continue in CheckIO::checkFileUsage() ( #4466 )
2013-02-15 08:30:43 -08:00
PKEuS
017b4a8a7f
Treat references like global variables in CheckOther::checkRedundantAssignment() as they might refer to such. ( #4425 )
2013-02-15 08:09:31 -08:00
Robert Reif
c5ee083c82
Fixed #4388 (false positive 'noConstructor' in 1.57)
2013-02-15 06:44:07 +01:00
Daniel Marjamki
452dc23742
Fixed #4480 (False positive : Inefficient usage of string::find)
2013-02-14 19:14:20 +01:00
Daniel Marjamäki
08ada4cc63
Fixed #2652 (container .size() check too strict)
2013-02-14 16:59:58 +01:00
Robert Reif
a1da067b88
Fixed #4585 (false positive, Variable 'b' is assigned a value that is never used when using+loop)
2013-02-14 06:31:41 +01:00
Robert Reif
5de26bfeb9
Fixed #4574 (noConstructor false positives introduced in cppcheck 1.58)
2013-02-13 06:00:04 +01:00
Frank Zingsheim
213d31b360
Fixed #4547 (Improve check: Duplicate conditions in 'if' and related 'else { if'.)
...
Local fix in CheckOther::checkDuplicateIf()
2013-02-12 21:43:12 +01:00
Frank Zingsheim
75f69c11b7
Test for #4573 (False positive: variableScope within if/else if)
2013-02-12 21:16:57 +01:00
Daniel Marjamäki
1e550f9fdf
Reverted fix for #4547 : It causes fp. See #4573
2013-02-12 16:13:08 +01:00
Daniel Marjamäki
28e38a9e56
Fixed #4519 (false positive: (error) Uninitialized variable: eax (inline assembly usage))
2013-02-12 15:59:23 +01:00
Ettl Martin
c192e4d669
spellfixes
2013-02-12 15:21:27 +01:00
Ettl Martin
dade326a99
#4566 implemented new check: redundantGetAndSetUserId on posix systems
2013-02-11 20:26:27 +01:00
Daniel Marjamäki
75cf951c56
add return value to test case
2013-02-11 18:39:03 +01:00
Daniel Marjamäki
442db6cdf9
Fixed #4569 (False Positive: Uninitialised variable)
2013-02-11 18:31:14 +01:00
Daniel Marjamäki
94f1d34dcb
Fixed #4560 (false positive: (error) Uninitialized variable: s)
2013-02-11 17:05:59 +01:00
Daniel Marjamäki
48e194dc56
Fixed #4572 (Analysis failed: sizeof final)
2013-02-10 23:54:15 +01:00
Mathias De Maré
dfd557888d
Fixed #4565 (false positive: dangerous usage (not null-terminated))
2013-02-10 13:36:40 +01:00
Andrew C. Martin
bd0d9b9639
fix misspellings & gcc v3.4.6 warnings
...
1. fix typos / misspellings
- Fix misspelling within comments, variable/function names, stdout messages
- changes the name of an error code: ```stlBoundries``` changed to ```stlBoundaries```. Alias old name (```stlBoundries```) to the new one.
2. fix gcc v3.4.6 32bit & 64bit warnings
- fixes gcc v3.4.6 warnings, except for those in tinyxml and "-Wmissing-declarations" makefile warnings
- in Preprocessor::handleIncludes(), replace a ```vector <bool>``` with ```stack<bool>``` (see ```vector<bool>``` warning below).
- this is the only ```vector<bool>``` in the codebase
- ```vector <bool>``` is actually a case of template specialization, and is not recommended, according to the following links:
http://stackoverflow.com/q/6461487
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2160.html
http://stackoverflow.com/q/670308
- in the codebase before and after this change, testrunner SEGVs in a number of places on gcc v3.4.6, including ```Check::~Check()```, among others
- fc42fc95
fixes this particular runtime issue for DJGPP & __sun
2013-02-09 23:43:09 -07:00
Robert Reif
fe5de60f32
Fixed #4567 (false negative: The class 'B' does not have a constructor.)
2013-02-08 06:55:45 +01:00
Daniel Marjamäki
463121be71
Fixed #4561 (cppcheck 1.58 crashes on empty signals block in headerfile)
2013-02-07 17:03:08 +01:00
Frank Zingsheim
5144307642
Raise syntax error for if-condition without parentheses according to #2518 #4171
2013-02-05 21:13:57 +01:00
Daniel Marjamäki
4ac5648656
Uninitialized struct: Fixed false positive in for loop
2013-02-05 17:01:46 +01:00
Frank Zingsheim
b531195e08
Fixed #4547 (Improve check: Duplicate conditions in 'if' and related 'else { if'.)
...
Change tokenizer: "else if" -->> "else { if"
2013-02-04 21:12:12 +01:00
Daniel Marjamäki
a39a2479da
Travis: Fixed false positive in lib/checkbufferoverrun. Ticket: #4486
2013-02-04 19:02:42 +01:00
Daniel Marjamäki
1de54ba88e
Fixed #4486 (False positive: Return of address from function with integer return type (p+1-q))
2013-02-04 18:14:52 +01:00
Frank Zingsheim
89560564ed
Refactoring: Add braces to an if-block, for-block, etc. in tokenizer.
...
Fixed #4521 (Tokenizer: Wrong braces for triple if else)
2013-02-02 16:01:34 +01:00
Daniel Marjamki
abd536b84c
Null pointer: Changed 'possible null pointer dereference - otherwise condition is redundant' to warning
2013-02-02 15:46:29 +01:00
Daniel Marjamki
75e20a996d
assign function pointer: Fixed false positive when pointer is used also. Ticket: #2930
2013-02-02 15:26:14 +01:00
Daniel Marjamki
6bb8dd605a
assign function parameters: only show warning when --enable=warning or --enable=style is used. Ticket: #2930
2013-02-02 15:08:43 +01:00
Daniel Marjamäki
cbbb582fc9
Fixed #2930 (new check: redundant assignment of pointer function parameter)
2013-02-01 19:16:17 +01:00
Robert Reif
1a58ae4994
Symbol database: handle when forward declaration doesn't match declaration. Ticket: #4531
2013-02-01 06:31:02 +01:00
Daniel Marjamäki
e2faed355b
Fixed #4485 (False positive: Same expression of '-' when checking if float is inf)
2013-01-31 17:29:31 +01:00
Daniel Marjamäki
bd7e3cbac5
Fixed #4540 (memory leak not detected ('.' or '->' is used before Function))
2013-01-31 17:00:50 +01:00
Daniel Marjamäki
fc42aa3a30
Fixed #4523 (false positive: (error) Possible null pointer dereference)
2013-01-30 16:52:12 +01:00
Daniel Marjamäki
bc6d31c7c7
unsigned division: don't warn about 'unsigned char' because it is promoted to int.
2013-01-30 16:50:12 +01:00
Daniel Marjamäki
509dd9a989
Fixed #4523 (false positive: (error) Possible null pointer dereference)
2013-01-29 17:12:14 +01:00
Daniel Marjamäki
3679a809dd
Uninitialized variables: fixed false positive
2013-01-28 18:08:20 +01:00
Robert Reif
859793731d
SymbolDatabase: Refactor findFunction handling. Ticket: #4494
2013-01-28 06:47:48 +01:00
Daniel Marjamäki
4391f0880f
Tokenizer: Add special tokenize method for the Preprocessor with only basic simplifications
2013-01-27 17:58:54 +01:00
Daniel Marjamäki
42dd956dff
Preprocessor: Better fix for hangs. And added proper unit test.
2013-01-27 02:53:29 +01:00
Robert Reif
a0d8fd26fe
SymbolDatabase: improved handling of const in function parameters
2013-01-27 02:46:00 +01:00
Frank Zingsheim
6dc9987ad0
Fixed #4517 (Testmemleak should not use Tokenizer on pseudo code)
2013-01-27 02:41:43 +01:00
Daniel Marjamki
f69b1f426e
Preprocessor: Improved handling of expressions in simplifyVarMap. Ticket: #4516
2013-01-26 16:21:33 +01:00
Daniel Marjamki
641e7cba28
Fixed #4516 (Preprocessor: wrong #if evaluation)
2013-01-26 12:37:46 +01:00
Daniel Marjamki
8738223e82
Fixed #4512 (Improve check: Uninitialized variable not detected)
2013-01-26 08:16:53 +01:00
Daniel Marjamäki
ae43b12bf1
Fixed #4511 (False positive: uninitialized struct member)
2013-01-25 18:20:57 +01:00
Robert Reif
3b08b410a2
Symbol database: Improved function lookup (a.b.f()). Ticket: #4494
2013-01-25 06:49:04 +01:00
Daniel Marjamäki
c235737b6c
Uninitialized variables: improved checking of loops
2013-01-24 19:41:15 +01:00
Erik Lax
c2608108dd
Fixed #3928 (Tokenizer: Wrong simplification of inner if-else 'if (a) while (b) if (c) x; else y;')
2013-01-24 16:53:20 +01:00
Robert Reif
cecd726b11
Symbol database: Improved function lookup for foo.f(). Ticket #4494
2013-01-23 16:53:55 +01:00
Daniel Marjamäki
f86e83d813
Memory leaks: Improved handling of allocation functions that contains ::. Ticket: #4494
2013-01-22 21:33:39 +01:00
Erik Lax
444f80c4bb
Fixed #4505
2013-01-22 13:49:54 +01:00
Robert Reif
ddb604d1a5
Symbol database: function lookup when :: is used. Ticket #4494
2013-01-22 06:55:25 +01:00
Frank Zingsheim
096cb1bd88
Fixed #3686 : false positive: Possible null pointer dereference (inconclusive)
2013-01-21 19:38:59 +01:00
Daniel Marjamäki
bfafd51ca1
Fixed #4470 (New check: redundant bitand 'x&=1; x&=2;' can be simplified to 'x=0;')
2013-01-21 19:59:34 +01:00
Daniel Marjamki
c478a3214f
Uninitialized variables: Added TODO test case (while)
2013-01-20 18:40:24 +01:00
Daniel Marjamki
76534ccd1b
Uninitialized struct member: Fixed false negatives for return statements
2013-01-20 17:54:32 +01:00
Daniel Marjamki
d33341a21a
Fixed #4502 (Preprocessor: Treat SystemInclude and UserInclude the same)
2013-01-20 14:42:04 +01:00
Daniel Marjamki
e63f2c3b5b
Uninitialized struct member: Avoid false positive when struct member is passed by address
2013-01-20 13:12:40 +01:00
Daniel Marjamäki
67c9720299
Tokenizer: fixed simplification of static constants
2013-01-19 21:14:15 +01:00
Daniel Marjamki
bff6ed7af0
Fixed #3500 (false negative: (error) Returning pointer to local array variable)
2013-01-19 13:39:23 +01:00
Daniel Marjamki
f1c195e652
Fixed #3506 (false negative: not initialized variables ( struct timeval))
2013-01-19 12:48:56 +01:00
Daniel Marjamki
3cf0e88fbe
Uninitialized struct members: Improved checking when struct member is used in expression
2013-01-19 10:09:58 +01:00
Zachary Blair
8647e4c0d0
Fixed a false positive in #4109 (if (c == 1) c == 0; Isn't picked up)
2013-01-18 16:34:15 -08:00
Daniel Marjamäki
7c615f0f12
Fixed #4497 (False positive: uninitialized struct (writing/reading member))
2013-01-18 21:26:28 +01:00
Zachary Blair
a1cbed3df8
Fixed #4109 (if (c == 1) c == 0; Isn't picked up)
2013-01-17 23:03:04 -08:00
Daniel Marjamäki
77e9f65e6b
Uninitialized struct members: Fixed unit test
2013-01-17 23:55:13 +01:00
Daniel Marjamäki
2c6b383822
Uninitialized member variables: Improvements
2013-01-17 21:04:22 +01:00
Daniel Marjamäki
93fb6b0c6a
Fixed #4493 (FP: uninit struct member (struct is assigned))
2013-01-17 17:01:04 +01:00
Daniel Marjamäki
5773e69ab1
Uninitialized variables: Add experimental checking of struct members
2013-01-16 20:28:29 +01:00
Daniel Marjamäki
4cd8c7c608
Merge pull request #128 from acmyo/master
...
Fix compiler warnings and comment/string typos
2013-01-16 08:00:59 -08:00
Daniel Marjamäki
0fb2d309a6
Fixed #4490 (False positive: unused function (function pointer is taken in global scope))
2013-01-16 16:52:57 +01:00
Andrew C. Martin
4a73c93750
Fix compiler warnings and comment/string typos
...
- fix g++ warning:
> lib/checkother.cpp:3779: warning: comparison between signed and unsigned integer expressions
- fix suncc warning (see [everything2](http://everything2.com/title/C%252B%252B%253A+static+extern+%2522C%2522 )):
> "lib/checkmemoryleak.cpp", line 578: Warning (Anachronism): Formal argument __compar of type extern "C" int(*)(const void*,const void*) in call to bsearch(const void*, const void*, unsigned long, unsigned long, extern "C" int(*)(const void*,const void*)) is being passed int(*)(const void*,const void*).
- prefer empty() / isEmpty() over "size() > 0" (cases not caught by stlSize)
- fix word misspellings (mostly comments, a few output lines)
- Parenthesis => Parentheses (both variations were used in the codebase)
- fix typo and wording ("never alwayw") in gui/test/data/benchmark/simple.cpp's CheckOther::unsignedPositive():
```
- "An unsigned variable will never alwayw be positive so it is either pointless or "
+ "An unsigned variable can't be negative so it is either pointless or "
```
2013-01-16 07:37:07 -07:00
Daniel Marjamäki
27eedcd0a3
Merge pull request #127 from rofl0r/master
...
sanitize the descriptive text displayed for "varFuncNullUB"
2013-01-15 21:34:03 -08:00
rofl0r
623e30d677
fix unit test for varFuncNullUB
2013-01-15 20:45:53 +01:00
Daniel Marjamäki
2fa35a6f8d
Fixed #4429 (unused functions: handle function declarations better)
2013-01-15 17:00:28 +01:00
Daniel Marjamäki
d46789ee4a
varFuncNullUB: fixed false positive when non-variadic argument is NULL ( #4482 )
2013-01-14 06:44:52 +01:00
Erik Lax
723d95597b
Fixed #4481 (Simplify %str% [ %num% ])
2013-01-13 20:52:38 +01:00
Daniel Marjamäki
f0ce26a2aa
Preprocessor: Let the Tokenizer handle NULL
2013-01-13 15:01:31 +01:00
Daniel Marjamäki
2e56928834
Fixed #4482 (add test for UB due to usage of NULL in variadic functions)
2013-01-13 12:02:10 +01:00
Daniel Marjamäki
97b928b2bc
Fixed #4476 (Tokenizer: wrong simplification of static anonymous-type struct array declaration)
2013-01-10 18:24:01 +01:00
Zachary Blair
309edbbdc5
Fixed #4389 (False positive: Possible null pointer dereference if the default parameter value is used)
2013-01-09 23:22:54 -08:00
Edoardo Prezioso
6236e1dc38
Token::Match: removed harmless special code for initial '!!foo' patterns.
2013-01-09 20:13:33 +01:00
Thomas Jarosch
7dd07d8e77
Properly implement %op% for Token::multiCompare
...
Use tok->isOp() instead of doing it "manually".
This fixes false positives for the C++ template case since
the brackets in "template < something >" are not comparison operators.
Profiling showed using tok->isOp() is actually faster than before (-O2).
2013-01-09 17:05:53 +01:00
Thomas Jarosch
29c66dd9bc
Add another TODO test case for Token::Match
2013-01-08 00:19:12 +01:00
Thomas Jarosch
818362f496
Add TODO test case for a bug in Token::Match multicompare
...
The result of the %op% operator is wrong in the multicompare
case for C++ templates. Detected by comparing the output
of the compiled matches with the on-the-fly match parser.
2013-01-07 23:47:20 +01:00
Frank Zingsheim
498d03458f
Fixed #4385 : lock_guard RAII throws unreadVariable
2013-01-07 20:28:43 +01:00
Daniel Marjamäki
eebfea2b23
Fixed #4381 (Inline type declaration on statics causes warning)
2013-01-07 19:20:15 +01:00
Zachary Blair
f3c3b7c910
Fixed #4405 (False positive: Memory in freed twice (throw))
2013-01-05 19:02:19 -08:00
PKEuS
f5ebbff0a3
Fixed #4460 : Ensure that memset/memcpy is called on a pointer to a class instance.
2013-01-05 12:27:55 -08:00
Edoardo Prezioso
4c73c29cdd
Revert partially the previous commit:
...
The two formulas are true iff 2n = 2 <=> n = 1.
2013-01-05 17:31:08 +01:00
Edoardo Prezioso
1c0c0471df
Simplify some generalized math formulas:
...
Now the 'sin^2+cos^2=1' and the 'sinh^2-cosh^2=-1' code can handle, for example: sin^4+cos^4=1, sinh^10-cosh^10=-1.
Also, the arguments can be also multitokens, so that it's possible to simplify, for example: 'sin^2(k())+cos^2(k())=1'.
2013-01-04 13:06:09 +01:00
Edoardo Prezioso
5485e6866f
Fixed wrong tokenization of some math formulas:
...
The two formulas: sin^2+cos^2 = 1 and sinh^2-cosh^2 = -1 are true iff the two arguments are the same.
2013-01-04 11:28:01 +01:00
Robert Reif
d37906041b
Fixed #4458 (False positive: noCopyConstructor in template class)
2013-01-04 10:35:24 +01:00
Daniel Marjamäki
a3ee72a51d
Fixed #4409 (Cppcheck 1.58 dev hangs when checking mhz.c of lmbench3 (attached code))
2013-01-03 19:14:44 +01:00
Daniel Marjamäki
70059c06de
Fixed #4456 (std::string::compare(char const*) crash)
2013-01-03 08:44:32 +01:00
Daniel Marjamäki
6e58ed3040
Fixed #4454 (False positive: class member (POD) not initialized (when initialized to 0 in initializer list))
2013-01-02 13:59:57 +01:00
Reijo Tomperi
5d5f7085bf
Updating year 2012 -> 2013 to .cpp and .h files and man page.
2013-01-01 18:29:08 +02:00
Robert Reif
d2e8ab9c86
Fixed #4302 (Member variable not initialized in public delegate constructor)
2013-01-01 09:53:40 +01:00
Daniel Marjamäki
4378357d7e
Fixed #4372 (Tokenizer misidentifying which function a variable belongs to)
2012-12-29 21:07:41 +01:00
Daniel Marjamäki
4d085dd3fd
Fixed #4316 (False positive: (constStatement) Redundant code)
2012-12-29 17:13:06 +01:00
Daniel Marjamäki
e7aa1ec396
Fixed #4411 (Variable is assigned a value that is never used.)
2012-12-29 12:45:37 +01:00
Daniel Marjamäki
8491df31ca
Merge pull request #126 from SimonKagstrom/for-upstream
...
Misc fixes for the --include= option
2012-12-28 23:58:14 -08:00
Daniel Marjamäki
9af51a75e6
Tokenizer::setVarId: Proper handling of 'void f(struct foobar). Ticket: #4444 '
2012-12-29 08:54:39 +01:00
Daniel Marjamäki
38d1b064e8
Symbol database: Add support for unnamed array arguments to functions ( #4444 )
2012-12-29 08:32:43 +01:00
Robert Reif
07d118dee5
Fixed #4449 (segfault in CheckClass::initializeVarList())
2012-12-29 08:30:14 +01:00
Thomas Jarosch
1f87c6d669
Fix crash on empty brackets
...
Relevant parts from the backtrace:
2012-12-28 20:16:51 +01:00
Daniel Marjamäki
1769240e15
Fixed #4022 (false positive: (style) Variable 'sort_entry' is assigned a value that is never used)
2012-12-28 18:18:36 +01:00
Simon Kagstrom
95b51d02c9
path: Add getPathFromFilename (returns the path part of a filename)
...
E.g.,
/tmp/a.h -> /tmp/
a.h ->
etc.
2012-12-28 12:44:26 +01:00
Daniel Marjamäki
de2c133f6a
Fixed #4426 (False positive: Unitialized variable warning when comparing addresses)
2012-12-28 12:32:15 +01:00
Thomas Jarosch
4708be09f5
Fixed #4444 (segmentation fault)
2012-12-28 11:15:18 +01:00
Robert Reif
bd2f59bdf0
Fixed #4442 (crash of cppcheck while scanning gcc-testsuite (invalid code))
2012-12-28 08:36:20 +01:00
Daniel Marjamäki
b914466285
Uninitialized variables: fixed false positives by bailing out when variable is conditionally initialized and then there is a conditional return.
2012-12-27 18:45:00 +01:00
Daniel Marjamäki
bf9b900c30
Tokenizer::setVarId: Fixed problem with initializer lists ( #4436 )
2012-12-27 18:15:00 +01:00
Robert Reif
a43ae677d7
Fixed #4419 (False positive: Class does not have a constructor)
2012-12-27 17:21:30 +01:00
Robert Reif
3e6d601982
Fixed #4436 (FP: Member variable is not initialized in the constructor. (with two parameters))
2012-12-27 17:15:38 +01:00
Simon Kagstrom
ef28bde3e4
Fixed #4408 (Force inclusion of files (a la -include /.../ in GCC))
2012-12-27 16:52:31 +01:00
Daniel Marjamäki
2e0a9c4b33
Fixed #4434 (false positive: (style) Mismatching assignment and comparison, comparison 'pen!=-1' is always true.)
2012-12-27 15:40:00 +01:00
PKEuS
735069e3a7
Fixed unit tests
2012-12-26 12:50:59 +01:00
Daniel Marjamäki
b3301a9ef9
Fixed #4433 (Wrong array size for string with \0)
2012-12-26 12:10:09 +01:00
Robert Reif
ce380301fd
Fixed #4432 (Crash on parsing PHP interpreter)
2012-12-26 08:29:10 +01:00
Daniel Marjamäki
f127d56719
Null pointer: Fixed FP when there are 'return p?p->x:0;'
2012-12-25 14:23:50 +01:00
Daniel Marjamäki
f16c30248a
Uninitialized variables: fixed FP when there are function calls where type* is converted to unknown_type
2012-12-25 14:05:29 +01:00
Daniel Marjamäki
f381058293
Uninitialized variables: fixed FP when there are suspicious function calls where type** is converted to type*
2012-12-25 13:58:15 +01:00
Daniel Marjamäki
bcc5a82b1d
Uninitialized variables: Fixed FP when using typeof on uninitialized data in return statement
2012-12-25 13:31:54 +01:00
Daniel Marjamäki
db123c2c9b
Fixed #4431 (FP: Erroneous 'Ineffective call of function empty()' in ?: test)
2012-12-25 12:50:38 +01:00
Daniel Marjamäki
299c1bb208
Uninitialized variables: handle unsimplified labels better
2012-12-25 10:37:21 +01:00
Daniel Marjamäki
db2a129557
Tokenizer: Improved handling of '\0' in strings
2012-12-25 08:56:12 +01:00
Daniel Marjamäki
83da4125e3
Uninitialized variables: Better value flow analysis. Fixed false positives.
2012-12-24 19:11:13 +01:00
Daniel Marjamäki
b39afb2cf9
Revert "Fixed #4419 (False positive: Class does not have a constructor)"
...
This reverts commit 9a79961b6c
.
There is a segmentation fault when checking lib/preprocessor.cpp
2012-12-24 07:46:55 +01:00
Robert Reif
9a79961b6c
Fixed #4419 (False positive: Class does not have a constructor)
2012-12-24 06:46:30 +01:00
Daniel Marjamäki
56b7670468
Tokenizer::setVarId: Fixed problem in initializer list when parameter and class member has same name
2012-12-23 19:55:09 +01:00
Daniel Marjamäki
0b4da3d5cd
Uninitialized variables: Fixed false positives when variable x is given a nonzero value when variable y is uninitialized.
2012-12-23 16:27:04 +01:00
Robert Reif
dae232015e
Fixed #4430 (FP: Member variable is not initialized in the constructor.)
2012-12-23 08:04:44 +01:00
Daniel Marjamäki
47e1a571f7
Tokenizer: Fixed goto problems
2012-12-22 19:28:53 +01:00
Daniel Marjamäki
7f6a10599b
Fixed #4262 (Small Request/Suggestion for checks on array size of args (bounty offer))
2012-12-22 09:23:34 +01:00
Daniel Marjamäki
365a260ddc
Fixed #4398 (False negative: out of bounds (for loop))
2012-12-22 08:00:05 +01:00
Robert Reif
80848c6e0e
Fixed #4383 (Improve check: uninitialized member variable not detected when initialization is not proper)
2012-12-21 19:36:45 +01:00
Daniel Marjamäki
2050cd71db
Uninitialized variables: Better testing of function handling
2012-12-21 19:32:56 +01:00
Daniel Marjamäki
dc6aa92f3b
Uninitialized variables: warn about structs in C code
2012-12-21 18:50:38 +01:00
Daniel Marjamäki
cf84c211ed
Uninitialized variables: Improved handling of function calls
2012-12-21 17:04:15 +01:00
Daniel Marjamäki
415ee977d8
Uninitialized variables : fixed false positives when passing address of pointer to function.
2012-12-21 16:57:49 +01:00
Daniel Marjamäki
7e8019e474
Fixed #4403 (False positive 'Conversion of string literal <string> to bool always evaluates to true.' with BOOST_ASSERT)
2012-12-20 20:48:48 +01:00
Daniel Marjamäki
ccdea4dc2b
Uninitialized variables: Improved checking of functions
2012-12-20 19:45:30 +01:00
Robert Reif
bb2a15c140
Symbol database: Better handling of 'using namespace N;'. Ticket: #4412
2012-12-20 06:53:04 +01:00
Daniel Marjamäki
3913fd8398
Fixed #4320 (False positives 'unassignedVariable' and 'uninitvar')
2012-12-18 19:02:30 +01:00
Daniel Marjamäki
1e2fb4f1a4
Unused var: Limit bailout for foreach loops. Only bailout if name contains 'foreach' or 'for_each'. Only bailout variables that are used more than once in the body. Ticket: #4155
2012-12-17 18:19:05 +01:00
Daniel Marjamäki
72ea94bf75
Fixed #4155 (false positive: Variable is assigned a value that is never used (inside BOOST_FOREACH loop))
2012-12-17 17:07:56 +01:00
Daniel Marjamäki
a84d21f271
CheckMemoryLeaksInFunction: Fixed problems with catch and function calls. Ticket: #4405
2012-12-16 18:06:40 +01:00
Daniel Marjamäki
8e1e894dff
AST: Added some tests to ensure operator precedence is handled properly
2012-12-16 11:56:23 +01:00
Daniel Marjamäki
bca7927913
AST: generate tree from bottom and upwards
2012-12-16 11:48:19 +01:00
Daniel Marjamäki
aad3a041ad
AST: Handle function calls
2012-12-16 10:06:55 +01:00
Daniel Marjamäki
1ad9c933ec
AST: Improved handling of unary operators
2012-12-16 08:41:04 +01:00
Robert Reif
6732f05b95
Fixed #4404 (Forward declared class cause false style warning about missing constructor)
2012-12-16 07:18:03 +01:00
Daniel Marjamäki
fa8e5cd7d8
AST: Simple AST. Not used in the clients. Only part of the testing for now.
2012-12-15 20:21:09 +01:00
PKEuS
c4821db796
Updated VS9 solution with qmake ( #4397 ).
2012-12-13 20:38:10 +01:00
Daniel Marjamäki
88c1e42bdb
VS2010: Added cli/cppcheckexecutor.cpp to testrunner project
2012-12-13 18:43:45 +01:00
Daniel Marjamäki
df03e3a8d2
Fixed #4395 (Wrong simplification of known variables in nested assignment)
2012-12-10 06:08:33 +01:00
Robert Reif
5a7ede2563
Fixed #4391 (False positive: ctor not detected after variable declaration)
2012-12-10 06:01:29 +01:00
Frank Zingsheim
327db15284
Fix #4045 : memory leak not reported after usage of " + p[]"
2012-12-09 08:59:21 +01:00
PKEuS
410c0f98d9
Refactorized CheckObsoleteFunctions:
...
- Speedup checkobsoletefunctions by using symboldatabase and by not calling SymbolDatabase::findFunctionByToken() for each function call.
-> Benchmark (SQlite amalgamation):
CheckObsoleteFunctions::runSimplifiedChecks(): 9s -> 0,016s (562%, 4% on entire runtime)
- Fixed false negative when passing function result as parameter
2012-12-08 02:46:30 -08:00
PKEuS
578e582987
Fixed regression #4368 .
2012-12-08 00:26:10 -08:00
PKEuS
068c695bd1
Fixed false positive when ternary operator is used: case A&&B?B:A:
2012-12-07 12:44:30 -08:00
PKEuS
0ac4c3baf4
New check: Find suspicious case labels like 'case A||B:'
2012-12-07 12:27:32 -08:00
PKEuS
65db8b8b9f
Fixed #4229
2012-12-07 11:45:20 -08:00
Edoardo Prezioso
0273c183a7
Run astyle and update the translation files.
...
I believe we need a hook script because else everytime we change a file we have to make a new commit to fix the discrepancies problems.
2012-12-07 01:49:51 +01:00
PKEuS
4737966caf
Unit test cleanup: Removed some empty lines and whitespaces before \n.
2012-12-06 10:19:22 -08:00
Robert Reif
63b585424d
Fixed #4386 (False positive: ctor not detected)
2012-12-05 20:31:17 +01:00
Frank Zingsheim
aebdb3769f
Fixed #4369 (false positive: Variable 'i' is assigned a value that is never used)
2012-12-04 21:39:51 +01:00
Frank Zingsheim
590704afb4
Missing semicolon in "do {} while();" tests of testunusedvar.cpp ( #4180 )
2012-12-03 21:49:53 +01:00
Daniel Marjamäki
c91250cd6e
Fixed #4277 (duplicateExpression finds false positive for floats in a union as a member of a class)
2012-12-03 17:05:37 +01:00
Daniel Marjamäki
cb06d07ae7
Fixed #4351 (Escaped whitespace gives wrong error)
2012-12-02 18:04:19 +01:00
Daniel Marjamäki
15ef6bb32f
Fixed #4382 (Use of alloca causes VLA recommendation in C++)
2012-12-02 11:39:26 +01:00
Daniel Marjamäki
bf91454136
Fixed #4224 (False positive: Comparison of a boolean with an integer (neglecting a cast))
2012-12-02 08:34:30 +01:00
Robert Reif
b216639069
Fixed #4378 (simplifyEnum doesn't simplify enum type within open and close parenthisis)
2012-12-02 07:22:55 +01:00
Edoardo Prezioso
aeb4531a58
Token::Match: add a new pattern: '%comp%'.
...
Token::Match returns true if the token is a comparison operator. It's equivalent to matching '<|<=|==|!=|>=|>' and the tests show that the new pattern speeds up the program execution. Added the new pattern in CheckInternal (and also reordered the %cmd% lists) and in TestToken.
2012-12-01 00:55:24 +01:00
Edoardo Prezioso
47f1220367
Remove useless preprocessor pieces from some testcases.
2012-11-30 20:28:30 +01:00
Daniel Marjamäki
45b77554ea
Fixed #4308 (C++11 raw string literals not parsed correctly)
2012-11-30 13:46:46 +01:00
Daniel Marjamäki
672831f41a
Fixed #4187 (False positive: Variable inside a lambda is reported as uninitialized)
2012-11-30 10:30:26 +01:00
Daniel Marjamäki
031adef6ea
Array index checking: Fixed TODO comment (false negatives when using ?:)
2012-11-30 09:01:15 +01:00
Daniel Marjamäki
82223227bd
Uninitialized variables: Fixed false negative in new checking when using while loops
2012-11-30 06:30:04 +01:00
Robert Reif
35c2b8058d
Fixed #3190 (SymbolDatabase: Parse of sub class constructor fails)
2012-11-30 06:03:58 +01:00
Edoardo Prezioso
a219ed313b
Fixed again #2963 (FP: Typedef names considered duplicate because __LINE__ not expanded).
...
It is caused by a regression introduced with commit 75fbe310ff
. Add also a TODO in the non working detection inside TestSimplifyTokens::simplifyTypedef98.
2012-11-30 00:00:44 +01:00
PKEuS
36aeb74b5a
Fixed string literals in several unit tests (one test failing - changed it to TODO)
2012-11-29 21:07:52 +01:00
Daniel Marjamäki
68327b3c64
Uninitialized variables: Fixed TODO testcase
2012-11-29 18:41:48 +01:00
Daniel Marjamäki
7760a92930
CheckAssignIf: Better handling of various expressions in assignments
2012-11-29 10:19:52 +01:00
Daniel Marjamäki
ddad2d45cf
CheckAssignIf: Add more testcases
2012-11-29 09:58:55 +01:00
Daniel Marjamäki
3372657a07
Fixed #4227 (False positive: Comparison of a boolean with an integer (double dResult=false))
2012-11-29 09:29:25 +01:00
Daniel Marjamäki
509721d6d0
Fixed #4304 (False positive during an array declaration)
2012-11-29 08:44:12 +01:00
Daniel Marjamäki
ba3833c692
Fixed #3678 (stlcstrReturn for classes which don't provide a std::string)
2012-11-29 07:10:56 +01:00
Daniel Marjamäki
40719c56db
Fixed #4183 (false positive with method named c_str())
2012-11-28 08:48:48 +01:00
Daniel Marjamäki
fe8b6f0f95
astyle formatting
2012-11-28 08:48:00 +01:00
Daniel Marjamäki
7d94230329
Fixed #4079 (#if condition does not evaluate numbers with sign)
2012-11-28 07:33:24 +01:00
Daniel Marjamäki
5d1b4e6dbb
Tokenizer: Remove redundant '+'
2012-11-28 07:09:56 +01:00
Frank Zingsheim
f23ce8d254
Fixed #4180 (false positive: (style) Variable is assigned a value that is never used (inside loop))
2012-11-28 06:11:33 +01:00
Daniel Marjamäki
4e92f8dfcd
Fixed #4295 (False positive: Expression '(X & 0xFF00000000000000LL)==0xa00000000000000' always evaluates to false (64-bit value))
2012-11-27 17:37:49 +01:00
Edoardo Prezioso
f3029ce6bb
Fixed a bug in Tokenizer::simplifyKnownVariables.
...
When we find constant variables, check if there's a usage of its reference in the code (for example: don't simplify 'f(&x)' to 'f(&100)').
2012-11-26 17:06:52 +01:00
Robert Reif
bbc1747919
Fixed #3702 (False negative: fail to detect constructor implementation with slightly different (irrelevant) signatures)
2012-11-26 16:34:44 +01:00
Edoardo Prezioso
76639578ad
Improve Tokenizer::simplifyFuncInWhile.
...
Differentiate between the new cppcheck:r variables by appending a number to the name, like 'cppcheck:r1', 'cppcheck:r2' and more.
2012-11-26 02:19:35 +01:00
Zachary Blair
095824373a
Fixed #3302 (new check: nullpointer dereference)
2012-11-20 23:56:17 -08:00
Edoardo Prezioso
5fb2115e9d
Fixed a bug in Tokenizer::concatenateNegativeNumber.
...
The first negative number inside a '{}' list was not simplified correctly.
2012-11-20 19:14:58 +01:00
Robert Reif
ffe657128f
Fixed #4364 (Segfault in CheckStl::stlBoundries)
2012-11-20 06:12:14 +01:00
Daniel Marjamäki
382e1e95ef
Fixed #4168 (False positive: (style) struct or union member 'super::x' is never used)
2012-11-18 15:24:47 +01:00
Edoardo Prezioso
9d0a295b85
Partially fixed #4288 (handle %var%|%num% patterns).
2012-11-17 20:51:18 +01:00
Daniel Marjamäki
a2febc49d6
Fixed #4318 (False positive: 'unreadVariable')
2012-11-15 08:36:43 +01:00
Daniel Marjamäki
79cd601ae7
Fixed #4356 (False positive at variable initialization)
2012-11-15 07:48:45 +01:00
Robert Reif
04d04c33c2
speed up checks by caching commonly looked up stuff in the symbol database (CheckOther). Ticket #4266
2012-11-14 18:12:33 +01:00
PKEuS
e5ebb49312
Added support for sizeof(wchar_t). Improved <Windows.h> type testing for Win64 platform.
2012-11-11 16:16:17 +01:00
PKEuS
5555e055f1
Refactorized <Windows.h> type support:
...
- Changed some more Win32 simplifications of wide-character/string types to use wchar_t
- Added support for LPWSTR
- Fixed test case to ensure that simplifications also work for Win32W
2012-11-11 15:40:06 +01:00
PKEuS
b15ff0c0e3
Fixed unit test failures caused by previous commit
2012-11-11 15:16:08 +01:00
PKEuS
17b720ef7d
Refactorization: Removed unnecessary code. Variable::typeStartToken() and Variable::typeEndToken() never point to "const".
...
Ran AStyle
2012-11-11 13:32:19 +01:00
PKEuS
704f285c90
Refactorized CheckStl::pushback():
...
- insert(), reserve() and clear() also invalidate iterators
- Properly support return and throw statements: Bailout after semicolon
- "." is also bad usage of invalid iterator.
2012-11-11 13:03:58 +01:00
Jose Roquette
e8d3a4300d
Fixed #4197 - False negative: invalidIterator2 not detected
2012-11-11 12:01:52 +01:00
PKEuS
4ee955fc8c
Improved CheckNullPointer::isPointerDeRef():
...
- Fixed #4240
- Added support for wstring/wchar_t
2012-11-10 19:53:20 +01:00
PKEuS
58fe7105f4
Remove C++11 keywords "override", "final" and "constexpr"
2012-11-09 19:53:10 +01:00
PKEuS
ce961578c2
New checks (inconclusive): Suspicious calculation with sizeof()
...
- Check for sizeof(ptr)/something: This indicates that programmer was trying to calculate array size, but sizeof(ptr) doesn't return the length of the memory area, but size of a pointer.
- Check for sizeof()*sizeof(): This indicates that programmer misunderstood what sizeof() does: It does return the length in bytes of the given variable, not e.g. the number of elements in an array.
2012-11-09 18:08:20 +01:00
Edoardo Prezioso
119ab519a4
Support GNU extension of '?:' operator:
...
"x ? : y" is equivalent to "x ? x : y". I found a lot of code with this extension, probably we should warn a user to not use this.
2012-11-08 17:49:43 +01:00
PKEuS
aa2ad41629
Print message "Found calculation inside sizeof()" also for increment/decrement operator.
2012-11-06 11:39:47 -08:00
Zachary Blair
51d128c918
Fixed #2029 (free invalid address) by reporting previously-unreported errors as "inconclusive"
2012-11-05 21:02:51 -08:00
Edoardo Prezioso
1d4cacb3f1
Add more testcases for simplifyPlatformTypes:
...
these should cover up some unused branches.
2012-11-05 00:35:34 +01:00
Edoardo Prezioso
960dad0c21
Related to commit 71150e987ddf935237578aec3a4c6e02247882c2:
...
indent-separate test cases of the same kind.
2012-11-05 00:33:02 +01:00
Edoardo Prezioso
4d38dd4f2c
Add testcase for Tokenizer::simplifyVarDecl.
...
A branch was not executed in coverity, but there was a testcase which needed it.
2012-11-04 23:49:23 +01:00
Edoardo Prezioso
71150e987d
Add testcase related to commit 0d26a79f2c
.
...
cover up the case when there's at least a token before 'namespace %type% { }'.
2012-11-04 23:14:41 +01:00
Edoardo Prezioso
24bf6f99e1
More simplifyRedundantParenthesis changes:
...
simplify also '( var . var . ... . var )' parenthesis.
2012-11-04 22:38:18 +01:00
Edoardo Prezioso
87c931b74b
Add '%char%' as pattern to match in Token::Match.
...
All and only those single characters enclosed in "'" are accepted.
2012-11-04 16:58:18 +01:00
Andrew Martin
7c370ec873
Fixed #4305 (improve check: 'vector.size() < 1' should result in 'inefficient checking for '...' emptiness.')
2012-11-04 16:15:26 +01:00
PKEuS
4cd96158ae
Fixed parsing of "__asm__ volatile {""};"
2012-11-04 12:21:34 +01:00
PKEuS
b0c1c2c819
Don't suggest using initialization list for static variables ( #4332 )
2012-11-04 11:59:09 +01:00
PKEuS
e44ee280bc
Fixed handling of pointers to functions in namespace as template parameters ( #4172 )
2012-11-04 11:15:03 +01:00
PKEuS
9cb9388e49
Fixed handling of pointers in templates ( #4319 )
2012-11-04 10:49:25 +01:00
PKEuS
6122819832
Message refactorization: Changed expression "0-terminate" to "null-terminate" as discussed on 24b98feadb
2012-11-03 21:21:19 +01:00
PKEuS
1c399c86ca
Improved fix for #4311 ; Added back support for "this." (fixes again #4291 )
...
Added TODO unit test for missing varid.
2012-11-03 21:16:05 +01:00
Daniel Marjamäki
6c2563c467
Fixed #4311 (False positive: warning (selfAssignment): Redundant assignment of 'm_bar' to itself.
2012-11-03 13:18:43 +01:00
Daniel Marjamäki
24e71c479c
Fixed #4301 (htmlreport broken)
2012-11-03 11:25:40 +01:00
PKEuS
a36e008967
Fixed #4314 : Using CheckNullPointer::isPointerDeRef() here is overkill and doesn't work as intended, since this function is designed to return 'false' if it isn't sure.
2012-11-03 10:25:32 +01:00
PKEuS
472a39d157
Fixed two MSVC warnings in testsymboldatabase.cpp
2012-11-01 18:55:15 +01:00
PKEuS
24b98feadb
Message refactorization: checkuninitvar.cpp, checkunusedfunctions.cpp, checkunusedvar.cpp
2012-11-01 18:40:20 +01:00
Robert Reif
8e14d7682c
Symbol database: fix some function prototype bugs that were found during check conversions. Ticket: #4266
2012-10-30 15:48:06 +01:00
Daniel Marjamäki
e1dce66494
tweaked message
2012-10-28 13:03:40 +01:00
Daniel Marjamäki
38213f1f2f
Fixed #4237 (False positive: (error) Memory Leak: data (assign reference variable value to a shadow variable in inner scope))
2012-10-27 16:36:14 +02:00
Daniel Marjamäki
863441afe8
Fixed #4236 (False positive: pointer free()d twice - neglecting call to other function)
2012-10-25 19:41:18 +02:00
Daniel Marjamäki
e7483af028
Opposite inner conditions - made check 'experimental' because there are unsolved false positives.
2012-10-21 18:18:29 +02:00
Baris Demiray
0e100f7563
Fixed #4189 (Improve check (printf('%l') not detected))
2012-10-21 08:50:29 +02:00
Edoardo Prezioso
f0f216390e
Fixed #4276 (segmentation fault of cppcheck (invalid code))
2012-10-20 21:40:51 +02:00
Alexander Mai
1881898e67
Added unit test for #4290
2012-10-19 20:04:43 +02:00
Edoardo Prezioso
4ddcde1e6f
CheckMemoryLeak: add '?1:0' to clarify the value of the argument to 'deleteNext'; Tokenize.cpp: in simplifyCompoundAssignment(), remove ':' odd code used to fix a weird test case ('case' code not inside a function body), remove useless 'tok->next() != NULL' check (already true by previous condition); in simplifyConditionOperator(), handle better the parenthesis skipping code and remove useless ')'check; in simplifyQuestionMark(), remove useless 'tok->tokAt(-2)' check (Token::Match returns false if the token is NULL), add more patterns to Token::Match to handle more test cases; in simplifyBitFields(), add 'const' to 'offset' bool. RedirectOutputError: style nitpick change to declaration of a pointer.
2012-10-19 14:19:52 +02:00
Baris Demiray
d84d360afc
Fixed #4291 (Variable ID is not set when variable is accessed through 'this')
2012-10-19 06:18:13 +02:00
Edoardo Prezioso
61365ea0e5
Fixed #4293 (FP: Variable is not simplified, causing a false positive).
2012-10-17 00:25:20 +02:00
Daniel Marjamäki
b591097c87
Revert "Fixed #3190 (SymbolDatabase: Parse of sub class constructor fails)"
...
This reverts commit 1ee980184e
.
2012-10-16 19:12:27 +02:00
Robert Reif
1ee980184e
Fixed #3190 (SymbolDatabase: Parse of sub class constructor fails)
2012-10-16 06:11:28 +02:00
Daniel Marjamäki
562291477d
Fixed #4226 (False positive: Uninitialized variable (problem with namespace ::rtl))
2012-10-15 06:53:38 +02:00
Daniel Marjamäki
be174d6266
TemplateSimplifier: Fixed bad pattern that was detected by CheckInternal and pointed out by edward-san. The handling of recursive templates is better now.
2012-10-14 19:48:53 +02:00
Robert Reif
0d4b87c71e
SymbolDatabase: Improved find function functionality. Taking arguments into account
2012-10-14 17:30:37 +02:00
PKEuS
2aae8381cc
Message refactorization: checkstl.cpp
2012-10-14 11:16:48 +02:00
Edoardo Prezioso
64b4960acc
Tokenizer: simplify GCC '({ %var%|%num% ; })' to '%var%|%num%'.
...
Remove useless brace around condition in simplifyFlowControl.
2012-10-13 13:24:41 +02:00
Edoardo Prezioso
1951d1cdc5
Tokenizer: improve the new 'skipTernaryOp' function by supporting GCC '{(var|num;)}' statement expression extension; improve 'Tokenizer::simplifyQuestionMark' by supporting simplification with 'case' before ternary operation, using skipTernaryOp to get colon and, most importantly, supporting indented '?:' operations.
2012-10-13 02:32:43 +02:00
Edoardo Prezioso
d4a3c1617a
Fixed: Tokenizer::simplifyLabelCaseDefault was careless with '?:' operator near 'case' adding the semicolon after the ternary colon.
2012-10-12 20:51:13 +02:00
XhmikosR
8d08c3b58b
pro and pri files: remove unneeded empty lines, use spaces for consistency
2012-10-12 17:46:57 +02:00
Edoardo Prezioso
c42facae1f
Tokenizer::simplifyLabelsCaseDefault: jump '(' and '[' parenthesis.
...
TestTokenizer: add simple test cases with some correct and wrong syntax concerning 'case'.
2012-10-12 17:08:21 +02:00
Edoardo Prezioso
e62e03ab31
Fixed #4267 (segmentation fault of cppcheck (invalid code)).
2012-10-09 20:44:30 +02:00
Ettl Martin
2cf75d5339
astyle run
2012-10-08 21:50:21 +02:00
Ettl Martin
0879bb5825
#4245 : Segmentation fault (invalid code); Applied patch from amai.
2012-10-08 21:49:25 +02:00
Daniel Marjamäki
f74c30e116
Fixed #4231 (False positive: (error) Returning/dereferencing 'ptr' after it is deallocated / released (ignoring goto))
2012-10-08 17:23:47 +02:00
Daniel Marjamäki
61183e7896
astyle formatting
2012-10-08 16:23:05 +02:00
Daniel Marjamäki
fefd8529c6
Fixed #4007 (False positive: 'Possible null pointer dereference' when using short-circuit evaluation)
2012-10-07 19:06:49 +02:00
Daniel Marjamäki
6a37942431
Fixed #3935 (False report for accessing array out of bounds after casting to short)
2012-10-07 18:38:05 +02:00
Alexander Mai
3656366c7e
Fixed #4257 (False Positive: String literal compared with variable - for non-pointer variable)
2012-10-07 16:26:03 +02:00
Daniel Marjamäki
0115bb8d24
Fixed #4102 (False positive: 'find('=') + 1U' can't be replaced with compare)
2012-10-07 12:43:14 +02:00
Daniel Marjamäki
4c1abde48e
Reverted 107b3b44
. Write syntax error for 'if MACRO()'. We can't know if MACRO() is supposed to be used in the condition or if it is some annotation that should be removed. Ticket #4171
2012-10-06 19:12:39 +02:00
Edoardo Prezioso
e3bbcf501f
Fixed #4234 (segmentation fault of cppcheck in Tokenizer::simplifyFlowControl() (invalid code))
2012-10-06 13:37:44 +02:00
Daniel Marjamäki
c2b61030a8
Fixed #4254 (Tokenizer::simplifyIfAssign: varids not preserved)
2012-10-06 12:49:24 +02:00
Daniel Marjamäki
dbddbe75bf
Path: Removed java/c# handling. Thanks amai.
2012-10-03 19:47:14 +02:00
Daniel Marjamäki
1e024a9abc
cleanup more java/c# code. Thanks amai for telling me about this.
2012-10-03 19:19:49 +02:00
Daniel Marjamäki
2f069f550f
Removed Java/C# handling
2012-10-02 18:44:36 +02:00
Daniel Marjamäki
9a462d8a0a
Fixed #4225 (False positive: uninitialized variable (assignemnt in ternary expression with cast))
2012-09-30 18:49:25 +02:00
Daniel Marjamäki
a64669b1ec
Fixed #4203 (Don't warn about setting NULL value for pointers and not using that value)
2012-09-30 17:22:35 +02:00
Daniel Marjamäki
c65ac603e9
Fixed #3837 (False positive: national locale inline asm comments are reported as unsupported)
2012-09-30 09:35:32 +02:00
Daniel Marjamäki
4e1bef5535
AssignIf: better handling of function calls
2012-09-29 19:22:34 +02:00
PKEuS
c4b881f844
Refactorizations in tokenize.cpp and testsimplifytokens.cpp:
...
- Avoid const_cast in testsimplifytokens.cpp
- Removed redundant null-check (VS11 code analysis)
- Fixed MSVC compiler warning
- Replaced some indentation counters
2012-09-29 14:10:41 +02:00
XhmikosR
5101243c64
use const_cast instead of c cast
2012-09-29 13:15:09 +02:00
PKEuS
c17853949d
Fixed scope handling problems with CheckOther::checkComparisonOfFuncReturningBool(), removed its experimental status.
2012-09-29 11:23:30 +02:00
Daniel Marjamäki
10aa667648
assignif: Fixed testcase. parse while loops if variable is local and not external.
2012-09-29 10:54:09 +02:00
Daniel Marjamäki
44926654a4
df
2012-09-29 10:41:12 +02:00
Daniel Marjamäki
12cfdee61b
AssignIf: Check into scopes recursively
2012-09-29 10:33:54 +02:00
Daniel Marjamäki
52be4a5925
Disabled checkComparisonOfBoolWithBool since there are false positives. Ticket #2617
2012-09-28 19:11:36 +02:00
Daniel Marjamäki
ff4f8b58f3
Disable checkComparisonOfFuncReturningBool check because of false warnings. Ticket #2617
2012-09-28 18:51:10 +02:00
Daniel Marjamäki
bb62325ddb
AssignIf: Better handling of complex conditions with multiple subconditions
2012-09-28 17:03:16 +02:00
Alexander Mai
074b7781b2
Fixed #4239 (segmentation fault of cppcheck (invalid code))
2012-09-27 06:35:36 +02:00
Daniel Marjamäki
9f7a0146d0
AssignIf: Detect mistake in such code: 'int x=y&4; if ((x==3)||..'
2012-09-26 20:15:46 +02:00
Mohit Mate
9e297c95f2
Fixed #2617 (improve check: comparing boolean with '<')
2012-09-26 18:18:36 +02:00
Daniel Marjamäki
8010bcfbe8
astyle formatting
2012-09-26 18:17:02 +02:00
Daniel Marjamäki
753942df0c
Revert "Fixed #4165 (False positive:(error) Uninitialized variable: here)"
...
This reverts commit 96b1890797
.
2012-09-26 16:15:35 +02:00
Daniel Marjamäki
96b1890797
Fixed #4165 (False positive:(error) Uninitialized variable: here)
2012-09-25 20:45:42 +02:00
Daniel Marjamäki
0ff8105c71
Fixed #4074 (Internal error. Token::Match called with varid 0)
2012-09-24 06:44:51 +02:00
Daniel Marjamäki
990340ba98
Fixed #4072 (False positive: Structure is not initialized in the constructor (1.55))
2012-09-23 18:29:05 +02:00
Daniel Marjamäki
68240fffc6
Fixed #4228 ((error) Internal error. Token::Match called with varid 0 (multiple declarations in for loop))
2012-09-23 17:15:39 +02:00
Daniel Marjamäki
ec01cc811e
Second fix for #4207 (Internal error. Token::Match called with varid 0)
2012-09-23 13:25:28 +02:00
Daniel Marjamäki
865c0205e3
Fixed #4210 (Unmatched suppression warning emitted from disabled check)
2012-09-23 10:56:12 +02:00
Daniel Marjamäki
c9c04f9691
Fixed #4038 (FP: possible null pointer dereference)
2012-09-23 09:20:16 +02:00
Daniel Marjamäki
2e3a7db4eb
Fixed #4115 (Incorrect uninitialized variable error message with realloc macro)
2012-09-22 18:41:33 +02:00
Daniel Marjamäki
37695d44f3
Fixed #4085 (tinyxml2 false positives)
2012-09-22 16:49:28 +02:00
Daniel Marjamäki
a17f37c67d
CheckBufferOverrun: Better handling of functions with variable arguments
2012-09-22 16:19:19 +02:00
Daniel Marjamäki
d3e990b1e5
Fixed #3987 (False positive: Memory leak reported when throwing/catching)
2012-09-22 10:37:27 +02:00
Daniel Marjamäki
6d928a2ff7
Fixed #4119 (false positive with operator= when implemented in terms of swap)
2012-09-22 08:50:36 +02:00
Daniel Marjamäki
a65f427195
Fixed #3836 (False positive: variable not initialized in copy constructor/operator (attached example code)
2012-09-22 08:16:16 +02:00
Daniel Marjamäki
6c25f3662e
Tokenizer::simplifyEnum: Don't simplify enums in function heads. Ticket #3953
2012-09-21 16:17:20 +02:00
Edoardo Prezioso
8e1e8525a3
Partial rewrite of Tokenizer::simplifyComma:
...
skip '= { .. }' where possible;
hence remove '%num% after comma' check because it's redundant now;
replace round braces counter method with faster 'link skip';
if 'endAt' is 'NULL' after finding the ';' token, exit the function;
hence remove redundant 'tok != NULL' check after simplifying 'return' code.
2012-09-20 21:45:16 +02:00
Edoardo Prezioso
406483b618
Fixed valgrind error in #3953 , but there's still the bad enum problem.
2012-09-20 21:07:37 +02:00
Daniel Marjamäki
de8e592d00
Class: Show inconclusive warnings about unknown types that are not initialized in copy constructors. Ticket: #3611
2012-09-20 19:16:26 +02:00
Daniel Marjamäki
7d3e661774
Fixed #3611 (CheckClass: uninitVar and operatorEqVarError false positives (non-copyable members))
2012-09-20 16:47:01 +02:00
Daniel Marjamäki
aa3cdc6b6f
Fixed #3565 (Variable hides enumerator (attached code example))
2012-09-19 19:19:13 +02:00
Daniel Marjamäki
c3cb6202ed
Fixed #4172 (TemplateSimplifier: Handle 'A<&f> x' template instantiation)
2012-09-19 16:10:13 +02:00
Ettl Martin
3905f4ad7d
fixed #4169 semgentation fault (invalid code); Applied patch from amai and added a unittest.
2012-09-19 11:03:40 +02:00
Ettl Martin
3f89e38275
fixed #4195 segmentation fault of cppcheck (invalid code); Added a testcase
2012-09-19 10:37:30 +02:00
Daniel Marjamäki
07d2935e81
Fixed #4164 (False positive: (error) Uninitialized variable: min)
2012-09-18 20:55:37 +02:00
Daniel Marjamäki
ffd5c82b4f
Fixed #4118 (False null-pointer warning when check is indirect)
2012-09-18 19:16:28 +02:00
Daniel Marjamäki
1f7d9ca22c
Fixed #4211 (Tokenizer::simplifyVarDecl: Improved handling of >> in templates)
2012-09-17 19:45:42 +02:00
Daniel Marjamäki
3ff792560f
Deactived bad message. Ticket #4154
2012-09-17 18:10:11 +02:00
Daniel Marjamäki
25befccb26
Revert "CheckClass::copyconstructors: Removed check. Because there is unfixed ticket #4154."
...
This reverts commit 066a1d48fe
.
2012-09-17 17:59:35 +02:00
Daniel Marjamäki
066a1d48fe
CheckClass::copyconstructors: Removed check. Because there is unfixed ticket #4154 .
2012-09-17 16:18:27 +02:00
XhmikosR
3c14e4b52a
test: tabs to spaces, remove trailing spaces and extra empty lines at the end of files
2012-09-17 13:51:40 +02:00
PKEuS
5237ed2de9
Message refactorization: checkother.cpp
2012-09-16 19:44:02 +02:00
PKEuS
f762b55aa0
Fixed MSVC 10 compiler warnings
2012-09-16 16:29:06 +02:00
PKEuS
b06c078969
Updated VS10 solution.
2012-09-16 13:38:46 +02:00
Daniel Marjamäki
a99515ca91
Fixed #3933 (Negative array index issue (because sizeof struct is assumed to be 100))
2012-09-16 08:20:43 +02:00
Daniel Marjamäki
57804b3554
Fixed compile error. I forgot to commit testtimer.cpp
2012-09-15 20:43:37 +02:00
PKEuS
9a624576f4
Revert "CheckOther::clarifyStatement: improved message to show what's the 'bad' and the 'good' expression."
...
This reverts commit f8591f9004
.
2012-09-15 20:19:02 +02:00
Daniel Marjamäki
ae7ee5ffd3
Symbol database: Added TODO test case for #3190
2012-09-15 20:13:32 +02:00
Daniel Marjamäki
295ba9cc4f
Fixed #2709 (Negative times in --showtime summary)
2012-09-15 19:49:48 +02:00
Daniel Marjamäki
f1ebd99dc2
Fixed #3507 (false positive: comma-separated statements before return in methods)
2012-09-15 11:55:08 +02:00
Daniel Marjamäki
84c0368bfd
Fixed #3586 (false positive: uninitvar in argument in namespaced function)
2012-09-15 10:48:17 +02:00
Kamil Dudka
b4d78e3d05
Fixed #3651 (Preprocessor: Wrong handling of #elif)
2012-09-15 09:34:41 +02:00
Daniel Marjamäki
a9c1a052b9
CheckAssignIf: Improved checking for bitwise or
2012-09-14 19:13:44 +02:00
Daniel Marjamäki
9f2e1ab98d
Fixed #4048 (Tokenizer::simplifyVarDecl: Improve handling of 'a::b const * p = 0;')
2012-09-14 16:46:45 +02:00
PKEuS
929f16d892
Fixed hang on garbage code ( #4193 )
2012-09-14 15:32:35 +02:00
Daniel Marjamäki
3e58472cd3
Fixed #4013 (Several test failures in testcmdlineparser.cpp)
2012-09-14 06:58:14 +02:00
Daniel Marjamäki
19fdbf0fd0
Fixed #4185 (Incorrect 'Found duplicate if expressions' for strings with high bit set)
2012-09-13 16:44:10 +02:00
Daniel Marjamäki
6ebfbf42e1
Fixed #4191 (wrong syntax error if 'error' substring of stringification)
2012-09-12 16:10:45 +02:00
PKEuS
22a8e3f4e6
Replaced Tokenizer::getFunctionTokenByName() by SymbolDatabase::findFunctionByName(), which handles scopes slightly better.
2012-09-11 18:03:47 +02:00
Daniel Marjamäki
64faa780fe
Fixed #4087 (div by zero check is invalid for floats)
2012-09-11 16:50:42 +02:00
PKEuS
1863306198
Fixed false negative in checkunusedvar.cpp and reduced code dupliaction.
2012-09-11 14:24:12 +02:00
PKEuS
623ffe23f0
Fixed #4145
2012-09-11 14:14:35 +02:00
PKEuS
50f9dd52ab
Used enum instead of string in implementation for '--language='.
2012-09-11 08:53:27 +02:00
PKEuS
77b5175ec3
Support 0B... syntax for binary numbers.
2012-09-11 08:39:01 +02:00
PKEuS
95f4bb3e97
Implemented support for binary numbers ( #4113 )
2012-09-10 21:13:32 +02:00
PKEuS
87131f6105
Added new cmdline option --language= (alias of GCC-like -x) to enforce a specific language. Valid values: c, c++, java, c#. ( #3994 )
2012-09-10 18:51:32 +02:00
PKEuS
ce9f6bdb56
Fixed segfault #4182
2012-09-10 17:33:52 +02:00
Daniel Marjamäki
54f1771938
Fixed #4082 (Maybe false positive: memleak)
2012-09-10 17:27:41 +02:00
PKEuS
3449684137
Fixed usage of _settigns->isEnabled("style") in CheckIO. Added forgotten test cases.
2012-09-10 16:23:00 +02:00
PKEuS
1e5d082251
Moved remaining part of c_str() checking to checkstl.cpp. Fixed false positive #4157 .
2012-09-10 15:20:38 +02:00
PKEuS
4e59e55229
Refactorization/Partial rewrite of CheckClass::copyconstructors():
...
- Reformatted check code and some test cases
- Fixed false positives #4148 (non-copyable/unknown base classes) and #4178 (copy ctor implementation not seen)
- Proper usage of STL containers
- Better support for initializer list
- Rephrased error messages
2012-09-10 13:31:30 +02:00
Ettl Martin
f1faaac1f2
Added testcases for #3098
2012-09-09 19:49:40 +02:00
Daniel Marjamäki
d3bdd84d8b
Fixed #4175 (segmentation fault of cppcheck)
2012-09-09 18:56:26 +02:00
Daniel Marjamäki
7acb04b44c
Tokenizer: improved simplification of numeric calculations
2012-09-09 16:22:39 +02:00
PKEuS
d44f10fc01
Fixed createLinks2() on this code: nvwa<(x > y)>
2012-09-09 15:31:23 +02:00
XhmikosR
1968b6ffe0
vs2010 projects: consistently use /MP and remove default property
2012-09-09 14:20:49 +02:00
Daniel Marjamäki
511c5a62e7
Fixed #4141 (Crash when parsing divide by zero.)
2012-09-09 12:38:15 +02:00
Daniel Marjamäki
107b3b4401
Fixed #4171 (don't choke when parentheses are missing from macros)
2012-09-09 09:48:07 +02:00
Daniel Marjamäki
0c55d5cfa7
Fixed #4002 (syntax error for 'X( typedef, Y)')
2012-09-09 09:14:46 +02:00
Daniel Marjamäki
69a0062177
Tokenizer: don't crash for 'int'. Ralated with tickets #2978 and #3304
2012-09-08 20:59:25 +02:00
Daniel Marjamäki
853c6522dc
Tokenizer::simplifyEnum: Readded refactorings. Tickets 3949,3950,4025,4053 has been solved as far as I see.
2012-09-08 12:42:24 +02:00
PKEuS
78d49ea4b8
Fixed #3732 - properly simplify struct declarations:
...
- Don't replace "{ {" if they are part of an initialization
- Properly split struct definition, variable declaration and variable initialization.
Used std::stack instead of std::list
2012-09-08 10:51:31 +02:00
Daniel Marjamäki
a39b58046f
Tokenizer: Improved simplification of 'a?(1):b'
2012-09-08 10:45:00 +02:00
Daniel Marjamäki
2722f53edd
Fixed #4142 (false positive (error) Uninitialized variable: b)
2012-09-08 10:15:37 +02:00
Daniel Marjamäki
c31ce68520
TestTokenizer: Added TODO assertion
2012-09-08 09:01:02 +02:00
Daniel Marjamäki
2ce5cb3075
Tokenizer: Simplified parentheses better in such pattern: 'git merge --squash 4142 operator git merge --squash 4142 (%var%|)) ( %num%|%bool% ) %op%|;|,|)'
2012-09-08 07:01:35 +02:00
Daniel Marjamäki
6b56b4a9d3
Show that inconclusive message is inconclusive
2012-09-07 16:11:15 +02:00
PKEuS
e87ebcc602
Added support for std::unique and std::remove_if to CheckStl::uselessCalls().
2012-09-07 14:23:32 +02:00
PKEuS
a4b5824dec
New internal check: checkRedundantNextPrevious().
...
Fixed findings by new internal check
2012-09-07 12:36:40 +02:00
PKEuS
489df29346
Moved Tokenizer::typeConstToConstType() to Tokenizer::simplifyConst()
2012-09-07 11:41:41 +02:00
PKEuS
c2d4afc525
Support default arguments in symboldatabase for arguments without name ( #4055 )
2012-09-06 20:50:46 +02:00
PKEuS
0c812c5ac3
Throw an InternalError when trying to divide (or modulo) by zero in MathLib.
2012-09-06 20:15:32 +02:00
PKEuS
20f989b6c4
Skip code in brackets in default argument declaration ( fixes #4057 )
2012-09-06 20:02:53 +02:00
PKEuS
31e7e41098
Fixed and refactorized broken CheckNullPointer::CanFunctionAssignPointer():
...
- return true if parameter is passed by reference (fixes #4111 )
- Use symboldatabase
- Improved handling of inconclusive
2012-09-06 18:33:15 +02:00
PKEuS
a8cdd15738
Fixed false positive #4077 .
2012-09-06 16:30:10 +02:00
Daniel Marjamäki
1c7027140a
Tokenizer: Improved simplifyRedundantParanthesis
2012-09-06 16:16:29 +02:00
PKEuS
6edec7bdce
Fixed false positive #4123 .
2012-09-06 16:10:51 +02:00
Daniel Marjamäki
2a9eaebcaa
replaced tabs with spaces
2012-09-05 20:50:25 +02:00
Daniel Marjamäki
3032ded9aa
replaced tabs with spaces
2012-09-05 19:46:44 +02:00
Arpit Chaudhary
67e40a85e5
Improved check for shifting by negative values and removed false positives
2012-09-05 16:09:40 +02:00
PKEuS
f969530e1f
Revert "Fixed #4087 " which was committed by accident.
...
This reverts commit 0bbef8d803
.
2012-09-05 13:57:57 +02:00
Nilesh Kumar
c7633fc73c
Fixed #3645
2012-09-05 13:48:00 +02:00
gaurav kaushik
9ad7dfd5fd
Fixed #211 and #214
2012-09-05 12:58:09 +02:00
PKEuS
e5b1a6ceb1
Merge branch 'master' of github.com:danmar/cppcheck
2012-09-05 12:18:11 +02:00
Zachary Blair
8546bcc94e
Fixed #2029 (new check: free invalid address)
2012-09-04 23:31:23 -07:00
PKEuS
0bbef8d803
Fixed #4087
2012-09-04 21:50:50 +02:00
Daniel Marjamäki
4eeec75b73
TestPreprocessor: Encode extended ASCII characters to avoid VS compiler warnings.
2012-09-04 16:29:06 +02:00
PKEuS
8924e8af43
Fixed #4143 : Give correct line numbers in checkunusedvar.cpp
2012-09-04 14:53:24 +02:00
anuraggarg011
913670d254
Fixed #3304 (simple cases)
2012-09-04 13:41:14 +02:00
kbajaj91
be716e81d3
Fixed #4138 - False positive about variable assigned a value that is never
...
used in loops
2012-09-04 13:06:04 +02:00
Edoardo Prezioso
f8591f9004
CheckOther::clarifyStatement: improved message to show what's the 'bad' and the 'good' expression.
2012-09-04 02:07:55 +02:00
Edoardo Prezioso
6fd60eebb0
Tokenizer: added a workaround for #3690 (Support MSVC's 'for each').
2012-09-03 20:23:53 +02:00
anuraggarg011
bf11248a09
Fixed #1620 (tokenizer: simplify well known math functions)
2012-09-03 18:51:15 +02:00
anuraggarg011
b156c727b0
Fixed #3939 : Support ****foo++;
2012-09-03 17:10:27 +02:00
Ankita Gupta
c3a65dca40
Fixed #3793 (improve check: calculation in sizeof)
2012-09-03 15:56:10 +02:00
Edoardo Prezioso
04661fd7d0
Fixed test changes I forgot in previous commit.
2012-09-03 15:20:34 +02:00
XhmikosR
cd7c4df622
consistency changes
2012-09-03 13:52:06 +03:00
PKEuS
27cafd495a
Don't bailout for noreturn functions in checkRedundantAssignments outside switch.
2012-09-03 12:03:30 +02:00
PKEuS
b6c1528566
Test case for #4135
2012-09-03 11:32:15 +02:00
Kartik Bajaj
ea0cbbcf78
Fixed #1481
2012-09-02 18:50:17 +02:00
deepak gupta
24659dee92
Fixed #4087
2012-09-02 14:26:39 +02:00
PKEuS
2d64b69cf4
New check: Detect redundant assignment to a variable and redundant copying to a buffer
...
This check partially replaces the check for redundant assignments in switch
2012-09-02 13:09:32 +02:00
Deepak Gupta
4202866100
Fixed #4096 (Improve check: Buffer overrun in for loop, postfix increment in array access)
2012-09-01 19:17:28 +02:00
pranav1509
6f6baa67e4
Added more patterns to redundant condition check.
2012-09-01 13:39:32 +02:00
PKEuS
c20adf91bf
Moved simplification of wide character string literals (L"foo") to tokenize(). Token::isLong flag used to indicate that string is a wchar_t literal.
2012-09-01 13:12:47 +02:00
Ankita-gupta
ff7373f46f
Fixed bug in Token::Match ( #3720 )
2012-08-30 13:33:19 +02:00
Edoardo Prezioso
0d26a79f2c
Tokenizer::simplifyEmptyNamespaces: new function.
...
It removes from the token list, if found, the following tokens: 'namespace %var% { }'. It won't involve C code.
2012-08-28 22:40:25 +02:00
PKEuS
ea85dd305a
Fixed #4086 : Set varId in initialization list.
2012-08-28 12:44:40 +02:00
Daniel Marjamäki
9fe9944adb
Fixed #4034 (false positive:(error) Dereferencing 'cfileP' after it is deallocated / released)
2012-08-28 06:38:38 +02:00
Daniel Marjamäki
0d82b08080
Fixed #4040 (false positive: (error) Uninitialized variable: iter)
2012-08-27 15:48:21 +02:00
PKEuS
671f1b83d9
Fixed false positive: Return value of std::remove() ignored when std::remove(char*) is called ( #4093 )
2012-08-27 14:28:16 +02:00
PKEuS
046712aaec
Removed --doc formating hack that removes more than three newlines and added format testing of Check::classInfo instead.
...
- Fixed test failures shown by new test.
Use const_iterator instead of iterator in testcppcheck.cpp when possible
2012-08-26 16:22:46 +02:00
PKEuS
1fbaae948c
Added regression test cases for #404 .
2012-08-26 11:39:17 +02:00
PKEuS
4b1075b34b
Fixed #3729 : Don't suggest recursive call to optimize away c_str()
2012-08-26 10:56:46 +02:00
PKEuS
6893948c72
Bugfix: Reset property info when Token::link() is set (< can be a bracket or a comparison operator). Fixes #4075 .
2012-08-26 10:23:16 +02:00
PKEuS
662b0d2dbe
Simplify 0[foo] to *(foo) ( fixes #4083 )
2012-08-26 10:03:05 +02:00
PKEuS
9fa7e15fb4
Fixed setVarId for nested templates ( #3976 , #3769 ) and support C++11 right angle brackets in TemplateSimplifier::templateParameters()
2012-08-26 09:49:38 +02:00
Daniel Marjamäki
f127728582
Enable --std=c11 and --std=c++11 by default
2012-08-25 21:57:45 +02:00
Daniel Marjamäki
41797d409d
Fixed #4036 (cppcheck hangs with 100% cpu load)
2012-08-25 13:24:17 +02:00
Daniel Marjamäki
7975ffba21
Fixed #3980 (Variable not assigned a value)
2012-08-25 13:07:33 +02:00
PKEuS
bb068d2f78
Fixed false positive #4039 : Handle operator precedence in CheckStl::size()
2012-08-25 12:36:13 +02:00
Daniel Marjamäki
985ac662ee
Fixed #4035 (False positive: Memory leak: pTempFile)
2012-08-25 12:00:25 +02:00
Daniel Marjamäki
730935efdd
Fixed testrunner assertions in TestPreprocessor
2012-08-25 11:45:18 +02:00
Daniel Marjamäki
5051837c1a
Reverted last commit. I pushed it by mistake.
2012-08-25 11:00:51 +02:00
Daniel Marjamäki
5e1ccfaf90
Fixed #4035 (False positive: Memory leak: pTempFile)
2012-08-25 10:55:20 +02:00
PKEuS
808c3468c9
New check: detect suspicious comparison of string literal with char* variable
...
Bugfix: Update Token type when varId is set
2012-08-24 14:25:17 +02:00
PKEuS
76fbcce13f
Restored (intentional) content of screwed up commits 1bcdf4ce3d
and 674f7980d519712ff16d8f874dfe55a84deb4b5b:
...
- New check (Inconclusive): Array filled incompletely with memset/memcpy/memmove
-- This check only warns if the number of elements is given as size in bytes to memset, memcpy or memmove and if the size of an element is larger than 1 Byte. It does not warn for random numbers
- New check: Detect ineffective statements like '*foo++;' (Should be: '(*foo)++;')
Sorry for the inconveniences.
2012-08-24 11:28:50 +02:00
Edoardo Prezioso
0f1accc2da
Revert latest two commits as they break the compilation and the style. PKEuS???
2012-08-24 00:10:19 +02:00
PKEuS
1bcdf4ce3d
New check: Detect ineffective statements like '*foo++;' (Should be: '(*foo)++;')
2012-08-23 12:28:40 -07:00
PKEuS
674f7980d5
New check (Inconclusive): Array filled incompletely with memset/memcpy/memmove.
...
This check only warns if the number of elements is given as size in bytes to memset, memcpy or memmove and if the size of an element is larger than 1 Byte. It does not warn for random numbers
2012-08-23 11:27:00 -07:00
Daniel Marjamäki
d24badbfda
Fixed #4068 (Endless loop inside MathLib::add())
2012-08-22 20:50:39 +02:00
Daniel Marjamäki
f133c9e8ec
Fixed #4020 (false positive: (style) Variable 'dst' is assigned a value that is never used)
2012-08-22 19:47:46 +02:00
PKEuS
4fb464982c
Fixed crash reported in #4076
2012-08-22 10:17:23 -07:00
PKEuS
f238f3fad5
Support sizeof in preprocessor directives
...
Applied "patch" provided by michaeln123 in #4071
2012-08-22 17:28:06 +02:00
PKEuS
43e01a2b1a
Ran AStyle, removed redundant tokAt(0)
2012-08-22 16:51:44 +02:00
SAndeep
0600b0be8f
sprintf changes
2012-08-22 16:46:14 +02:00
PKEuS
4d2104ca08
Made a TODO from failing tests - Simplification of known variables is not smart enough to handle operator>> properly-
2012-08-22 16:44:41 +02:00
PKEuS
6364f43b7a
Fixed compiler error introduced recently.
2012-08-22 16:41:11 +02:00
Arpit Chaudhary
7c8da17c44
Added check for detecting if a variable or number is shifted by negative right operand. Statements like:
...
int i = -1;
a << i;
would result in an error message stating undefined behavior.
2012-08-22 15:44:20 +02:00
Kumar Ashwani
afe030ce9b
Fixed #2628 : Detect redudant usage of operator++/-- in switch.
2012-08-22 14:40:57 +02:00
PKEuS
e05a597066
Fixed false negatives in checkautovariables.cpp:
...
- Detect returning temporary instances (#4076 )
- Added support for returning user defined types
2012-08-22 04:08:32 -07:00
PKEuS
00f6c635b8
Detect functions returning a template type in SymbolDatabase
...
Fixed comment
2012-08-22 03:37:50 -07:00
Edoardo Prezioso
2b5cd2effc
Fixed G++ [-Wparentheses] warning. This also fixed #4073 (Crash on self assignment).
2012-08-21 20:15:04 +02:00
Daniel Marjamäki
41b624230f
Fixed #3942 (false positive: (error) Memory leak: keyword)
2012-08-21 17:02:11 +02:00
PKEuS
b4b5c80db9
Improved check: Added message when checking sign of a pointer.
2012-08-21 03:28:02 -07:00
PKEuS
a5bca705a5
New check: Ensure that the return value of std::remove() is used.
2012-08-21 02:30:27 -07:00
PKEuS
b641a10e35
Fixed false negative: memset(foo, 0, sizeof(&foo)); is as suspicious as memset(foo, 0, sizeof(foo));
2012-08-20 10:08:18 -07:00
Daniel Marjamäki
9ffc7f4c2d
Fixed #3964 (False positive: Expressions in array declarations are not simplified 'char mac[17+1];')
2012-08-20 18:10:32 +02:00
PKEuS
a243983242
Refactorized type handling in CheckIO and CheckOther:
...
- Added several types (std::) to isComplexType
- Types in namespace std:: are considered to have no side-effects (solved one TODO)
- Scope of a pointer can be limited without side effects
2012-08-20 08:57:28 -07:00
PKEuS
c537a86363
Fixed false negative in unused variable checking when class without side effects inherits from another one.
2012-08-20 07:55:39 -07:00
PKEuS
c7e2490f2b
Refactorized iterator check:
...
- Handles reassignment (fix for #4062 )
- Better support of execution paths
- Use symboldatabase for better performance
2012-08-20 04:57:24 -07:00
Daniel Marjamäki
7786e12ba2
Fixed #3922 (false positive: (error) null pointer dereference)
2012-08-18 22:11:48 +02:00
Daniel Marjamäki
6a5cc4727d
Fixed #4019 (false positive: (style) Variable 'dest' is assigned a value that is never used)
2012-08-17 16:37:25 +02:00
Daniel Marjamäki
1601baa974
Fixed #4016 (false positive: incorrectLogicOperator)
2012-08-14 16:17:18 +02:00
Daniel Marjamäki
e534ee0426
Fixed #3706 (cppcheck 1.53 hangs when processing a certain template with specializations)
2012-08-13 16:17:33 +02:00
Daniel Marjamäki
8afdde0b5e
Fixed #3931 (FP: Buffer access out-of-bounds)
2012-08-12 17:06:54 +02:00
Edoardo Prezioso
358fb9a284
Fixed the GCC Wshadow warnings introduced recently.
2012-08-12 17:04:37 +02:00
Daniel Marjamäki
4368f66a00
Fixed #4018 (false positive: Dereferencing 'foo' after it is deallocated / released)
2012-08-12 16:18:07 +02:00
PKEuS
2ac2674f67
Fixed #4000 , added support for function prototypes to TemplateSimplifier::templateParameters()
2012-08-12 05:19:56 -07:00
PKEuS
35d94c26d5
Changed creation of SymbolDatabase. Database always created after Tokenizer::tokenize() and Tokenizer::simplifyTokenList() instead of on-demand creation by Tokenizer::getSymbolDatabase.
...
-> With Token::scope() it is possible to access the symboldatabase without having to call getSymbolDatabase(). The change increases safety because it is guaranteed that the database is available in all checks, even if the specific check doesn't call getSymbolDatabase
- Tokenizer::_symbolDatabase does no longer have to be mutable -> Increased const correctness
The change above required two additional changes:
- A bug causing a debug message was fixed in the symboldatabase that became visible in the test suite by the change above.
- Simplify expressions like "struct struct Foo" which might be result of typedef instanciation.
2012-08-12 03:01:24 -07:00
PKEuS
45bad7d1b2
Refactorized tokenizer:
...
- Don't run setVarId() twice, keep old varId's while/after simplifyTokenList
-> Modified two test cases in testmemleak.cpp. I consider this to be safe. Feel free to investigate this.
- Fixed two nullpointer issues shown by cppcheck
Ran Astyle on teststl.cpp
2012-08-10 09:31:22 -07:00
Edoardo Prezioso
1d8240356b
Really fixed #4024 . Now the simplification won't be done on non-executive scopes.
2012-08-10 17:43:09 +02:00
PKEuS
70de691551
Fixed false positive #4032
2012-08-10 06:26:07 -07:00
Daniel Marjamäki
0254344df5
Tokenizer::simplifyEnum: Reverted refactorings/optimisations as there were regressions ( #3949 , #3950 , #4025 )
2012-08-10 14:06:24 +02:00
PKEuS
355c1322d6
Small refactorizations in checkunusedvar.cpp:
...
- Token::Match handles nullpointers
- In chained assignments variables are only written (not read) when assigned
- Fixed crash #4033
2012-08-10 03:36:08 -07:00
Daniel Marjamäki
9f6a11f89c
SymbolDatabase: Added unit test that ensure the dimension is 0 when it is unknown ( #3964 )
2012-08-10 11:01:12 +02:00
Daniel Marjamäki
6ff1760c72
TemplateSimplifier: Improved handling of unknown inner template instantiation inside template instantiation ( #3818 )
2012-08-09 17:19:36 +02:00
Daniel Marjamäki
4ec12209dc
TemplateSimplifier: Fixed wrong match when inner template parameters are wrongly counted ( #3818 )
2012-08-08 06:43:41 +02:00
Daniel Marjamäki
77b8e496d6
fixed testrunner assertion
2012-08-07 16:42:11 +02:00
Daniel Marjamäki
735c0f5f6b
Fixed #3963 (segmentation fault of cppcheck (invalid typedef code))
2012-08-07 16:39:41 +02:00
Edoardo Prezioso
9e916eec66
Fixed #4024 (Tokenizer::simplifyFlowControl removes pieces of code inside a class if 'exit' is a member function).
2012-08-07 10:59:27 +02:00
Edoardo Prezioso
09fd3a6ed7
Fixed a testcase failure from Token::stringifyList change.
2012-08-07 10:22:11 +02:00
Daniel Marjamäki
5ee7758a83
Fixed #4015 (segmentation fault of cppcheck (enum))
2012-08-06 16:21:21 +02:00
Daniel Marjamäki
445fd4e6aa
Fixed #4010 (error (cppcheckError): Internal error. Token::Match called with varid 0)
2012-08-05 17:11:39 +02:00
PKEuS
25ecd3ed71
Message refactorization: checknullpointer.cpp
...
Removed a duplicate test in checknullpointer.cpp
2012-08-05 01:38:48 -07:00
PKEuS
452f95cea0
More robust template detection in clarifyCondition check based on Token::link. ( #3818 )
...
Create links between < and > only on non-C code.
AStyle fix
2012-08-02 04:03:01 -07:00
PKEuS
3b5dabdb14
Clarified errormessage of checkBoost
2012-08-02 02:40:08 -07:00
PKEuS
003a9be3ed
Refactorizations: Made several test functions const according to cppcheck messages.
2012-08-02 02:13:09 -07:00
PKEuS
8594eca9cd
Made several functions in testsuite.cpp const according to cppcheck suggestions
2012-08-01 11:54:55 -07:00
PKEuS
7b25c48f9f
Partially reverted my last commit, since some of the tests were already commented out below.
2012-08-01 11:35:20 -07:00
PKEuS
78bc4ddbad
Fixed unusedFunctions warnings emmitted by cppcheck:
...
- Several tests in testcmdlineparser.cpp were never executed (failing tests commented)
- Unnecessary function in testmemleak.cpp removed.
2012-08-01 11:18:03 -07:00
PKEuS
88e4794d6e
Refactorized CheckClass::checkConst:
...
- Added checking for functions that can be even declared static (#1971 . Removed fix for #1563 )
- Consistent usage of Function::TokenDef to avoid problems with scope identifiers
- Rewrote parsing of function body making it more generic
- Removed three redundant tests
2012-08-01 10:24:38 -07:00
Ettl Martin
98d608231d
spelling fixes
2012-07-31 23:35:56 +02:00
Ville Skyttä
dce16a970d
spelling fixes
2012-07-31 21:28:42 +02:00
Daniel Marjamäki
435340b463
Fixed #3814 (false positive: missing constructor)
2012-07-29 16:01:05 +02:00
PKEuS
26a2379f9f
Fixed false positive #3941 .
2012-07-29 06:39:43 -07:00
PKEuS
1ec3c9f634
Fixed hang in libreoffice code (simplification of K&R style function declaration tried to simplify a function with parameters without name whose implementation contained "; {".
...
Test cases of this simplification only need basic simplifications done in Tokenizer::tokenize
2012-07-29 06:11:48 -07:00
PKEuS
6aa7f984cb
Fixed false positives on FILE* arrays. ( #3965 )
2012-07-29 04:04:12 -07:00
PKEuS
2f95b97c66
Message refactorization: checkobsoletefunctions.h and checknonreentrantfunctions.h
2012-07-29 02:30:03 -07:00
Daniel Marjamäki
0ead18122d
Fixed #3695 (False positive: memory leak (ptr?free(ptr):0))
2012-07-27 12:25:20 +02:00
Daniel Marjamäki
1a6f7ea9a0
Fixed #3998 (Tokenizer::simplifyEnum: wrong handling of expressions => crash)
2012-07-26 11:12:28 +02:00
PKEuS
9834888f19
Removed some duplicate tests and a redundant variable
2012-07-25 01:34:54 -07:00
PKEuS
c11e8cdbfa
Fixed false positive "Variable is not assigned a value" on class types
2012-07-25 00:34:27 -07:00
PKEuS
f5e5d59562
Refactorizations:
...
- Removed redundant newlines at the end of test cases
- Make use of STL algorithms instead of own implementations of std::replace and std::remove+string::erase
- Removed unused variable (found by cppcheck)
- Prefer postfix increment (found by cppcheck)
2012-07-24 12:21:05 -07:00
PKEuS
bb940e4722
Implemented unused variable checking for standard types ( #2851 )
2012-07-24 11:47:29 -07:00
Ettl Martin
a6c54563ae
#2553 added testcase
2012-07-24 15:54:38 +02:00
Daniel Marjamäki
e6f761126c
Fixed #2802 (False positive: ::free() is not recognised as free() to release buffers)
2012-07-24 09:28:08 +02:00
PKEuS
5c0cab238f
Fixed useInitializationList false positives ( #3988 )
2012-07-23 08:16:47 -07:00
PKEuS
ae6201d289
Fixed false positive "Parameter 'x' is passed as a value" for types like std::vector<T>::size_type ( #3986 )
2012-07-23 01:41:20 -07:00
Daniel Marjamäki
a733c9b603
Fixed #3914 (false positive null pointer dereference, assignment in conditional)
2012-07-23 10:05:55 +02:00
Zhao Qifa
188d2e143d
add a performance checker for const assignment
2012-07-22 09:17:00 +02:00
Ville Skyttä
7ab2f6a9fa
Spelling fixes.
2012-07-21 18:11:20 +02:00
Ettl Martin
4312d31b87
#3979 added todo testcases
2012-07-19 09:44:06 +02:00
Daniel Marjamäki
dc6c3228d7
Fixed #3834 (Preprocessor: -U doesn't work)
2012-07-18 20:57:00 +02:00
Daniel Marjamäki
17c27f51ff
Fixed #3791 (False positive: returnTempReference)
2012-07-18 07:22:29 +02:00
Edoardo Prezioso
aedaacba95
Don't report 'warning unknown pragma' message with GCC.
2012-07-18 00:48:45 +02:00
Daniel Marjamäki
a768b0e8b2
Fixed #3954 (Pointer reference memory leak false positive)
2012-07-17 16:28:34 +02:00
Daniel Marjamäki
d34924ba6d
Uninitialized variables: Fixed false positive when there is assignment in condition
2012-07-17 07:03:40 +02:00
Daniel Marjamäki
ddfc968028
Fixed #3891 (False positive 'Double deallocation:' due to ((void*)1))
2012-07-16 17:07:51 +02:00
PKEuS
2103811291
Refactorizations in testrunner:
...
- Removed unnecessary space characters
- Removed comments from test cases which are not preprocessed
2012-07-16 05:02:33 -07:00
PKEuS
7d33181fba
Refactorizations in testrunner:
...
- Avoid creation of std::string instances of static strings where possible in testrunner.
- Removed unnecessary include of tinyxml.h in testcppcheck.cpp
2012-07-16 04:17:14 -07:00
Daniel Marjamäki
a96ec0ad46
Fixed #3804 (False positive: Member not initialized (simplifyTokenList removes const on pointers))
2012-07-16 07:28:59 +02:00
PKEuS
e9182f1fcc
Implemented support for 'using namespace std;': Add std:: prefix to names that are known to be in std namespace. Simplify namespace (std::)tr1:: if C++11 flag is set.
2012-07-15 02:05:19 -07:00
PKEuS
1e704edbd5
Message refactorization: checkio.h/cpp
2012-07-13 10:36:58 -07:00
PKEuS
41fecb2e6d
Fixed evaluation of redundant conditions ( #3972 )
2012-07-13 06:01:19 -07:00
PKEuS
247d820027
Fixed #3972 : Don't issue auto variable error when the address is assigned to a reference to a non-pointer.
2012-07-13 05:21:45 -07:00
PKEuS
4ed15d87b6
Properly fixed test failure and line numbers in uselessCallsEmpty error
2012-07-13 05:15:58 -07:00
Daniel Marjamäki
c6fdd2733b
Test 'Preprocessor: Proper fix for #3690 '
2012-07-13 13:04:10 +02:00
Daniel Marjamäki
e4ad193b40
Fixed #3690 (CppCheck is stuck on evaluating false preprocessor expression( = 0))
2012-07-13 11:28:45 +02:00
Daniel Marjamäki
aa4fe3a1e2
fixed unit test
2012-07-13 08:38:27 +02:00
Daniel Marjamäki
6018bb4636
Fixed #3442 (unmatchedSuppression can't be suppressed)
2012-07-13 08:29:49 +02:00
PKEuS
5a91d6a0f5
Check for useless calls of .empty() ( #3816 )
...
Messages from CheckStl::uselessCalls() only shown when correct severity is enabled.
2012-07-12 03:23:52 -07:00
Daniel Marjamäki
8dd5270be3
Preprocessor: skip preprocessor directives in the Preprocessor::validateCfg function
2012-07-11 21:20:31 +02:00
PKEuS
2bd1f1d8dc
Improved check: Sign checking in printf format string ( #3511 )
...
Removed some redundant code (already covered by token list simplifications and symboldatabase)
2012-07-11 10:46:35 -07:00
Daniel Marjamäki
4f4be79f20
Preprocessor: Fixed bugs in my #3643 fix
2012-07-11 18:29:33 +02:00
PKEuS
e8f4dce25f
Added check to CheckInternal: detect invalid patterns like "%typ%"
...
Replaced some Token::Match by Token::simpleMatch (suggestions of internal checks)
2012-07-11 08:45:16 -07:00
PKEuS
524df179af
Fixed (unexpected) compilation error: Cast argv to 'const char**'
2012-07-11 02:29:20 -07:00
PKEuS
0ea1124a19
Fixed warning of Intel Compiler:
...
- standard conformant main function in testrunner.cpp
Fixed warning of Intel and MSVC Compilers:
- commented out unused parameter
2012-07-11 01:26:32 -07:00
Daniel Marjamäki
17cf24ed34
Fixed #3643 (Preprocessor: Invalid configuration (macro is used in code))
2012-07-10 20:29:04 +02:00
PKEuS
68e19b33ff
Fixed parsing of C++11 initializatation in initializer list ( #3957 )
2012-07-10 06:15:11 -07:00
PKEuS
37d9d6fd7e
Improved parsing of C++11 initializer list ( #3956 ) in CheckClass::initializeVarList.
2012-07-10 05:47:51 -07:00
PKEuS
a93c47988c
Restored comment that was modified by accident.
2012-07-09 11:40:49 -07:00
PKEuS
4b3ee97f54
Fixed test failures.
2012-07-09 11:36:28 -07:00
PKEuS
b5589e41f9
Cleanup of VS10 solutions (As suggested by XhmikosR). Fixed problems:
...
- UNICODE set correctly
- Fixed path to pcre.lib; use external library directories
- Removed several unnecessary and redundant flags from projects
Thank you for your help, XhmikosR!
2012-07-09 08:09:54 -07:00
Edoardo Prezioso
fae40c4782
Change every C version of 'size_t' to C++ 'std::size_t'.
2012-07-09 13:30:18 +02:00
PKEuS
639f15645a
Message refactorization: checkbufferoverrun.cpp (2), checkclass.cpp, checkexceptionsafety.h
2012-07-09 02:11:05 -07:00
PKEuS
ed7e950671
Message refactorization: checkbufferoverrun.cpp
2012-07-08 06:51:24 -07:00
Daniel Marjamäki
848fd59cbd
Fixed #3913 (boundcheck, false positive continue in loop)
2012-07-08 14:34:47 +02:00
PKEuS
1032312fe1
Committed forgotten test64bit.cpp; tests should work again.
2012-07-08 05:28:17 -07:00
Daniel Marjamäki
bf98e952c1
Fixed #3927 (false positive: (error) Uninitialized variable: new)
2012-07-08 13:59:00 +02:00
PKEuS
0f1cb4c98c
Message refactorization: checkassignif.cpp, checkautovariables.cpp
2012-07-07 11:31:18 -07:00
PKEuS
43c060b630
Removed preprocessor directives from tests that aren't preprocessed before being tokenized.
2012-07-07 11:21:08 -07:00
Pino Toscano
5262ba16d9
Fixed #3947 (build failure if PATH_MAX is not defined)
2012-07-07 19:55:43 +02:00
Daniel Marjamäki
49198f52c4
Fixed #3934 (False positive for logical conjunction with enum and define)
2012-07-07 15:34:26 +02:00
PKEuS
d3c44c20ff
Refactorized checking of scanf field width specifiers ( #3946 ):
...
- Removed duplicate check
- Changed severity to portability, when a crash only happens with certain libc versions
- Fixed handling of * in format string (#3877 )
- Added support for [...] pattern
- Removed garbage from tests
2012-07-07 04:34:37 -07:00
PKEuS
dec4844c10
Define _WIN64 in VS10 solution when compiling for x64
2012-07-07 02:41:41 -07:00
PKEuS
2c9545f603
Fixed #3797 : _ is a valid character in suppression IDs
2012-07-06 09:16:43 -07:00
PKEuS
5caab6ba10
Fixed crash on garbage code ( #3870 )
2012-07-06 09:03:33 -07:00
Daniel Marjamäki
7122aeff58
Fixed #3617 (CLI: '-DMACRO' should be considered as '-DMACRO=1')
2012-07-05 19:35:41 +02:00
Daniel Marjamäki
f9da83f4b5
Fixed #3926 (false postive: (error) Uninitialized variable: exitpattern)
2012-07-03 18:52:23 +02:00
Robert Morin
25c1cc4c8e
Improve check: warn when comparing boolean value with < <= > >=. Ticket: #2617
2012-07-03 06:39:13 +02:00
Thomas Sondergaard
f72ddbb2e9
Fixed #3912 (Analysis failed)
2012-07-03 06:34:14 +02:00
Ettl Martin
7401104f45
#2773 added missing testcase
2012-07-02 10:01:37 +02:00
Daniel Marjamäki
325414e354
CheckLeakAutoVar: Updated error messages
2012-06-30 16:23:10 +02:00
Daniel Marjamäki
bb9f114d84
Fixed #3924 (False positive: Uninitialized variable (const pointer))
2012-06-30 12:12:36 +02:00
Daniel Marjamäki
cb7757f650
CheckUnusedVar: dont report false positives for extern variables
2012-06-28 17:22:56 +02:00
Daniel Marjamäki
2e3a08a8c1
Fixed #3916 (false positive: uninitialized variable when using assignment and , in rhs)
2012-06-27 20:44:19 +02:00
Daniel Marjamäki
9da3373876
Fixed #3919 (False positive: uninitialized variable (extern))
2012-06-26 18:28:41 +02:00
Daniel Marjamäki
0042ee7bc8
Fixed #3660 (False positive memleak (allocation function uses non-local variable))
2012-06-25 20:00:50 +02:00
PKEuS
f5c42660de
Fixed #3909 : Handle constructor syntax initialization.
2012-06-24 09:57:17 -07:00
Daniel Marjamäki
25b24d149f
Fixed #3910 (False positive: Variable is not assigned a value (pointerArray alias))
2012-06-24 16:54:37 +02:00
Daniel Marjamäki
8af044255d
Tokenizer: Added new function isFunctionParameterPassedByValue that check if a parameter is passed by value
2012-06-24 13:40:09 +02:00
Ettl Martin
8c39b95aae
#3873 added testcase to make sure false positive does not appear again.
2012-06-24 00:00:15 +02:00
Daniel Marjamäki
abde1d0ec1
added comment in test case
2012-06-23 20:20:11 +02:00
Daniel Marjamäki
72d24ab4b4
Fixed #3904 (false positive memory leak with linked list)
2012-06-23 20:15:58 +02:00
Daniel Marjamäki
162a430354
Fixed #3868 (false positive: (style) Same expression on both sides of '|'.)
2012-06-23 19:54:15 +02:00
Daniel Marjamäki
f59078fad9
Refactoring TestUninitVar. Added TODO test case.
2012-06-23 16:44:02 +02:00
Daniel Marjamäki
1e1b20d113
Refactoring TestUninitVar. Created TestUninitVar::uninitvar_return
2012-06-23 16:27:57 +02:00
Daniel Marjamäki
b6f4dbd067
Uninitialized variables: Fixed TODO assertion (related with ticket #3106 )
2012-06-23 16:06:20 +02:00
Daniel Marjamäki
d3ce3e78bd
Uninitialized variables: Added test case
2012-06-23 15:52:35 +02:00
Daniel Marjamäki
7f5950967e
Reviewed handling of >> in return statements in C files in UninitVar checking
2012-06-23 15:47:48 +02:00
Daniel Marjamäki
f0f69ed818
Reviewed handling of << and >> in C files in CheckUninitVar
2012-06-23 12:41:00 +02:00
Daniel Marjamäki
e2964c0c9e
Uninitialized variables: Fixed false negative when ? operator is used in rhs
2012-06-23 12:19:03 +02:00
Daniel Marjamäki
5de82c1c42
Updated arrayIndexOutOfBounds error message. Thank you Kimmo for the suggestion.
2012-06-23 09:51:32 +02:00
Daniel Marjamäki
4e98cb3ed9
Fixed #3907 (improve check: detect buffer overrun when using && or || in for loop)
2012-06-23 09:23:14 +02:00
Daniel Marjamäki
ac524c56ad
Reviewed handling of unknown types in ExecutionPathBufferOverrun
2012-06-23 08:15:59 +02:00
Robert Reif
dc4982115a
Improved checking of scanf format strings
2012-06-23 07:52:52 +02:00
Daniel Marjamäki
3db58bb57f
Reviewed C handling in CheckOther::clarifyCondition, never treat x<..> as a template in C files.
2012-06-23 07:29:49 +02:00
Daniel Marjamäki
d2dbaca24b
Reviewed handling of unknown types in C files in UninitVar
2012-06-22 19:57:07 +02:00
Daniel Marjamäki
abaa044e03
Reviewed handling of unknown types in CheckUninitVar
2012-06-22 16:39:39 +02:00
Daniel Marjamäki
354406441a
Fixed #3906 (false positive uninitvar for vector pointer)
2012-06-22 16:26:43 +02:00
Daniel Marjamäki
951da02f89
Reviewed handling of unknown types in C files in checkunusedvar
2012-06-22 15:59:41 +02:00
Daniel Marjamäki
8aba801360
Fixed #3800 (False negative: Self-assignement of variable declared as 'extern')
2012-06-22 11:23:50 +02:00
Daniel Marjamäki
935351c601
Fixed #3895 (Improve check: double deallocation not detected (if-else))
2012-06-22 09:10:30 +02:00
Daniel Marjamäki
3d0e090a13
Fixed #3899 (false positive: (error) Returning/using deallocated pointer fp)
2012-06-20 17:09:41 +02:00
Daniel Marjamäki
974225626d
Fixed #3901 (false positive: (error) Uninitialized variable: temp)
2012-06-19 20:07:39 +02:00
Daniel Marjamäki
ce5c38f52c
Fixed #3890 (False positive Uninitialized variable on returning default value on a class member)
2012-06-19 20:04:10 +02:00
Kimmo Varis
fe9e6130cf
Add general PRO file for console builds.
...
It is easier to maintain PRO files when we keep all the console-
build specific general options in one file. For example changes to
compiler options affect to all console builds.
2012-06-18 09:28:32 +03:00
Daniel Marjamäki
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