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
18b0e14590
Refactorizations: Fixed a pattern in checkbufferoverrun.cpp, simplified one in checkclass.cpp
2015-01-31 12:32:05 +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
3a1bd4a5ad
Fixed gcc shadowing warnings
2015-01-30 22:04:26 +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
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
PKEuS
8225b12763
Fixed some cppcheck messages
2015-01-28 22:29:07 +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
21bd1d080e
Refactorization: Rearranged some code in checkleakautovar.cpp
2015-01-28 19:44:59 +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
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
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
Dmitry-Me
e7bb43fc6b
Cache and reuse token pointer
2015-01-27 10:23:58 +03:00
Dmitry-Me
c79bfdce2c
CheckClass: Better checking of what operator= returns
2015-01-24 11:18:33 +01:00
PKEuS
ee046af20c
Fixed false positives #6450 and #6451
2015-01-23 19:38:39 +01: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
4c76f71499
Reactivated old uninitialized variable checker which I accidentially disabled in previous commit
2015-01-22 17:34:22 +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
PKEuS
331a6b66be
Fixed internal message
2015-01-22 10:53:53 +01:00
PKEuS
7c60fe4aef
Fixed crash introduced by last commit.
2015-01-22 10:51:06 +01:00
PKEuS
7364cc8040
Fixed false positive in fityk: operator new calling constructor
2015-01-22 10:37:31 +01:00
PKEuS
60b2b655df
Support new/delete in new uninitialized variable checking; realloc() requires an initialized first argument.
2015-01-21 23:46:52 +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
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
d8e282fe76
Refactorization: Made checkUninitVar::isVariableUsage() non-static
2015-01-21 13:52:03 +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
5f36c7c914
Improved detection of Type::needInitialization:
...
- Implement shortcut for C code - all types need initialization there
- Break out of loop faster if we encounter a type that needs initialization (it is sufficient if one member needs initialization)
2015-01-21 10:34:58 +01:00
Samir Aguiar
141a071792
* Added Clang-related flag to gui.pro
...
* Updated external lib location with PWD variable
2015-01-20 19:20:00 +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
5a8574cc05
tokenlist::createAst(); should not be const.
2015-01-20 11:22:22 +01:00
orbitcowboy
bf1565bd34
Fixed inconclusive warnings regarding const correctness.
2015-01-20 09:09:16 +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
Thomas Jarosch
a83fe0e268
Check "var" for null pointer before using it
...
Reported by covertey -> amai on IRC.
2015-01-18 13:02:58 +01:00
Thomas Jarosch
c0aceb893e
Replace custom code with Settings::isWindowsPlatform()
2015-01-18 12:43:43 +01:00
Thomas Jarosch
9a5260a43f
Only simplify Windows's DEBUG_NEW macro on Windows platform
2015-01-18 12:20:23 +01:00
Thomas Jarosch
cd4c297dce
Fix segfault in template simplifier
...
When something parsing the template syntax
went wrong, "tok2" was NULL and resulted
in deleting all remaining tokens. Whoops.
Triggered by gcc test suite:
gcc/testsuite/g++.dg/cpp0x/variadic87.C
Tracked down the source of the bug with
valgrind's "--track-origins=yes" switch.
2015-01-18 01:43:43 +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
2bcd675653
Verbose AST dump: Show if token is expanded from macro
...
I also added the token variable id, but that decreased
readability of the AST tree too much.
2015-01-17 23:20:52 +01:00
Thomas Jarosch
10fffbfce0
Use unsigned int for all flags
...
Frank Zingsheim reported: With the parameter 'flag_'
and the member variable '_flags' having the type 'int'
produces a lot of warings in clang:
"warning: implicit conversion changes signedness: 'int' to 'unsigned int'".
2015-01-17 16:46:05 +01:00
Thomas Jarosch
fd01cafb1b
Clean up redundant pointer operations
2015-01-17 16:29:50 +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
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
Thomas Jarosch
ef7f104335
Make sure we have a valid Variable pointer before dereferencing it
...
All other call sites check the pointer already.
2015-01-14 23:00:28 +01:00
Thomas Jarosch
c92d861b1e
Fix typo in "internal error" message
2015-01-12 23:09:17 +01:00
Robert Reif
68bb197bcb
Destructor detected as constructor resulting in false variable not initialized warnings
2015-01-12 06:11:22 +01:00
Thomas Jarosch
059f9d056c
Move to global variables to file scope
...
Putting them in the anonymous namespace
is the same effect as making them "static".
2015-01-11 12:37:11 +01:00
PKEuS
787cbcb02e
Accept unknown elements in Library files, but print a warning. This fixes backward compatibility of libraries with older cppcheck versions
2015-01-10 22:18:57 +01:00
PKEuS
fd2f93bb80
Two small refactorizations:
...
- Avoid leaving and entering again critical section without doing anything
- Use isPointer() in checkbufferoverrun.cpp instead of string comparison
2015-01-10 21:03:21 +01:00
PKEuS
d019b7f9a6
Fixed wrong condition in library.cpp
2015-01-10 20:51:14 +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
Thomas Jarosch
332254e0af
Make patterns compilable (mini refactoring)
2015-01-09 23:43:45 +01:00
PKEuS
d110d715ba
Refactorization: Use Token::link() when stringifying template argument list in symboldatabase.cpp
2015-01-09 22:03:43 +01:00
PKEuS
4da314b2e4
Declared recently added helper functions as static
2015-01-09 21:40:50 +01:00
PKEuS
25cd3794ac
Refactorization: Simplified and unified SymbolDatabase printing
2015-01-09 21:35:16 +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
PKEuS
4d5bf28b33
Refactorization: Removed code for copying attributes from function declaration to implementation in symboldatabase as it is neither tested nor necessary
2015-01-09 19:46:04 +01:00
Robert Reif
6998c55680
Symboldatabase: function return token ( #6244 )
2015-01-09 16:08:34 +01:00
Thomas Jarosch
374af15bd4
Fix parsing linkage specifier from global function declaration
...
Our very own "tools/dmake.cpp" had a function declaration
featuring "static void foobar()" while the function implementation
did not have the 'static' keyword (which is perfectly legal code).
2015-01-09 00:38:25 +01:00
Daniel Marjamäki
2375f1c46d
CheckBufferOverrun: Fix FN when multifile checking is used.
2015-01-08 21:01:22 +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
Thomas Jarosch
4248c94d87
Silence compiler warning about unused parameter
...
PKEuS should decide if we can drop the parameter altogether.
2015-01-07 16:30:30 +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
cd98471398
Merge branch 'master' of https://github.com/danmar/cppcheck
2015-01-07 08:30:17 +01:00
Thomas Jarosch
4bec2b58fd
Unused function check: Fix detection of func.usedOtherFile
...
Check if function is called from another file or not.
2015-01-07 11:29:37 +01:00
orbitcowboy
c07b07b8fe
Fixed #6415 - FP stringCompare memcmp(ptr, ptr+offset, length).
2015-01-07 08:30:05 +01:00
orbitcowboy
ba837a6f2d
Added support for strpbrk to std.cfg. Running astyle.
2015-01-07 02:34:41 +01:00
Daniel Marjamäki
8a6bb46958
Tokenizer: only print AST in debug output if --verbose is used
2015-01-07 06:46:04 +01:00
Daniel Marjamäki
b0cc46e98b
reverted 840b2fb0
, it caused FN. tweaked the Tokenizer::simplifyAssignmentBlock to fix the FP it caused.
2015-01-07 06:38:42 +01:00
Daniel Marjamäki
840b2fb035
Tokenizer: Removed simplification Tokenizer::simplifyAssignmentBlock. This fixes a fp in linux.
2015-01-06 20:44:58 +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
88e7b55a2d
CheckSizeof: only report warnings when --enable=warning has been used
2015-01-06 15:20:42 +01:00
Daniel Marjamäki
1068e095e7
Fixed cppcheck warning about iterator post increment
2015-01-06 15:16:29 +01:00