Commit Graph

27046 Commits

Author SHA1 Message Date
PeterSchops b689ca8d89
Update cppcheckdata.py (#5149)
* Update cppcheckdata.py

- added links to cpp-file/function that writes this part of the dump-file 
- updated documentation (Added list of possible return values for a number of variables) 
- added MacroUsage isKnownValue 
- added ValueType reference 
- added Token isBoolean 
- added Token isCast 
- added Token externLang 
- added Token isComplex 
- added Token isRestrict 
- added Token isAttributeExport 
- added Token originalName 
- added Scope functions 
- added Scope definedType 
- added Function hasVirtualSpecifier 
- removed Function isVirtual 
- added Function isAttributeNoreturn 
- added Function overriddenFunction 
- added Variable isVolatile 
- class Container added 
- added Value movedValue 
- added Value uninit 
- added Value bufferSize 
- removed Value inconclusive and added it to valueKind

* Update cppcheckdata.py

removed encoding from open (needed to make python 2.7 check pass) where python 2.7 should not be used anymore

* Update cppcheckdata.py after feedback

made sure that attributes I added to the class always have a value
added some missing attributes in the print
2023-06-15 20:42:58 +02:00
Daniel Marjamäki b462d070bf Minor tweaking of constness 2023-06-15 19:41:47 +02:00
Daniel Marjamäki f934d6e5d0
Fix #11767 (False positive: uninitialized member after assignment) (#5157) 2023-06-15 14:42:58 +02:00
Daniel Marjamäki d75331d00d
Fix #11435 (FP ctuOneDefinitionRuleViolation for template specialization) (#5156) 2023-06-15 11:43:07 +02:00
Long Radix c033c62190
Typos and stilistic updates (#5141) 2023-06-14 12:30:45 +02:00
Daniel Marjamäki 9339802be3
Fix #11740 (FP syntaxError from switch in C code) (#5153) 2023-06-14 10:41:37 +02:00
chrchr-github 6f56a9563e
Add missing rebinding trait to TaggedAllocator (complete #5015) (#5146) 2023-06-13 11:22:43 +02:00
Anton Lindqvist 09cd3a8269
Fix FP deallocuse regression (#5144)
Introduced in commit 69116c838 ("Fix #11758 Regression: memleak / Fix #11746 FN:
deallocuse (#5139)").
2023-06-11 14:11:41 +02:00
Daniel Marjamäki f6a65afdee
Fix FP uninitStructMember when other variable is only nonzero if struct member is initialized (#5143) 2023-06-10 21:35:17 +02:00
Daniel Marjamäki 7840bc4c63 Execute runformat 2023-06-10 17:37:32 +02:00
chrchr-github 24b0d08753
Fix FP autoVariables (#5107)
* Fix #11732 FP autoVariables when reassigning argv

* Fix #11732 FN autoVariables with array and std::string

* Add test

* Format

* Format

* Simplify check, fix inconclusive

* Fix merge, add test

* Fix FPs

* Format

* Format

* Undo move

* Format
2023-06-10 16:28:29 +02:00
Daniel Marjamäki 1c28457d2c
ValueFlow: Fix uninitvar false positive after initialization '*((int*)&x) = ..' (#5142) 2023-06-10 15:22:17 +02:00
Daniel Marjamäki 3c8caac772
Fix #11688 (FP uninitvar in for loop iteration expression) (#5140) 2023-06-10 09:58:08 +02:00
chrchr-github 7e0f64688f
Fix #11275 internalAstError on C++20 templated lambda / Fix #11400 internalAstError on nested lambda (#5134)
* Fix #11275 internalAstError on C++20 templated lambda

* Fix #11400 internalAstError on nested lambda passed as argument
2023-06-10 07:42:10 +02:00
chrchr-github d4705ca8ab
Fix #10809 cppcheckError Cyclic reverse analysis (#5137)
* Fix #10809 cppcheckError Cyclic reverse analysis

* Handle fixed AST in ValueFlow, fix FN

* Remove
2023-06-10 07:41:52 +02:00
chrchr-github 69116c8386
Fix #11758 Regression: memleak / Fix #11746 FN: deallocuse (#5139)
* Fix #11758 Regression: memleak

* Format

* Fix #11746 FN: deallocuse

* Complete the trifecta
2023-06-10 00:24:36 +02:00
Daniel Marjamäki 22e67d3534
Fixed #10442 (AST: wrong ast of ({}) in struct initialization) (#5135) 2023-06-09 22:31:14 +02:00
orbitcowboy 6ea88c2758
Added test case from #8302 (#5138)
* Added test case from #8302 and a TODO

* Check with in C++ mode to get rid of TODO.

* Updated expected error message text

* Updated expected error message text
2023-06-09 21:46:45 +02:00
Daniel Marjamäki a62fedc641
GUI: Do not use --rule-texts in cppcheck premium (#5136) 2023-06-09 17:15:48 +02:00
chrchr-github bd6c5318ad
Detect container action and yield functions (#5117)
* Detect container action and yield functions

* Fix test

* Adapt getUseRetValType() to handle container yield functions
Add TODO

* Handle combined action/yield

* Add Yield::BUFFER

* Remove redundant functions

* Revert "Remove redundant functions"

This reverts commit 4f124a57de5c761ac757ebed83d9f047ef4a1328.

* Add Yield::AT_INDEX

* Add Yield::ITERATOR

* Simplify
2023-06-09 16:03:47 +02:00
Daniel Marjamäki 2beb46194f philosphy.md: Remove section about bughunting it has been moved to Cppcheck Premium 2023-06-09 09:40:58 +02:00
Daniel Marjamäki b086873599
Cppcheck: change severity from information to error for internalError (#5133) 2023-06-08 23:31:36 +02:00
Daniel Marjamäki 3630ba9a3d AUTHORS: add carlatcrown 2023-06-08 20:05:09 +02:00
Carl Morgan 6741f774b1
Support integer Z suffix and user defined literals with _ suffix (#10807, #11438) (#5130)
Co-authored-by: Carl Morgan <no-reply@crown.com>
2023-06-08 20:03:41 +02:00
Daniel Marjamäki d4902109cd
threadsafety.py: cleanup (#5132) 2023-06-08 19:58:11 +02:00
Andrew C Aitchison 0727528876
The threadsafety.py addon now flags MT-Unsafe symbols and functions. (#5086) 2023-06-08 14:46:09 +02:00
Daniel Marjamäki 520a6644a6
y2038.py: some fixes for obsolete code in y2038.py (#5131) 2023-06-08 14:44:05 +02:00
chrchr-github be2824b003
Fix FN deallocuse with array access (#5121)
* Fix FN deallocuse with array access

* Fix another FN

* Undo
2023-06-08 07:55:49 +02:00
chrchr-github 901b775471
Fix scope for function returning rvalue reference, insert std:: in return statement (#5119)
* Fix scope for function returning rvalue reference

* Insert std:: in return statement

* Fix failing test
2023-06-08 07:47:21 +02:00
chrchr-github 4dbbae62a7
Fix #11753 FN: invalidLifetime (#5128)
* Fix #11753 FN: invalidLifetime

* Format

* Format

* Only forward for local variables

* Format

* Format
2023-06-08 07:45:59 +02:00
chrchr-github 3ff8ce316c
Fix AST for parameter pack (#10199, #10492, #11103) (#5125)
* Fix AST for parameter pack (#10199, #10492, #11103)

* Skip ... after )
2023-06-07 20:46:14 +02:00
chrchr-github ec4267a2bd
Don't suggest const for smartptr::get() (#5126)
* Don't suggest const for smartptr::get()

* Fix test

* Fix merge

* get() doesn't change a smartpointer

* Parentheses
2023-06-07 20:45:48 +02:00
chrchr-github 12fe652321
Fix #11063 FP unreadVariable with extra parentheses and scope operator (#5122) 2023-06-07 20:45:27 +02:00
Daniel Marjamäki ae83d53813
GUI: Do not replace relative paths with absolute paths in suppressions. (#5127) 2023-06-07 20:42:18 +02:00
chrchr-github 39f958bcfb
Fix #11596 FP uninitvar with array of function pointers (#5098) 2023-06-07 11:41:22 +02:00
Daniel Marjamäki 30aa0ae880 AUTHORS: Added rwiesenfarth 2023-06-07 11:36:59 +02:00
Rainer Wiesenfarth f4f58bf020
Fix #11081 GUI: Windows release build crashes (#5083)
* Fix #11081 GUI: Windows release build crashes

Use generator expressions rather than if statements when adding compiler
options or definitions.

* Fix #11081 GUI: Windows CMake debug build fails with default options

When DISABLE_CRTDBG_MAP_ALLOC is using the default value (OFF), the
debug build of cppcheck-gui fails, as the "realloc" method names in some
of the Qt headers are replaced by the macro defined by the compiler.
Thus DISABLE_CRTDBG_MAP_ALLOC is explicitely set when compiling
cppcheck-gui in Debug mode using MSVC.
2023-06-07 11:33:55 +02:00
chrchr-github ac86eda6b3
Revert "Revert "Skip forwarding values for unique expressions (#5103)"" (#5124) 2023-06-07 11:11:48 +02:00
Daniel Marjamäki 7d4472616b Revert "Skip forwarding values for unique expressions (#5103)"
This reverts commit 26ed052e8d.
2023-06-06 17:31:24 +02:00
Paul Fultz II 26ed052e8d
Skip forwarding values for unique expressions (#5103) 2023-06-05 20:49:19 +02:00
SChernykh 93595aeff0
Fixed `std::vector::data` return type (#5116)
This caused many `arithOperationsOnVoidPointer` false positives in my project which uses `std::vector<uint8_t>` in many places.
2023-06-05 20:47:42 +02:00
Haowei Hsu 34cecf2336
GUI: Update zh_TW translation (#5115) 2023-06-05 20:45:52 +02:00
Daniel Marjamäki 5976faaaf5
Fixed #11745 (Fix AST for 'new type..[..]{..}') (#5118) 2023-06-05 20:43:17 +02:00
Daniel Marjamäki f4cfed674c AUTHORS: Add hwhsu1231 2023-06-04 07:53:17 +02:00
Haowei Hsu bf8b3188a3
GUI: Add zh_TW translation (#5108) 2023-06-04 07:51:48 +02:00
chrchr-github 18b60d2f2b
Fix #11670 FP constStatement (inconclusive) triggered by namespace (#5114) 2023-06-03 15:13:15 +02:00
chrchr-github f2976e5bb5
std.cfg: add support for smartptr member functions (#5113)
* std.cfg: add support for smartptr member functions

* Fix test

* Fix
2023-06-03 14:36:30 +02:00
chrchr-github 1b98be458d
Fix #11739 Assert failure in valueflow.cpp / setSymbolic() (#5104) 2023-06-03 11:08:06 +02:00
chrchr-github 82e9c076da
Fix #11744 FN functionConst/functionStatic with recursion (#5105)
* Fix FN functionStatic

* Fix FN functionConst, add test

* Fix build
2023-06-02 23:33:42 +02:00
chrchr-github 055489df5a
Fix #11742 Can't reduce scope as variable references itself (#5112) 2023-06-02 23:33:17 +02:00