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