Commit Graph

8353 Commits

Author SHA1 Message Date
orbitcowboy 04d6b05da9 preprocessor: It is more efficient to seek for a single character rather than a string. 2016-12-01 17:54:45 +01:00
orbitcowboy 4a439b9308 It is more efficient to provide a character instead of a string when searching for a single character. This has been fixed in various places. 2016-11-30 12:01:22 +01:00
orbitcowboy 8a45c3192b There is not need to clear a string directly after its creation. 2016-11-30 10:39:14 +01:00
amai2012 f66e7fb379 #7833 UB: member call on null pointer when --dumping configuration with unknown value 2016-11-28 18:19:19 +01:00
PKEuS 36d12d7866 SymbolDatabase: Function::retDef should not point at "static" or "extern" 2016-11-28 17:23:39 +01:00
Stefan Weil 57b57428c2 Fix some typos in comments (found by codespell)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-27 11:40:42 +01:00
Daniel Marjamäki b6cba4a55c Fixed #7784 (Token: can't be both type and variable) 2016-11-26 22:39:47 +01:00
Matthias Krüger b3ace258ab there is no need to have "if(tok && Token::Match(tok,..." since Token::Match checks "tok" by itselfs already. 2016-11-26 17:22:30 +01:00
Daniel Marjamäki a198422f0e Fixed Coverity warning. Coverity assumes that 'bits < 64' means that bits can be 63. That is not true here but anyway I think the code needed to be fixed. 2016-11-25 15:19:18 +01:00
Matthias Krüger 213589ee68 ValueFlow: don't perform UB when a function returns shifts of/by negative values. Fixes #7814. 2016-11-24 23:23:47 +01:00
Daniel Marjamäki 8be50fd822 --project: loading props when relative paths are given 2016-11-24 08:11:51 +01:00
Daniel Marjamäki a61f4e9c94 Fixed #7831 (false-positive: terminateStrncpy) 2016-11-24 07:04:58 +01:00
Matthias Krüger cf24ea5221 fix #7783: false positive knownConditionTrueFalse on assert(0 && "message"). 2016-11-23 21:54:38 +01:00
Matthias Krüger 01e5f14bf8 CheckClass::virtualDestructorError and a variation of CheckNullPointer::nullPointerError would print inconclusive,warning messages altough no --enable=warning was given. Fix. 2016-11-23 00:13:09 +01:00
Daniel Marjamäki 0b3751520b Add a check for float conversion overflows 2016-11-22 22:37:13 +01:00
PKEuS 02d8f691f8 Fixed false positive: Do not show useInitializationList message for enums 2016-11-22 12:09:30 +01:00
Daniel Marjamäki d40f4e4a55 Fixed #7778 (valueFlowAfterAssign: alias) 2016-11-21 17:26:36 +01:00
Daniel Marjamäki 21364b4401 Refactoring fix for #7816 2016-11-21 13:54:59 +01:00
amai2012 933815ee54 #7816 Segmentation fault at Tokenizer::simplifyAttribute() for stand-alone void. Throw syntax error on incomplete code 2016-11-21 12:19:47 +01:00
Daniel Marjamäki 9043436e67 Visual Studio: Improved --project handling. 2016-11-20 22:44:50 +01:00
Matthias Krüger 4cf85b72b6 CheckOther::checkAccessOfMovedVariable: don't warn if --enable=warning is not given. 2016-11-20 18:44:37 +01:00
Daniel Marjamäki 74fa69fe5e Fixed #7821 (syntax error, first token is &) 2016-11-20 17:59:50 +01:00
Daniel Marjamäki 4388435ce1 Revert "checkautovariable: fix #7818, crash when accessing nullpointer tok2->next()."
This reverts commit a5d32aa7a5.
2016-11-20 17:21:56 +01:00
Daniel Marjamäki c329887bfe use const 2016-11-20 15:44:20 +01:00
Frank Zingsheim c8ff96fe8f Fixed #6180 (Usage of variable after std::move or std::forward) 2016-11-20 15:14:49 +01:00
PKEuS e23dc5c1e2 Fixed wrong message shown if unused label appears directly after a switch() scope 2016-11-20 14:43:54 +01:00
Matthias Krüger b6614d0aa4 valueflow: bail out earlier when encountering divisions by zero. Fixes #7819.
This caused valueflow to actually try to divide by zero, detected by UBSAN.
2016-11-20 14:38:35 +01:00
Daniel Marjamäki 5b377ea2e4 Fixed #7821 (segmentation fault, invalid last token) 2016-11-20 14:15:51 +01:00
Daniel Marjamäki 1235815ae9 SymbolDatabase: refactoring condition 2016-11-18 22:01:15 +01:00
PKEuS 5344a5e098 Fixed race condition by properly constructing a local CheckUnusedFunctions instance in CppCheck::processFile(). Instantiating Checks is dangerous! 2016-11-18 21:09:41 +01:00
Daniel Marjamäki 2f27a0c8f6 Revert "SymbolDatabase: refactoring condition"
I don't see why, but this did not work well on appveyor.

This reverts commit 5d7a4d51ad.
2016-11-17 22:53:03 +01:00
Daniel Marjamäki 79fc332511 Fixed #7810 (SymbolDatabase: method with redundant scope info) 2016-11-17 22:45:50 +01:00
Daniel Marjamäki 5d7a4d51ad SymbolDatabase: refactoring condition 2016-11-17 22:20:01 +01:00
Matthias Krüger a5d32aa7a5 checkautovariable: fix #7818, crash when accessing nullpointer tok2->next().
Not test case added yet because I failed to add it as .h files to testgarbage.
2016-11-16 14:46:37 +01:00
Daniel Marjamäki 7d7212c465 --cppcheck-build-dir: generate unique analyzeinfo filenames when source files have same names 2016-11-14 20:50:08 +01:00
Daniel Marjamäki 3b57273ef1 Fix Cppcheck warnings 2016-11-14 07:21:10 +01:00
Daniel Marjamäki 1e31c6c01c ValueFlow: Extended handling of float values 2016-11-14 06:42:52 +01:00
Daniel Marjamäki e1e9eacccc ValueFlow: Added float type 2016-11-13 22:59:56 +01:00
Daniel Marjamäki 4732667488 ValueFlow: allow more value types 2016-11-13 22:33:39 +01:00
Daniel Marjamäki 7ebfb10edd Fixed #7806 (ValueFlow: better handling of subfunction with early return) 2016-11-13 18:19:51 +01:00
Daniel Marjamäki ee56fbe3a1 Fixed #7791 (Cppcheck does not expand Visual Studio macros) 2016-11-13 12:16:09 +01:00
Daniel Marjamäki 621c1e59c6 --project: handle SolutionDir and ProjectDir. This is a partial fix for #7791. custom build macros are still not handled. 2016-11-11 16:22:14 +01:00
Daniel Marjamäki 4de5dc75aa Fixed #7807 (false positive: (error) Signed integer overflow for expression 'int32_max-1'.) 2016-11-07 22:29:40 +01:00
Daniel Marjamäki 1245f1d621 Unused Functions: Fix checking when --cppcheck-build-dir is used. 2016-11-07 21:49:58 +01:00
Daniel Marjamäki ac7b351d1e ValueFlow: Don't calculate x<<64 and x>>64 2016-11-06 20:40:58 +01:00
Daniel Marjamäki dd69d5eabe ValueFlow: Don't calculate result when there is UB 2016-11-06 17:42:01 +01:00
Daniel Marjamäki 483fd8682a cleanup redundant info in comment. ticket numbers can be looked up with git blame. if the code says there is a syntax error then a comment that says 'invalid code' isn't much clarification. 2016-11-06 16:49:25 +01:00
Alexander Mai ee11f0974a #7769 segmentation fault at setTokenValue() on invalid code. 2016-11-06 14:20:58 +01:00
Daniel Marjamäki b607e83648 Try to fix travis 2016-11-05 21:45:31 +01:00
Daniel Marjamäki 350e5a7142 UnusedFunctions: Perform checking using analyzeinfo 2016-11-05 21:26:56 +01:00