dummyunit
ac505afe69
Fixed #9729 (AST broken: lambda with noexcept keyword) ( #3243 )
...
The previous fix for the issue (43b58dbc9e
) didn't seem to actually fix
it because it added a check for noexcept without a condition, but when
AST is created noexcept always has a condition due to simplification
from "noexcept" to "noexcept(true)" in Tokenizer::simplifyKeyword().
The issue from the ticket couldn't be reproduced neither on 43b58dbc9e
nor on the previous commit, so it is hard to tell whether the fix was
effective or not.
The issue appeared again after a refactoring of AST code in ac67049661
.
Test added with the original fix was unable to catch that because it
used testAst() helper function which skips most simplification steps.
To fix the issue we now check for noexcept with a condition and add a
proper regression test that:
1. Uses tokenizeAndStringify() to ensure that all simplifications are
performed before AST is created.
2. Parses the code snippet from the ticket, as having "if (cond)" is
crucial to reproducing the original issue (internalAstError).
Also fix AST creation for lambdas that have both constexpr and mutable
keywords.
2021-05-02 21:34:28 +02:00
Daniel Marjamäki
f7d0bf7a59
Refactoring; Reuse simplecpp::characterLiteralToLL
2021-05-02 13:44:37 +02:00
dummyunit
da27159d7c
Fixed #9728 (Support function level try blocks)
2021-05-02 09:05:12 +02:00
Daniel Marjamäki
6f60c6d965
Revert "Refactoring; Reuse function in simplecpp"
...
This reverts commit dbe9eb2a27
.
2021-05-01 19:54:14 +02:00
Daniel Marjamäki
dbe9eb2a27
Refactoring; Reuse function in simplecpp
2021-05-01 18:13:40 +02:00
keinflue
6541f52e61
Fix false positive invalidFunctionArg for zero arguments to calloc. ( #3238 )
2021-05-01 12:39:01 +02:00
Daniel Marjamäki
9b717b8835
Refactoring __attribute__ simplification
2021-05-01 11:39:26 +02:00
Daniel Marjamäki
07c1f28035
astyle formatting
2021-05-01 07:35:03 +02:00
DGarry82
d3035c246f
Attribute lists support ( #3239 )
2021-05-01 07:33:55 +02:00
Paul Fultz II
31e3e4d87b
Fix issue 10086: false positive: (style) constVariable: Variable 'x' can be declared with const ( #3219 )
2021-04-30 17:47:08 +02:00
Daniel Marjamäki
d2d2124238
Revert "Clang import; This experimental feature didn't "take off" much. After a lot of work we are still far fram the goal. I remove it now but don't rule out completely that it could ever be added again."
...
This reverts commit 207361b174
.
2021-04-30 16:47:02 +02:00
Robert Reif
e1e822275d
fix daca2 paraview crash from uninstantiated recursive template ( #3237 )
2021-04-29 11:09:51 +02:00
keinflue
d2184ac6a8
Fix UB on right-shift. ( #3235 )
2021-04-28 11:57:28 +02:00
Daniel Marjamäki
bd97b8eb8a
SymbolDatabase; Add variables when structured binding is used
2021-04-26 18:21:07 +02:00
Daniel Marjamäki
8aa9e448f5
Parser; Set varid for structured binding variables
2021-04-26 18:04:27 +02:00
Daniel Marjamäki
b798b99777
Parser; do not remove alignof and alignas in the same way
2021-04-26 11:44:08 +02:00
dummyunit
b18e6f1e10
Fix varId assignment for uses of variables declared in the if condition ( #3231 )
...
Variables declared in the if condition (or in C++17 init-statement) are
visible not only in the if body but also in the else body. But logic in
Tokenizer::setVarIdPass1() handled such variables as if they were
declared in the if body.
As the result they were removed from variablesMap by the time the else
block was parsed and their uses in the else block were either given an
incorrect varId from variables in some outer scope or not given a varId
at all.
This then resulted in false positive unreadVariable errors for variables
declared in the if condition (or init-statement) and used only in the
else block.
Simplification from "else if ..." to "else { if ... }" was moved before
setVarId() to simplify detection for ends of blocks in if-else chains.
2021-04-26 07:38:03 +02:00
Daniel Marjamäki
28a7bb63ec
Parser; simplify (break out) init expression from if/switch/range-for
2021-04-25 14:37:27 +02:00
Daniel Marjamäki
4f43dbf954
Parser; fixed ast and auto type deduction for c++17 braced init lists
2021-04-25 10:38:33 +02:00
Daniel Marjamäki
c9dc92c266
Parser; C++20 for loop with initialization expression
2021-04-24 11:47:51 +02:00
IOBYTE
bd7551411a
fix #10258 (coredump due to (?) template simplification) ( #3228 )
2021-04-22 22:23:01 +02:00
Daniel Marjamäki
26c0945309
Handle c++20 spaceship operator
2021-04-22 19:15:22 +02:00
Daniel Marjamäki
bccc0607d1
astyle formatting
...
[ci skip]
2021-04-22 19:08:24 +02:00
dummyunit
229832e72e
Read error locations in the correct order from XML ( #3226 )
...
When ErrorMessage::callStack elements are serialized to XML they are
saved in the reverse order. But when they read back from XML they are
added at the end of the list. Thus the round trip via XML reverses the
order of ErrorMessage::callStack.
From the user point of view it looks like the usage of the
--cppcheck-build-dir option sometimes (when the file wasn't reanalyzed,
but that is hard to spot) results in incorrect location info for some
diagnostic messages.
Moreover, when the first location matches some suppression rule and the
last doesn't match any (or vice versa), usage of --cppcheck-build-dir
results in some diagnostic messages appearing and disappearing seemingly
at random (again, depending on whether the file was reanalyzed or not).
2021-04-22 14:28:33 +02:00
Daniel Marjamäki
207361b174
Clang import; This experimental feature didn't "take off" much. After a lot of work we are still far fram the goal. I remove it now but don't rule out completely that it could ever be added again.
2021-04-21 18:59:48 +02:00
Daniel Marjamäki
bfb98dbf51
TemplateSimplifier: updated output of uninstantiated c++17 fold expressions
2021-04-21 13:13:11 +02:00
Daniel Marjamäki
04e9c13bc6
TemplateSimplifier; Better handling of c++17 fold expressions and c++20 concepts.
...
c++17 fold expressions are simplified to a __cppcheck_uninstantiated_fold__ if they are not instantiated.
c++20 concepts are skipped/removed by Cppcheck and these will be enforced by the compiler.
2021-04-20 15:40:25 +02:00
Paul Fultz II
db5f00a16a
Fix issue 10214: FP: danglingTempReference doesn't account for reference lifetime extension ( #3220 )
...
* Fix issue 10214: FP: danglingTempReference doesn't account for reference lifetime extension
2021-04-19 14:20:29 +02:00
IOBYTE
59f7b937f1
fix daca2 gdcm template simplifier crash ( #3221 )
...
This only fixes the crash. The templates that are instantiated are
correct but one template is left uninstantiated. Fixing the missing
instantiation is not easy and will be looked at later.
Co-authored-by: Robert Reif <reif@FX6840>
2021-04-19 09:17:49 +02:00
Paul Fultz II
c1bb1d771b
Fix issue 10012: False positive: mismatching container, not containers ( #3222 )
...
* Fix issue 10012: False positive: mismatching container, not containers
2021-04-19 09:17:02 +02:00
Paul Fultz II
691f681d86
Fix issue 10235: Regression: oppositeInnerCondition ( #3223 )
2021-04-19 09:15:03 +02:00
Ken-Patrick Lehrmann
5768c3a726
Check stat return value in addFiles2 ( #3214 )
2021-04-18 21:52:14 +02:00
Paul Fultz II
563c9dd9cc
Fix issue 10208: FP: knownConditionTrueFalse in for loop with function that assigns by ref ( #3198 )
2021-04-18 21:42:27 +02:00
Daniel Marjamäki
56773b82c4
Simple handling of coroutines
2021-04-18 19:42:22 +02:00
Daniel Marjamäki
fe87afb2f9
TestTokenizer: Align function pointer test case names
2021-04-18 12:33:04 +02:00
Paul Fultz II
a772d652d8
Fix issue 9932: FP: containerOutOfBounds ( #3217 )
...
* Fix issue 9932: FP: containerOutOfBounds
2021-04-18 10:43:38 +02:00
Daniel Marjamäki
9a9043a07e
Fixed #4349 (Support C++11 variadic templates)
2021-04-17 21:57:21 +02:00
IOBYTE
5568ac95e7
fix simplifyUsing debug warning for: using value_type = const ValueFlow::Value; ( #3211 )
2021-04-17 14:20:16 +02:00
Daniel Marjamäki
c98afa83fd
Tokenizer; Add test for c++14 lambda expression 'lambda=[value=1]{...}'
2021-04-16 15:18:02 +02:00
Daniel Marjamäki
11f828a669
Fixed #9415 (C++11: `alignas` not handled -> wrong code -> false negatives)
2021-04-15 20:26:53 +02:00
orbitcowboy
f62d9d5853
std.cfg: Fixed bufferAccessOutOfBounds false negative for strncmp().
2021-04-13 19:13:00 +02:00
orbitcowboy
03bdcc4c42
Attempt to make CI happy
2021-04-13 16:57:31 +02:00
orbitcowboy
e869452240
#10244 : Fixed false negative: bufferAccessOutOfBounds
2021-04-13 16:40:38 +02:00
orbitcowboy
44c8b315c6
Attempt to make CI happy
2021-04-13 14:44:59 +02:00
orbitcowboy
040e58f943
std.cfg: strxfrm(): Added minize values to arg1 and arg2 and a TODO test case
2021-04-13 14:07:45 +02:00
orbitcowboy
cf211610d3
wxwidgets.cfg: Fixed wrong configuration for wxLogApiError(). This function does return after appending data to wxLog(). Ensure that no duplicateBreak-warning is issued in case code resides afterwards.
2021-04-13 13:07:15 +02:00
Daniel Marjamäki
eacc9e552e
Function::returnsReference: handle type scope better
2021-04-10 14:31:50 +02:00
orbitcowboy
f7e6d216b2
Running astyle [ci skip]
2021-04-09 08:53:32 +02:00
orbitcowboy
b5719418ea
#8206 - Added a regression test
2021-04-09 08:53:01 +02:00
orbitcowboy
260eb4acac
Running astyle [ci skip]
2021-04-09 08:46:47 +02:00
Paul Fultz II
5cf2f7e633
Fix issue 10087: false positive: error: Reference to temporary returned. ( #3205 )
2021-04-09 07:44:20 +02:00
Paul Fultz II
255f273c46
Fix issue 10088: ValueFlow: Array size, wrong known value ( #3204 )
2021-04-09 07:43:54 +02:00
ericmalenfant
1e9687aa8b
Fix noCopyConstructor with multiple inheritance ( #3203 )
2021-04-09 07:41:59 +02:00
Paul Fultz II
f8dc9862da
Fix issue 10202: FP: constParameter ( #3202 )
2021-04-08 16:02:11 +02:00
Daniel Marjamäki
c8e661f61f
assignmentInCondition: Clarify error message
2021-04-07 19:46:00 +02:00
Daniel Marjamäki
72802554c9
Fixed #3593 (New Check: Check for assignment within conditional expression)
2021-04-07 17:21:34 +02:00
orbitcowboy
e60d79e2c9
wxwidgets.cfg: Added tests for commit ccb2cb26b2
2021-04-07 07:57:27 +02:00
Daniel Marjamäki
73e698b84d
Fixed #9214 (Tests are run on simplified token list)
2021-04-06 21:21:53 +02:00
Paul Fultz II
e0f9627201
Fix issue 10226: FP: redundant condition or invalid iterator ( #3195 )
2021-04-06 11:04:37 +02:00
Daniel Marjamäki
93f46f6e7b
Fix testrunner after file0 tweaks
2021-04-05 13:11:23 +02:00
Paul Fultz II
e65ea8575f
Fix issue 10207: FP: derefInvalidIteratorRedundantCheck with ternary operator ( #3197 )
2021-04-05 11:10:43 +02:00
Paul Fultz II
f605f71e49
Fix issue 10225: false positive: knownConditionTrueFalse ( #3196 )
2021-04-05 10:20:14 +02:00
Daniel Marjamäki
de2e836727
test/cfg/windows.cpp; Uncommented TODO, Cppcheck now writes a warning as it should about unused function return value
2021-04-05 05:20:42 +02:00
Daniel Marjamäki
cf8a423636
Unreachable code; better handling of throw in C code
2021-04-05 04:53:07 +02:00
Daniel Marjamäki
a21c81365d
one definition rule: Fixed false positive for 'class A::B ..'
2021-04-04 21:29:45 +02:00
Daniel Marjamäki
084bc74080
Fixed #8223 (false negative: Statements following return, break, continue, goto or throw will never be executed.)
2021-04-04 19:43:51 +02:00
Daniel Marjamäki
518fb01553
Fixed #8412 (ignoredReturnValue not issued when return value is changed but not really used (by logical not for example))
2021-04-04 18:26:07 +02:00
Daniel Marjamäki
44f914eaee
astyle formatting
...
ci skip
2021-04-04 18:20:32 +02:00
Oliver Stöneberg
6397e29f84
cleaned up includes based on include-what-you-use ( #3141 )
2021-04-03 21:30:50 +02:00
Oliver Stöneberg
052de79b6d
some test/CI related refactoring and cleanup ( #3163 )
2021-04-03 21:22:39 +02:00
Daniel Marjamäki
9ce0235e8e
std.cfg: Fixed configuration of mbstowcs
2021-04-03 10:42:24 +02:00
Paul Fultz II
182ae75290
Fix issue 10216: FP containerOutOfBounds with std::array initialized with = {} ( #3190 )
2021-03-31 22:07:54 +02:00
Paul Fultz II
5077663684
Fix issue 9979: false positive: containerOutOfBounds with conditional resize ( #3136 )
2021-03-30 14:02:28 +02:00
Paul Fultz II
9de976b243
Fix issue 10194: hang with followAllReferences() ( #3189 )
...
* Decrease depth faster when there is multiple returns
2021-03-30 11:22:56 +02:00
DGarry82
77716ee398
fix w64-mingw32-ld linking error ( #3184 )
...
* fix w64-mingw32-ld linking error
use shlwapi instead of Shlwapi.lib in mingw-w64 build environment
(prevents "/usr/bin/x86_64-w64-mingw32-ld: cannot find -lShlwapi" error)
* same MinGW shlwapi fix for {tests,tools}/CMakeLists.txt
Co-authored-by: Igor Rondarev <igor.rondarev@gmail.com>
2021-03-29 17:04:42 +02:00
Ken-Patrick Lehrmann
cddaa6d671
10221: Fix setVarId in template code ( #3187 )
...
The computation of the classname was not expecting templates. Simply
skipping the template part seems to fix the issue.
2021-03-29 12:16:02 +02:00
orbitcowboy
e23a967215
#4750 Added a regression test
2021-03-28 09:29:46 +02:00
orbitcowboy
185a5e1ee6
#7682 Added regression test
2021-03-26 10:54:08 +01:00
orbitcowboy
6fd916a90f
#3763 Added regression test
2021-03-26 10:01:44 +01:00
Lars Even Almaas
9786f1c34b
Suggested implementation for rule 8.2 ( #3169 )
2021-03-25 08:25:43 +01:00
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
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
orbitcowboy
8fffb84aad
Running astyle [ci skip]
2021-03-16 09:44:58 +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
orbitcowboy
2a40ce6430
windows.cfg: Added support for more defines from WinBase.h and Winnt.h
2021-03-02 10:48:37 +01:00
Daniel Marjamäki
fef956f3f0
Testing; Moved test/cli tests from travis to github actions
2021-03-01 18:49:59 +01:00
Daniel Marjamäki
6b166eb5a7
test/cli/test-other-projects.py: Temporarily disable test (to make Travis happy)
2021-02-28 23:11:25 +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
Daniel Marjamäki
199f9608cb
TestSuite: Fixed getLocationStr
2021-02-27 04:33:16 +01:00
Daniel Marjamäki
7106e1f48f
Moved TestTokenizer::simplifyCasts tests to TestSimplifyTokens
2021-02-27 04:19:54 +01:00
Daniel Marjamäki
81c7fa0348
Moved TestTokenizer::tokenize6 to TestSimplifyTokens
2021-02-27 04:07:33 +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
Daniel Marjamäki
1adea5c3b0
Move simplifyKnownVariables tests to TestSimplifyTokens
2021-02-25 21:32:56 +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
e03851f51c
Fix compilation error
2021-02-24 22:31:46 +01:00
Daniel Marjamäki
15bc7ad5cb
Fix compilation error
2021-02-24 22:20:11 +01:00
PKEuS
3998836b03
Refactorization: Improved string handling in test suite
...
Merged from LCppC.
2021-02-24 22:05:23 +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
Daniel Marjamäki
2baeeeb02f
astyle formatting
2021-02-24 21:48:26 +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
99ff242dde
astyle formatting
...
[ci skip]
2021-02-20 13:33:57 +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
Lukasz Czajczyk
0a06a083af
Additional macros ( #3106 )
2021-02-20 13:19:06 +01:00
PKEuS
4b01d5bdc6
Re-enabled a bunch of disabled unit tests, some as TODO tests
...
Merged from LCppC.
2021-02-20 13:02:14 +01:00
PKEuS
2bd6a6c252
Test suite:
...
- Enabled test in testgarbage.cpp that succeeds
- Optimizations in TestIO
Merged from LCppC.
2021-02-20 13:00:30 +01:00
PKEuS
cf1937294a
Refactorization: Removed unnecessary \n and spaces in strings
...
Merged from LCppC.
2021-02-20 12:58:42 +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
Daniel Marjamäki
f836c7a546
Fix compile error
2021-02-18 18:50:30 +01:00
PKEuS
acafdb655c
Refactorization: Reduced stack usage of givenACodeSampleToTokenize
...
Merged from LCppC.
2021-02-18 16:28:04 +01:00
PKEuS
4678a9cb45
Refactorization: Include cleanup and added one more header to test/precompiled.h
...
Merged from LCppC
2021-02-18 16:16:40 +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
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
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
fbf63b932e
astyle formatting
...
[ci skip]
2021-02-10 11:42:00 +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
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
7ab70654ba
Fixed #10170 (Preprocessor; Fail to extract some configurations)
2021-02-06 12:48:52 +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
Daniel Marjamäki
0338e99f84
CheckClass: Refactoring
2021-02-03 19:25:28 +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
986f658e39
Fixed #10161 (False negative; uninitialized member variable in base class without constructor)
2021-02-01 18:58:51 +01:00
Oliver Stöneberg
b472b4e65d
some Python cleanups based on PyCharm inspections ( #2999 )
...
* some Python cleanups based on PyCharm inspections
* test-helloworld.py: adjusted assert in test_addon_relative_path()
2021-01-31 14:27:11 +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
Daniel Marjamäki
9e9bb9f804
Refactor test/cli/test-proj2.py
2021-01-30 10:43:08 +01:00
Daniel Marjamäki
49e6e83bc3
astyle formatting
...
[ci skip]
2021-01-29 10:27:32 +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
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
203d6ebe5a
Fixed #10100 (FP: shadowVariable clangimport)
2021-01-27 20:03:42 +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
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
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
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
95d1b41a5b
runtests.sh: fixed check for cppunit ( #3072 )
2021-01-21 10:59:34 +01:00
Oliver Stöneberg
f46a9e3543
fixed/excluded some shellcheck warnings and actually fail the build when something is found ( #3068 )
2021-01-20 18:43:49 +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
Paul Fultz II
65395aeaa1
Add regression test for 7013: valueFlowAfterCondition: false positive below overspecified code ( #3055 )
2021-01-17 16:29:11 +01:00
IOBYTE
dd866f2898
fix using type alias with derived class ( #3050 )
2021-01-17 16:10:53 +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
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
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
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
f493ce16b3
astyle formatting
...
[ci skip]
2021-01-10 14:46:19 +01:00