Commit Graph

9438 Commits

Author SHA1 Message Date
Paul Fultz II d8b3fa5c70 Fix #8482: Regression with valueflow (#1159)
* Fix regression with valueflow

* Simplify test case
2018-04-09 16:13:17 +02:00
Daniel Marjamäki f677322c69 Suppressions: Allow symbol-based inline suppressions 2018-04-09 11:50:59 +02:00
PKEuS 17b4721bd2 C++17: Support "if constexpr" (by simplifying it to plain if() statement)
This might lead to complaints about constant expressions as if() statement, but should fix syntax errors.
2018-04-09 11:42:59 +02:00
PKEuS b15cc3f236 Refactorization: Replace several push_back-sequences by initializer lists 2018-04-09 09:54:39 +02:00
Daniel Marjamäki 6f9c115640 Refactoring: use range for loops 2018-04-09 08:00:11 +02:00
Daniel Marjamäki a0906140a6 Suppressions: New extensible Suppressions xml format that allow more attributes. To start with it also allows symbolName. 2018-04-09 06:43:48 +02:00
PKEuS e2002db78d Replaced make_container by C++11 initializer lists 2018-04-08 23:03:44 +02:00
Daniel Marjamäki ae3e649cc4 astyle formatting
[ci skip]
2018-04-08 20:29:52 +02:00
Dmitry-Me d9cbaa83d6 Extract common condition 2018-04-08 21:11:44 +03:00
Paul Fultz II 95fc84a26b Find duplicate expressions assigned to the same variable (#1129)
* Check for duplicate assignments

* Improve checking of expression

* Add more tests

* Use simple match

* Improve robustness of check

* check for null

* Reduce side effects by checking for side effects

* Improve verbose message

* Reword the error message
2018-04-08 14:43:19 +02:00
Daniel Marjamäki ee5c60e8f6 Refactoring, use early continue 2018-04-08 09:30:13 +02:00
Daniel Marjamäki 795b9f5e0f astyle formatting 2018-04-08 09:25:59 +02:00
Paul Fultz II aed84abfd5 Extend valueflow comparison ops (#1153)
* Handle else clause when doing a compare

* Break early

* Fix bug in checking no return else

* Escape quotes

* Add equal sign

* Simplify the logic
2018-04-08 09:24:01 +02:00
Paul Fultz II b85dda77da Add a check for identical inner conditions (#1156) 2018-04-08 08:13:44 +02:00
Daniel Marjamäki 541e255159 Remove inner identical condition 2018-04-08 08:12:56 +02:00
IOBYTE 90983303f0 Fix #8477 (False positive caused by anonymous enum in method body) (#1154) 2018-04-08 08:00:12 +02:00
IOBYTE 4f9073159a Fix another SymbolDatabase bailout (#1157) 2018-04-08 07:29:19 +02:00
IOBYTE 20f0784c06 Fix #8470 ((error) SymbolDatabase bailout; unhandled code) (#1155) 2018-04-07 16:41:39 +02:00
Matthias Krüger 5a104cab6e remove weird "#line 2" from valueflow.cpp 2018-04-06 23:26:08 +02:00
Daniel Marjamäki 0daa3bba30 ValueType: Improved type handling of containers when [] operator is used 2018-04-06 22:26:35 +02:00
IOBYTE 7e15e39f39 Fix some new SymbolDatabase bailout; unhandled code syntax errors. (#1152) 2018-04-06 21:32:32 +02:00
Daniel Marjamäki 05acf9b352 Fixed #8470 ((error) SymbolDatabase bailout; unhandled code) 2018-04-06 16:03:58 +02:00
jrp2014 034296039c Refactor lib/checkunusedvar.cpp 2018-04-06 08:07:15 +02:00
jrp2014 d2160f00b2 Refactor lib/checkuninitvar.cpp 2018-04-06 08:04:06 +02:00
jrp2014 15b5b7ebf4 Refactor lib/checkother.cpp 2018-04-06 08:00:10 +02:00
IOBYTE 9f386d305a Fixed #8280 (False positive uninitMemberVar - initialized from nested overloaded function) (#1151) 2018-04-06 07:53:05 +02:00
jrp2014 c5e14ad590 Refactor lib/checkmemoryleak.cpp 2018-04-05 21:41:31 +02:00
jrp2014 94048d93f6 Refactor lib/checkleakautovar.cpp 2018-04-05 15:58:28 +02:00
jrp2014 c367fc9f09 Refactor lib/checkio.cpp 2018-04-05 15:55:57 +02:00
jrp2014 17bd2f0c72 Refactor lib/checkcondition.cpp 2018-04-05 15:53:49 +02:00
jrp2014 043b64467b Refactor lib/checkclass.cpp 2018-04-05 15:48:23 +02:00
Daniel Marjamäki 4836df9b1d Fix Token::Match pattern 2018-04-05 15:47:25 +02:00
Daniel Marjamäki e5db23fff3 project: import compile_commands.json generated by compiledb-generator 2018-04-05 15:40:59 +02:00
Daniel Marjamäki 3ad6c7ebce Refactoring, use early continue 2018-04-05 08:21:43 +02:00
jrp2014 67a71fa362 Refactor lib/checkbufferoverrun.cpp 2018-04-05 08:17:56 +02:00
jrp2014 e65c63e2bb Refactor lib/astutils.cpp 2018-04-05 08:07:22 +02:00
jrp2014 214322d501 Refactor lib/tokenize 2018-04-05 08:02:59 +02:00
Paul Fultz II b871c85b67 Improve valeflow analysis with comparison operators (#1131)
* Improve valeflow analysis with comparison operators

* Use simple match

* Dont add 0 on comparisons

* Check reverse comparisons

* Use nullptr

* Remove duplicate code tests
2018-04-05 06:51:31 +02:00
Paul Fultz II 54de7b48c9 Fix false positive when constructing with curly brace (#1148) 2018-04-05 06:47:59 +02:00
IOBYTE 06133fa3ba Refactor findFunction to unify two ValueFlow paths. (#1149) 2018-04-05 06:46:48 +02:00
Paul Fultz II 0c6f184423 Fix false positive for opposite conditions when using different containers (#1143)
* Fix false positive for opposite conditions when using different containers

* Add additional test
2018-04-05 06:43:13 +02:00
jrp2014 b6504c70ca Improve constness 2018-04-04 21:51:31 +02:00
IOBYTE a62c932a8f Improve findFunction for function calls with function calls as arguments. (#1147)
Duplicate the existing logic for variable to variable type comparisons
for function return type to variable type comparisons.
2018-04-04 20:44:01 +02:00
Daniel Marjamäki 0d434efc15 virtualCallInConstructor: Clarify warning message 2018-04-04 13:04:40 +02:00
Daniel Marjamäki b3b364b42f virtualCallInConstructor: Updated warning message 2018-04-04 12:52:58 +02:00
Daniel Marjamäki 3b07b749d6 Refactoring, use early return 2018-04-04 10:50:10 +02:00
IOBYTE fa968d75bd Partial fix for #8291: (False positive uninitMemberVar when calling delegated constructor) (#1142) 2018-04-04 08:29:12 +02:00
Paul Fultz II bce5fe5cef Improve duplicate expressions in the ternary op by checking for equal values as well (#1134)
* Improve duplicate expressions in the ternary op by checking for equal values as well

* Use value instead of expression
2018-04-03 21:43:55 +02:00
Paul d240a36a60 Extend nullPointerArithmetic to check for addition as well 2018-04-03 21:32:37 +02:00
Daniel Marjamäki ee22a325c7 virtual function call in constructor: don't warn about explicit scoped call 2018-04-03 14:02:59 +02:00
IOBYTE 2a418fa0f5 Fixed #8466 (False Positive: Member variable is not initialized in the constructor. When using overloaded constructors) (#1141) 2018-04-02 18:32:45 +02:00
Daniel Marjamäki 1046ca2120 Improve check: Warn about virtual function calls in constructor/destructor 2018-04-02 15:31:47 +02:00
Daniel Marjamäki e492932f19 Improve check: Variable is not initialized in private constructor (C++11 or later) 2018-04-02 15:26:15 +02:00
PKEuS 32a2060f14 Set version to 1.83.99/1.84 dev
Updated copyright year in version.h
2018-04-02 15:21:37 +02:00
Daniel Marjamäki 9f92685b92 SymbolDatabase: Throw InternalError if parsing fails 2018-04-02 13:14:48 +02:00
Daniel Marjamäki c0272fc2ef Fixed #8259 (Don't combine &= for anonymous reference parameters) 2018-04-01 10:27:16 +02:00
Daniel Marjamäki 7260be81a6 Update version 2018-03-31 21:25:29 +02:00
Daniel Marjamäki 7e4dba6a7e Updated copyright year 2018-03-31 20:59:09 +02:00
Daniel Marjamäki 4af2e517b9 Fixed #8465 (SymbolDatabase: bailout if there is 'struct A::B ab[5];') 2018-03-31 17:54:47 +02:00
Daniel Marjamäki ecfb4fd26c Fix --dump output 2018-03-31 10:27:34 +02:00
Daniel Marjamäki da4fc25fee Fixed #8432 (Problem with dump files and non-ASCII characters) 2018-03-30 22:34:55 +02:00
Daniel Marjamäki 95ccd9483b gcc 4.5 compatibility 2018-03-30 20:57:25 +02:00
Daniel Marjamäki dbe962ad5d Compatibility fix for gcc 4.5 2018-03-29 22:00:04 +02:00
Daniel Marjamäki 96167ffa51 Compatibility fixes for gcc 4.5 2018-03-29 17:37:06 +02:00
Daniel Marjamäki 1bc8f7f29a astyle formatting 2018-03-29 17:25:20 +02:00
Paul Fultz II 70da3acb70 Add foreach emulation for older compilers (#1138) 2018-03-29 04:51:22 +02:00
Daniel Marjamäki 210b921062 Fixed #8462 (AST: no ast created for 'e = { std::move(address),httpPort, (httpsPort) };') 2018-03-27 13:44:28 +02:00
Daniel Marjamäki e65a5529ad astyle formatting
[ci skip]
2018-03-24 12:30:11 +01:00
Paul 43be20a824 Check more opposite conditions 2018-03-24 07:58:37 +01:00
IOBYTE 5bc039b7da Fix #6367 and #8439 (improve sizeof value flow support) (#1132) 2018-03-23 08:28:12 +01:00
Daniel Marjamäki 5a444f764b Fixed one more syntax error FP related to #8390 2018-03-22 15:20:37 +01:00
Daniel Marjamäki 3d4b773fd1 Fixed #8390 (Syntax error from an MSVC internal header) 2018-03-22 09:07:58 +01:00
Daniel Marjamäki 1ae75303a7 micro optimisation, use const reference 2018-03-19 09:53:14 +01:00
Daniel Marjamäki 7699f6432b Fixed #8288 (valueFlowGlobalVar: compound assignments) 2018-03-18 19:53:33 +01:00
Daniel Marjamäki f7d537ea26 Null pointers: better detection of null pointer dereference 2018-03-18 19:02:30 +01:00
Daniel Marjamäki ec6133aea2 Fixed #8182 (False positive uninitvar - variable initialized in function in ternary expression) 2018-03-16 19:13:48 +01:00
Paul Fultz II 166e4cafcd Check for functions calls in sizeof calculations (#1111)
* Check for functions calls in sizeof calculations

* Use seperate message and id for sizeofFunction

* Check for overloads

* Using decltype with a function should not be an error

* Fix warning

* Fix false positives when running pass the close paren

* Fix test error

* Try to fix more false positives

* Traverse using astOperand2

* Only check first argument

* Update fixes from feedback from PR
2018-03-15 10:24:17 +01:00
Daniel Marjamäki 814828f436 dump: save if variable is const 2018-03-14 11:54:23 +01:00
Daniel Marjamäki 2c3cd402ba Thread safety: changed local static variable 'count' to member variable 2018-03-14 09:41:27 +01:00
Daniel Marjamäki 9800e82d13 GUI: Allow that platform is selected in project dialog 2018-03-13 13:07:10 +01:00
Daniel Marjamäki 0d2171a553 astyle formatting 2018-03-12 13:43:04 +01:00
Daniel Marjamäki 31dd4ed787 use early continue 2018-03-12 12:50:33 +01:00
Daniel Marjamäki c0e14d0a5d Added doxygen comment 2018-03-12 12:49:27 +01:00
Daniel Marjamäki 3ef3a6088d astyle formatting 2018-03-12 10:19:55 +01:00
Hinterwaeldlers a9b1f4c640 Taking care of operation overloading functions (#1108) 2018-03-12 10:25:30 +01:00
Daniel Marjamäki 46307df9b6 Renamed method 2018-03-11 15:06:08 +01:00
Daniel Marjamäki 380ecc408f Fixed #8418 (AST: wrong ast for throw expression) 2018-03-10 22:30:21 +01:00
amai2012 b1d943894b Copy platforms/ directory to bin/ 2018-02-27 09:09:12 +01:00
Sebastian 54d1490c89 platform.cpp: Fix that platform files on Windows are not found (#1096)
* platform.cpp: Fix that platform files on Windows are not found

I suggested this change here:
https://trac.cppcheck.net/ticket/8242#comment:7

* Use fromNativeSeparators() and only search for forwardslash
2018-02-26 13:51:02 +01:00
Daniel Marjamäki 1628405869 Fix internal warning 2018-02-24 22:35:37 +01:00
Daniel Marjamäki 7701e4594a ValueFlowBeforeCondition: Fix wrong value in do-while condition when there is a break in the loop body 2018-02-24 22:07:34 +01:00
orbitcowboy b7b376d901 checkTypes: Take into account type promotion to integer. 2018-02-19 23:55:38 +01:00
orbitcowboy b1b3164259 checktype: Added handling of 'short'-type and added test cases. 2018-02-18 21:09:19 +01:00
orbitcowboy 50844aa7fc checkType: Take into account the size of char. 2018-02-18 14:28:48 +01:00
Daniel Marjamäki 5c44580528 Refactoring, use early continue and make code a bit more specific. 2018-02-16 22:59:38 +01:00
IOBYTE fcde1d80e9 Fix #8382 (Syntax error when scanning code with template and attribute) (#1089)
* Fix #8382 (Syntax error when scanning code with template and attribute)

This commit only addresses #8382. There are issues concerning which
versions of C++ should be supported and also generic C++ 14 attribute
support which can be revisited later.

* Remove all C++ style attributes.

Remove all C++ style attributes when C++ version is 11 or greater.
Rename simplify function to simplifyCPPAttributes.
Handle more cases of roreturn function attribute.
2018-02-16 22:25:51 +01:00
Daniel Marjamäki 03a222e926 Platform: Improve testability of platform file loading 2018-02-15 21:01:34 +01:00
orbitcowboy b86b7175cb cli:platforms: Added missing sizeof Boolean variable handling when platform file is loaded from XML. 2018-02-13 11:27:50 +01:00
orbitcowboy 1906067aac cli:platforms: Fixed wrong loading of platform info. 2018-02-13 10:41:15 +01:00
Daniel Marjamäki 69b50b274c Try to make Travis happy 2018-02-11 22:54:14 +01:00