Commit Graph

7724 Commits

Author SHA1 Message Date
Alexander Mai 5b6758b03b Add some debugging code (inspired by #6021) 2015-12-27 17:38:15 +01:00
Daniel Marjamäki f09dded7b1 TokenList: Better handling of '1++a' and 'a++1' 2015-12-27 14:57:22 +01:00
Daniel Marjamäki 908bc664a4 Evaluation order: ignore usage in sizeof 2015-12-27 14:08:16 +01:00
Alexander Mai e9635fd393 #7236 segmentation fault (invalid code) in ValueFlow::setValues. #7237 segmentation fault (invalid code) in Tokenizer::setVarIdClassDeclaration 2015-12-26 23:51:10 +01:00
amai2012 081f443b2a #7235 segmentation fault (invalid code) in TokenList::createAst 2015-12-26 20:26:07 +01:00
amai2012 36a6599386 #7324 segmentation fault (invalid code) in Tokenizer::simplifyTokenList1 2015-12-26 20:16:01 +01:00
Daniel Marjamäki c672210e06 Evaluation order: don't warn for 'dostuff(expr++, &expr)' 2015-12-26 15:48:43 +01:00
Daniel Marjamäki 32455e8441 Fixed #7214 (ValueType: does not handle static_cast) 2015-12-26 15:20:17 +01:00
Daniel Marjamäki 34449ae857 Use simpleMatch instead of Match for simple pattern, hope this makes Travis happy 2015-12-26 02:21:52 +01:00
Daniel Marjamäki cea40168e0 Code fix. Used wrong variable in condition, leading to segfaults. 2015-12-26 01:52:43 +01:00
Daniel Marjamäki 293bd2eead Fixed #6990 (false negative: Invalid abs() argument nr 1. A non-boolean value is required.) 2015-12-26 01:38:41 +01:00
Alexander Mai 87767fb666 #7228 segmentation fault (invalid code) in Tokenizer::isFunctionHead 2015-12-26 00:21:56 +01:00
Daniel Marjamäki e6ff77d825 Evaluation order: Don't use this checker on C++11 code 2015-12-25 18:57:59 +01:00
Daniel Marjamäki 90148ce2a1 Evaluation order: Only use this checker on non-C++11 code 2015-12-25 18:49:34 +01:00
Daniel Marjamäki 55779a5772 Evaluation order: Only use this checker on non-C++11 code 2015-12-25 18:45:46 +01:00
Daniel Marjamäki 24438c326e Fixed #7233 (Fasle negative 'unknownEvaluationOrder in case of macro) 2015-12-25 18:31:21 +01:00
Daniel Marjamäki 27af1bcfd8 Fixed #7229 (Improve check; unknown evaluation order, write different message for self assignment) 2015-12-25 18:00:19 +01:00
Daniel Marjamäki 90a54b1fae Fixed #7232 (False positive unknownEvaluationOrder on id = Remap( id += 42 );) 2015-12-25 16:45:11 +01:00
PKEuS 0bdd353062 Merge pull request #744 from Dmitry-Me/useSetInsteadofList
Use set instead of list
2015-12-25 15:57:22 +01:00
Dmitry-Me 7fdbd8f0ca Use set instead of list 2015-12-25 16:19:27 +03:00
Dmitry-Me 05cb4e16fe Fix misspelled word 2015-12-25 11:51:08 +03:00
Dmitry-Me 458f0da197 Reduce variable scope, better name 2015-12-24 17:08:49 +03:00
PKEuS 940d569980 Refactorization: Removed redundant %any% patterns. 2015-12-24 14:40:48 +01:00
PKEuS 0052896c41 Merge pull request #738 from Dmitry-Me/reduceMatchCalls
Pre-check to reduce number of match checks
2015-12-24 13:48:56 +01:00
Dmitry-Me 7303790a73 Pre-check to reduce number of match checks 2015-12-24 13:07:47 +03:00
PKEuS 93cb73ebcf Merge pull request #741 from Dmitry-Me/useArrowForDereferencing
Use arrow as in surrounding code
2015-12-24 09:37:40 +01:00
PKEuS ae740e28fd Merge pull request #740 from Dmitry-Me/donClearEmptyStrings
No need to clear empty strings
2015-12-24 09:37:20 +01:00
Daniel Marjamäki 81f0597316 Fixed #3206 and #7226 (New check: Undefined execution order) 2015-12-24 09:13:20 +01:00
Dmitry-Me 1d614f2e5b Use arrow as in surrounding code 2015-12-24 10:21:48 +03:00
Dmitry-Me bd45c71d8d No need to clear empty strings 2015-12-24 10:16:58 +03:00
PKEuS 1b7f23daa5 Merge pull request #737 from Dmitry-Me/omitDeepCopy
Omit unneeded deep copy
2015-12-23 16:26:44 +01:00
PKEuS d5e9bb4323 Merge pull request #739 from Dmitry-Me/repeatedSearch
Omit repeated search
2015-12-23 16:24:50 +01:00
Dmitry-Me 3e9ef0894f Omit repeated search 2015-12-23 16:10:39 +03:00
Daniel Marjamäki 3f386af21c astyle formatting 2015-12-23 10:26:12 +01:00
Dmitry-Me 5cba4ac602 Omit unneeded deep copy 2015-12-23 10:32:59 +03:00
Dmitry-Me 398da8ea7c Cache and reuse result of expensive operation 2015-12-22 14:03:45 +03:00
Dmitry-Me 155ccecf2f Drop useless braces 2015-12-22 10:31:49 +03:00
Alexander Mai 28a625abd8 #7218 Improve performance in TokenList::validateAst(): Keep a list of 'verified' tokens during recursion check. 2015-12-19 20:36:30 +01:00
PKEuS a6b719eb10 Refactorization: Fixed true positive when self-checking cppcheck 2015-12-18 18:13:13 +01:00
Dmitry-Me 06ff877415 Typo in variable name 2015-12-18 15:46:12 +03:00
Dmitry-Me 166e2a2cb8 Extract duplicate code 2015-12-18 10:24:02 +03:00
orbitcowboy 4a3c61f031 Merge pull request #731 from Dmitry-Me/dontProceedToOuterScope
Don't proceed to outer scope once there's a match in this scope
2015-12-17 16:04:59 +01:00
PKEuS 8f22e4924c Updated AStyle to version 2.05.1
Tweaked runastyle.bat a little bit.
2015-12-17 15:53:13 +01:00
Dmitry-Me ecc2e00a38 Don't proceed to outer scope once there's a match in this scope 2015-12-17 17:31:22 +03:00
orbitcowboy bc6ae499dc Merge pull request #730 from Dmitry-Me/loopVariableNotUsed
Loop variable wasn't really used
2015-12-17 15:09:41 +01:00
Dmitry-Me 6f996142dc Loop variable wasn't really used 2015-12-17 12:54:05 +03:00
Daniel Marjamäki febe1c9c14 Merge pull request #729 from Dmitry-Me/removeRedundantCheck
Remove redundant check
2015-12-16 15:03:07 +01:00
Daniel Marjamäki bebf8ccdd5 Revert da15efb3 and 6304a4dd to fix FPs. See #7148, #7179, etc 2015-12-16 14:51:50 +01:00
Dmitry-Me 0d2edc532c Remove redundant check 2015-12-16 16:36:06 +03:00
orbitcowboy 66897a95f4 Merge pull request #727 from Dmitry-Me/fixC4706
Fix C4706 assignment within conditional
2015-12-15 10:58:14 +01:00
Dmitry-Me 4a8a5d4460 Fix C4706 assignment within conditional 2015-12-15 11:34:04 +03:00
Dmitry-Me bd4b47123a Better variable name 2015-12-15 11:30:20 +03:00
PKEuS 18693a7fce Refactorized token.cpp:
- Removed redundant overload of Token::insertToken()
- Fixed leak in Token::deleteThis()
- Moved condition out of loop in Token::tokAt()
2015-12-14 22:04:51 +01:00
Daniel Marjamäki 8f27cec991 Revert "minor tweak of comment"
This reverts commit b1d1869f22.
2015-12-14 20:29:29 +01:00
Daniel Marjamäki 9acda09fa2 refactoring. combine 2 if to 1 2015-12-14 20:05:17 +01:00
Daniel Marjamäki b1d1869f22 minor tweak of comment 2015-12-14 20:03:40 +01:00
Daniel Marjamäki 2532f94bef Merge pull request #719 from 3adev/fix-multiple-config-dumps
Fix multiple config dumps
2015-12-14 20:03:09 +01:00
Albert ARIBAUD (3ADEV) e7fdb1c825 Fix multiple config dumps
With multiple configurations, option --dump only dumps
the last configuration.

Fix it to dump every configuration.

Also update all Python addons so that they can handle
multiple-configuration dumps.

Additionally run autopep8 on addons/*.py.

The results of 'make test' before and after applying
this commit are identical.
2015-12-14 18:20:35 +01:00
Dmitry-Me 182877df88 Variable name consistent with other code 2015-12-14 17:35:32 +03:00
Daniel Marjamäki 0baad496f2 Fixed #6383 (FP shiftNegative - value converted to unsigned in function argument) 2015-12-14 10:55:23 +01:00
Daniel Marjamäki 0cc003830a Revert "Fix Compiler warnings."
This reverts commit cbb7c8b854.
2015-12-13 19:58:27 +01:00
Albert ARIBAUD (3ADEV) 58031147b2 Optimize tokenizing
Reorganize cppcheck.cpp to separate actual checking from
tokenizing and XML dumping. This implies splitting checkFile()
in three parts, checkRawTokens, checkNormalTokens() and
checkSimplifiedTokens().
2015-12-13 09:29:47 +01:00
Alexander Mai 96531d6ffe TokenList::createAst() doesn't validate itself anymore. Remove some duplicated code and fix glitch in TestGarbage::garbageCode162 2015-12-12 20:01:03 +01:00
Daniel Marjamäki 9cb8e9a07e Revert "Fixed #3923 (valueFlowForward: assignment in if should not cause bailout for code in else)"
This reverts commit 04f9b71281.
2015-12-12 16:50:02 +01:00
Alexander Mai 5b2dacb4b4 Correct travis and compiler warnings and comments 2015-12-12 16:08:52 +01:00
Daniel Marjamäki 04f9b71281 Fixed #3923 (valueFlowForward: assignment in if should not cause bailout for code in else) 2015-12-12 15:50:33 +01:00
Alexander Mai 9a847d7b14 #7208 Cppcheck hangs with 100% CPU load in CheckOther::checkNegativeBitwiseShift (invalidcode). TokenList::validateAst() is running consistency checks on AST 2015-12-12 15:39:38 +01:00
PKEuS 51bb76c5b5 Optimization: Skip over expression in brackets in Tokenizer::isFunctionParameterPassedByValue() 2015-12-10 15:53:14 +01:00
PKEuS 37572dc109 Small refactorizations:
- Improved formatting of unhandled-char-constant message (Side-effect: fixes #7206)
- Replace nr="-1" by nr="any" in windows.cfg
2015-12-10 15:47:46 +01:00
Daniel Marjamäki 61da95010c Removed unused CppCheck::replaceAll() 2015-12-10 13:32:36 +01:00
Daniel Marjamäki 1f16e72b19 Removed --debug-fp. The reduce tool should be used instead. 2015-12-10 10:44:36 +01:00
Akhilesh Nema 932f6ea81b Cppcheck hangs with 100% CPU load in TemplateSimplifier::checkComplicatedSyntaxErrorsInTemplates (invalidcode) 2015-12-09 14:00:40 +01:00
Dmitry-Me 28bf944d81 Remove redundant checks 2015-12-09 11:10:56 +03:00
orbitcowboy eead6862cc Merge pull request #718 from Dmitry-Me/cacheAndReuse3
Cache and reuse value
2015-12-08 15:07:59 +01:00
Daniel Marjamäki e88a1b0915 astyle formatting 2015-12-08 14:23:26 +01:00
Dmitry-Me f96484b609 Cache and reuse value 2015-12-08 10:36:03 +03:00
Albert ARIBAUD (3ADEV) b8dd71c577 Factorize toxml() into a single member function
lib/symboldatabase.cpp and lib/tokenize.cpp both
define a static toxml() function. Make it a single
static ErrorLogger::toxml() member function.
2015-12-07 18:21:01 +01:00
Akhilesh Nema ca3c19c63d GUI: Fixed compiler warnings 2015-12-07 11:24:54 +01:00
PKEuS 57e9954390 Merge pull request #715 from Dmitry-Me/eliminateRepeatedLookup3
Remove repeated lookup
2015-12-07 10:47:37 +01:00
amai2012 7129b1c5b3 Merge pull request #716 from Dmitry-Me/betterVariableName7
Better variable name
2015-12-07 10:35:34 +01:00
Dmitry-Me 67f0301f0b Better variable name 2015-12-07 12:21:17 +03:00
Dmitry-Me f00a73f1a1 Remove repeated lookup 2015-12-07 11:57:04 +03:00
Alexander Mai 26b699fd30 Fix compiler warnings about incomplete handling of library error codes 2015-12-06 12:52:49 +01:00
Alexander Mai 9d8dffbd79 #6269 false positives in case of overloaded standard library functions. Detect memset() with proper argument cound, using new function numberOfArguments() 2015-12-06 12:50:05 +01:00
PKEuS eb27d3b877 Refactorization: Moved condition out of loop and ran AStyle 2015-12-06 10:40:22 +01:00
Alexander Mai 98f2cd021e #7199 SymbolDatabase::validate() should be run in debug mode and print debug messages. In turn correct some test examples with invalid code. 2015-12-06 08:14:04 +01:00
Alexander Mai 5cf923d091 Don't run SymbolDatabase::validate on --debug. Replace some NULL by nullptr 2015-12-05 21:07:03 +01:00
Alexander Mai ba0859e838 #6981 crash in checkvaarg.cpp (with possible fix). Avoid segfault. Add SymbolDatabase::validate() to allow validating smyboldatabase 2015-12-05 20:55:26 +01:00
Alexander Mai 5ddc5c0798 #7187 internal error; unhandled char constant \e. Support \e char literal support by clang,gcc,tcc 2015-12-05 18:53:03 +01:00
Alexander Mai 86c9387987 #7182 crash: CheckMemoryLeak::functionReturnType() 2015-12-05 18:43:29 +01:00
Alexander Mai e69377d5a8 #7183 CheckClass::checkMemset() uint overflow. Plus some minor refactoring 2015-12-05 18:22:01 +01:00
Alexander Mai 6ae1533cb4 #7190 Cppcheck hangs with 100% CPU load in Tokenizer::simplifyAttribute (invalidcode). Call validate() once more in Tokenizer::simplifyTokenList1 to trigger invalid code exception 2015-12-05 13:55:33 +01:00
PKEuS 308fd1ba50 Fixed false positive 'noCopyConstructor' for static member variable (#7198) 2015-12-04 18:26:49 +01:00
PKEuS 46d6623182 Refactorization: Improved performance of Tokenizer::isFunctionParameterPassedByValue()
- Skip it for C code
- Improved performance by around 80% on C++ code (3,5% of entire runtime)
2015-12-03 14:44:59 +01:00
PKEuS 70767a30c4 Small refactorizations:
- Avoid calling c_str() for functions that take std::string
- Avoid copying std::list
2015-12-03 14:19:30 +01:00
Daniel Marjamäki 7f4dae8de4 Merge pull request #714 from Dmitry-Me/betterVariableNames
Better variable names, more linear code
2015-12-03 13:46:28 +01:00
PKEuS 32e2fb2f78 Refactorization: Prefer Token::simpleMatch over Token::Match also for non-const patterns. 2015-12-03 13:04:55 +01:00
PKEuS 00662ec484 Refactorization: Improve performance of simplifyTypedef by using Token::simpleMatch by ~15% (forgotten in b8d39a2229) 2015-12-03 12:50:42 +01:00
Dmitry-Me cb84b88cb1 Better variable names, more linear code 2015-12-03 14:20:46 +03:00
amai2012 f624f6fc25 Merge pull request #713 from Dmitry-Me/eliminateRepeatedLookup2
Eliminate repeated lookup
2015-12-03 10:18:08 +01:00