PKEuS
0d127f15a5
Fixed grammar mistake; fixed two VS2013 code analysis messages; removed redundant Token::Match call
2015-03-15 10:06:56 +01:00
Daniel Marjamäki
a200e5b32f
Merge pull request #551 from simartin/ticket_4335
...
Ticket #4335 : Properly detect and handle template class specialisations
2015-03-15 07:59:11 +01:00
Simon Martin
520314f9a0
Ticket #4335 : Properly detect and handle template class specializations.
2015-03-15 00:28:33 +01:00
Alexander Mai
5b8d93efda
posix.cfg: Fix false positives and add poll()
2015-03-14 23:31:56 +01:00
amai2012
40769c9a59
Merge pull request #549 from simartin/ticket_6437
...
Ticket #6347 : Fix use after delete when simplifying template instantiations
2015-03-14 22:30:58 +01:00
PKEuS
4ec2df92b7
Refactorized testsimplifytypedef.cpp, fixed broken unit test simplifyTypedef99
2015-03-14 20:43:15 +01:00
Daniel Marjamäki
0efa113b6e
fixed test/cfg/posix.c code
2015-03-14 19:40:13 +01:00
Daniel Marjamäki
fd6bd97972
Fixed #6495 (Improve check: uninitialized variable, 3rd function argument)
2015-03-14 19:23:33 +01:00
Simon Martin
4c916641cc
Ticket #6347 : Fix use after delete when simplifying template instantiations.
2015-03-14 18:46:17 +01:00
Daniel Marjamäki
42c4aa1c49
Fixed #4880 (false negative: uninitialized variable, handling of conditional noreturn scopes)
2015-03-14 17:59:11 +01:00
Alexander Mai
d52e3c8eb7
Fix missing suppression in test/cfg/posix.c
2015-03-13 18:29:46 +01:00
PKEuS
6e0302fd56
Refactorized CheckBool::checkComparisonOfBoolWithInt(), CheckBool::checkComparisonOfBoolExpressionWithInt() and CheckBool::pointerArithBool():
...
- Support more patterns in CheckBool::pointerArithBool()
- Use AST and SymbolDatabase
- Removed redundant skipping over template arguments
2015-03-12 20:07:48 +01:00
PKEuS
7f2b6881b3
Refactorization: Avoid including path.h in (almost) every source file (via library.h)
2015-03-11 22:54:45 +01:00
PKEuS
bc5132e0ac
Refactorization: Moved declaration of errout, ... to testsuite.h, uniformized style
2015-03-11 22:54:43 +01:00
PKEuS
cd84d78e92
Ran AStyle, fixed VS2015 warning in symboldatabase.h
2015-03-11 20:26:53 +01:00
PKEuS
9bafa3bf25
Fixed false positive #6575
2015-03-11 20:25:27 +01:00
Alexander Mai
c8bee3e1a6
Merge branch 'master' of https://github.com/danmar/cppcheck
2015-03-11 18:59:56 +01:00
Alexander Mai
6bd7dd771d
Add some functions from <time.h> to posix.cfg (see #6577 )
2015-03-11 18:59:34 +01:00
amai2012
ed097d4c4f
Merge pull request #540 from JakubMelka/ticket_695
...
Ticket #695 : new style check : explicit declaration of ctor
2015-03-11 12:15:22 +01:00
Jakub Melka
e1e1dbfe97
Ticket #695 : Fixed VS 2010 issue, switched to "style" severity, changed error messages and updated unit tests
2015-03-10 19:35:12 +01:00
Martin Ettl
0839ce5a96
posix.cfg: Removed duplicate utime() function introduced by 841a27c19d
. Added more test cases for uninitvar for utime() and utimes().
2015-03-08 21:38:43 +01:00
amai2012
3d9c2b4d97
Merge pull request #542 from MegaManSec/master
...
Add utime function to posix.cfg
2015-03-08 19:55:41 +01:00
Jakub Melka
b7d92a4fc7
Fixed warnings of CppCheck's own code (caused by new check #695 )
2015-03-08 18:18:09 +01:00
Daniel Marjamäki
780a530e0e
test/cfg/windows.cpp: Added test for #6571 , Library::isNotLibraryFunction() should return true for methods.
2015-03-08 16:23:54 +01:00
Alexander Mai
34a61e0883
Additions to windows.cfg. Fix compiler warning in test/cfg/posix.c
2015-03-08 15:21:50 +01:00
Joshua Rogers
841a27c19d
Add utime function to posix.cfg
2015-03-09 00:43:25 +11:00
Alexander Mai
95411414c4
#6569 Add strcasestr function to gnu.cfg
2015-03-08 14:04:09 +01:00
Simon Martin
1d973b882d
Ticket #6567 : Handle member functions in TemplateSimplifier::getTemplateNamePosition.
2015-03-07 21:52:12 +01:00
Jakub Melka
2af9212b16
Ticket #695 : new style check : explicit declaration of ctor
2015-03-07 20:07:54 +01:00
Simon Martin
9c6a625f91
Ticket #6181 : Normalize '>>' into '> >' when it's closing a C++11 template parameter list.
2015-03-07 11:06:04 +01:00
Daniel Marjamäki
f705cdce72
Fixed #6556 (Tokenizer::simplifyVarDecl: doesn't simplify template variables properly)
2015-03-06 17:30:20 +01:00
Alexander Mai
21ab4413aa
Fix compiler warnings
2015-03-05 20:49:42 +01:00
Alexander Mai
cbc8c4f57d
Fix unsuppressed warning in checkcfg target
2015-03-05 06:57:30 +01:00
Alexander Mai
b5f0eec44a
#6559 Regression/ false positive: Return value of allocation function OpenFile is not stored. Add required definitions to windows.cfg, include afx_msg. Add test file test/cfg/windows.cpp to check windows configuration. Fix for gnu.cfg. FileLister now features a non-recursive mode.
2015-03-05 06:48:44 +01:00
Daniel Marjamäki
6646a896f9
Fixed #6446 (FP zerodivcond on double arithmetics)
2015-03-03 15:50:31 +01:00
Daniel Marjamäki
925f077b8a
Fixed #6110 (TemplateSimplifier::simplifyCalculations: wrong simplification of 'if (VG_(strlen)(s)>=3)')
2015-03-02 16:27:00 +01:00
Daniel Marjamäki
86cdc8e7a6
Fixed #6540 (Tokenizer::simplifyKnownVariables: Missing varid for simplification in conditional code)
2015-03-02 06:18:00 +01:00
Alexander Mai
49099e78ff
Add more string conversion functions to library files
2015-03-01 20:18:26 +01:00
Daniel Marjamäki
830f656a25
Library: variables are not library functions (variable declarations can look like function calls)
2015-03-01 11:46:43 +01:00
Daniel Marjamäki
449b88aa0c
Fixed #6547 (Regression - unknown macro causes analysis error)
2015-02-28 11:09:39 +01:00
Daniel Marjamäki
3add466035
Add isFunctionHead() in Tokenizer
2015-02-27 18:29:34 +01:00
Daniel Marjamäki
acbf48c7fa
Fixed #6548 (Tokenizer: Wrong varid set after function which is throw())
2015-02-26 16:31:42 +01:00
Alexander Mai
cea71f8625
Fix false positive ignoredReturnValue about strtol
2015-02-25 22:03:10 +01:00
Daniel Marjamäki
d1892786b8
ValueFlow: Improved when using '[' on arrays and strings
2015-02-24 15:57:39 +01:00
Alexander Mai
8427398d9d
#6539 Segmentation fault in Tokenizer::duplicateTypedef. Avoid crash on garbage code
2015-02-24 11:15:23 +01:00
Robert Reif
130ffc5752
Fixed #6538 (Symboldatabase: improve isFunction)
2015-02-24 06:11:31 +01:00
Alexander Mai
b9cc5b5c6b
#6543 crash: CheckCondition::checkBadBitmaskCheck ; wine dlls/gdi32/dibdrv/primitives.c. Run astyle.
2015-02-23 22:06:55 +01:00
Daniel Marjamäki
fb5cc6fded
Fixed #5905 (isSameExpression: comparisons 'a<b' and 'a>b' are same)
2015-02-23 16:38:55 +01:00
Daniel Marjamäki
830d1eb3fd
Revert "Fixed #6538 (Symboldatabase: improve isFunction)"
...
This reverts commit d7ef89bbe6
.
There was crashes in a Travis job.
2015-02-23 08:07:19 +01:00
Robert Reif
d7ef89bbe6
Fixed #6538 (Symboldatabase: improve isFunction)
2015-02-23 06:49:50 +01:00
Alexander Mai
fd7d29447d
std.cfg: snprintf(NULL,0,) is legal. Fix some testcases in test/cfg as well
2015-02-22 14:25:25 +01:00
Daniel Marjamäki
d4fa656e58
Refactor and improve Tokenizer::sizeofAddParentheses
2015-02-22 13:38:06 +01:00
PKEuS
bedc935ab0
New check: Warn about constant expression if ( unknown | non_null_constant) ( #6519 )
2015-02-22 13:09:39 +01:00
PKEuS
5f31242ee8
CheckOther::checkRedundantAssignment(): Bail out on inline assembly ( #6525 )
2015-02-22 12:03:53 +01:00
PKEuS
f04070940e
Fixed setVarId on ternary operator in initialization list
2015-02-22 11:57:46 +01:00
Alexander Mai
6bfeb71dd2
Add more interfaces to gnu and posix libraries
2015-02-21 11:08:58 +01:00
Alexander Mai
6d9eb6199d
posix.cfg: add support for sched.h and 1 bugfix
2015-02-20 20:50:20 +01:00
PKEuS
6227abac73
Fixed GCC (testsymboldatabase.cpp) and MSVC (checkother.cpp) warnings
2015-02-18 21:19:36 +01:00
Daniel Marjamäki
e251a99817
AST: fix handling of sizeof. ticket #6515
2015-02-18 19:56:13 +01:00
Daniel Marjamäki
fd4d4bba33
test/cfg/posix.c: fix tests
2015-02-17 19:58:07 +01:00
Daniel Marjamäki
6363c1359d
TestUninitVar: moved out posix.cfg testing
2015-02-17 18:16:29 +01:00
Daniel Marjamäki
d900148e6b
TestUninitVar: Fix compile error
2015-02-17 18:09:23 +01:00
Daniel Marjamäki
e5c098c7de
TestUninitVar: move out posix.cfg testing
2015-02-17 18:08:19 +01:00
Daniel Marjamäki
e9663873e5
TestOther: refactoring library testing
2015-02-17 15:52:45 +01:00
Alexander Mai
0a6babea74
#6181 Drop redundantGetAndSetUserId. Ensure (style-) warnings are issued if setuid()/getuid() and some related functions are ignored. Move strdupa()/strndupa() from posix.cfg to gnu.cfg
2015-02-16 22:19:51 +01:00
Alexander Mai
115cefc8fb
#6181 Drop redundantGetAndSetUserId. Ensure (style-) warnings are issued if setuid()/getuid() and some related functions are ignored. Move strdupa()/strndupa() from posix.cfg to gnu.cfg
2015-02-16 22:06:08 +01:00
Daniel Marjamäki
42b40b0c85
Merge pull request #525 from Dmitry-Me/moreDoubleSlashCases
...
Handles double slashes close to end of path, more tests
2015-02-16 18:02:51 +01:00
Daniel Marjamäki
d83f07dddd
TestOther: moved posix.cfg testing
2015-02-16 16:25:27 +01:00
Dmitry-Me
f0e0201c2d
Better handle double slashes, more tests
2015-02-16 13:11:13 +03:00
Dmitry-Me
764e7ff79b
Deduplicate a multislash test
2015-02-16 10:19:08 +03:00
Daniel Marjamäki
fe8ba51f03
TestMemLeak: moved posix.cfg tests
2015-02-15 18:11:09 +01:00
Daniel Marjamäki
adedb5a888
TestMemLeakInFunction: Moved test to cfg test
2015-02-15 15:56:05 +01:00
Daniel Marjamäki
cc0f61376a
more cleanup of std.cfg testing in TestBufferOverrun
2015-02-14 18:55:54 +01:00
Daniel Marjamäki
e510902d58
TestBufferOverrun cleanup some more std.cfg testing
2015-02-14 17:30:08 +01:00
Daniel Marjamäki
86cf372309
Merge pull request #522 from simartin/revert_6181_add_6354_6414
...
Revert fix for #6181 , that caused #6354 and #6414 .
2015-02-14 16:59:27 +01:00
Daniel Marjamäki
360ec9d853
updated TestBufferOverrun test case. Since checker doesn't use library dont load std.cfg.
2015-02-14 16:44:08 +01:00
Daniel Marjamäki
0c0d62171e
removed duplicate testcase. See testcase for #836
2015-02-14 16:41:51 +01:00
Daniel Marjamäki
a57d5d7eda
moved testcases
2015-02-14 16:37:48 +01:00
Daniel Marjamäki
e01b30345e
move testcases in TestBufferOverrun
2015-02-14 16:29:05 +01:00
Daniel Marjamäki
166db40af2
Fix TestBufferOverrun test case, it was wrongly written.
2015-02-14 15:51:13 +01:00
Daniel Marjamäki
c43d537726
renamed TestBufferOverrun test method to same name as CheckBufferOverrun method that is tested
2015-02-14 15:49:17 +01:00
Daniel Marjamäki
2b7c7134e1
TestBufferOverrun: move memset test
2015-02-14 15:46:00 +01:00
Simon Martin
c4c46be972
Revert fix for #6181 , that caused #6354 and #6414 .
2015-02-14 12:29:05 +01:00
Luis Díaz Más
22424ba54a
Add CMake files
2015-02-13 19:00:14 +01:00
Dmitry-Me
7961bba0da
Path: better handling of UNC paths
2015-02-13 16:32:45 +01:00
Daniel Marjamäki
e0d90c00be
TestBufferOverrun: Cleanup testcases for memory functions
2015-02-13 16:16:59 +01:00
Daniel Marjamäki
2d21eb07ba
Cleaned up snprintf hardcoding in CheckBufferOverrun
2015-02-13 06:44:38 +01:00
Daniel Marjamäki
a6cfd15bde
refactoring TestBufferOverrun
2015-02-12 17:36:22 +01:00
Daniel Marjamäki
9aad4fa8ca
CheckBufferOverrun: Remove hardcoding for sprintf and rely on cfg configuration instead
2015-02-12 17:29:36 +01:00
Daniel Marjamäki
b43c2de63a
refactor cfg testing in TestClass
2015-02-11 06:29:33 +01:00
Daniel Marjamäki
d9deabe2ce
TestBufferOverrun: clean up
2015-02-10 17:29:36 +01:00
Daniel Marjamäki
53718047f1
refactoring TestBufferOverrun
2015-02-10 06:49:48 +01:00
Daniel Marjamäki
9aa0420472
TestBufferOverrun: Moved out cfg tests. Created minsize-mul testing in TestBufferOverrun
2015-02-10 06:44:19 +01:00
Daniel Marjamäki
ce1d0099cf
TestBufferOverrun: Moved out cfg tests. Created minsize-argvalue testing in TestBufferOverrun
2015-02-10 06:35:41 +01:00
Daniel Marjamäki
631536980c
TestBufferOverrun: split up strncpy testing, keep checker testing in TestBufferOverrun and move cfg tests to cfg test
2015-02-09 16:20:28 +01:00
Daniel Marjamäki
8a1b8df1ba
ValueFlow: Improved handling of alias values in valueFlowForward
2015-02-08 19:20:05 +01:00
Daniel Marjamäki
62a5d88eb0
ValueFlow: Improved handling of strings
2015-02-07 18:14:22 +01:00
Daniel Marjamäki
29db3eb848
Fixed #5980 (ValueFlow: pointer cant be 0 below throw in switch)
2015-02-07 10:45:30 +01:00
Daniel Marjamäki
eec938dbad
Fixed #6249 (False positive: Incorrect detection of (assignment + comparison) inside for-clause)
2015-02-05 20:17:30 +01:00
PKEuS
f1714110d0
Fixed crash if double constants are passed as default arguments ( #6494 )
2015-02-03 22:12:05 +01:00
Daniel Marjamäki
c2b85d1032
Fixed testrunner
2015-02-03 18:35:52 +01:00
orbitcowboy
84e831c21c
posix.cfg: Improved support for functions from <unistd.h>.
2015-02-02 17:23:43 +01:00
Dmitry-Me
21fbc30d59
Calling a function using Class::func() syntax should not be simplified
2015-02-02 10:37:10 +03:00
PKEuS
451a277b18
Refactorization: Support function default values in ValueFlow, removed now obsolete CheckNullPointer::nullPointerDefaultArgument().
...
-> Use valueFlowForward() to parse values passed to functions
-> valueFlowForward(): Set value in first occurrence of a variable in a condition
2015-02-01 15:15:00 +01:00
Daniel Marjamäki
78b711fd7b
astyle formatting
2015-02-01 14:50:51 +01:00
PKEuS
f78744ac30
Fixed AST generation if expression starts with ternary operator
2015-02-01 14:02:19 +01:00
Daniel Marjamäki
d6c94e3828
isOppositeCond: Fixed FN
2015-02-01 13:03:38 +01:00
Daniel Marjamäki
d091639080
Fixed #6482 (False positive multiCondition)
2015-02-01 12:58:06 +01:00
PKEuS
58c3fdd063
Fixed crash on garbage code introduced recently, optimized code in valueFlowFunctionReturn.
2015-02-01 12:26:46 +01:00
PKEuS
54b6b8e571
Fixed false positive #6481
2015-01-31 20:34:06 +01:00
PKEuS
21cb0cfd60
Take simplifyIfNotNull and simplifyIfNot out of simplifyTokenList1 (first step for #6072 )
2015-01-31 20:12:02 +01:00
PKEuS
1f97e3001b
Fixed calculation of array size ( #6487 )
2015-01-31 19:06:44 +01:00
PKEuS
ae4b86c231
Several improvements to CheckMemoryLeakNoVar::checkForUnusedReturnValue():
...
- Support user defined functions (solves TODO tests)
- Print message if return value is not stored properly (adapted message text, #6458 )
2015-01-31 17:28:03 +01:00
Daniel Marjamäki
73113c67e7
Fixed #6480 (False positive unreachableCode - member function exit called instead of ::exit())
2015-01-31 16:55:55 +01:00
PKEuS
789665dadf
Fixed #6455 : Show uninitvar even for const variables
2015-01-31 13:21:22 +01:00
PKEuS
27924d4ae2
Improved detection of array dimensions ( #6430 )
2015-01-31 13:12:06 +01:00
PKEuS
f771a79738
Removed obsolete internal check. The underlying but in Token::Match should be fixed since b4f0869a71
2015-01-31 12:56:54 +01:00
PKEuS
b2835051df
Refactorization: Renamed Token::Match pattern %var% to %name%, implement new pattern %var% which is true if varId > 0.
2015-01-31 12:32:04 +01:00
PKEuS
33f5d27b53
Fixed varId0 message #6443 .
2015-01-31 10:33:32 +01:00
Daniel Marjamäki
57ec1aea91
Library: Don't rely on ast in isNotLibraryFunction since it's used in tokenizer
2015-01-31 10:24:10 +01:00
PKEuS
36841cfa41
Better support for stream operator in CheckAutoVariables::returnReference() ( #6423 )
2015-01-31 10:12:49 +01:00
PKEuS
dcc1362890
SymbolDatabase: Support std::array ( fixes #6401 )
2015-01-30 21:56:27 +01:00
PKEuS
03e44d4aa0
CheckMemoryLeakInFunction: Don't treat delete as delete operator for C code
...
Fixed GCC message in checkbufferoverrun.cpp
2015-01-30 20:55:53 +01:00
PKEuS
98e33a189f
Enhanced CheckBufferOverrun:
...
- Fixed bug in library: manual and existing libraries use "size", but library.cpp reads "sizeof" as podtype attribute
- Fixed a couple of bugs in handling unknown size in checkbufferoverrun.cpp, get size from library if available.
2015-01-30 20:27:48 +01:00
PKEuS
b69528eb80
Bailout in Token::getValueTokenDeadPointer() if reference is used ( #6399 )
2015-01-30 19:29:37 +01:00
PKEuS
0d151b45b5
Better support for funciton pointers in checkuninitvar.cpp ( #6404 )
2015-01-30 19:16:25 +01:00
Daniel Marjamäki
6b20172a36
Moved cfg tests from TestUninitVar
2015-01-30 16:35:17 +01:00
Daniel Marjamäki
355a2d38b3
added missing test/cfg/posix.c file
2015-01-30 07:52:32 +01:00
Daniel Marjamäki
8d2f271921
clean up cfg tests in TestNullPointer
2015-01-30 06:51:03 +01:00
Daniel Marjamäki
9bbad1b622
TestNullPointer: Moved posix.cfg tests
2015-01-30 06:43:40 +01:00
PKEuS
80feb8697d
Fixed false positives #6473 and #6469
2015-01-29 21:26:06 +01:00
PKEuS
71379616e7
Fixed false positive #6467
2015-01-29 10:18:21 +01:00
PKEuS
9ada111045
Fixed false positive #6466
2015-01-29 09:50:48 +01:00
Daniel Marjamäki
250a082e46
Fix travis
2015-01-29 06:23:41 +01:00
Daniel Marjamäki
0949baac9b
TestNullPointer: moved out std.cfg checking
2015-01-29 06:07:48 +01:00
PKEuS
3342ea4c54
CheckInternal: Complain about Token::Match pattern if %or% or %oror% is the only "complex" pattern
2015-01-28 19:48:36 +01:00
PKEuS
0488f45a5f
Removed standalone check CheckOther::checkDoubleFree(), integrated (most of) the functionality into CheckLeakAutoVar. Added support for new/delete to checkLeakAutoVar.
2015-01-28 17:38:43 +01:00
Daniel Marjamäki
70a38b1da6
TestNullPointer: Moved some std.cfg tests to the cfg testing
2015-01-28 16:22:45 +01:00
PKEuS
5c56e63996
Fixed false positive #6452 : Handle member functions in CheckIO::checkFileUsage()
2015-01-27 21:52:52 +01:00
PKEuS
e82d2b3c8d
Fixed false positive #6453 : Skip over inner class if checking outer function
2015-01-27 21:21:17 +01:00
Matthias Krüger
e56671101e
tests: add a script which runs test/cfg tests.
...
add new make target (checkcfg) which builds cppcheck and executes the script
make travis run checkcfg
2015-01-27 19:46:52 +01:00
Daniel Marjamäki
01601b58dd
test: move cfg/test to test/cfg
2015-01-27 18:23:28 +01:00
Daniel Marjamäki
3285f85ebf
Fixed #6460 (Library: better function/type matching)
2015-01-27 17:55:18 +01:00
PKEuS
bfa16ec258
Set /LARGEADDRESSAWARE flag for Win32 builds
...
Idea from Kosta-Github (pull-request #501 )
2015-01-27 15:43:40 +01:00
orbitcowboy
180d7389a0
Fixed #6457 : Added missing podtype defintions to posix.cfg.
2015-01-26 08:35:22 +01:00
Daniel Marjamäki
d8af472393
Merge pull request #500 from Dmitry-Me/resolve1265723
...
Resolve CID 1265723
2015-01-24 11:24:57 +01:00
Dmitry-Me
c79bfdce2c
CheckClass: Better checking of what operator= returns
2015-01-24 11:18:33 +01:00
Martin Ettl
0ef43c05dc
Removed accidently added ';' [ci skip]
2015-01-23 17:31:21 +01:00
Martin Ettl
ac551807b6
posix.cfg: Added support for blkcnt_t datatype.
2015-01-23 17:29:18 +01:00
PKEuS
ee046af20c
Fixed false positives #6450 and #6451
2015-01-23 19:38:39 +01:00
Dmitry-Me
6c248dd1ac
Resolve CID 1265723
2015-01-23 17:53:39 +03:00
PKEuS
da35a74589
Fixed false negative: Passing uninitialized variable to stream ( #4673 )
2015-01-22 22:56:41 +01:00
PKEuS
da5a04f071
Fixed recently introduced FP in checkuninitvar.cpp if address of variable is passed to a function
2015-01-22 21:22:02 +01:00
PKEuS
f4d11a4209
Fixed false negatives on try and non-executable scopes in checkUninitVar, removed unnecessary function parameters
2015-01-22 13:55:19 +01:00
PKEuS
bdae9064ea
Support throw in checkleakautovar.cpp
2015-01-22 11:12:26 +01:00
orbitcowboy
a7ded1e19f
Merge branch 'master' of https://github.com/danmar/cppcheck
2015-01-22 06:53:23 +01:00
PKEuS
7364cc8040
Fixed false positive in fityk: operator new calling constructor
2015-01-22 10:37:31 +01:00
orbitcowboy
2cfb286558
Added test case for #5412 .
2015-01-22 06:53:11 +01:00
orbitcowboy
dd241501f3
Added test case for #6341 .
2015-01-22 06:37:09 +01:00
PKEuS
c3e47f7eaa
Fixed false positive in CheckUninitVar and internal message
2015-01-21 22:26:44 +01:00
PKEuS
94c3c45350
CheckUninitVar: Use function information from library, bailout for '?'
2015-01-21 22:02:25 +01:00
PKEuS
ecb9d87e42
Fixed false positive: Bailout in checkuninitvar.cpp if setjmp is found
2015-01-21 16:49:34 +01:00
PKEuS
8f1e44f1b7
Stricter false positive testing: Perform old and new check on uninitialized variables false positives tests (with a few exceptions for FP in old checker that don't exist in the new one)
2015-01-21 16:45:15 +01:00
PKEuS
81dc96f373
Refactorization: Rearranged code in testuninitvar.cpp, avoid copying of settings
2015-01-21 16:26:27 +01:00
PKEuS
5334aaa25f
Refactorization:
...
- Removed a few unit tests of old uninitialized variable checking expecting other results than same test for new checking
- A few tweaks to new uninitvar checking to improve results when run on tests for old check
- switched some (TODO) tests to new check if the TODO is fixed
2015-01-21 16:17:58 +01:00
PKEuS
346532d312
Fixed false positives in CheckUninitVar::checkStruct()
2015-01-21 13:11:48 +01:00
PKEuS
54de731cac
Refactorized CheckUninitVar::checkScope(), fixed false negative
2015-01-21 12:20:03 +01:00
PKEuS
3274a00b82
Moved some more tests to testgarbage.cpp
2015-01-21 10:04:46 +01:00
Martin Ettl
fab34a8382
Fixed a few inconclusive warnings regarding const-correctness in cppcheck code base.
2015-01-20 16:50:16 +01:00
Thomas Jarosch
ec21134817
Fix false negatives for local suppressions
...
Introduce a new bool setting jointSuppressionReport
that will be set by the analyseWholeProgram() code path.
When the flag is enabled, unmatched suppressions are
collected after running the final whole program analysis
to prevent false positives for the unusedFunction check.
The check functions in the unit test
for single / multi file suppressions were unified.
2015-01-20 18:47:30 +01:00
orbitcowboy
bf1565bd34
Fixed inconclusive warnings regarding const correctness.
2015-01-20 09:09:16 +01:00
orbitcowboy
ff415871bd
Fixed some const correctness issues in the test suite.
2015-01-19 18:00:05 +01:00
Robert Reif
56dc0b02ef
Fixed #6432 (cppcheck fails to detect ctor - partial template specialization)
2015-01-19 16:15:11 +01:00
Robert Reif
3b8540fdc0
Fixed #6424 (false negative: Use of 'class Ns::C' silence Cppcheck)
2015-01-19 06:38:54 +01:00
Matthias Krüger
01dba4062f
testrunner: add testcases for fixed crashes in Template code: #5950 #6034 #6108 #6117 #6225
2015-01-18 14:13:59 +01:00
Thomas Jarosch
58cb6cc116
Add new "style" check to catch redundant pointer operations
...
Doing "&*some_ptr_var" is redundant and might be the remainder
of a refactoring. Warnings for expanded macros are excluded though:
They are often used with and without pointers and
do something like this: "func(&(*macroarg))".
The new check is fully AST based and was given
strong false positive testing on a large code base.
2015-01-18 00:34:07 +01:00
Thomas Jarosch
e6f042dadc
Multi process check: Sanitize error messages for illegal characters
...
before sending them across the pipe.
The deserializer died while deserializing
a string containing a binary zero.
2015-01-17 16:12:00 +01:00
Thomas Jarosch
36bcefc39d
Don't crash when the deserialization of an error message fails
...
Found while scanning the code of an
open source project related to onions.
2015-01-17 16:09:58 +01:00
Robert Reif
193645318b
Tokenizer: Remove macro in class declaration like 'class DLLEXPORT Fred {}' to be able to handle the class better later
2015-01-17 07:42:49 +01:00
Thomas Jarosch
08985bf68a
Throw exception in getVariableFromVarId() if called with out_of_range varId
...
That way we have a chance to catch code bugs at all.
2015-01-15 18:52:11 +01:00
Thomas Jarosch
cf64fd3dad
Add more complex variation of the #6406 unit test
...
This is a false negative right now.
2015-01-15 14:45:10 +01:00
Thomas Jarosch
0286abfb45
Add unit test for #6406
2015-01-14 23:05:33 +01:00
Thomas Jarosch
1cc85bfce3
Add bounds check to getVariableFromVarId()
...
While poking around the memory leak check,
I managed to trigger an out-of-bounds access
in the symbol database.
Fix it by sanity checking the variable id
passed to getVariableFromVarId().
2015-01-14 23:00:38 +01:00
orbitcowboy
a26aa1cd16
testmathlib: Fixed typo in comment, no functional changes.
2015-01-14 00:51:50 +01:00
Robert Reif
68bb197bcb
Destructor detected as constructor resulting in false variable not initialized warnings
2015-01-12 06:11:22 +01:00
Martin Ettl
910af75e3a
testmemleak: Added missing () in test case.
2015-01-11 10:27:37 +01:00
Martin Ettl
37c89a6b70
Fixed #6311 : Add support for GNU get_current_dir_name().
2015-01-11 10:12:39 +01:00
Aneesh Azhakesan S
fe5d2fc245
Fixed #5906 (false negative: 'else if' expression is always false (use library to determine if function is pure))
2015-01-10 12:21:55 +01:00
PKEuS
7452613479
Refactorization:
...
- Merged messages exceptThrowInNoexecptFunction, exceptThrowInNoThrowFunction, exceptThrowInAttributeNoThrowFunction and exceptThrowInDeclspecNoThrowFunction into a single message.
- Merged Token::fIsDeclspecNothrow into Token::fIsAttributeNothrow
2015-01-09 20:18:09 +01:00
Daniel Marjamäki
6a8293a8b7
Library: More strict matching of functions
2015-01-08 19:31:41 +01:00
Robert Reif
ba1c24ee65
Fixed #6422 (symbol database: put function flags into a single flag variable)
2015-01-08 05:45:31 +01:00
Matthias Krüger
0259b4a672
testgarbage: add code example from #6361 to testrunner
2015-01-07 16:44:46 +01:00
Thomas Jarosch
2cb2161c5d
Fix unmatched local suppression error message for "unusedFunction" ( #6228 )
...
This fixes a regression from commit
e35329aba3
(fix for #4946 )
2015-01-07 15:40:12 +01:00
orbitcowboy
4c2e42a52c
alwaysTrueFalseStringCompare: Added more test cases to ensure no FP appears.
2015-01-07 08:38:39 +01:00
orbitcowboy
c07b07b8fe
Fixed #6415 - FP stringCompare memcmp(ptr, ptr+offset, length).
2015-01-07 08:30:05 +01:00
Daniel Marjamäki
a87fb96eaf
Uninitialized variables: fix fp when 'a=((b)=c)' is used
2015-01-06 18:03:40 +01:00
Daniel Marjamäki
eee9183406
ValueFlow: improved handling of conditional noreturn scope in valueFlowForward
2015-01-06 14:12:35 +01:00
Daniel Marjamäki
f2e5fbd30d
Uninitialized variables: bailout when ({..}) are used to avoid fp. it can be handled better.
2015-01-06 07:44:04 +01:00
Daniel Marjamäki
1f698ca493
ValueFlow: Fixed valueFlowForward, when condition is false and else-block returns dont set values below the else-code
2015-01-05 16:39:47 +01:00
Daniel Marjamäki
fe8d04e840
CheckNullPointer: Fix FP when x is NULL and address is calculated with expression '&x->y.z[0]'
2015-01-05 14:54:24 +01:00
Daniel Marjamäki
c5467766e2
ValueFlow: Fix for valueflow analysis after for loop
2015-01-05 14:00:12 +01:00
Daniel Marjamäki
a80101f277
CheckMemoryLeak: Fix FP for allocation functions that register memory before returning it
2015-01-05 13:23:38 +01:00
Daniel Marjamäki
fb685f096a
CheckOther:checkNegativeBitwiseShift: Fix FP when shift is protected by ?:
2015-01-05 10:01:04 +01:00
Daniel Marjamäki
d1927e3492
Removed Tokenizer::simplifyStructInit simplification.
2015-01-04 16:48:52 +01:00
Daniel Marjamäki
7bafbfbd6e
Tokenizer: cleanup simplification of '!= 0' to avoid FP in 'x[(y & 0x80) != 0]' (linux)
2015-01-04 13:50:54 +01:00
PKEuS
e06a4cdf00
Refactorized CheckStl::if_find():
...
- Added support for find()-like functions to Library::Container
- Use <container> information from library
- Fixed false positive #6402
2015-01-04 12:43:50 +01:00
Daniel Marjamäki
f94243f85e
CheckMemoryLeak: Fix fp for allocation function that returns success value
2015-01-04 11:46:26 +01:00
Daniel Marjamäki
b3c2ea2c4f
CheckUninitVar: Fix fp for 'int x=2+x();' when x() is an unseen preprocessor macro
2015-01-04 11:13:20 +01:00
Zachary Blair
22bd20c94a
New check: Use make_shared/make_unique ( #5673 )
2015-01-04 11:07:53 +01:00
PKEuS
11fa185cae
Fixed crash on range-based for-loop
2015-01-03 22:36:39 +01:00
PKEuS
7ece58c3a0
CheckStl::stlOutOfBounds() now uses <container> information from Libraries
2015-01-03 22:18:33 +01:00
PKEuS
e39729ffcc
Library: Add <container> tag to Libraries, provide configuration for std::vector, std::deque, std::array and STL strings
...
Token: Added function to jump to the next template argument
2015-01-03 22:18:33 +01:00
Daniel Marjamäki
eb1c048d2a
Tokenizer: Fix wrong simplification when checking linux kernel
2015-01-03 21:35:03 +01:00
PKEuS
267552779d
Improved check ( #6391 ): Detect identical code in both branches of ternary operator
2015-01-03 18:01:49 +01:00
Daniel Marjamäki
ff11ba9847
Updated copyright year to 2015
2015-01-03 12:14:58 +01:00
PKEuS
1355f49af7
Fixed false positive: Support assignments in CheckStl::if_find()
2015-01-03 11:29:13 +01:00
PKEuS
8885ac3eba
Fixed #6217 , refactorized CheckStl::if_find(): allow all comparison operators, use AST, fixed wrong unit tests
2015-01-03 11:07:11 +01:00
Martin Ettl
465f74b3bb
Fixed #6398 - false negative: (warning) Unnecessary comparison of static strings.
2015-01-02 12:58:04 +01:00
PKEuS
417f42f732
Fixed #6096 : bool is an integral type, but there is no portability issue if a pointer is assigned to a bool.
2015-01-02 21:07:02 +01:00
PKEuS
274e1a838a
Fixed #5871 : Properly parse initialization list in setVarId() if constructor is declared as noexcept
2015-01-02 20:03:06 +01:00
orbitcowboy
d53f2f583c
Fixed #6388 : Support strncasecmp
2015-01-02 14:04:55 +01:00
PKEuS
c4fd8919a2
Fixed #6014 : Added plausibility check before issuing null pointer messages on function calls defined in library
2015-01-02 13:35:39 +01:00
PKEuS
88990bac59
Fixed #6386 : Improved behaviour on unknown language (header file)
2015-01-02 12:32:23 +01:00
Daniel Marjamäki
2831bbd420
ValueFlow: better handling of goto to avoid false positives
2015-01-01 14:29:49 +01:00
Alexander Mai
d2caf89706
#6385 crash in Variable::getFlag(). Catch token without variable in fix for #6095 .
2014-12-31 18:19:10 +01:00
Daniel Marjamäki
5c2a2a5c22
Fixed #6095 (False positive oppositeInnerCondition - neglecting statements with side-effects)
2014-12-31 15:14:22 +01:00
PKEuS
58f4660c94
Fixed #5223 : Bailout in valueFlowForLoop1() for complex conditions
...
Refactorization: Reuse result instead of calling MathLib::toLongNumber() twice
2014-12-30 19:56:47 +01:00
PKEuS
5dc45bd4ac
Fixed #5497 : Support designated initializers in array size detection
2014-12-30 19:23:01 +01:00
PKEuS
ec826a0e0e
Fixed #6022 : Support ++%var% in valueFlowForLoop1
...
Fixed TODO unit test: properly handle loops that are never executed
2014-12-30 18:50:22 +01:00
PKEuS
9e8a66ee40
Fixed #6373 : Support bitops in clarifyCalculation check
2014-12-30 17:55:29 +01:00
Thomas Jarosch
17b47f1ce0
New internal check: Catch extra whitespace in match patterns
...
Inspired by a recent commit from PKEuS.
2014-12-30 14:21:18 +01:00
Robert Reif
9e60f584d9
Fixed #6321 : Implemented function Token::swapWithNext().
2014-12-27 10:53:26 +01:00
Dmitry-Me
14f13afa0a
Don't care which type protected operator= returns
2014-12-26 15:38:22 +01:00
Daniel Marjamäki
6194a4eefd
Fixed #6357 (Improve check: pointer arithmetic 'p+x' overrun, conditional x)
2014-12-26 09:12:00 +01:00
Daniel Marjamäki
7ab12cea63
Improved pointer arithmetic message
2014-12-25 14:31:46 +01:00
Daniel Marjamäki
bc594d52c8
Fixed #6349 (Pointer arithmetic: clarify message)
2014-12-25 10:05:55 +01:00
Daniel Marjamäki
0c086cf247
Incomplete statement: tweaked bailout for '0;' statement using isExpandedMacro()
2014-12-24 21:47:37 +01:00
Daniel Marjamäki
7cfa54f0e0
Fixed #6353 (False positive: CheckBufferOverrun checking reassigned array function parameter)
2014-12-24 14:03:52 +01:00
Daniel Marjamäki
fb3f5a159d
Token: Added flag for attribute noreturn ( #6328 )
2014-12-24 12:50:51 +01:00
Daniel Marjamäki
de1a91f30d
Incomplete statement: tweaked bailout for '(void*)0' using isCasted()
2014-12-23 18:19:33 +01:00
Daniel Marjamäki
1b2a23b3fe
Fixed #6350 (Tokenizer::simplifyCast: set Token::isCasted when cast is removed)
2014-12-23 16:16:14 +01:00
Thomas Jarosch
d5e10c18d3
checkUnreachableCode(): fix FP for statements that just hide compiler warnings about unused function arguments
...
Seen throughout the rockbox codebase.
2014-12-22 11:18:23 +01:00
Daniel Marjamäki
10ae551fef
CheckBufferOverrun: Use portability warning for pointer arithmetic UB. It can be used by intention and usually works as intended.
2014-12-22 10:56:17 +01:00
Thomas Jarosch
bac1dfce86
Add test cases when sizeof is used on struct members
2014-12-22 09:59:34 +01:00
Thomas Jarosch
dca65ce3da
Fix FP if sizeof is used without parentheses on struct members
...
Right now we only support checking basic pointer types.
Pointers inside structs are not supported yet.
Consider the tokens "foo@1 . bar@2",
Token::Match( "sizeof ( %varid% )" ) won't match it.
Token::Match( "sizeof %varid%" ) did match it -> FP.
2014-12-22 09:44:08 +01:00
Daniel Marjamäki
93ac5a41cd
Fixed #6346 (pointer calculation overflow)
2014-12-22 09:38:00 +01:00
Daniel Marjamäki
293dc1efc7
Fixed #6327 (Unwanted constStatement on (void)0)
2014-12-21 13:42:21 +01:00
PKEuS
e03f49360f
Merge pull request #484 from simartin/ticket_6181
...
Ticket #6181 : Properly handle >> terminating template parameter lists.
2014-12-21 12:21:17 +01:00
Daniel Marjamäki
a95e5bff2b
Fixed #6344 (false positive: out of bounds access when array size is unknown)
2014-12-20 18:50:08 +01:00
Daniel Marjamäki
b8371ebd87
Revert 2e45df3b
. Because there are FP.
2014-12-18 06:37:15 +01:00
orbitcowboy
2e45df3b72
Fixed #6341 : false negative uninitvar pattern "return foo ( %var%"
2014-12-17 17:43:31 +01:00
orbitcowboy
4cbbca3db0
Refactoring: Avoid to load posix.cfg multiple times while testing (testother.cpp) ( #6336 )
2014-12-17 16:33:55 +01:00
Daniel Marjamäki
a1537e1a6e
Fixed #6339 (false negative: array index out of bounds on allocated buffer using valueflow)
2014-12-17 16:23:48 +01:00
orbitcowboy
f13475ceb2
Refactoring of testuninitvar: Splitted large test functions into smaller pieces.
2014-12-16 22:02:03 +01:00
orbitcowboy
ade7365cc0
testuninitvar: moved more tests to checkUninitVar2, which does not rely on ExecutionPath.
2014-12-15 19:47:20 +01:00
orbitcowboy
bf4b6dfd19
testuninitvar: changed test cases to do not rely on ExecutionPath.
2014-12-15 15:41:03 +01:00
orbitcowboy
32cd7d727d
Fixed #6325 : false negative: uninitialized variable usage (write, posix).
2014-12-15 10:05:44 +01:00
Simon Martin
4c7a8c5497
Ticket #6181 : Properly handle >> terminating template parameter lists.
2014-12-14 15:14:27 +01:00
Thomas Jarosch
6b78ae7c46
Add mmap() / mmap64() / munmap() to posix.cfg. Enables basic leak tracking
...
Includes function prototype in posix.cfg as comment
for easier overview of the function arguments.
2014-12-14 13:30:24 +01:00
PKEuS
010eb1c8cb
Merge pull request #483 from simartin/ticket_6172
...
Ticket #6172 : Properly grok %type%... template parameters.
2014-12-14 17:01:25 +01:00
Simon Martin
859c6381cc
Ticket #6172 : Properly grok %type%... template parameters.
2014-12-14 14:33:37 +01:00
Daniel Marjamäki
5490fad8c7
Fixed #5840 (False positive (inconclusive): Possible nullpointer dereference - use before for-loop over nested list)
2014-12-14 14:10:42 +01:00
orbitcowboy
ac4f7879db
posix.cfg: Added support for rewinddir().
2014-12-10 16:10:03 +01:00
Thomas Jarosch
269a4419f0
Fixed false positives about strdupa() / strndupa() memleak
...
strdupa() / strndupa() allocates memory on the stack using alloca().
This memory is freed automatically once the current function is left.
2014-12-10 22:23:52 +01:00
orbitcowboy
def3491829
posix.cfg: Added support for readdir().
2014-12-10 17:44:21 +01:00
PKEuS
ff5ede342b
Fixed #6266 : Support noexcept(false)
2014-12-09 23:53:50 +01:00
PKEuS
493ab541ab
Fixed #6291 and #6293 : Support :: in front of function name in checkUnusedFunctions
...
Simplified code in CheckUnusedFunctions
2014-12-09 22:04:51 +01:00
PKEuS
e9bc3b7acf
Fixed #6308 : Properly associate Function with Scope for destructors in SymbolDatabase
2014-12-09 21:36:09 +01:00
orbitcowboy
b8cca63a76
Improved test coverage of MathLib.
2014-12-03 18:24:27 +01:00
Alexander Mai
ec2c4aa2e3
#6301 Unused shared lock variable. Add exception for std::shared_lock() to CheckUnusedVar::checkFunctionVariableUsage_iterateScopes()
2014-12-07 15:32:09 +01:00
Alexander Mai
d11eb4931a
#6306 false positive with strxfrm NULL argument. Adjust std.cfg in favor of no false positive
2014-12-07 15:24:27 +01:00
Alexander Mai
c2584aa635
#6303 crash in CheckBufferOverrun. Add check on loop variable in CheckBufferOverrun::checkScope().
2014-12-04 20:49:58 +01:00
Robert Reif
c5bfd21d48
Tokenizer::simplifyTypedef: Add test that #5191 is fixed (function pointer)
2014-12-04 05:43:58 +01:00
Daniel Marjamäki
e3892a95b5
Fixed #6290 (Tokenizer: Because 'and' is not simplified to '&&' there are false positives)
2014-12-03 16:32:05 +01:00
Robert Reif
418c2e51a0
Fixed #3314 (cppcheck incorrectly reporting Syntax error.)
2014-11-28 17:44:36 +01:00
Robert Reif
0dad8b64e8
Fixed #6268 (False positive functionStatic (inconclusive) - nested namespaces)
2014-11-27 06:29:33 +01:00
Alexander Mai
1779921306
Increase test coverage for MathLib
2014-11-26 17:35:32 +01:00
Dmitry-Me
f926958acb
Fix false positive about return type when there's =delete in operator= declaration
2014-11-25 15:52:52 +01:00
Daniel Marjamäki
a002654c47
Reverted refactoring 828417c
for now. It caused a major slowdown in the unused functions checking.
2014-11-24 06:37:08 +01:00
Frank Zingsheim
9497732ac8
Fixed #6238 (false positive with double fopen)
2014-11-20 22:19:39 +01:00
Daniel Marjamäki
051d42ae6b
astyle formatting
2014-11-20 14:20:09 +01:00
orbitcowboy
4a2a4474c9
Fixed #6281 : MathLib: Long integer suffix i64 is not supported.
2014-11-20 10:23:09 +01:00
orbitcowboy
f5d804f71a
running astyle
2014-11-20 10:13:03 +01:00
Robert Reif
d12f14844a
Fixed #6279 (False Positive: Member variable 'Fred::i' is not initialized in the constructor)
2014-11-20 06:18:29 +01:00
Robert Reif
b7c9187539
Fixed #6280 (MathLib: binary literals are integers)
2014-11-19 06:43:52 +01:00
Alexander Mai
1c191845fb
Fix invalid assertion from recent commit. Make single argument givenACodeSampleToTokenize ctor explicit.
2014-11-18 19:52:06 +01:00
PKEuS
4163f1e122
Fixed #6260 - C++11 style array initialization
2014-11-18 19:50:09 +01:00
PKEuS
428587f3d4
Fixed #6275 : Simplification of = (NULL); to = 0;
2014-11-18 19:39:38 +01:00
Alexander Mai
85c02df56c
Fix compiler warning. run astyle
2014-11-18 19:36:47 +01:00
PKEuS
ad8749c0bd
Fixed #6278 : Remove casts to references to pointers in Tokenizer::simplifyCasts()
2014-11-18 19:23:59 +01:00
Alexander Mai
0ba3c15c52
Cure null pointer access within Scope::findFunction introduced by recent cs
2014-11-17 23:05:15 +01:00
Robert Reif
c5e15950df
Fixed #6230 (SymbolDatabase: Wrong function() is set for token)
2014-11-17 16:04:44 +01:00
Robert Reif
7c4a137e14
Fixed #6274 (MathLib::isFloat doesn't recognize long double literal suffix L or l)
2014-11-17 06:53:32 +01:00
Alexander Mai
ea94b2748f
#633 Adding tests for some MathLib member functions, should reach 100% function coverage now
2014-11-16 18:09:21 +01:00
Daniel Marjamäki
828417c934
CheckUnusedFunction: Refactorings to use same infrastructure for whole program analysis as CheckUninitVar and CheckBufferOverrun
2014-11-15 18:44:23 +01:00
Daniel Marjamäki
de7e9223b8
Fixed #6272 (Improve check: multifile checking in checkbufferoverrun)
2014-11-15 10:43:49 +01:00
Daniel Marjamäki
149fe74d9d
astyle formatting
2014-11-14 21:43:37 +01:00
orbitcowboy
b9a9f51fe0
MathLib: Added test for isDec() and removed not required state.
2014-11-14 04:29:35 +01:00
Dmitry-Me
cb9a6c1cb5
Don't show warning for same expressions alongside == in static_assert
2014-11-13 16:04:34 +01:00
Daniel Marjamäki
189dfd64f7
Revert "Fixed #6230 (SymbolDatabase: Wrong function() is set for token)"
...
This reverts commit 685fce6b91
.
2014-11-11 07:29:16 +01:00