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
Sam Lane
60f9fefcd4
Add Support For Configuring Addon Python Interpreter Version ( #2591 )
2020-04-05 10:57:28 +02:00
Daniel Marjamäki
f01783238e
Fixed #9596 (False positive: Returning an integer in a function with a pointer return type auto handling)
2020-04-04 20:03:48 +02:00
orbitcowboy
048b08f5be
Running astyle. There are no functional changes [ci skip]
2020-04-04 14:49:08 +02:00
Paul Fultz II
efdc5f5c4e
Fix issue 9435: False negative: invalidContainer when using range for loop ( #2587 )
...
* Fix issue 9435: False negative: invalidContainer when using range for loop
* Use ast
* Make string const
2020-04-04 11:47:02 +02:00
Oliver Stöneberg
1dd8d4afaf
fixes for Clang and clang-tidy 10 ( #2588 )
...
* clang_tidy.cmake: added clang-tidy-10 to program list
* fixed -Wrange-loop-construct Clang warnings
* fixed readability-qualified-auto clang-tidy warnings
* .clang-tidy: actually disable clang-analyzer-* warnings
* .clang-tidy: disabled some new warnings introduced with clang-tidy-10
2020-04-04 11:44:59 +02:00
Daniel Marjamäki
ac45bf7af2
Small refactoring
2020-04-04 11:19:39 +02:00
Paul Fultz II
40e1e82a65
Fix issue 9644: Token::astOperand1() cyclic dependency on valid C++ code ( #2590 )
...
* Remove check for lambda
* Add test case
2020-04-04 10:55:31 +02:00
Daniel Marjamäki
e0acd1abf8
Tokenizer: Report unknown macro that contains '.x=..' argument
2020-04-04 10:32:56 +02:00
Daniel Marjamäki
efb583e3d1
astyle formatting
...
[ci skip]
2020-04-04 10:31:38 +02:00
Paul Fultz II
a22a77c1fc
Use library config for unstable containers instead of hardcoded values ( #2585 )
...
* Use library config for unstable containers instead of hardcoded values
* Fix xml validation
2020-04-03 13:16:57 +02:00
Paul Fultz II
58e3f19ed8
Fix issue 9662: AST broken, ternary operator missing operand(s) on valid C++ code ( #2589 )
...
* Fix issue 9662: AST broken, ternary operator missing operand(s) on valid C++ code
* Add test for issue 9537
2020-04-03 10:04:10 +02:00
Oliver Stöneberg
8968edeabd
avoid unnecessary creation of lists in SingleValueFlowForwardAnalyzer.isAlias() and MultiValueFlowForwardAnalyzer.isAlias() ( #2586 )
...
Comparing before and after (Ir per call) when scanning the Cppcheck source:
SingleValueFlowForwardAnalyzer.isAlias()
1246 -> 1101
MultiValueFlowForwardAnalyzer.isAlias()
4202 -> 1617
2020-04-03 09:25:21 +02:00
Paul Fultz II
71deaaeb18
Fix issue 9608: False Positive: returnDanglingLifetime with braced-init-list ( #2583 )
2020-04-02 10:17:58 +02:00
Paul Fultz II
02ae71917a
Fix issue 9536: False positive: Reference to temporary returned when using operator() ( #2582 )
...
* Fix issue 9536: False positive: Reference to temporary returned when using operator()
* Add more test cases
2020-04-01 22:35:41 +02:00
Paul Fultz II
6cc58e1086
Set a max for the combination of arguments that can be passsed through valueFlowSubFunction ( #2579 )
...
* Set a max for the combination of arguments that can be passsed
* Skip mismatch path ids when computing the cross product
2020-04-01 22:33:09 +02:00
Armin Müller
3ff171e157
Typos found by running "codespell" ( #2584 )
2020-04-01 14:37:43 +02:00
Daniel Marjamäki
7577bdb1df
DACA: Try to avoid some crashes/hangs for the most crazy code so we can focus on most serious bugs first
2020-03-31 11:33:38 +02:00
Oliver Stöneberg
28cd5d7ea2
fixed OSS-Fuzz builds and added CMake targets ( #2577 )
...
* fixed compilation of OSS-Fuzz clients
* added preliminary CMake target for fuzz-client - also added *_sanitized targets of dependencies (only available with Clang)
* added oss-fuzz build to Travis CI
2020-03-31 09:33:58 +02:00
orbitcowboy
acdc62f8f0
Formatted the code. There are no functional changes [ci skip]
2020-03-26 17:03:21 +01:00
Paul Fultz II
5462e43161
Fix issue 9639: False positive: Returning object that points to local variable that will be invalid when returning ( #2576 )
...
* Follow reference when tracking local variables
* Fix issue 9639: False positive: Returning object that points to local variable that will be invalid when returning
2020-03-23 22:54:53 +01:00
Paul Fultz II
b68d6f9471
Fix crash in valueflow when using local classes ( #2575 )
2020-03-22 10:12:53 +01:00
Paul Fultz II
7fd3580f21
Dont traverse conditions multiple times ( #2574 )
2020-03-20 10:37:16 +01:00
Paul Fultz II
f2527f5340
Fix crash in valueFlowForLoopSimplifyAfter ( #2573 )
2020-03-20 07:16:05 +01:00
Dmitry-Me
dd5b9f3b82
Resolve sign mismatch warnings
2020-03-19 18:22:55 +03:00
orbitcowboy
637c4e2bc0
wxwidgets.cfg: Added support for more interfaces.
2020-03-15 19:39:23 +01:00
Dmitry-Me
ab5835d359
Avoid giant C4267 warning in 64-bit Visual C++ build ( #2569 )
2020-03-14 14:41:45 +01:00
Daniel Marjamäki
1173186876
Fixed daca@home crash by stopping for unknown macro 'MACRO(a();b();)'
2020-03-12 13:28:09 +01:00
Daniel Marjamäki
900b99fbd8
Tokenizer; Report unknown macro used in function declaration
2020-03-10 20:22:46 +01:00
Daniel Marjamäki
51732e9d75
ForwardAnalyzer: Fixed crash
2020-03-10 10:36:05 +01:00
Daniel Marjamäki
f093d23a36
SymbolDatabase: Fixed addArguments
2020-03-09 15:13:50 +01:00
Daniel Marjamäki
1008868506
AST: Better handling of '(type){..}'
2020-03-08 16:46:06 +01:00
Daniel Marjamäki
cdee62c032
AST: Fixed AST for struct cast '(struct T){...}'
2020-03-08 16:21:22 +01:00
Daniel Marjamäki
f7612fd1a9
ForwardAnalyser; Tweak fix for crash
2020-03-08 12:02:45 +01:00
Daniel Marjamäki
2600dee36c
ForwardAnalyzer: Fix crash in cast '(T* &&)', the && does not have operands
2020-03-08 11:49:14 +01:00
Daniel Marjamäki
5376ba1701
AST: Throw validation exception if ternary operator is missing operands
2020-03-07 21:46:38 +01:00
orbitcowboy
85a26802e3
Running astyle [ci skip]
2020-03-01 20:39:00 +01:00
Paul Fultz II
6ea4f60600
Enable valueFlowSubfunction for multiple parameters ( #2550 )
2020-03-01 16:46:20 +01:00
Daniel Marjamäki
5df6d5bc7c
Tokenizer; Warn about unknown macro used in string concatenation
2020-02-28 21:52:01 +01:00
Daniel Marjamäki
baa4cee70c
Travis: Fixed Cppcheck warning
2020-02-27 10:51:34 +01:00
Daniel Marjamäki
38b570138f
AST: Try to handle c++17 for properly 'for (auto [a,b]:c)'
2020-02-27 09:58:53 +01:00
Daniel Marjamäki
84995485ea
VarId: fixed varids for 'for (auto [x,y]: xy)'
2020-02-27 07:18:07 +01:00
Oliver Stöneberg
1863ccb0a7
fixed Clang warnings about unused variables ( #2554 )
2020-02-26 14:52:43 +01:00
Daniel Marjamäki
e4937ed621
AST: Fixed wrong AST for cast '(std::vector<int>&&)s->second'
2020-02-25 21:05:49 +01:00
Rikard Falkeborn
9896dce7f2
checkuninitvar: Fix FN with c++ casts ( #2549 )
2020-02-23 19:53:17 +01:00
Daniel Marjamäki
4f9a0b8420
Refactoring suppressions
2020-02-23 19:49:53 +01:00
Daniel Marjamäki
bba340da3d
Preprocessor: Tweak parseCommentToken
2020-02-23 18:29:56 +01:00
Daniel Marjamäki
5ed5bf935f
astyle formatting
...
[ci skip]
2020-02-23 18:04:47 +01:00
ghking
5479c7340b
a new method to declare inline suppress which is more readable and more convenient. ( #2533 )
2020-02-23 18:04:24 +01:00
Daniel Marjamäki
ef26b55737
AST: Fix wrong handling for '{scope} (expr)'
2020-02-23 15:01:06 +01:00
Daniel Marjamäki
f07a71e3e1
Report unknown macros for pattern '%name% %num%'
2020-02-22 11:57:36 +01:00
Daniel Marjamäki
cf10b1a220
fix ast for expression that starts with number
2020-02-21 21:11:32 +01:00
Daniel Marjamäki
ec8c733afb
Improved Qt simplification
2020-02-21 19:04:21 +01:00
Daniel Marjamäki
388b5118df
Fixed bad ast (wrong result from iscast())
2020-02-21 17:15:33 +01:00
Daniel Marjamäki
c514818b65
astyle formatting
...
[ci skip]
2020-02-21 16:18:41 +01:00
Daniel Marjamäki
26a11e20d0
Revert "Fix crash with garbage code ( #2547 )"
...
This reverts commit b25709a492
.
The real problem was wrong AST for valid code, I want to fix that instead.
2020-02-21 09:35:01 +01:00
Paul Fultz II
b25709a492
Fix crash with garbage code ( #2547 )
2020-02-21 06:53:28 +01:00
Daniel Marjamäki
6f6f9dd5bc
Tokenizer: Throw unknownMacro in non-executable scope
2020-02-19 21:12:58 +01:00
Paul Fultz II
392060aefe
Fix issue 7804: ValueFlow: possible value in second if body ( #2543 )
2020-02-19 07:55:04 +01:00
Rikard Falkeborn
f6e7fb4bd9
Bugfix valuetype for some integer constants ( #2545 )
2020-02-19 07:51:39 +01:00
Daniel Marjamäki
95ac456e13
Fixed #9582 (false positive "error: Out of bounds access" with std::array and constant)
2020-02-19 07:36:02 +01:00
Daniel Marjamäki
1fd85c0ae8
Fixed #9630 (False positive: in stlIfFind checking, if with initializer is not handled properly)
2020-02-18 19:02:54 +01:00
Daniel Marjamäki
afb5590741
New check: delete 'self pointer' that might be used as 'this' and then use some member/method
2020-02-18 18:24:18 +01:00
Dmitry-Me
2168305f4e
Better variable name
2020-02-18 18:38:59 +03:00
Daniel Marjamäki
244e291605
Fixed #9640 (clang import: reference parameter)
2020-02-17 18:56:25 +01:00
Armin Müller
75b1ade316
Typos found by running "codespell" ( #2542 )
2020-02-17 18:28:58 +01:00
Dmitry-Me
f6da17eda5
Return early to avoid unneeded computations
2020-02-17 18:56:27 +03:00
Paul Fultz II
3b20684aca
Fix issue 9360: False positive: arrayIndexOutOfBounds when function is called with different array sizes ( #2541 )
2020-02-17 10:31:08 +01:00
Ken-Patrick Lehrmann
7044c17599
9575: false positive in fclose ( #2540 )
...
Fix false positive introduced by
0b7649ca9b
Only return the function token from checkTokenInsideExpression when it
might be one the argument (hence keeping a pointer to one of them).
Otherwise, we can directly skip to the token after the function call.
2020-02-17 10:25:30 +01:00
Daniel Marjamäki
89cb0187d0
Travis: Use simpleMatch for simple pattern
2020-02-16 21:47:46 +01:00
amai2012
efeb7deb7a
Run dmake and astyle
2020-02-16 19:58:09 +01:00
Daniel Marjamäki
ae0a73a538
Fixed #9618 (isCast flag not set for c++ casts)
2020-02-16 16:46:40 +01:00
Paul Fultz II
921887a281
Use valueFlowGeneric for valueFlowForwardExpression ( #2537 )
2020-02-16 16:02:22 +01:00
Paul Fultz II
95a48eac67
Fix issue 9598: False positive: Using iterator to local container that may be invalid for loop handling ( #2539 )
2020-02-16 15:56:52 +01:00
Daniel Marjamäki
a350ed9bc2
Fixed #9023 (AST: wrong lhs for a = b + foo(A::Hash{}("")))
2020-02-16 13:58:43 +01:00
Daniel Marjamäki
320cb9008f
minor tweaks of knownConditionTrueFalse
2020-02-15 20:21:13 +01:00
Daniel Marjamäki
67b495fc50
Fixed #9280 (False positive: unreadVariable on assignment to fixed address volatile struct member)
2020-02-15 17:31:47 +01:00
Daniel Marjamäki
8c0ad6a1b9
Fixed #9555 (False positive (unreadVariable): struct is assigned a value that is never used)
2020-02-15 16:43:06 +01:00
Daniel Marjamäki
569b2a4171
Fixed #9600 (false positive: compareBoolExpressionWithInt with --clang)
2020-02-15 14:45:12 +01:00
Daniel Marjamäki
df21da35bf
Refactoring; Use std::function instead of template type
2020-02-15 09:20:49 +01:00
Daniel Marjamäki
365da62624
Refactoring; Use std::function instead of template type
2020-02-15 09:14:14 +01:00
Daniel Marjamäki
697ca12d97
Refactoring; Convert templates to normal functions
2020-02-15 08:08:55 +01:00
Paul Fultz II
61d847cac2
Fix issue 9637: false positive: Condition 'i<2U' is always true ( #2536 )
2020-02-15 07:57:43 +01:00
Daniel Marjamäki
e04b9fe4a4
Remove unused functions
2020-02-14 20:37:33 +01:00
Daniel Marjamäki
332279326f
checkVirtualFunctionCallInConstructor; Check should be 'style' since there is no UB. Disabled the check temporarily, it should use CTU to determine if the class is a base class
2020-02-14 17:10:12 +01:00