Daniel Marjamäki
42437277dc
Update Copyright year
2021-03-21 20:58:32 +01:00
Daniel Marjamäki
51564504a8
astyle formatting
2021-03-20 18:54:46 +01:00
Daniel Marjamäki
b2691bda88
Fixed false positive in self check
2021-03-20 18:54:46 +01:00
Paul Fultz II
b0ac92ce8f
Report an error if analysis becomes cyclic ( #3173 )
2021-03-20 14:02:07 +01:00
Tetrix
9b7f1f6280
simplifyCPPAttribute tokenizer strips alignas ( #3171 )
2021-03-20 10:38:47 +01:00
IOBYTE
1874b9cb0f
fix crash in CheckClass::getFileInfo ( #3172 )
...
* fix crash in CheckClass::getFileInfo
* fix another crash
* fix memory leak
Co-authored-by: Robert Reif <reif@FX6840>
2021-03-19 09:19:48 +01:00
IOBYTE
b1b7fbb63a
partial revert of b1eaa3021f
( #3174 )
...
It is necessary to use a fake NameAndToken in
mTypesUsedInTemplateInstantiation rather than a Token pointer so the
template simplifiers internal state is kept valid when tokens are
deleted. This prevents a use after free.
Co-authored-by: Robert Reif <reif@FX6840>
2021-03-18 09:15:21 +01:00
IOBYTE
c9f09fc73f
small template simplifier fixes ( #3168 )
...
* small template simplifier optimization
* don't look for template parameter name in default values
* fix cppcheck warning
* add test for TemplateSimplifier::getTemplateParametersInDeclaration()
Also removed TemplateSimplifier::getTemplateParametersInDeclaration()
return value since it wasn't used.
* added another test
Co-authored-by: Robert Reif <reif@FX6840>
2021-03-16 09:31:52 +01:00
Daniel Marjamäki
7d4582d8ef
Fixed #9832 (extract configurations; include guards not handled correctly '#if !defined(FILE1_H)')
2021-03-12 18:16:57 +01:00
Rikard Falkeborn
103e52f394
Fix tokenizing of x[i](0) ( Fixes #8875 ) ( #3167 )
...
Fix faulty removal of parenthesis when "]" is followed by parenthesis
with a number inside, for example when calling a function pointer in
an array or (perhaps more common) in c++, calling operator ( on an
element in an array.
Fixes #8875 where such wrong simplification lead to a FP with too many
bits shifted due to "<<" was interpreted like a shift operator rather
than a stream output.
2021-03-11 08:16:25 +01:00
Daniel Marjamäki
3502036b14
Usability: Fixed loading of platform file placed in same path as project file
2021-03-05 08:39:09 +01:00
IOBYTE
fe4964f22c
fix overloaded template instantiation ( #3160 )
2021-03-04 08:43:22 +01:00
Rikard Falkeborn
27316e04ed
Fix #10187 (memleak open with fd >= 0) ( #3156 )
2021-03-03 07:00:28 +01:00
Rikard Falkeborn
42a41e8b41
Fix #9139 (leak when variable has const qualifier) ( #3159 )
...
Also, in the tests, change socket/close to resource to get error
messages which say "resource leak" instead of "memory leak".
2021-03-03 06:58:38 +01:00
IOBYTE
8c57e2bb14
fix template simplifier overloaded specialized instantiations ( #3154 )
2021-02-28 21:52:14 +01:00
Daniel Marjamäki
c9bc5a076f
Fixed #10014 (-U switch ignored when using --project=compile_commands.json and --force)
2021-02-28 21:43:51 +01:00
IOBYTE
bc8eb164a3
fix more daca simplifyUsing hangs ( #3152 )
2021-02-26 18:30:17 +01:00
Rikard Falkeborn
c3eb37972d
Fix #10182 (FN memory leak with if-statement) ( #3151 )
...
Improve leak detections in if-statements. This is done by checking
for leaks every time a scope is left. This allows cppcheck to catch
more memory leaks, as well as improve some error messages which now
contain the line where the variable goes out of scope, instead of the
end of the function.
2021-02-26 12:58:52 +01:00
Rikard Falkeborn
951ca2c8b9
Fix #10186 (FP memleak with cast and assignment) ( #3148 )
2021-02-25 10:55:34 +01:00
Daniel Marjamäki
0988448319
Fixed self-check. Naming conventions
2021-02-25 10:54:29 +01:00
Daniel Marjamäki
849ea6b3c8
Fix compilation errors
2021-02-24 22:12:48 +01:00
PKEuS
141d2ac215
Refactorization: Improved internal implementation of severity and certainty levels
...
Backported from LCppC.
2021-02-24 22:00:06 +01:00
PKEuS
c25b4f1ad6
Fixed false negatives incompleteArrayFill on user defined types (estimate size to determine if it is larger than one byte)
...
Merged from LCppC.
2021-02-24 21:48:26 +01:00
IOBYTE
9bb57a7b6f
fix #10183 (performance regression (hang) - ScopeInfo3::findInChildren()) ( #3147 )
2021-02-24 06:36:53 +01:00
IOBYTE
fc1cfba5e0
fix simplifyUsing hang parsing class initializer list using {} ( #3146 )
...
Co-authored-by: Robert Reif <reif@FX6840>
2021-02-23 20:35:20 +01:00
IOBYTE
a07f93f819
fix simplifyUsing crash and hang ( #3145 )
2021-02-23 09:48:15 +01:00
shaneasd
02ac2b08a0
Fix some warnings ( #3096 )
2021-02-23 08:19:05 +01:00
Daniel Marjamäki
627a5e75cc
Token::stringify; refactor in/out parameter to return value
2021-02-21 17:21:33 +01:00
Daniel Marjamäki
cc1dfe243c
Fix Cppcheck warnings
2021-02-20 17:22:04 +01:00
PKEuS
29a6031cea
Fixed more false negatives (and recently introduced false positives) literalWithCharPtrCompare by using ValueType
...
Merged from LCppC.
2021-02-20 13:29:59 +01:00
PKEuS
25678a9faf
Refactorized CheckStl::string_c_str(), fixing some false negatives by supporting member functions and overloads
...
Merged from LCppC.
2021-02-20 12:52:39 +01:00
PKEuS
423d7dbc3c
Fixed false negatives literalWithCharPtrCompare when address-of operator (C only) or arrays are used, adapted TODO unit tests
...
Enabled working unit test in testunusedvar.cpp
Merged from LCppC.
2021-02-20 12:42:48 +01:00
Robert Reif
3c6fae37e4
minor simplifyUsing optimizations
...
The using type aliases are a C++ 11 feature so only check for them in C++ 11 or later.
Don't try to simplify a type alias when it can't be parsed.
2021-02-19 22:48:31 +01:00
PKEuS
aa2f143ea6
Fixed false positive: Parameter can be declared with const in constructors did handle noexcept
...
Merged from LCppC.
2021-02-19 08:21:26 +01:00
PKEuS
1a7595e29b
Bugfix: Apply --relative-paths also to preprocessor errors
...
Merged from LCppC
2021-02-18 22:35:55 +01:00
PKEuS
6a811eec1c
Refactorization: Removed unused functions
2021-02-17 22:44:03 +01:00
Philipp Kloke
ef82897af5
Refactorization: Use std::string::pop_back
...
Merged from LCppC.
2021-02-17 22:39:29 +01:00
PKEuS
2fa2fec24f
Visual Studio: Added missing file
...
Merged from LCppC.
2021-02-17 21:52:31 +01:00
IOBYTE
8547ff8cc2
fix some hangs in daca from uninstantiated template classes derived f… ( #3133 )
...
* fix some hangs in daca from uninstantiated template classes derived from itself
* remove assertions
* fix another simplifyUsing hang
Co-authored-by: Robert Reif <reif@FX6840>
2021-02-17 18:12:49 +01:00
Paul Fultz II
0619b873d0
Fix issue 10178: FP: nullPointerRedundantCheck with ternary and null condition first ( #3134 )
2021-02-17 12:09:11 +01:00
IOBYTE
7ab84bef0c
fix daca crash in intel-compute-runtime ( #3132 )
2021-02-15 08:12:29 +01:00
Daniel Marjamäki
70511464f5
Fixed Cppcheck self-check
2021-02-14 15:53:46 +01:00
Daniel Marjamäki
f08dde1140
Fixed #10013 (Tokenizer: Code with 'not' is not handled)
2021-02-13 20:32:49 +01:00
Oliver Stöneberg
3814163373
some MathLib adjustments for out-of-range numbers after std::stringstream removal ( #3100 )
2021-02-13 19:10:45 +01:00
IOBYTE
75e439e56d
fix crash in checkclass from unknown template valueType ( #3129 )
2021-02-13 13:41:12 +01:00
IOBYTE
1eafed9e75
fix hang in simplifyUsing ( #3128 )
...
Co-authored-by: Robert Reif <reif@FX6840>
2021-02-12 16:21:51 +01:00
IOBYTE
e57a674458
fix #10173 (syntax error from wrong simplifications for using type al… ( #3126 )
2021-02-12 09:47:16 +01:00
Daniel Marjamäki
0a71b52a87
Remove unused function
2021-02-11 19:27:36 +01:00
IOBYTE
b6e93bb575
fix #10172 (debug: Executable scope 'x' with unknown function.) ( #3121 )
2021-02-11 08:08:45 +01:00
Paul Fultz II
51f93400d1
Fix issue 10166: FP uninitvar with break from infinite loop ( #3124 )
2021-02-11 08:07:12 +01:00
Daniel Marjamäki
c2c40a18fd
One definition rule; avoid false positives when location is same
2021-02-10 11:44:05 +01:00
Daniel Marjamäki
fbf63b932e
astyle formatting
...
[ci skip]
2021-02-10 11:42:00 +01:00
Oliver Stöneberg
39c5274742
valueflow.cpp: optimized SingleValueFlowAnaylzer::isAlias() by avoidi… ( #3051 )
2021-02-10 08:18:21 +01:00
Paul Fultz II
8569a970b4
Fix issue 10147: False positive: Out of bounds access in expression 'v[0]' because 'v' is empty. ( #3123 )
2021-02-10 08:11:06 +01:00
Daniel Marjamäki
0fa225ecb5
Fix Cppcheck warning; useStlAlgorithm
2021-02-09 21:47:56 +01:00
Daniel Marjamäki
ef726aaece
New check: Detect one definition rule violations
2021-02-09 21:35:08 +01:00
Paul Fultz II
0e871c178f
Fix issue 10141: Errors with ref assignment (duplicateValueTenary and knownEmptyContainer) ( #3093 )
2021-02-09 15:27:46 +01:00
IOBYTE
d3d2e16137
fix hang from f48e195c31
( fix #10136 TODO test ( #3117 )) ( #3120 )
...
Co-authored-by: Robert Reif <reif@FX6840>
2021-02-09 14:19:01 +01:00
IOBYTE
f48e195c31
fix #10136 TODO test ( #3117 )
2021-02-07 21:46:35 +01:00
IOBYTE
1872725ca2
fix #10171 (debug: Executable scope 'x' with unknown function.) ( #3116 )
2021-02-07 09:04:57 +01:00
Daniel Marjamäki
68537e4fc3
Fixed #9867 (No dump file is generated (clang))
2021-02-06 19:06:05 +01:00
Daniel Marjamäki
7ab70654ba
Fixed #10170 (Preprocessor; Fail to extract some configurations)
2021-02-06 12:48:52 +01:00
Daniel Marjamäki
b7c4aeca16
astyle formatting
2021-02-06 12:27:51 +01:00
IOBYTE
c70fcf8e2b
fix #10136 (debug: Executable scope 'x' with unknown function.) ( #3113 )
2021-02-05 15:50:32 +01:00
IOBYTE
da3eb2e411
fix #10169 (CheckClass::checkDuplInheritedMembersRecursive) ( #3114 )
...
Co-authored-by: Robert Reif <reif@FX6840>
2021-02-05 11:05:07 +01:00
Rikard Falkeborn
be09361279
Refactor: Use enum class in checkio ( #3112 )
2021-02-05 08:17:57 +01:00
Daniel Marjamäki
0338e99f84
CheckClass: Refactoring
2021-02-03 19:25:28 +01:00
Daniel Marjamäki
205af353db
CheckClass: Fix endless recursion
2021-02-03 19:13:49 +01:00
Paul Fultz II
0ecac8e23b
Fix issue 10090: ValueFlow: Wrong lifetime, pointer member is not allocated on stack ( #3109 )
2021-02-03 10:22:31 +01:00
Paul Fultz II
cf8a5d9a22
Fix issue 10111: FP knownConditionTrueFalse ( #3110 )
2021-02-03 10:21:47 +01:00
Daniel Marjamäki
c0731703af
astyle formatting
...
[ci skip]
2021-02-02 15:01:28 +01:00
alonlib12
a22e476162
Fix CheckClass::operatorEqToSelf ( #3088 )
2021-02-02 15:00:46 +01:00
Paul Fultz II
913dbeb8d8
Fix FP when inserting a range into a container ( #3108 )
2021-02-02 14:57:48 +01:00
Daniel Marjamäki
dc63dd6ada
Fix Cppcheck self check warnings
2021-02-01 19:31:30 +01:00
Daniel Marjamäki
986f658e39
Fixed #10161 (False negative; uninitialized member variable in base class without constructor)
2021-02-01 18:58:51 +01:00
Daniel Marjamäki
bd9e6212b2
Refactoring, avoid 'magic' connection between vector items and variables
2021-02-01 17:13:58 +01:00
Ken-Patrick Lehrmann
96ea5a432f
Fix crash in checkclass.cpp ( #3104 )
2021-01-31 12:14:10 +01:00
Ken-Patrick Lehrmann
4e35f19659
10153: Check that string.find() is compared with 0 before recommending starts_with() ( #3099 )
2021-01-31 12:05:38 +01:00
Daniel Marjamäki
6a24b4f7c8
Fixed #10149 (compile database; incomplete handling of directory and file)
2021-01-31 10:14:22 +01:00
IOBYTE
5810171336
fix daca crashes in Type::findDependency() ( #3101 )
2021-01-31 10:07:03 +01:00
Daniel Marjamäki
95e2eebd8a
Revert fix for #10149 , it caused an unexpected appveyor failure
2021-01-30 15:01:19 +01:00
Daniel Marjamäki
43e8430a80
Fixed #10149 (compile database; incomplete handling of directory and file)
2021-01-30 12:27:40 +01:00
IOBYTE
7700cff0e9
fix daca crash in openfst fst_test.cc ( #3095 )
2021-01-30 06:33:09 +01:00
Paul Fultz II
a81427f97f
Fix issue 10022: Logical conjunction error between two completely unrelated members ( #3094 )
2021-01-29 10:26:57 +01:00
Paul Fultz II
a9b7f0e27b
Improvements to debug output ( #3091 )
2021-01-28 22:19:37 +01:00
Oliver Stöneberg
e8b8cfec78
some minor optimizations ( #3057 )
2021-01-28 22:18:17 +01:00
Daniel Marjamäki
1151c3dafd
Fixed msvc compilation error by implementing Variable::operator=
2021-01-28 13:46:15 +01:00
IOBYTE
6914f375e1
fix #10135 ("debug: Executable scope 'what' with unknown function." with custom std::exception) ( #3089 )
2021-01-28 12:38:36 +01:00
Paul Fultz II
e17d22eb87
Fix issue 10134: False positive: value is not known. Early return. ( #3086 )
2021-01-28 12:37:56 +01:00
Daniel Marjamäki
dc230d18ef
Try to fix Cppcheck self-check warnings
2021-01-28 12:36:31 +01:00
Daniel Marjamäki
203d6ebe5a
Fixed #10100 (FP: shadowVariable clangimport)
2021-01-27 20:03:42 +01:00
IOBYTE
4e1ff86bb2
use nonneg int for varid and exprid ( #3085 )
2021-01-27 19:49:13 +01:00
Daniel Marjamäki
987c8a854e
astyle formatting
...
[ci skip]
2021-01-25 22:51:50 +01:00
Paul Fultz II
0f8f207719
Remove valueFlowFwdAnalysis and update valueFlowAfterAssign to handle expressions ( #3074 )
2021-01-25 17:24:36 +01:00
Ken-Patrick Lehrmann
00707455be
10110: Fix FP knownConditionTrueFalse ( #3053 )
2021-01-25 17:23:47 +01:00
Daniel Marjamäki
3f2d9c03b2
CheckFunctions::checkIgnoredReturnValue: Fixed unwanted DacaWrongData messages
2021-01-23 18:19:51 +01:00
Daniel Marjamäki
772b44d11a
Fixed compiler warnings
2021-01-23 18:04:28 +01:00
Simon Martin
9d10f4f572
Ticket #10028 : Properly simplify auto variables' initialization. ( #3079 )
2021-01-23 17:56:58 +01:00
IOBYTE
a4953575f1
fix #10127 (debug: Executable scope 'x' with unknown function.) ( #3077 )
2021-01-23 17:55:25 +01:00
Paul Fultz II
c860de8565
Fix issue 8143: valueFlowCondition: before and inside while ( #3045 )
2021-01-23 17:52:01 +01:00
Paul Fultz II
d80f2fb46f
Reapply f1cc3ad
and fix performance regression ( #3076 )
2021-01-23 08:47:39 +01:00
orbitcowboy
bb451ca289
Running astlye [ci skip]
2021-01-22 21:47:24 +01:00
Paul Fultz II
a6f4fbae54
Fix issue 2741: False negative: redundant assignment of x to itself (ref = x) ( #3071 )
2021-01-22 11:00:57 +01:00
Daniel Marjamäki
0fa89ff2ba
Revert 14365ffc7
and f1cc3ada8
, there was a performance regression
2021-01-22 10:51:46 +01:00
Daniel Marjamäki
14365ffc7c
make a function static
2021-01-21 20:27:28 +01:00
Paul Fultz II
f1cc3ada86
Refactor valueFlowTerminatingCondition to handle inner conditions and complex conditions ( #3060 )
2021-01-21 20:18:53 +01:00
Paul Fultz II
d05acf3c41
Fix issue 10120: FP: containerOutOfBounds, regression ( #3064 )
2021-01-21 19:50:57 +01:00
Paul Fultz II
8b26ecbcdd
Extend ProgramMemory to handle expressions ( #3069 )
2021-01-21 19:49:37 +01:00
IOBYTE
d39956414f
fix #10122 , #10124 and #10125 (debug: Executable scope 'x' with unknown function.) ( #3073 )
2021-01-21 19:47:51 +01:00
Oliver Stöneberg
491f4874c5
fixed/aligned some compiler warnings ( #3065 )
2021-01-21 18:13:32 +01:00
IOBYTE
952857195b
fix out of line member functions using global namespace ( #3063 )
2021-01-19 18:52:47 +01:00
IOBYTE
fde5994cc3
fix #10061 (debug: Executable scope 'x' with unknown function.) ( #3062 )
2021-01-18 19:01:04 +01:00
Paul Fultz II
25ada657da
Fix issue 9030: ValueFlow: Possible value after conditional assignment in for loop ( #3059 )
2021-01-18 10:12:07 +01:00
IOBYTE
664289792c
fix simplifyTypedef removing needed type qualification ( #3058 )
2021-01-18 10:08:55 +01:00
abhijit-sawant
b97387db66
Made missing comparison in loop check more generic ( #3048 )
2021-01-18 08:11:37 +01:00
IOBYTE
dd866f2898
fix using type alias with derived class ( #3050 )
2021-01-17 16:10:53 +01:00
Oliver Stöneberg
b2ed372f75
various optimizations ( #3054 )
2021-01-16 19:05:51 +01:00
Oliver Stöneberg
9f9a652ae1
refs issue #9089 : avoid usage of expensive std::stringstream ( #2996 )
2021-01-16 19:03:28 +01:00
Daniel Marjamäki
853c271f22
Fix gcc warning; variable vidx is assigned but not read
2021-01-16 18:13:06 +01:00
Oliver Stöneberg
7aa85aa408
Use std::unordered_* containers for faster lookups ( #3052 )
2021-01-16 13:52:09 +01:00
Daniel Marjamäki
76f759fcc4
Fixed #9702 (False positive: Opposite inner condition when modifying member variable used by inner condition)
2021-01-15 20:51:47 +01:00
Daniel Marjamäki
503662f625
Try to fix null pointer dereference
2021-01-15 08:27:58 +01:00
Daniel Marjamäki
55262f03ec
Fixed #9218 (False positive: Searching before insertion is not necessary (stlFindInsert))
2021-01-14 22:31:43 +01:00
Daniel Marjamäki
a5babf25a7
Fixed #10080 (syntax error: operator)
2021-01-14 20:56:11 +01:00
Ken-Patrick Lehrmann
56124f0c5d
Skip calculateWarningHash if we are not in bugHunting ( #3047 )
2021-01-13 18:38:00 +01:00
Paul Fultz II
b571e9fe0b
Fix issue 10106: FP: nullPointerRedundantCheck ( #3044 )
2021-01-13 12:36:26 +01:00
Paul Fultz II
b469da1069
Fix issue 8253: False negative: Comparison is always true (early return) ( #3043 )
2021-01-13 12:35:43 +01:00
Daniel Marjamäki
1858465bca
astyle formatting
...
[ci skip]
2021-01-12 21:28:56 +01:00
Daniel Marjamäki
5f21d9d97b
Fixed #8975 (Syntax error for valid C code)
2021-01-12 21:28:07 +01:00
Armin Müller
0de0a954d2
Typos found by running "codespell" ( #3042 )
2021-01-12 20:48:25 +01:00
Paul Fultz II
fc4238829f
Fix issue 10092: false positive: (warning) The address of local variable 'data' might be accessed at non-zero index. ( #3041 )
2021-01-12 10:24:28 +01:00
Paul Fultz II
b1c56d33ac
Fix issue 9133: Invalid iterator; vector::push_back, functions ( #3008 )
2021-01-11 18:47:38 +01:00
Paul Fultz II
678ee00fe9
Infer variables from conditions in valueFlowSubfunction ( #3037 )
2021-01-11 08:00:13 +01:00
Paul Fultz II
a3617fe573
Fix issue 10102: False positive: knownConditionTrueFalse in for loop ( #3038 )
2021-01-11 07:56:16 +01:00
Rikard Falkeborn
f018163551
Improve handling of realloc in memory leak checker ( #3036 )
...
Mark realloced variables as realloced instead of freed. This allows
improved checking for code with error realloc handling.
If cppcheck finds an if-statement which checks the validity of the
allocated memory or resource, check if the memory/resource is
reallocated from another variable. If so, we can add checking of that
variable in the if-statement instead. This allows to check that variable
for memleaks and double frees.
This fixes #9292 and #9990 which both concern FPs with double frees
after correct error handling.
2021-01-11 07:55:05 +01:00
Daniel Marjamäki
707f1f2fbe
ValueFlow: Fixed isEqual
2021-01-10 16:52:11 +01:00
Daniel Marjamäki
98c7c0af96
Fixed GCC compiler warnings
2021-01-10 15:27:42 +01:00
Daniel Marjamäki
4e07a13feb
ClangImport: If typeIndex is negative we want to have Cppcheck warnings about that
2021-01-10 14:51:28 +01:00
Daniel Marjamäki
f493ce16b3
astyle formatting
...
[ci skip]
2021-01-10 14:46:19 +01:00
Paul Fultz II
bc3f5554a4
Fix issue 8871: improve check: mismatching container size conditions ( #2988 )
2021-01-10 13:30:00 +01:00
Oliver Stöneberg
ac7647fcd8
some self-check suppression cleanups ( #3032 )
2021-01-09 20:32:38 +01:00
IOBYTE
2482873029
fix location of forward declaration of specialized template ( #3031 )
2021-01-09 20:00:35 +01:00
Daniel Marjamäki
f6c98a0999
Fix Cppcheck self check warning
2021-01-09 11:14:41 +01:00
Paul Fultz II
c267d85640
Add generic valueflowBeforeCondition ( #3001 )
2021-01-08 22:55:04 +01:00
Daniel Marjamäki
4b5aedbbab
Fixed #10066 (FP: duplicateExpression clangimport)
2021-01-08 22:30:06 +01:00
Paul Fultz II
3b5c558414
Fix issue 10076: ValueFlow: False positive after address of var is taken 'T t = {{&var}};' ( #3027 )
2021-01-08 10:29:32 +01:00
Rikard Falkeborn
bedf3118ef
library: Refactor to use enum class ( #3026 )
2021-01-08 10:29:01 +01:00
IOBYTE
503a5dd441
fix #10081 (Hang: TemplateSimplifier::useDefaultArgumentValues) ( #3021 )
2021-01-06 23:06:50 +01:00
IOBYTE
cb02628c7c
fix #10075 (namespace alias changes variable name) ( #3020 )
2021-01-06 17:30:11 +01:00
IOBYTE
c085151eb0
fix exprengine.cpp:2833:18: debug: Executable scope 'executeAllFunctions' with unknown function. ( #3019 )
2021-01-06 17:29:23 +01:00
Rikard Falkeborn
50cdb6cbfc
Astyle: sync windows and linux folders ( #3016 )
2021-01-06 17:13:44 +01:00
Daniel Marjamäki
9e4e06a524
Clang import; Testing that token index is set properly
2021-01-06 11:19:14 +01:00
Daniel Marjamäki
0bd401c17b
ClangImport; Assign token indexes
2021-01-06 11:07:21 +01:00
Daniel Marjamäki
168db9351d
ClangImport; set exprid
2021-01-06 11:03:43 +01:00
Daniel Marjamäki
3a86262244
SymbolDatabase: Do not set definedType for global scope etc
2021-01-06 08:53:45 +01:00
IOBYTE
22b10f8987
fix token.cpp:745:19: debug: Executable scope 'getStrSize' with unknown function. ( #3015 )
2021-01-05 22:07:53 +01:00
Oliver Stöneberg
96704c9971
fixed and enabled some more clang-tidy warnings ( #3007 )
2021-01-05 17:51:32 +01:00
Paul Fultz II
e004731f1c
Fix issue 8650: ValueFlow: Track if pointer is created by '&' operator ( #3011 )
2021-01-05 16:56:38 +01:00
IOBYTE
8897ad3408
fix #10068 (typedef not replaced when namespace is involved) ( #3009 )
2021-01-05 16:53:56 +01:00
Paul Fultz II
f0b5668436
Fix issue 9890: ValueFlow: known value not found (variable is changed in path that returns) ( #3010 )
2021-01-05 16:49:08 +01:00
Paul Fultz II
a95c931da0
Fix issue 8501: false negative: (style) Opposite expression on both sides of ( #3012 )
2021-01-05 12:07:27 +01:00
Daniel Marjamäki
b3b7ecc7ea
Removed integerOverflowOptimization checking and merged functionality into invalidTestForOverflow
2021-01-05 11:38:19 +01:00
Daniel Marjamäki
abd6c00c82
Integer overflow; generalized checking for nonportable code
2021-01-04 19:43:05 +01:00
orbitcowboy
02b714f6dc
Code formatting [ci skip]
2021-01-04 13:09:05 +01:00
Daniel Marjamäki
c546b244a9
ClangImport; throw exception if CXXForRangeStmt can't be imported
2021-01-04 10:15:09 +01:00
abhijit-sawant
a4a225203c
Fix #9938 (false positive: StlMissingComparison) ( #2989 )
2021-01-04 10:07:07 +01:00
Daniel Marjamäki
da198e0726
Fix Cppcheck self check warning; use reference to avoid data copying
2021-01-04 01:47:04 +01:00
Daniel Marjamäki
38aa0fa2f0
Signed integer optimisation; ensure expr is variable
2021-01-03 23:30:34 +01:00
Daniel Marjamäki
52491f1c53
Signed integer optimisations; Also warn about 'x+y<x'
2021-01-03 22:12:19 +01:00
Daniel Marjamäki
6375fb4f08
New check: Warn about nonportable code that can be optimised (signed integer overflow)
2021-01-03 21:03:07 +01:00
Daniel Marjamäki
208014bae9
checkIntegerOverflow: Remove bailout for shifts
2021-01-03 17:44:46 +01:00
IOBYTE
23da5c9815
fix #9885 (SymbolDatabase: function lookup fails calling variadic method) ( #3002 )
...
Co-authored-by: Robert Reif <reif@FX6840>
2021-01-03 11:17:32 +01:00
Oliver Stöneberg
d59abfd977
fixed clang-tidy warnings ( #3006 )
...
* clang_tidy.cmake: added clang-tidy-11 to list of executables to look for
* .clang-tidy: disabled warnings we are (currently) not interested in
* fixed clang-tidy warnings
2021-01-02 23:10:27 +01:00
Oliver Stöneberg
fbf5858f76
fixed and enabled several clang-tidy warnings ( #2816 )
2021-01-02 19:10:25 +01:00
Rikard Falkeborn
d19454b935
Refactoring: Convert ValueType to enum class ( #3005 )
2021-01-02 09:30:00 +01:00
Daniel Marjamäki
3445a958d5
ValueFlow: Improved debug output.
2021-01-01 18:08:03 +01:00
Daniel Marjamäki
4e4db50311
Clang import: Use getChild
2021-01-01 17:59:43 +01:00
Daniel Marjamäki
214f90c10a
Bug hunting; Fix false positive, unsigned array index can't be negative
2021-01-01 08:57:35 +01:00
Daniel Marjamäki
1d6c0976e5
astyle formatting
...
[ci skip]
2021-01-01 08:56:17 +01:00
miltolstoy
ee8d5b972a
checkunusedvar: handle array element change using pointer arithmetic ( #3000 )
2021-01-01 08:06:20 +01:00
Daniel Marjamäki
e469436fe1
astyle formatting
...
[ci skip]
2020-12-31 19:24:29 +01:00
Oliver Stöneberg
20e462a8ed
split "varid0" from more generic "debug" messages ( #2997 )
2020-12-31 19:24:16 +01:00
Daniel Marjamäki
b16944b310
Revert "Clang import: Throw InternalError when nodeType is unknown"
...
This reverts commit 589174b92d
.
2020-12-31 18:08:55 +01:00
Daniel Marjamäki
589174b92d
Clang import: Throw InternalError when nodeType is unknown
2020-12-31 17:48:39 +01:00
Daniel Marjamäki
f37274a5c0
ClangImport: Improved error handling
2020-12-31 17:37:14 +01:00
IOBYTE
e7bdf5f71c
remove cleanupAfterSimplify from the template simplifier ( #2998 )
...
The template simplifier works well enough now so cleanupAfterSimplify is
no longer necessary. In fact cleanupAfterSimplify was introducing a bug
which improperly simplified C++ style casts.
Bugs should be exposed and fixed properly rather than just hiding them.
Co-authored-by: Robert Reif <reif@FX6840>
2020-12-31 09:33:23 +01:00
Daniel Marjamäki
a1756f3afc
Clang import; Function declaration
2020-12-30 17:00:05 +01:00
Daniel Marjamäki
f986b37a50
Clang import: Improved function pointer
2020-12-30 16:24:10 +01:00
IOBYTE
277da763aa
fix #10054 (debug: Executable scope 'x' with unknown function.) ( #2994 )
2020-12-30 08:09:34 +01:00
Daniel Marjamäki
cb9efcb100
Clang import; Add a validation step
2020-12-29 21:36:50 +01:00
Daniel Marjamäki
0adf09c507
ClangImport; Fixed output for anonymous enum
2020-12-29 21:10:34 +01:00
Daniel Marjamäki
79a8f21183
ClangImport; Set Token::scope properly for empty enum body
2020-12-29 16:34:06 +01:00
Daniel Marjamäki
4bd5933691
Clang import: Do not write unreferenced enum declaration
2020-12-29 15:39:33 +01:00
Daniel Marjamäki
1e9f67936e
Cppcheck: Fix; Do not run clang twice
2020-12-29 12:43:21 +01:00
Daniel Marjamäki
7719b27e44
Cppcheck: Print clang command when --verbose is used and build dir is empty
2020-12-29 10:20:46 +01:00
Daniel Marjamäki
2898a2925d
Cppcheck: Using both --clang and --project
2020-12-29 10:15:38 +01:00
Daniel Marjamäki
b94a6d595a
Fixed #9295 (ValueFlow: Does not handle noreturn function)
2020-12-28 20:00:35 +01:00
shaneasd
53734a3da1
Test for return address of reference ( #2991 )
2020-12-28 10:50:42 +01:00
Daniel Marjamäki
e7c462b827
Refactoring; Avoid 'unsigned'
2020-12-27 21:05:31 +01:00
orbitcowboy
f1688667a5
Running astyle [ci skip]
2020-12-27 12:38:21 +01:00
Ken-Patrick Lehrmann
f1169bf2b4
10062: Fix FP due to assignment in reverseanalyzer ( #2983 )
...
reverseanalyzer has a special process for assignments, and would not see
a stop condition on a rhs of an assignment.
2020-12-27 10:14:46 +01:00
Oliver Stöneberg
0a1012a273
fixed and enabled -Wdocumentation and -Wdocumentation-pedantic clang warnings ( #2819 )
2020-12-27 09:15:59 +01:00
Georgy Komarov
1c12b4fd78
ExprEngine: Handling cases when for condition is always false ( #2984 )
2020-12-26 21:29:50 +01:00
Paul Fultz II
bd22070df5
Fix issue 10027: Segmentation fault in ValueFlowAnalyzer::analyze ( #2987 )
2020-12-26 21:26:39 +01:00
Daniel Marjamäki
9d54303cfa
Clang import; Fixed segmentation fault
2020-12-26 19:59:57 +01:00
Daniel Marjamäki
d024eb3ee0
Fixed #10051 (AST: Wrong ast for function call with initializer list)
2020-12-26 18:33:54 +01:00
orbitcowboy
38fc6f209d
Running astye [ci skip]
2020-12-26 14:02:03 +01:00
Oliver Stöneberg
00071d09f6
split "valueFlowBailoutIncompleteVar" from more generic "valueFlowBailout" ( #2976 )
2020-12-26 13:48:22 +01:00
Oliver Stöneberg
fa8a836925
fixed some clang warnings ( #2980 )
2020-12-26 13:46:28 +01:00
IOBYTE
765c1ace87
fix #10008 (false negative: knownEmptyContainer with alias in namespace and "using namespace") ( #2979 )
2020-12-26 13:45:17 +01:00
Daniel Marjamäki
f700d81e59
ImportProject: Fixed compile_commands.json problems
2020-12-25 14:47:01 +01:00
orbitcowboy
53a4f68cb2
wxwidgets.cfg: Added support for more interface, found by daca@home
2020-12-25 12:16:06 +01:00
Daniel Marjamäki
cf57233f5d
ImportProject: Try to handle -D and -I in the same way
2020-12-25 11:51:24 +01:00
Daniel Marjamäki
bcf6039558
Fixed #10058 (False positive: redundant assignment, there is break)
2020-12-25 09:08:15 +01:00
Daniel Marjamäki
8fcef7ad0d
astyle formatting
...
ci skip
2020-12-25 08:58:12 +01:00
Daniel Marjamäki
b8f45a5c65
Replace and fix findBreakScope with findNextTokenFromBreak
2020-12-25 08:43:14 +01:00
Daniel Marjamäki
8bd783f820
Refactoring; Added findBreakScope and Scope::isLoopScope()
2020-12-24 22:58:31 +01:00
Paul Fultz II
7861aa00cf
Refactor afterCondition handlers into to seperate classes ( #2975 )
2020-12-24 20:07:46 +01:00
Ken-Patrick Lehrmann
aad723bf3a
Fix false positive AssignmentIntegerToAddress ( #2971 )
2020-12-24 19:57:02 +01:00
Paul Fultz II
e12a733ee9
Fix issue 10053: False positive: Same value on both branches of ternary operator ( #2962 )
2020-12-23 13:37:28 +01:00
Daniel Marjamäki
d1139db960
astyle formatting
...
[ci skip]
2020-12-22 21:30:15 +01:00
Daniel Marjamäki
e4766c73dc
ExprEngine; Use 60s as default maxtime processing a function, the analysis time will be somewhat reasonable
2020-12-22 21:09:24 +01:00
Georgy Komarov
259f562e73
ExprEngine: Add condition branches for the while loops ( #2970 )
2020-12-22 20:21:57 +01:00
Daniel Marjamäki
a9e7974963
ExprEngine: use 'real' instead of 'fpa' values in latest Z3 for floats
2020-12-22 18:05:21 +01:00
Daniel Marjamäki
315892d991
ExprEngine; add a 'stupid' handling of floating point promotions for integers
2020-12-22 17:15:11 +01:00
Daniel Marjamäki
1812951640
ExprEngine; Fix problem when float suffix is used
2020-12-22 15:17:36 +01:00
Daniel Marjamäki
347fccb207
ExprEngine; Avoid overspecified constraints
2020-12-22 11:10:01 +01:00
amai2012
f0da9098b9
Set language compatibility to C++14 in Visual Studio ( #2967 )
...
There is no C++11 flag
2020-12-22 10:24:25 +01:00
Georgy Komarov
0731df7d2d
ExprEngine: Add FP and String literals in determining that condition can ( #2969 )
2020-12-22 09:25:54 +01:00
Daniel Marjamäki
fcb496fb40
Fixed compiler error
2020-12-22 08:17:14 +01:00
Daniel Marjamäki
f6447cc546
ExprEngine; Wrap z3 interface that is not the same in different z3 versions
2020-12-22 08:13:40 +01:00
Daniel Marjamäki
13ed2effa1
astyle formatting
...
[ci skip]
2020-12-22 08:09:51 +01:00
IOBYTE
2ecab32fbe
fix debug printing of valuetype name with namespaces ( #2968 )
2020-12-21 19:47:54 +01:00
Daniel Marjamäki
c3e798968c
ExprEngine; Fix floating point comparison
2020-12-21 13:28:10 +01:00
Georgy Komarov
86f1ee5267
ExprEngine: Add workarounds for z3 bugs with FP comparisson ( #2965 )
2020-12-21 12:32:26 +01:00
abhijit-sawant
7d6fc23022
Checking in fix for issue 9957 - - False negative: duplInheritedMember ( #2964 )
2020-12-21 07:14:52 +01:00
Daniel Marjamäki
47bb487c95
Visual Studio; Try to fix compilation
2020-12-20 21:01:45 +01:00
Daniel Marjamäki
37a5ec8cd5
Summaries: Moved to its own files
2020-12-20 19:53:58 +01:00
Daniel Marjamäki
5701f6d368
ExprEngine: Added ifIntRangeAlwaysFalse and ifIntRangeAlwaysTrue tests
2020-12-20 19:04:46 +01:00
Daniel Marjamäki
229e39e7de
Revert "ExprEngine: Fixed float value"
...
This reverts commit 1f9edc6a66
.
2020-12-20 16:36:22 +01:00
Daniel Marjamäki
40e24cf417
Revert "ExprEngine; Try to fix assertion failure for floats"
...
This reverts commit aaabc74b9f
.
2020-12-20 16:36:11 +01:00
Daniel Marjamäki
aaabc74b9f
ExprEngine; Try to fix assertion failure for floats
2020-12-20 16:31:53 +01:00
Daniel Marjamäki
1f9edc6a66
ExprEngine: Fixed float value
2020-12-20 15:22:11 +01:00
Daniel Marjamäki
1ce5beb45f
ExprEngine; refactoring if()
2020-12-20 14:51:03 +01:00
Daniel Marjamäki
1bf6a2f62b
Summaries: Enhanced merge of noreturn info
2020-12-20 14:49:43 +01:00
Heiko Bauke
077fcad4ee
fix compile-time rounding error and fix overflow check ( #2937 )
...
fixes implicit conversion from 'unsigned long long' to 'double' changes value from 18446744073709551615 to 18446744073709551616 [-Werror,-Wimplicit-int-float-conversion]
2020-12-20 08:09:39 +01:00
Daniel Marjamäki
7a7d51a548
Fixed Cppcheck warning. Using emplace is not allowed for now for compatibility reasons.
2020-12-20 07:52:09 +01:00
Daniel Marjamäki
28e33ef0b9
Fix Cppcheck performance warning stlFindInsert properly
2020-12-19 22:23:39 +01:00
Wolfgang Stöggl
079255d913
Fix gcc11 build errors ( #2963 )
2020-12-19 21:54:19 +01:00
Daniel Marjamäki
d3d36dad2a
Suppress false positive stlFindInsert
2020-12-19 21:53:23 +01:00
Daniel Marjamäki
a493e17a6a
Tweaks to use summaries in GUI
2020-12-19 20:46:00 +01:00
Daniel Marjamäki
96caaedbd5
Generate basic function summaries
2020-12-19 19:02:42 +01:00
Paul Fultz II
a770342593
Fix crash in getInitListSize ( #2960 )
2020-12-19 12:23:19 +01:00
Daniel Marjamäki
1744cbaf66
astyle formatting
...
[ci skip]
2020-12-19 08:56:46 +01:00
miltolstoy
6366a577f9
feat(unused_var): analyze global variables inside function body ( #2944 )
2020-12-19 08:55:19 +01:00
Paul Fultz II
626dcd0eba
Fix issue 10037: False positive when passing variables to functions by address ( #2957 )
2020-12-19 08:29:37 +01:00
Paul Fultz II
2541b6034f
Fix issue 10049: False positive: generic reverse valueflow analysis ( #2959 )
2020-12-19 08:28:58 +01:00
Daniel Marjamäki
164c6b3441
Bug hunting; Detect array index out of bounds for multi dimensional arrays also
2020-12-18 21:32:23 +01:00
Daniel Marjamäki
33cde46068
astyle formatting
...
[ci skip]
2020-12-18 21:31:44 +01:00
Daniel Marjamäki
62a11f6490
Bug hunting; Fixed timeout
2020-12-18 20:41:10 +01:00
Daniel Marjamäki
1b0ca0811f
Bug hunting; option to set function analysis max time
2020-12-18 19:59:10 +01:00
IOBYTE
f2cf11682a
fix #10040 (symbolDatabaseWarning: debug: Executable scope 'x' with unknown function.) ( #2955 )
2020-12-18 07:46:01 +01:00
Paul Fultz II
b044f9ba96
Fix issue 9996: false negative: containerOutOfBounds with std::vector::front() and c++11 braced initializer ( #2958 )
2020-12-18 07:14:11 +01:00
Daniel Marjamäki
0b98053790
Fixed Cppcheck warning; Redundant assignment
2020-12-17 15:29:15 +01:00
Daniel Marjamäki
75f2ab20e8
Bug hunting; void* => might point at uninitialized data
2020-12-17 07:32:53 +01:00
Daniel Marjamäki
8619bfe957
Bug hunting; Remove old value from array when it is overwritten
2020-12-16 19:06:20 +01:00
Paul Fultz II
c9d2e55ea9
Fix issue 10035: FP: knownConditionTrueFalse when bool updated in for loop ( #2953 )
2020-12-16 17:25:21 +01:00
IOBYTE
2a05bc565d
insert simplified types for implicit template type deduction ( #2952 )
...
Co-authored-by: Robert Reif <reif@FX6840>
2020-12-15 22:28:58 +01:00
Daniel Marjamäki
ecfabbcdbb
Fix Cppcheck warning nullPointerRedundantCheck
2020-12-15 07:11:13 +01:00
Daniel Marjamäki
82635417d2
Bug hunting; Fixed array init
2020-12-14 22:15:10 +01:00
Daniel Marjamäki
4e90356a76
Bug hunting; Code cleanup
2020-12-14 18:04:12 +01:00
Daniel Marjamäki
116119083b
Bug hunting; Better result from function that returns unknown pointer result
2020-12-14 17:53:28 +01:00
Daniel Marjamäki
ab3614b4e2
Bug hunting; Improved debug output for structs
2020-12-14 12:32:39 +01:00
Paul Fultz II
da1375c9a3
Fix issue 10024: FP: nullPointerRedundantCheck when using a goto statement ( #2947 )
2020-12-14 11:13:47 +01:00
Daniel Marjamäki
bf951ea5e6
Bug hunting; Fix for '*x=y'
2020-12-13 19:54:57 +01:00
Georgy Komarov
38a055d2f3
ExprEngine: Better debug output for exceptions ( #2943 )
2020-12-13 16:54:22 +01:00
Daniel Marjamäki
8f71e62fd6
Fix Cppcheck warning
2020-12-13 16:47:50 +01:00
Georgy Komarov
36ab23f1f7
ExprEngine: Handle pointers to struct as function argument ( #2945 )
2020-12-13 16:02:35 +01:00
Daniel Marjamäki
81c3ac738d
CI: Fix testrunner
2020-12-13 15:51:20 +01:00
Daniel Marjamäki
6fb1a81eae
Bug hunting; more debug output
2020-12-13 14:05:35 +01:00
Daniel Marjamäki
b18dc0fdbb
Bug hunting: Handle not better
2020-12-13 13:00:04 +01:00
Daniel Marjamäki
0ccc5c695b
Bug hunting: prevent recursion in analysis when code calls self
2020-12-13 09:33:40 +01:00
Daniel Marjamäki
be16b2c276
Bug hunting; better handling of early return
2020-12-13 09:13:26 +01:00
Daniel Marjamäki
2e96cc932d
ExprEngine; Improved debug output, show constraints.
2020-12-12 21:23:38 +01:00
Daniel Marjamäki
a7fb946ab8
ExprEngine: Clarify debug output a bit
2020-12-12 18:29:17 +01:00
Daniel Marjamäki
cba8b99095
ExprEngine: Catch and handle exceptions in ExprData
2020-12-12 17:33:21 +01:00
Daniel Marjamäki
d0f700305c
ExprEngine: Avoid analyzing unreachable execution paths
2020-12-12 15:22:49 +01:00
IOBYTE
7fc03c6030
fix #10032 (Syntax error if first function in a struct is a template function) ( #2940 )
...
Co-authored-by: Robert Reif <reif@FX6840>
2020-12-11 07:01:20 +01:00
Daniel Marjamäki
d340e8770c
Fixed Tokenizer::setVarId when removing last scope name
2020-12-08 17:39:04 +01:00
Daniel Marjamäki
245284acde
Tokenizer; Fixed varid for base class member variable
2020-12-08 17:25:50 +01:00
Daniel Marjamäki
7a4462dac5
Tokenizer: Refactoring, use isFunctionHead in setVarId. It should be more reliable.
2020-12-08 16:53:55 +01:00
Daniel Marjamäki
6d7ddde1b5
Bug hunting; Make bughuntingUninit check a bit less noisy about const parameters
2020-12-08 13:34:46 +01:00
Daniel Marjamäki
99cb65b4b2
Bug hunting; Clarify bughuntingUninit output for non-const parameters
2020-12-08 11:16:38 +01:00
IOBYTE
8161baf1e9
fix template debug output line numbers ( #2938 )
2020-12-08 10:35:13 +01:00
IOBYTE
6103da59be
add column number to TokenList::addtoken ( #2939 )
2020-12-08 10:34:23 +01:00
Daniel Marjamäki
bcc7945540
Bug hunting; Separate bughuntingUninit warnings for arguments with separate id
2020-12-08 10:28:40 +01:00
Daniel Marjamäki
02bb14003b
Bug hunting; better handling of struct member assignment in for loop
2020-12-07 19:58:19 +01:00
Daniel Marjamäki
39a9350f6e
Bug hunting: Better analysis of BailoutValue
2020-12-07 06:27:14 +01:00
Daniel Marjamäki
7e9cbda2d5
Revert "2"
...
This reverts commit db386b2a7f
.
That commit was half-done and not intended to be merged.
2020-12-06 22:29:46 +01:00
IOBYTE
8d9f0b3528
fix #9394 ("debug: Executable scope 'x' with unknown function." with … ( #2935 )
2020-12-06 22:08:42 +01:00