Commit Graph

23959 Commits

Author SHA1 Message Date
amai2012 6012cd4fd9
philosophy.md : Describe inconclusive messages (#2841)
Inspired by https://github.com/danmar/cppcheck/pull/2839 inconclusive messages are added to this document.
2021-01-18 19:58:06 +01:00
Mathias Schmid ab7d728831
Add missing support for "type-checks" and "smart-pointer" configuration. (#3039) 2021-01-18 19:10:53 +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
Daniel Marjamäki 5391880dc6 Travis; Quick fix of builds. pylint does not work well on Travis so remove that. 2021-01-18 08:44:06 +01:00
abhijit-sawant 3bb5f15c38
Added .vscode to gitignore (#3061) 2021-01-18 08:28:56 +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
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
Mathias Schmid 583ee7b70e
Fix update of some translations after application language switch. (#3049) 2021-01-15 18:19:51 +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
Oliver Stöneberg c94713c607
improved error handling in ThreadExecutor (#3023) 2021-01-13 12:41:59 +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
Oliver Stöneberg 7c5015d54e
fixed --check-library not showing anything on its own (#3035) 2021-01-12 20:53:05 +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
Mathias Schmid 348b2d4832
Check for mandatory "name" attribute in "podtype". (#3040) 2021-01-11 18:48:56 +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
Mathias Schmid cdc0ba32e4
Check if XML reader stopped because of an error. (#3034) 2021-01-10 12:10:30 +01:00
Mathias Schmid b74aa707d1
Add optional attribute "stdtype" of element "podtype" to avoid loss during library configuration save. (#3033) 2021-01-09 21:30:29 +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
Georgiy Komarov 35a42cd0fe
cppcheckdata: Make the source files for configuration public (#3030)
Extend CppcheckData class API to make the list of source files public.
This can be used by custom addons.
2021-01-08 22:59:58 +01:00
Paul Fultz II c267d85640
Add generic valueflowBeforeCondition (#3001) 2021-01-08 22:55:04 +01:00
shaneasd e931d609e7
improve cppunit macros (#3025) 2021-01-08 22:48:28 +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
Georgiy Komarov 13b8ee8871
cppcheckdata: Use instance attributes in Cppcheckdata (#3029)
This commit makes CppcheckData class to use instance attributes instead
of class attributes.

Since class attributes are mutable (list), when you append to them, they
don't promote to instance variable which means when you call parsedump()
multiple times data just gets appended to them.

Found by samed on the forum:
https://sourceforge.net/p/cppcheck/discussion/general/thread/c6e1210ec2/
2021-01-08 10:25:51 +01:00