Pavel Roschin
651ebcf17b
Add GLib library, add GLib tests (some new bugs found)
2014-02-02 22:45:57 +04:00
Daniel Marjamäki
ef35b6b1b4
Merge pull request #230 from xypron/5355
...
5355: False positive var not assigned
2014-02-02 10:10:55 -08:00
Daniel Marjamäki
0166a717c5
Merge pull request #229 from scriptum/#3236
...
Added regression for #3236
2014-02-02 09:52:14 -08:00
Heinrich Schuchardt
6bfd4af5f7
5355: False postive var not assigned
...
Avoid false positive "variable not assigned" for
struct Fred{
};
void foo () {
Fred fred;
throw fred;
}
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2014-02-01 22:40:35 +01:00
Martin Ettl
6ca7daec10
Fixed #389 : Providing negative value to memory allocation function.
2014-02-01 22:38:29 +01:00
Pavel Roschin
e06e96e864
Added regression for #3236 (Failure to detect memory leak if pointer members are added)
2014-02-01 15:51:29 +04:00
Simon Martin
8ff9696374
OSX's compiler supports C++11 but one needs to use GNU's STL to build cppcheck, that does not have cbegin/end.
2014-02-01 07:40:08 +01:00
Daniel Marjamäki
b3bfd5014d
Fixed #5433 (FP:Possible null pointer dereference)
2014-01-31 15:43:34 +01:00
Daniel Marjamäki
9aa9530e0d
Fixed #5426 (crash: btrfs-progs cmds-inspect.c)
2014-01-31 06:19:36 +01:00
Lucas Manuel Rodriguez
a34d2eb7b3
Fixed #4938 : (.empty() method false positive for non-STL classes)
2014-01-30 18:09:24 -03:00
Daniel Marjamäki
d6e3b3d3f3
ast: fixed syntax tree for 'a=(b)?1:0'. The parentheses should not be in the syntax tree
2014-01-30 17:31:06 +01:00
Daniel Marjamäki
30b56437c1
Merge pull request #226 from scriptum/rpg-fix-function-parameter
...
CheckMemoryLeak: improve leak checking in function parameters
2014-01-28 20:32:56 -08:00
Daniel Marjamäki
312780b6fc
TestTokenizer: refactored line2 test case
2014-01-28 17:18:28 +01:00
Kamil Dudka
dee18d10a8
Fixed #5423 (fix parsing of #line NNNN "file.c")
2014-01-28 17:15:07 +01:00
Daniel Marjamäki
abe8439917
Fixed #5416 (False positive: Array accessed at index, which is out of bounds.)
2014-01-28 16:55:10 +01:00
Lucas Manuel Rodriguez
2048313915
Add Variable::isStlType function
2014-01-28 11:44:56 -03:00
Pavel Roschin
2396073262
CheckMemoryLeak: improve leak checking in function parameters
2014-01-28 17:30:36 +04:00
Daniel Marjamäki
2108251851
Fixed #5417 (ast: avoid hang when '({})' is used)
2014-01-28 06:11:53 +01:00
Daniel Marjamäki
b8b573321e
CheckNullPointer: Update std.cfg and test that updates are correct
2014-01-27 17:33:16 +01:00
Daniel Marjamäki
6e6de82323
CheckMemoryLeak: test alloc/dealloc configuration in posix.cfg
2014-01-27 16:51:18 +01:00
Daniel Marjamäki
c8a1424e10
Fixed #5406 (crash inside valueFlowBeforeCondition() on files from kernel-git)
2014-01-27 06:18:42 +01:00
Daniel Marjamäki
2b8cf462c9
CheckMemoryLeak: Move posix-opendir/closedir to library
2014-01-26 17:02:36 +01:00
Daniel Marjamäki
87b67e9b77
TestNullPointer: Added test configuration for 'memcmp' that is needed by a test
2014-01-26 16:32:28 +01:00
Daniel Marjamäki
0c47555423
CheckNullPointer: use library instead of hard coded info
2014-01-26 16:19:49 +01:00
Daniel Marjamäki
be082a8e4a
value flow: added bailout for conditional return/continue/break when number_of_if is bigger than 0
2014-01-26 15:50:25 +01:00
Daniel Marjamäki
c5971b7137
value flow: fix fp when conditional value is assigned
2014-01-25 20:14:49 +01:00
Daniel Marjamäki
c1e35e1df1
value flow: fixed multivariable problem in condition
2014-01-25 19:13:33 +01:00
Daniel Marjamäki
df0995edf5
Fixed #5403 (Value flow: FP because post increment/decrement is not handled correctly)
2014-01-25 18:31:02 +01:00
Daniel Marjamäki
bc9ad08831
Fixed #5245 (false positive: Uninitialized variable (assignment inside ternary operator))
2014-01-25 10:12:50 +01:00
Daniel Marjamäki
35b51468cb
value flow: Fixed FP for division then check in for loop: 'for (a=b/x;x>0;x--)'
2014-01-25 09:22:32 +01:00
Daniel Marjamäki
4647a9fc93
Fixed #5401 (value flow: fp when there are increment/decrement)
2014-01-24 18:22:38 +01:00
Daniel Marjamäki
1cac7e1686
value flow: better handling in function call bailout of casting address of variable
2014-01-24 17:47:49 +01:00
Tobias Weibel
9d55265e6b
Replaced duplicated logf(2.0) with logf(2.0f) unittest
2014-01-23 16:19:30 +01:00
Daniel Marjamäki
ec034c1d59
Fixed #5386 (ast: hang when code is 'for (T a : b)')
2014-01-23 06:13:24 +01:00
Daniel Marjamäki
0dbb86f0cb
Cleanup ExecutionPath from CheckBufferOverrun
2014-01-22 21:25:37 +01:00
Daniel Marjamäki
1d7bb05faf
Remove ExecutionPath from CheckNullPointer
2014-01-22 20:24:51 +01:00
Daniel Marjamäki
f3f7e6d302
value flow: replacing executionpath checking of null pointers
2014-01-22 20:16:31 +01:00
Daniel Marjamäki
43db1ee797
value flow: use more specific bailouts when analysing value flow after assignment
2014-01-22 06:38:25 +01:00
Daniel Marjamäki
cc38dec3ad
value flow: a bit better handling of assigned variable
2014-01-22 06:10:17 +01:00
Daniel Marjamäki
a27ccbd0f8
value flow: start implementing value flow analysis of assigned value
2014-01-21 21:13:49 +01:00
Daniel Marjamäki
b91f42453b
value flow: improved handling of cast
2014-01-20 22:26:55 +01:00
Daniel Marjamäki
bb3cc67aaa
value flow: improved calculations that depends on variable
2014-01-20 21:45:30 +01:00
Daniel Marjamäki
98305e9163
astyle formatting
2014-01-20 06:31:28 +01:00
Daniel Marjamäki
7ff7bc1c2e
Fixed #5376 (false positive: zerodivcond (style) Either the condition 'B>0' is useless or there is division by zero)
2014-01-19 20:16:55 +01:00
Daniel Marjamäki
84c5f47eb1
value flow: bailout for class variables that are non-const
2014-01-19 11:55:02 +01:00
Daniel Marjamäki
ccda78f347
value flow: fixed todo assertion for handling of conditions
2014-01-19 09:31:40 +01:00
Daniel Marjamäki
cdaa7abf7e
value flow: better handling of conditional code below || && ?: operators
2014-01-19 09:05:48 +01:00
Daniel Marjamäki
77f3f6c21a
valueflow: added setTokenValue that perform calculations using set value
2014-01-18 19:30:44 +01:00
Daniel Marjamäki
6a3a9ee8e7
ast: fixed tree for 'sizeof(struct S)'
2014-01-18 13:18:11 +01:00
Daniel Marjamäki
c7032a8867
value flow: improved handling of loops
2014-01-18 11:54:00 +01:00
Daniel Marjamäki
d0d56aee4a
TestValueFlow: split up valueFlowBeforeCondition into smaller functions
2014-01-18 08:45:24 +01:00
Daniel Marjamäki
3e23e243f6
BufferOverflow: Updated message for out of bounds array index or redundant condition
2014-01-17 19:44:45 +01:00
Daniel Marjamäki
57d318b2e5
valueflow: better handling of increment/decrement
2014-01-17 19:28:28 +01:00
Daniel Marjamäki
18d6285ad2
BufferOverrun: Improved error message when array index is used before checking that its in limits
2014-01-17 18:56:46 +01:00
Daniel Marjamäki
36acfb6d20
Fixed Cppcheck warning. db is dereferenced before its checked against NULL
2014-01-17 18:10:10 +01:00
Daniel Marjamäki
30cae358d8
Removed the --value-flow flag. ValueFlow analysis will always be enabled from now on.
2014-01-17 18:07:05 +01:00
Daniel Marjamäki
3facc06cb7
CheckOther: Removed non-valueflow check for division by possible zero before condition
2014-01-17 17:42:54 +01:00
Daniel Marjamäki
0203a4a6f5
Tokenizer: Removed simplifyGoto as it's the cause of various FPs I see
2014-01-17 17:36:45 +01:00
Daniel Marjamäki
4eb746d7cc
Tokenizer: Removed simplifyComparisonOrder
2014-01-17 17:25:56 +01:00
Daniel Marjamäki
0b4de97e2b
value flow: Use ValueFlow in CheckBufferOverrun
2014-01-16 19:23:14 +01:00
Daniel Marjamäki
85b73f7c24
ast: fixed hang for weird loop: 'for (each_window(list,p))'
2014-01-16 16:58:50 +01:00
Daniel Marjamäki
e72ec830ef
ast: fixed hang in for-loop handling
2014-01-16 06:45:35 +01:00
Daniel Marjamäki
141e089329
ast: different handling of for loops. create a syntax tree for whole 'f(a;b;c)'.
2014-01-15 17:32:14 +01:00
Daniel Marjamäki
d43191a9e3
value flow: remove duplicate test case
2014-01-14 18:13:17 +01:00
Daniel Marjamäki
c547c9a108
value flow: fixed fp when variable is used in for-loop condition
2014-01-14 17:57:50 +01:00
Daniel Marjamäki
e45a2e2c61
Fixed #5347 (False positive: uninitialized variable (try catch))
2014-01-14 06:24:09 +01:00
Robert Reif
d679a4c1f7
Fixed #5248 (False positive: Invalid argument in scanf for %zd)
2014-01-14 06:09:13 +01:00
Daniel Marjamäki
eb774054b0
Merge pull request #210 from matthiaskrgr/travis
...
travis: rewrite config file.
2014-01-13 10:44:36 -08:00
Daniel Marjamäki
7981e3d38f
value flow: fix fp when gotos are used
2014-01-13 16:07:25 +01:00
Daniel Marjamäki
b1bbb23225
value flow: fixed fp when checking symboldatabase
2014-01-13 05:52:28 +01:00
Matthias Krüger
962018b722
revert: commit f6da9d4e3c
...
"testcmdlineparser: comment out unused functions fileListStdin(), ignorepaths{1-4}(), ignorefilepaths{1,2}()"
instead suppress the files.
also suppress unused variable in test/testpreprocessor.cpp
2014-01-12 22:47:21 +01:00
Daniel Marjamäki
c9e9262682
value flow: use checknullpointer checking based on new value flow analysis in the TestNullPointer
2014-01-12 19:51:05 +01:00
Daniel Marjamäki
5d2a39b580
CheckNullPointer: improved function call checking when new value flow analysis is used
2014-01-12 19:27:26 +01:00
Daniel Marjamäki
2e67ca06c0
value flow: some simplifications in unknown functions when there is library configuration
2014-01-12 18:19:00 +01:00
Daniel Marjamäki
d700114edf
value flow: bailout if condition is defined by macro
2014-01-12 17:16:51 +01:00
Daniel Marjamäki
bef56d7a70
reverted change I pushed by mistake
2014-01-12 15:44:40 +01:00
Daniel Marjamäki
424675982a
dmake: use -std=c++0x instead of -std=c++11 as it's supported by earlier gcc
2014-01-12 15:38:51 +01:00
Heinrich Schuchardt
f6510a6b45
Fixed #5339 (Tokenizer::setVarId : function-pointer function argument not getting variable id, causing FP)
2014-01-12 15:15:09 +01:00
Daniel Marjamäki
3d79613f2b
value flow: more bailouts when return/break/continue/goto is reached. TODO: handle these better.
2014-01-12 15:07:58 +01:00
PKEuS
b775714e3d
Moved several hardcoded function names in format string checking into libraries (std.cfg and windows.cfg).
...
Added support for loading a library in test suite.
2014-01-12 03:44:24 -08:00
Daniel Marjamäki
d8262963d9
value flow: condition in loop, bailout valueflow analysis before loop if there is assignment inside the loop
2014-01-12 11:58:10 +01:00
Daniel Marjamäki
e3496080c8
Fixed #5334 (False positive: same expression on both sides of '||')
2014-01-12 07:40:56 +01:00
Daniel Marjamäki
f58e1ab80e
value flow: fixed fp in switch
2014-01-11 21:21:00 +01:00
Daniel Marjamäki
3625d179e5
value flow: don't perform value flow analysis in sizeof/typeof expressions
2014-01-11 21:10:01 +01:00
Daniel Marjamäki
680d3f1312
value flow: fixed fp for nested assignments
2014-01-11 20:53:23 +01:00
Daniel Marjamäki
4d045879aa
value flow: fixed fp when while condition contains variable that is changed in loop body
2014-01-11 20:25:49 +01:00
Daniel Marjamäki
75f9111775
value flow: bailout when variable is used in assignment to itself
2014-01-11 15:36:09 +01:00
Daniel Marjamäki
1fc2c9fe79
ast: fixed syntax tree for statement enclosed in parentheses ';(expr);'
2014-01-11 15:18:39 +01:00
Daniel Marjamäki
ceca6be22b
Fixed #5334 (False positive: same expression on both sides of '||')
2014-01-11 15:15:01 +01:00
Daniel Marjamäki
eaf8c83db5
value flow: refactoring. broke out function for skipping value simplifications in expressions.
2014-01-11 14:54:10 +01:00
Daniel Marjamäki
85dcb14813
value flow: bailout in valueFlowBeforeCondition if variable can be assigned by subfunction
2014-01-11 14:31:51 +01:00
Daniel Marjamäki
02b92efd1a
value flow: improved analysis of expressions below ?, && and || operators
2014-01-11 12:44:55 +01:00
Daniel Marjamäki
60348da1b5
value flow: fixed fp for rhs in && and || expressions
2014-01-11 11:30:34 +01:00
Daniel Marjamäki
4e7e56df9f
astyle formatting
2014-01-11 07:54:06 +01:00
Daniel Marjamäki
1ad94a8be5
value flow: loosen up bailouts in valueFlowSubFunction
2014-01-11 07:52:25 +01:00
Matthias Krüger
f6da9d4e3c
testcmdlineparser: comment out unused functions fileListStdin(), ignorepaths{1-4}(), ignorefilepaths{1,2}()
2014-01-10 21:08:12 +01:00
Matthias Krüger
4f918e1c8c
testsuite: remove function todoAssert() which is unused according to cppcheck.
2014-01-10 21:08:11 +01:00
Matthias Krüger
d9ce61a9d6
testsuite: according to cppcheck, the function printTests() is not used, remove it.
2014-01-10 21:08:11 +01:00
Matthias Krüger
6feb0faf4c
testbool: same for checkComparisonOfBoolWithBool
2014-01-10 21:08:11 +01:00
Matthias Krüger
3602cc2f6a
testsymboldatabase: run symboldatabase32, probably someone forgot to implement this.
2014-01-10 21:08:11 +01:00
Daniel Marjamäki
c687933e9f
value flow: improved handling of for loops
2014-01-10 18:19:24 +01:00
Daniel Marjamäki
3eebc8a9f1
test1
2014-01-10 16:51:58 +01:00
Daniel Marjamäki
acb103e214
value flow: skip scopes that don't contain variable
2014-01-10 16:13:39 +01:00
Daniel Marjamäki
d085705e8f
value flow: assume that value of global const variable is not changed
2014-01-10 05:47:56 +01:00
Daniel Marjamäki
752e9d0fb7
Tokenizer::varId: Fixed wrong varid for shadow types with same names as class members
2014-01-09 21:44:29 +01:00
Daniel Marjamäki
1be30bf022
ast: fixed handling of templates
2014-01-09 17:14:16 +01:00
XhmikosR
96b62c6ccb
Fix the C4800 warnings.
2014-01-09 16:58:42 +02:00
Daniel Marjamäki
04cb56e070
ast: fixed trouble with 'ab=a+(b/(c))+d;' where the '(c)' could be mistaken for a cast
2014-01-08 21:49:42 +01:00
Daniel Marjamäki
4f11086505
Tokenizer: Don't remove parentheses in 'a?b:(c>0?d:e)'
2014-01-08 20:53:33 +01:00
Daniel Marjamäki
644004573b
Preprocessor: fixed 8.0E+007 in macros
2014-01-08 18:05:14 +01:00
Daniel Marjamäki
7c4a7ac3d5
value flow: starting to refactor CheckNullPointer::nullPointerDeRefThenCheck
2014-01-08 17:37:39 +01:00
Daniel Marjamäki
9c50deda64
value flow: reverted TestOther, don't use value flow in test cases yet
2014-01-08 16:18:50 +01:00
Daniel Marjamäki
a2fe1ebe92
value flow: pass result of bool operator to function
2014-01-08 16:17:47 +01:00
Daniel Marjamäki
6d22c9deaa
value flow: if unsigned variable is compared against 1 with either >= or <= then assume it can have the value 0
2014-01-08 06:53:17 +01:00
Daniel Marjamäki
1e3c43e708
value flow: improved bailouts in ?:
2014-01-08 06:39:15 +01:00
Daniel Marjamäki
dfee044925
value flow: Fixed wrong value in subfunction after conditional return
2014-01-08 06:04:51 +01:00
Daniel Marjamäki
1fb0b1750c
value flow: Fixed FP in ?:
2014-01-07 19:46:13 +01:00
Daniel Marjamäki
740f72fdbd
value flow: simple handling of for loops
2014-01-07 19:20:56 +01:00
Martin Ettl
fa04273473
Merge branch 'master' of https://github.com/danmar/cppcheck
2014-01-06 18:51:15 +01:00
Daniel Marjamäki
a6320a35e0
value flow: added experimental subfunction handling
2014-01-06 16:37:52 +01:00
Daniel Marjamäki
58fb2e756b
Value flow: added bailout on }
2014-01-06 11:27:56 +01:00
Daniel Marjamäki
d172e9bb29
value flow: Fixed testing
2014-01-06 10:09:49 +01:00
Daniel Marjamäki
c4fa3bb137
value flow: added bailouts for global variables and assignments
2014-01-06 07:44:58 +01:00
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