Commit Graph

13958 Commits

Author SHA1 Message Date
Oliver Stöneberg 339484d2a1
mitigated and enabled more clang-tidy warnings (#4470)
* fixed some `performance-inefficient-string-concatenation` clang-tidy warnings

* fixed and enabled `modernize-replace-random-shuffle` clang-tidy warning

* fixed and enabled `bugprone-suspicious-string-compare` clang-tidy warning

* mitigated and enabled `readability-non-const-parameter` clang-tidy warnings

* clang-tidy.md: documented some disabled checks

* mitigated and enabled `performance-unnecessary-value-param` clang-tidy warnings
2022-09-16 18:58:59 +02:00
chrchr-github 45ccc9ba1e
Fix ctunullpointer FP (#4471) 2022-09-16 12:11:34 +02:00
Oliver Stöneberg b3ec225480
iwyu.yml: use `debian:unstable` to always get latest include-what-you-use / cleaned up includes (#4466)
* iwyu.yml: use debian:unstable to always get latest include-what-you-use

* cleaned up includes based on include-what-you-use

* mitigated include-what-you-use false positives
2022-09-16 07:15:49 +02:00
chrchr-github c9ade33298
Fix memsetClass FP (#4465) 2022-09-15 20:20:49 +02:00
Daniel Marjamäki f1aa9eb48f dump: add externLang attribute for tokens 2022-09-15 19:57:42 +02:00
chrchr-github d1386a842a
Fix #11301 debug: constStatementError not handled. (#4463)
* Fix #11301 debug: constStatementError not handled.

* Use function
2022-09-14 23:57:02 +02:00
chrchr-github 266174ddc4
Fix #10993 danglingTemporaryLifetime reported in two different locati… (#4462)
* Fix #10993 danglingTemporaryLifetime reported in two different locations for std::string_view usage

* Missing include

* Add test
2022-09-14 07:28:04 +02:00
chrchr-github 07caf17eb3
Fix #1655 wrong usage of std::string in memcpy (#4460) 2022-09-13 15:14:25 +02:00
chrchr-github e904f7341e
Fix ValueFlow crash (#4461) 2022-09-13 12:25:15 +02:00
Paul Fultz II 43caa32abf
Fix 9755: false negative: access of moved variable in conditional code (#4459)
* Fix 9755: false negative: access of moved variable in conditional code

* Format
2022-09-11 12:32:01 +02:00
Oliver Stöneberg 76d1b9f31a
avoid unnecessary copies with `emplace_back()` (#4450)
* avoid unnecessary copies with `emplace_back()`

* cmdlineparser.cpp: suppress `accessMoved` selfcheck false positives
2022-09-10 11:25:15 +02:00
Paul Fultz II 53820515c9
Set valueflow for container elements (#4455)
* Track elements to containers

* Format

* Handle other access methods

* Format
2022-09-10 09:26:44 +02:00
Oliver Stöneberg 433293b9ab
added missing version bumps to 2.10 (#4420) 2022-09-09 21:02:04 +02:00
Paul Fultz II 117a753b10
Partial fix 11154: FN: knownConditionTrueFalse (#4453)
* Partial fix 11154: FN: knownConditionTrueFalse

* Formay

* Add more tests

* FOrmat

* Fix FP

* Add test

* Check for side effects

* Format

* Update tests

* Format
2022-09-08 22:08:38 +02:00
Oliver Stöneberg dbc05da356
fixed some clang-tidy warnings (#4435) 2022-09-08 20:01:41 +02:00
Paul Fultz II 7c986fbef1
Fix 11203: false positive: knownConditionTrueFalse 'always false' when comparing integer with floating-point (#4350) 2022-09-08 19:59:02 +02:00
Paul Fultz II f83b8dd385
Fix 11194: FN: knownConditionTrueFalse (#4452)
* Fix 11194: FN: knownConditionTrueFalse

* Format
2022-09-08 18:51:44 +02:00
Daniel Marjamäki 92845295b8 Fix broken CI caused by my qt fix 2022-09-08 11:12:38 +02:00
Oliver Stöneberg d46ea7ba86
avoid unnecessary copies with `push_back()` and `push_front()` (#4451) 2022-09-08 09:21:35 +02:00
Daniel Marjamäki 2e8d855b35 Tokenizer: Skip qt simplification if qt library is not loaded 2022-09-08 07:47:58 +02:00
Daniel Marjamäki b99474fe13 Tokenizer: Remove redundant setVarId call 2022-09-08 07:46:19 +02:00
Oliver Stöneberg 847391ea2d
some minor optimizations (#4449)
* cppcheck.cpp: reduced scope of a variable

* cppcheck.cpp: removed unnecessary severity checks

* cppcheck.cpp: avoid unnecessary copy

* templatesimplifier.cpp: perform early exit in loop in `expandTemplate()`
2022-09-07 19:19:04 +02:00
Paul Fultz II 32d96104d6
Fix 6370: ValueFlow: array element with known value (#4447)
* Fix 6370: ValueFlow: array element with known value

* Format

* Move comment
2022-09-07 19:16:07 +02:00
Paul Fultz II 6543b429c5
Fix 11285: FN: zerodiv (#4448)
* Fix 11285: FN: zerodiv

* Format
2022-09-07 19:15:37 +02:00
chrchr-github 6960332f8a
Fix #11294 FP arrayIndexOutOfBoundsCond with extra parentheses (#4442) 2022-09-06 21:21:06 +02:00
Oliver Stöneberg b3762cd76a
actually perform system tinyxml2 build on macos / fixed system tinyxml2 include (#4445)
* lib/CMakeLists.txt: removed unnecessary external include

* look up tinyxml2 include dir when using system one and specify it

* lib/CMakeLists.txt: do not treat bundled headers as system ones

* CI-unixish.yml: actually perform system tinyxml2 build on macos
2022-09-06 18:30:59 +02:00
Paul Fultz II 2d37a77281
Fix 11296: FN: knownConditionTrueFalse ( a !=0 && b != 0 && a == 0) (#4444) 2022-09-06 07:31:48 +02:00
Paul Fultz II 016793f258
Fix 11295: Regression FP: knownConditionTrueFalse (#4443) 2022-09-06 07:31:38 +02:00
Oliver Stöneberg 436b8bd3f1
optimized `isSameConstantValue()` a bit (#4441) 2022-09-05 21:36:26 +02:00
chrchr-github 31118fdce5
Fix noreturn FP with while() (#4429)
* Fix checkLibraryFunction FPs

* Fix FP with fclose()

* Format

* Fix FP with reinterpret_cast

* Fix noreturn FP with while()
2022-09-04 10:26:31 +02:00
Paul Fultz II 6ce5c24f21
Refactor knownConditionTrueFalse check and isUsedAsBool function (#4432)
* Refactor knownConditionTrueFalse check and isUsedAsBool function

* Format1

* Format

* Skip assign
2022-09-04 10:24:45 +02:00
Maksim Derbasov f93b588603
New check: use memcpy/memset instead of loop (#4257) 2022-09-03 23:29:06 +02:00
Daniel Marjamäki 9306c6f329 dump: Add Function::isAttributeNoreturn info 2022-09-03 12:09:20 +02:00
chrchr-github cf52ee098a
Fix checkLibraryFunction FPs (#4423)
* Fix checkLibraryFunction FPs

* Fix FP with fclose()

* Format

* Fix FP with reinterpret_cast
2022-09-02 07:51:10 +02:00
chrchr-github 79daad8ff4
Fix #11020 FP arrayIndexOutOfBounds if string literals are assigned conditionally (#4428) 2022-09-01 22:59:46 +02:00
Daniel Marjamäki 4779f0e172 TemplateSimplifier: Fixed instantiation when template parameters are A<..>, B<..> 2022-09-01 20:24:01 +02:00
chrchr-github 5804cc44e7
Fix FP bufferAccessOutOfBounds (#4427)
* Fix FN with buffer size 1

* Fix FP bufferAccessOutOfBounds
2022-08-31 19:31:37 +02:00
chrchr-github 3925a27182
Fix FP knowConditionTrueFalse (#4419)
* Fix #10426 FN (style) Condition 's.empty()' is always false

* Fix test

* Fix FP knowConditionTrueFalse

* Check for casts

* Fix FP for user-defined functions

* Adjust condition detection

* Tweaks
2022-08-30 18:08:24 +02:00
chrchr-github 9ab4f9976d
Fix #10426 FN (style) Condition 's.empty()' is always false (#4414)
* Fix #10426 FN (style) Condition 's.empty()' is always false

* Fix test
2022-08-29 12:25:10 +02:00
chrchr-github 1e14e360cb
Fix #8295 FN (error) Buffer is accessed out of bounds (wcpncpy, wcsncpy) (#4412)
* Fix #8295 FN (error) Buffer is accessed out of bounds (wcpncpy, wcsncpy)

* Fix cfg, validation

* Fix validation
2022-08-29 12:24:58 +02:00
chrchr-github df704361f6
Fix FN with buffer size 1 (#4410) 2022-08-29 12:24:44 +02:00
Daniel Marjamäki a400c94230 Update Copyrights 2022-08-28 14:22:12 +02:00
Daniel Marjamäki 5e0fc24bb7 Fixed #11232 (Syntax Error: AST broken, binary operator '!=' doesn't have two operands) 2022-08-27 18:02:19 +02:00
chrchr-github 7156afe003
Fix #5140 FN (error) buffer access out of bounds - known argument (#4402)
* Fix #5140 FN (error) buffer access out of bounds - known argument const char* argv[]

* Format
2022-08-26 17:27:54 +02:00
chrchr-github 917496a844
Fix #5678 FN destructor with no definition hide mismatching alloc/dealloc (#4401)
* Fix #5678 FN destructor with no definition hide mismatching allocation / deallocation

* Format

* Fix test

* Format
2022-08-25 22:52:51 +02:00
chrchr-github 456c6b410e
Fix #2304 FN known strcpy parameter (#4396)
* Fix #2304 FN known strcpy parameter

* Parentheses

* Format
2022-08-24 21:23:45 +02:00
Oliver Stöneberg 467648bec6
fixed #11249 (potential hang with -j and --showtime= when using threads) - synchronized access to `TimerResults::mResults` / added TSAN to CI (#4355) 2022-08-23 20:30:45 +02:00
chrchr-github 13e8d5220c
Fix another c_strParam regression (#4394) 2022-08-23 20:26:36 +02:00
Daniel Marjamäki a2454ecbca cli import cppcheck project with premium options 2022-08-23 20:13:03 +02:00
chrchr-github 4be7f689d7
Fix c_strParam regression (#4393)
* Fix #7515 New check: Not needed c_str() operation

* Comment

* Detect more instances of c_str() misuse

* Fix bad merge

* Check for data() also

* Fix

* Format

* Format

* Fix c_strParam regression
2022-08-23 15:00:27 +02:00