Commit Graph

23938 Commits

Author SHA1 Message Date
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
orbitcowboy b6f4961e4a windows.cfg: Add config for toupper/tolower 2021-01-08 09:20:23 +01:00
Rikard Falkeborn a8a0dbec26
cfg: Add config for toupper/tolower (#3028) 2021-01-08 08:34:09 +01:00
Georgiy Komarov 82f51bd523
misra: Fix crash on rule 9.x (#3024)
Closes ticket #10084
2021-01-07 15:04:12 +01:00
orbitcowboy 2b22120d22 wxwidgets.cfg: Added support for more interfaces, found by daca@home 2021-01-07 10:01:51 +01:00
orbitcowboy a576048da8 wxwidgets.cfg: Added support for more interfaces, found by daca@home 2021-01-07 10:00:28 +01:00
orbitcowboy 7452a01fb8 wxwidgets.cfg: Added support for more interfaces, found by daca@home 2021-01-07 09:57:36 +01:00
orbitcowboy 5f0a406e5e wxwidgets.cfg: Added support for more interfaces, found by daca@home 2021-01-07 09:54:15 +01:00
orbitcowboy 6cfd42305c wxwidgets.cfg: Added support for more interfaces, found by daca@home 2021-01-07 09:41:16 +01:00
orbitcowboy 220597bc0b wxwidgets.cfg: Added support for more interfaces, found by daca@home 2021-01-07 09:37:34 +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
Oliver Stöneberg a7f0e91539
cppcheckexecutor.cpp: fixed stack-use-after-scope reported by ASAN (#3018) 2021-01-06 11:39:24 +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