Commit Graph

9956 Commits

Author SHA1 Message Date
rikardfalkeborn 75caf8e4de Fix #8230: FP unknown evaluation order on comma expression in while clause (#1415)
The while part of a do-while loop looks almost like a function call, so
extend the check for function calls to ignore while-statements.

Note that there was only an FP when checking c-code, since the check is
disabled for c++-code. Therefore, make sure the test cases are run on a
c-file.
2018-10-09 14:44:01 +02:00
Daniel Marjamäki 20121b34d8 Fixed #7718 (False positive: out of bounds of already resized std::string) 2018-10-09 06:53:26 +02:00
Daniel Marjamäki aa58f41e6d Fixed #7152 (False positive for redundantAssignment after calling a lambda function) 2018-10-08 21:07:21 +02:00
PKEuS 86a1b84b0c Fixed handling of macros with known value defined in header file in configuration splitting (#8404)
Added proper unit test for configuration validation to ensure that it actually works when cppcheck is executed
2018-10-08 16:38:47 +02:00
orbitcowboy c312bbad78 Fixed a typo. There are no functional changes intended. 2018-10-08 13:58:21 +02:00
Daniel Marjamäki c3e6e7c338 Fixed #8664 (setVarId: Wrongly set varid for lambda argument) 2018-10-07 20:40:59 +02:00
Daniel Marjamäki f961324d45 Fixed #8735 (FP oppositeInnerCondition - regression) 2018-10-07 18:30:29 +02:00
Carlo Marcelo Arenas Belon d66c92edc3 Remove unused parameters for CheckOther::oppositeExpressionError (#1412) 2018-10-05 08:36:49 +02:00
Paul Fultz II 26a8435d76 Use knownConditionTrueFalse when is duplicate expression is true or false (#1410) 2018-10-05 06:00:24 +02:00
Paul Fultz II e170a45230 Enable followVar for opposite expressions (#1404)
Enable followVar for opposite expressions
2018-10-04 21:17:47 +02:00
orbitcowboy c98c7a2ebf suppressions: Avoid duplicate comparison. 2018-10-04 17:13:11 +02:00
Daniel Marjamäki a31db92918 Fixed #8669 (operator>> causes wrong style message) 2018-10-03 13:00:11 +02:00
Daniel Marjamäki de621eab99 Refactoring; use range for loop 2018-10-03 12:54:59 +02:00
Paul Fultz II 1fe1ec09a8 Reenable follow var for logical conjunction (#1400) 2018-10-01 14:40:03 +02:00
Paul Fultz II 2c91b95d2a Reenable followVar for multicondition (#1401) 2018-10-01 14:34:55 +02:00
Paul Fultz II 4598995564 Enable followVar for duplicate ternary expressions (#1406) 2018-10-01 14:31:06 +02:00
rikardfalkeborn b3fef7957a Fix FP with fclose after comma (#7525) (#1407) 2018-10-01 11:58:27 +02:00
Daniel Marjamäki 3a186b5bff astyle formatting 2018-10-01 11:53:32 +02:00
Paul Fultz II 4ed22f1ff8 Fix some FPs in mismatchingContainerExpression (#1402) 2018-09-30 14:49:58 +02:00
Paul Fultz II f65cf220ba Fix false positives in unknownEvaluationOrder when using followVar (#1391)
Fix false positives in unknownEvaluationOrder when using followVar
2018-09-28 08:38:24 +02:00
Daniel Marjamäki 9dccc4037b Fixed #8747 (Syntax error, AST broken (a = --*b)) 2018-09-27 19:26:08 +02:00
Daniel Marjamäki b79d829cfc Use for arithOperationsOnVoidPointer messages 2018-09-26 17:58:22 +02:00
orbitcowboy e25bf187ad Attempt to fix regression for pcre_free_study(). 2018-09-26 08:07:26 +02:00
IOBYTE 33b74a04ab Add union support to template simplifier. (#1398) 2018-09-26 06:23:12 +02:00
rikardfalkeborn 5e120b567c isVariableDeclaration: Handle pointer to const pointer (#1395)
isVariableDeclaration did not handle pointer to const pointer, or
pointer to volatile pointer. This resulted in FPs in examples like the
following:

    class Fred {
        public:
        const char *const *data;
        const char *const *getData() { return data; };
    }

where cppcheck would say getData could be static, since it didn't
recognize const char *const *data as a variable declaration.
2018-09-25 06:19:26 +02:00
Daniel Marjamäki ca5542131a Travis: Fix xml validation by readding the line attribute in <location>. 2018-09-25 06:14:26 +02:00
orbitcowboy 2f032d8fa7
Improved const correctness of local variables. (#1396)
* Improved const correctness of local variables.

* Running astyle [ci-skip].

* Removed duplicate 'const'-keyword.
2018-09-24 15:08:16 +02:00
orbitcowboy bdb136de02 PCRE: Fixed unintended message when HAVE_RULES=yes was set. 2018-09-24 09:00:09 +02:00
IOBYTE 01f9ce2c4a Improve debug printing of type qualification when declaration and definition are in different scopes. (#1394) 2018-09-24 06:40:20 +02:00
Paul Fultz II 5bebeec224 Fix issue 8775: Dont follow aliased variables (#1390) 2018-09-24 06:37:47 +02:00
orbitcowboy d08b39c915
Improved const correctness of local variables. There are no functional changes intended. (#1392) 2018-09-23 20:24:51 +02:00
Daniel Marjamäki 6ceab1f245 New fix for #8771. Remove line attribute in <location> when there is no line. This is more 'proper'. 2018-09-23 17:27:38 +02:00
Daniel Marjamäki 83e8465d18 Fixed #8771 (Invalid line number on unmatchedSuppression) 2018-09-23 17:05:32 +02:00
Daniel Marjamäki 3a007cbcbf astyle formatting
[ci skip]
2018-09-23 17:04:52 +02:00
Daniel Marjamäki 7f255c9e6f Refactoring: Use range for loop 2018-09-23 17:02:54 +02:00
Daniel Marjamäki 7db671fee6 Suppressions::NO_LINE : fixed comparisons 2018-09-23 16:50:51 +02:00
Daniel Marjamäki afe09f4d7a Temporarily comment out the followVariable() handling 2018-09-23 16:03:18 +02:00
orbitcowboy 29d7872440
Improvements for PCRE API usage (HAVE_RULES=yes) (#1384)
* PCRE: added pcre_study to improve regex matching speed.

* PCRE: catch return values from pcre_exec and return an error message in case it fails.

* Formatted the code. There are no functional changes intended.

* PCRE: decode internal PCRE error messages.

* Integrating comments from PR.

* PCRE: Use pcre_study() only in case PCRE_CONFIG_JIT is defined.

* PCRE: Fixed potential resource leak. In case prce_compile worked, but pcre_study() returns an error, the allocated resources by pcre_compile() can be freed.

* Make travis happy.

* PCRE: Improved output message format.

* PCRE: Attempt to be compliant to older PCRE versions and fix travis build.
2018-09-23 14:27:46 +02:00
Simon Martin 6bde2445a6 Ticket #8632: Parenthesize ternary operator operands containing < to avoid wrongly thinking a template instantiation is met. (#1389) 2018-09-23 10:27:38 +02:00
Matthias Krüger f965e5873d checkstl: remove uused variable 'beginCondTok'
Was:
lib/checkstl.cpp:2022:30: warning: unused variable 'beginCondTok' [-Wunused-variable]
                const Token *beginCondTok = condBodyTok->previous()->link();
                             ^

also run dmake to update Makefile
2018-09-22 21:10:21 +02:00
Simon Martin 915acac0b8 Ticket #8734: Skip static member variables in CheckUninitVar. (#1388) 2018-09-22 16:52:34 +02:00
Paul Fultz II d43cd56afd Show line number when suggesting std::transform (#1385) 2018-09-21 10:38:30 +02:00
orbitcowboy a26ac4d266 Running astyle. There is no functional change intended. 2018-09-21 08:53:09 +02:00
Paul Fultz II 1e347f6cde Initial check for recommending algorithms (#1352)
Add initial check for loop algorithms
2018-09-19 18:58:59 +02:00
shikamu 83cb0b3394 --suppress on line 0 (#1354)
Fixed --suppress on line 0
2018-09-18 12:58:14 +02:00
orbitcowboy a812da2cf1 Formatted the code. 2018-09-17 17:16:32 +02:00
IOBYTE e9a44f70b2 Remove out of line member functions of instantiated template classes. (#1377)
* Remove out of line member functions of instantiated template classes.
2018-09-14 14:16:34 +02:00
Paul Fultz II 4e7ed9ea6e More robust checking for crashes in followVar (#1375)
More robust checking for crashes in followVar
2018-09-13 09:19:15 +02:00
Paul Fultz II eb07280075 Fix issue 8743: FP when derefencing iterators (#1376) 2018-09-12 17:33:53 +02:00
Paul Fultz II 90a29d986b Fix issue 8730: Dont follow variables with unknown symbols (#1374) 2018-09-12 17:30:18 +02:00