Daniel Marjamäki
4e2f8d5d48
astyle formatting
...
[ci skip]
2020-05-23 07:30:22 +02:00
Daniel Marjamäki
5c3474ec5c
Renamed hasReturnFunction to hasNoreturFunction
2020-05-23 07:30:05 +02:00
Oliver Stöneberg
37bc0483a4
made check.h less heavy ( #2633 )
2020-05-23 07:16:49 +02:00
Paul Fultz II
0832830a95
Fix issue 9721: ValueFlow: Comparison is always false, but ValueFlow says it is always true ( #2658 )
2020-05-23 07:15:13 +02:00
Paul Fultz II
4270819728
Fix issue 9713: FP invalidContainerLoop when modifying container and immediately exiting the loop ( #2659 )
2020-05-23 07:14:45 +02:00
Paul Fultz II
6162ebd608
Fix issue 9714: FP invalidContainer related to auto and std::string::insert ( #2660 )
2020-05-23 07:13:55 +02:00
Paul Fultz II
526abd4b52
Fix issue 9738: ValueFlow: handle std::tie better ( #2657 )
2020-05-22 22:57:20 +02:00
Daniel Marjamäki
c86cfdaa50
Fixed #9736 (False positive: knownArgument in assert calls)
2020-05-22 11:49:28 +02:00
Daniel Marjamäki
43b58dbc9e
Fixed #9729 (AST: lambda with noexcept)
2020-05-22 11:29:10 +02:00
Daniel Marjamäki
ac1ceb85b6
AST: improved AST when expression starts with %char% or %str%
2020-05-22 09:35:55 +02:00
Daniel Marjamäki
4c5310433c
astyle formatting
...
[ci skip]
2020-05-22 08:48:28 +02:00
Daniel Marjamäki
ffdf13fcdb
AST: A little code cleanup
2020-05-22 08:48:06 +02:00
Paul Fultz II
8301fa8244
Fix issue 8144: valueFlowBeforeCondition: struct ( #2645 )
2020-05-21 08:47:48 +02:00
miltolstoy
a9d8b3495d
feat: add modulo of one check ( #9528 ) ( #2650 )
2020-05-20 23:01:32 +02:00
PKEuS
662745b504
Fixed several coverity messages
2020-05-20 18:54:16 +02:00
Ken-Patrick Lehrmann
a96a879b6d
Fix crash in addons/test/test-misra.py ( #2652 )
2020-05-20 16:02:13 +02:00
Ken-Patrick Lehrmann
79d3f488da
Pass defines flags when calling clang ( #2651 )
2020-05-20 14:56:55 +02:00
Daniel Marjamäki
299e11c991
Fixed Cppcheck warnings
2020-05-19 21:55:28 +02:00
PKEuS
dc701276de
Optimizations to ValueFlow and ForwardAnalyzer:
...
- Remove errorPath of a value on assignment (this fixes enormous memory consumption for code with many subsequent assignments)
- De-virtualized a simple get function that was virtual for no reason
- Cloned function isAliasOf() for single values to avoid instantiating unnecessary std::list objects (
- Replaced a couple of trivial Token::Match/simpleMatch expressions by direct comparison
- Treat enumerators as literal values
2020-05-19 21:07:04 +02:00
Daniel Marjamäki
64291c6b61
fix Clang execution
2020-05-19 19:17:23 +02:00
Daniel Marjamäki
32e569704b
executeCommand in CppCheckExecutor or QCheckThread
2020-05-19 16:04:40 +02:00
PKEuS
baca1fbe04
Fixed compilation: Added missing include
2020-05-19 14:32:50 +02:00
PKEuS
22884888fb
Optimization: Improved performance of ForwardAnalyzer by adding some pre-checks and combining conditions
2020-05-19 13:48:15 +02:00
PKEuS
c155062cf2
Optimization: Speed up SymbolDatabase creation and Tokenizer::findGarbageCode() by using Token::isKeyword() for pre-checks
2020-05-19 13:48:15 +02:00
PKEuS
f6788c0472
Fixed Token::isKeyword: Actually set this flag to a reasonable value in all code paths
2020-05-19 13:47:25 +02:00
PKEuS
c9d8f607df
Optimization: Reduced peak memory usage (30% in my test case) by immediately deleting simplecpp::TokenList while creating the cppcheck TokenList.
2020-05-19 12:08:17 +02:00
amai2012
d78ff975a0
Run dmake
2020-05-19 10:11:56 +02:00
Daniel Marjamäki
37646c9ffb
revert accidental mode changes
2020-05-19 10:05:14 +02:00
PKEuS
09a30bd6b5
Optimization: Speed up Tokenizer::findGarbageCode() (by 15% in my test case) by avoiding iterating through token list multiple times
2020-05-19 08:54:47 +02:00
PKEuS
a9cea9ad7c
Fixed compilation (next attempt): Added more missing includes
2020-05-19 08:53:38 +02:00
PKEuS
f0ac0c8675
Optimization: Remove simplecpp::TokenList as soon as cppecheck TokenList was created. This saves memory while checks are running (20% in my test case), although not peak memory
2020-05-19 08:41:05 +02:00
PKEuS
ade253a730
Optimization: Reduced memory consumption of token list
...
- allocate memory for mTemplateSimplifierPointers only if necessary
- reordered member variables in TokenImpl
2020-05-19 08:40:24 +02:00
PKEuS
c409daf918
Fixed compilation: Added missing include
2020-05-19 08:38:51 +02:00
PKEuS
4948f85460
Visual Studio: Updated solution
...
- Enable several compiler warnings again
- Let __cplusplus have a reasonable value
2020-05-19 08:35:13 +02:00
PKEuS
d6390dbd14
Optimization: Improved performance of simplifyTypedef for code with lots of typedefs
...
20% performance gain when checking ExtremeTuxRacer sourcecode (with glext.h available)
2020-05-19 08:35:13 +02:00
Philipp Kloke
32923b7ac5
Refactorization: Fixed a couple of compiler warnings about reusing variable names
2020-05-19 08:35:12 +02:00
PKEuS
793ed68029
Refactorization: Moved code from header to source
...
- from utils.h to new utils.cpp
- from token.h to token.cpp
- from valueflow.h to valueflow.cpp
- from errorlogger.h to errorlogger.cpp
2020-05-19 08:35:12 +02:00
Daniel Marjamäki
65e9f6210c
CLI: Tweak execution of python addons
2020-05-19 08:14:56 +02:00
Daniel Marjamäki
259724d6e3
astyle formatting
...
[ci skip]
2020-05-18 19:53:35 +02:00
shaneasd
7bfd686f04
Fix #9700 duplicateBranch false positive from missing scope operator :: in ast ( #2646 )
2020-05-18 19:31:13 +02:00
Daniel Marjamäki
f6f489ea49
Try to make AppVeyor happy
2020-05-18 09:51:47 +02:00
Daniel Marjamäki
aa7a4b8372
Try to make AppVeyor happy
2020-05-18 08:24:17 +02:00
Daniel Marjamäki
a0f2fda53a
Addons: If normal python fails, try 'python'
2020-05-18 07:44:46 +02:00
Daniel Marjamäki
2ef538c171
Tweak paths when executing addons in Cppcheck
2020-05-17 21:45:37 +02:00
Daniel Marjamäki
9eda399323
Less strict unknownMacro
2020-05-17 19:12:16 +02:00
Daniel Marjamäki
547d1b158e
Fixed #9723 (GUI: inline suppressions does not work for addons)
2020-05-17 16:50:13 +02:00
Daniel Marjamäki
871cf379d5
ExprData: Better handling of ternary operator
2020-05-15 21:34:52 +02:00
Daniel Marjamäki
76f4fae806
Bug hunting; Started to activate some itc tests for uninitialized variables
2020-05-15 20:58:33 +02:00
Daniel Marjamäki
57e9036186
Cppcheck --addon command should use python3 by default. It can be overridden if needed.
2020-05-15 14:33:35 +02:00
Daniel Marjamäki
e508950f4f
ExprEngine; Activate bug hunting analysis for uninitialized variables/data. This analysis is pretty experimental right now.
2020-05-15 11:25:56 +02:00
Daniel Marjamäki
275c8e84d2
Set development version 2.0.99
2020-05-15 11:15:34 +02:00
versat
2fd2edd3f9
astyle formatting
...
[ci skip]
2020-05-14 18:18:14 +02:00
Oliver Stöneberg
a0317477c9
utils.h: avoid unnecessary string creation in isStringCharLiteral() ( #2638 )
...
* utils.h: avoid unnecessary string creation in isStringCharLiteral()
reduces Ir from 541 to 63 in a test
* dmake
2020-05-14 14:45:35 +02:00
Paul Fultz II
d123279fc1
Fix issue 9709: ValueFlow: variable value is not known ( #2643 )
2020-05-14 14:10:32 +02:00
Daniel Marjamäki
0799d74071
Tweak Z3 version checks
2020-05-12 17:01:16 +02:00
Daniel Marjamäki
3e650c311b
Remove NEW_Z3 macro
2020-05-12 16:57:07 +02:00
Daniel Marjamäki
046f8eb6c6
ExprEngine: improved handling when lhs/rhs for && has unknown value
2020-05-10 22:50:23 +02:00
Oliver Stöneberg
e0e50139cb
cleaned up includes based on include-what-you-use ( #2632 )
...
* cleaned up includes based on include-what-you-use
* token.cpp: fixed -Wextra-semi-stmt warning
2020-05-10 16:45:45 +02:00
Daniel Marjamäki
dc32f428ff
Set Cppcheck version
2020-05-10 11:28:31 +02:00
Daniel Marjamäki
08ddd84780
Update copyright year
2020-05-10 11:16:32 +02:00
Daniel Marjamäki
3e0218299b
Revert "Update copyright year"
...
This reverts commit 6eec6c4bd5
.
2020-05-10 11:13:05 +02:00
Daniel Marjamäki
6eec6c4bd5
Update copyright year
2020-05-10 11:11:34 +02:00
Daniel Marjamäki
137f262300
Fix Token::isImpossibleIntValue
2020-05-09 10:30:19 +02:00
Daniel Marjamäki
d4169f04d5
Bug hunting; Avoid false warnings for impossible values
2020-05-08 17:42:56 +02:00
Daniel Marjamäki
ab8bf81f03
ValueFlow: Try to clarify debug output for impossible values
2020-05-08 16:13:55 +02:00
Daniel Marjamäki
02d88cb191
Travis: Run TestExprEngine tests
2020-05-08 12:21:22 +02:00
Daniel Marjamäki
4779cb124e
Fixed #9649 (False positive: uninitialized struct member)
2020-05-07 22:27:18 +02:00
Daniel Marjamäki
00d1091506
Tokenizer: operator handling, fix tests
2020-05-04 23:00:51 +02:00
Daniel Marjamäki
06cb0e99d1
Tokenizer: Fix syntax error when operator* is called
2020-05-04 21:33:30 +02:00
Daniel Marjamäki
8c57055a0b
Try to make Travis happy
2020-05-03 20:46:29 +02:00
Daniel Marjamäki
b5094f298a
Bug hunting; Add new 'incomplete' flag for error messages. Used when analysis is incomplete.
2020-05-03 17:20:38 +02:00
Daniel Marjamäki
4c63940902
Add bug hunting test case for CVE-2019-7156
2020-05-02 22:22:31 +02:00
Daniel Marjamäki
5eeeba97eb
SymbolDatabase: Better handling of function pointer function argument
2020-05-02 17:04:54 +02:00
Daniel Marjamäki
56abbc1d42
Fixed segmentation faults
2020-05-01 18:10:18 +02:00
Daniel Marjamäki
34572a40ab
Bug hunting: Fixed handling of switch 'case %char%'
2020-05-01 15:15:24 +02:00
Daniel Marjamäki
999ef06156
ExprEngine: Try to handle function with unknown type better
2020-04-30 22:10:30 +02:00
Daniel Marjamäki
b27fabaacb
Refactoring ExprEngine
2020-04-30 21:49:27 +02:00
Daniel Marjamäki
b97250e0fa
ExprEngine; Try to handle assignments better
2020-04-30 21:05:34 +02:00
Daniel Marjamäki
5a9e81897a
ExprEngine: Document how it works
2020-04-30 12:18:49 +02:00
Daniel Marjamäki
e30eabc896
ExprEngine: Fail to execute contract => write error message
2020-04-29 18:30:12 +02:00
Daniel Marjamäki
daea5e2d6c
Bug hunting: Do not warn about 'Division by zero' when variable is uninitialized
2020-04-29 11:00:33 +02:00
Daniel Marjamäki
5d67fd0e56
Bug hunting: Set 'inconclusive' flag for bailout values
2020-04-29 10:58:01 +02:00
Daniel Marjamäki
3eb19a64cb
Removed inline suppression, it was not a FP, use #ifdef differently
2020-04-28 22:29:16 +02:00
Daniel Marjamäki
13e79fdeb6
Temporary inline suppression to hide false positive
2020-04-28 22:21:07 +02:00
Daniel Marjamäki
249a101ec2
Travis: Fix naming
2020-04-28 22:18:02 +02:00
Daniel Marjamäki
12dfd8a5ca
GUI: Show missing/added contracts in tab
2020-04-28 22:09:01 +02:00
Daniel Marjamäki
dab8b9fd31
ExprEngine: Improved checking of contracts in function calls
2020-04-28 17:16:13 +02:00
Daniel Marjamäki
c19a9c2ad9
GUI: Only edit contract for non-bailout warnings
2020-04-27 19:43:38 +02:00
Daniel Marjamäki
2e369cc842
astyle formatting
...
[ci skip]
2020-04-27 17:35:52 +02:00
Lionel Gimbert
ad6be7b122
Enforcing CppCoreGuideline C.35 on virtual class destructor ( #2572 )
...
* Enforcing CppCoreGuideline C.35
A base class destructor should be either public and virtual, or protected and non-virtual
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rc-dtor-virtual
* Protected destructor of ciurtual class can be virtual
2020-04-27 09:22:42 +02:00
Daniel Marjamäki
f7096a2232
Bug hunting: basic handling of contracts through GUI
2020-04-27 09:08:50 +02:00
Daniel Marjamäki
72e0a4be29
Fixed initializerList warning
2020-04-26 15:24:25 +02:00
Daniel Marjamäki
6d7dd7400d
Refactoring; Sort options alphabetically. Removed unused --check-diff functionality.
2020-04-26 10:22:12 +02:00
Daniel Marjamäki
47c998e52d
Fixed #9689 (setVarId: wrong varid when 'not' is used)
2020-04-25 14:42:45 +02:00
Daniel Marjamäki
39710f106c
Fixed #9693 (Bug hunting: Segmentation fault with --bug-hunting and clangimport.cpp)
2020-04-25 10:13:18 +02:00
Oliver Stöneberg
04bd2bdb74
some sanitizer build fixes and cleanups ( #2621 )
...
* cleaned up sanitizer build flags
* exprengine.cpp: work around linker error with Clang and UBSAN
2020-04-24 21:17:06 +02:00
Daniel Marjamäki
3042bbdc3d
Bug hunting: Handle early returns faster
2020-04-24 18:51:54 +02:00
Paul Fultz II
2a09465a07
Fix issue 9686: Regression: ValueFlow should handle try/catch better ( #2618 )
2020-04-22 19:20:03 +02:00
Oliver Stöneberg
1388e9385b
cleaned up setting of compiler options and a few more things in CMake ( #2599 )
...
* cleaned up compiler options related code in CMake
* moved cmake_minimum_required() and raised to latest 2.8.x version
* use proper compiler version check / print compiler version
* fixed linking of sanitized builds
* added proper version checks to newer Clang warnings and enabled them / moved tinyxml_objs flags to proper compiler
* disabled -Wdeprecated-declarations for Clang
* compileroptions.cmake: removed unnecessary check for clang++ existence - CMAKE_CXX_COMPILER_ID is determined by CMake
* printInfo.cmake: removed unnecessary message for ANALYZE_ADDRESS - LSAN is part of ASAN and enabled by default
* cleaned up if() comparisons in CMake
* added/adjusted TODOs
2020-04-22 11:04:19 +02:00
Daniel Marjamäki
387f0a268b
Clang import: Better bailout for syntax errors when build dir is not used
2020-04-22 10:27:44 +02:00
Paul Fultz II
d88557bc18
Rename constArgument to knownArgument ( #2616 )
2020-04-22 09:13:35 +02:00
Daniel Marjamäki
05dcb9a435
Clang import; Allow Clang import without a Cppcheck build dir
2020-04-21 22:26:34 +02:00
Oliver Stöneberg
1af959af2c
fixed -Wextra-semi-stmt Clang warnings ( #2553 )
...
* fixed -Wextra-semi-stmt Clang warnings
* adjusted REDIRECT macro to require a semicolon
* testmathlib.cpp: rolled back accidental change
2020-04-21 17:27:51 +02:00
Daniel Marjamäki
bda73600e0
Tokenizer: Improved removal of unused template ( #9588 )
2020-04-20 20:48:22 +02:00
Daniel Marjamäki
da6e0308c5
Fixed #9195 (False positive: shadowFunction when constructor is shadowed)
2020-04-20 18:02:10 +02:00
Zorgovskiy
08fc956990
Fixes issue #9664 ( #2614 )
2020-04-20 08:59:35 +02:00
Daniel Marjamäki
219180b00a
Fixed #9038 (Auto type with explicit pointer symbol detected as integer)
2020-04-19 20:08:47 +02:00
Lukas Grützmacher
095fd2bc62
add command line option to select single project configuration of loaded solution ( #2523 )
...
* add command line option to select single project configuration of loaded solution
* Update cmdlineparser.cpp
* Update manual.md
* fix initialization
2020-04-19 18:19:28 +02:00
Daniel Marjamäki
e8bbfdbfee
Fixed #9559 (Multiple checks to std::atomic are not redundant)
2020-04-19 17:29:40 +02:00
Daniel Marjamäki
3c56ccc33f
Fixed #9531 (Syntax Error: AST broken, 'for' doesn't have two operands.)
2020-04-19 17:00:22 +02:00
Paul Fultz II
e2efb338b6
Fix issue 9678: False positive: generic valueflow forward analysis ( #2611 )
2020-04-19 08:28:07 +02:00
Daniel Marjamäki
54978847c5
Fixed #8916 (FP: followVar does not seem to handle non-const method call properly)
2020-04-18 19:54:55 +02:00
Daniel Marjamäki
de53f63f76
Fixed #9665 (Tokenizer::setVarId: for loop variables)
2020-04-18 12:08:53 +02:00
Carl Michael Grüner Monzón
7c93f51885
Consider pre{inc,dec}rements on assert checks ( #2605 )
...
* Consider pre{inc,dec}rements on assert checks
* Simplify code by using new AST APIs
* Fix assert test with invalid syntax
2020-04-18 09:26:24 +02:00
Paul Fultz II
453a69dd8c
Fix issue 9677: False positive: returning pointer to oject that will not be invalid ( #2607 )
...
* Fix issue 9677: False positive: returning pointer to oject that will not be invalid
* Formatting
2020-04-18 09:23:10 +02:00
Daniel Marjamäki
aa1bbf2e62
Fixed #9679 (False positive: use this after free (lambda not executed directly))
2020-04-17 20:20:45 +02:00
Daniel Marjamäki
e4bea02cad
Fixed #7578 (varid not set for 'pointer to array' member variable in method)
2020-04-15 20:56:21 +02:00
Daniel Marjamäki
266c8d2c09
Remove temporary daca bailouts
2020-04-15 19:54:56 +02:00
Daniel Marjamäki
98be091d80
Fixed typedef simplification for array of function pointers
2020-04-13 16:28:01 +02:00
Daniel Marjamäki
9ccf068393
astyle formatting
...
[ci skip]
2020-04-13 13:48:05 +02:00
Oliver Stöneberg
2c1e36e63e
cleaned up includes based on include-what-you-use ( #2600 )
...
* cleaned up includes based on include-what-you-use
* check.h: trying to work around Visual Studio 2012 bug
* fixed Visual Studio compilation
2020-04-13 13:44:48 +02:00
Daniel Marjamäki
0747bc7ba3
Clang import; Ensure Function::arg is set
2020-04-13 13:37:34 +02:00
Daniel Marjamäki
e1543587e0
Clang import; Bailout if clang reports error message
2020-04-13 12:52:24 +02:00
Daniel Marjamäki
2f5e585e59
astyle formatting
...
[ci skip]
2020-04-13 12:52:00 +02:00
Daniel Marjamäki
adb3588b24
Clang import; Set Variable::typeStartToken and Variable::typeEndToken
2020-04-13 10:45:31 +02:00
Daniel Marjamäki
c99867421d
Clang import; Fixed dead pointer
2020-04-12 22:41:45 +02:00
shaneasd
82c09f243b
Maybeunusedsupport ( #2570 )
...
* Add rudimentary support for [[maybe_unused]]
* Add more test cases. use the symboldatabase rather than reparsing. Fix travis error.
* test review actions
* change var to usage._var
2020-04-12 20:35:54 +02:00
Daniel Marjamäki
97f5c5767e
Clang import; Ensure function pointer is created
2020-04-12 20:34:05 +02:00
Daniel Marjamäki
6b579293b6
Clang import; Destructor
2020-04-12 17:27:49 +02:00
Daniel Marjamäki
4dfb793cd2
Clang import; Improved handling of constructor
2020-04-12 17:27:49 +02:00
Daniel Marjamäki
97b04ba9a7
Syntax check: Using keyword in global scope
2020-04-11 17:36:22 +02:00
Paul Fultz II
8b27f1c216
Fix issue 9667: crash: crash in valueflow for weird code where label address is returned ( #2602 )
2020-04-11 13:56:53 +02:00
Daniel Marjamäki
e8e3c2660d
Detect syntax error 'x ==> y'
2020-04-11 11:05:27 +02:00
Daniel Marjamäki
32bf53eeda
Fixed #9221 (False positive when using an array of lists)
2020-04-10 14:01:15 +02:00
Daniel Marjamäki
eff225a09c
Use 'static' instead of unnamed namespace for variables
2020-04-10 13:48:38 +02:00
Daniel Marjamäki
b67a043e5b
Remove unused variable
2020-04-10 13:16:15 +02:00
Daniel Marjamäki
05769e8dcc
Code cleanup
2020-04-10 13:14:38 +02:00
Daniel Marjamäki
c029d5150c
Fixed #9123 (False positive: uninitialized variable)
2020-04-10 12:33:15 +02:00
Daniel Marjamäki
0725c2290c
Tokenizer: Do not simplify function pointers to normal pointers as we loose important information
2020-04-10 11:53:32 +02:00
Daniel Marjamäki
e0c8118c02
Fixed crash in AST
2020-04-09 17:42:51 +02:00
Daniel Marjamäki
d7af52865d
ValueFlow: avoid crash when && is used in r-value variable declaration
2020-04-09 14:38:10 +02:00
Daniel Marjamäki
e7ddd9cc15
ForwardAnalyzer: Add recursion limit 10000
2020-04-09 12:11:33 +02:00
Oliver Stöneberg
aaffd1f761
some cleanups ( #2601 )
...
* exclude the *_sanitized fuzz-client dependencies from all as well
* .gitignore: added CMake output folders and removed a duplicated entry
2020-04-09 09:23:31 +02:00
Daniel Marjamäki
8e9d7290b2
Tokenizer::simplifyTypedef: Better handling of r-value references
2020-04-08 22:40:45 +02:00
Achouv
7719e4309d
avoid false positive unused static const struct member ( #2598 )
2020-04-08 18:09:20 +02:00
Oliver Stöneberg
e3b644d877
aligned GCC warnings ( #2592 )
...
* excluded oss-fuzz related CMake targets from all
* checkstl.cpp: fixed -Wmissing-declarations warning
* suppress -Wsuggest-attribute=format GCC warnings for tinyxml in CMake for now
* aligned GCC warnings in dmake, CMake and Travis / removed now useless WARNINGS_ANSI_ISO
2020-04-08 14:56:12 +02:00
Paul Fultz II
3773d0e875
Find more redundant conditions ( #2597 )
2020-04-07 07:15:15 +02:00
Daniel Marjamäki
66ee3a0afc
Clang import: Better handling of methods that are defined after declaration
2020-04-06 17:18:52 +02:00
Daniel Marjamäki
8dd0a9241c
TemplateSimplifier: Simplification of const types
2020-04-05 13:51:58 +02:00
Daniel Marjamäki
189cf29597
astyle formatting
...
[ci skip]
2020-04-05 10:57:51 +02:00