Commit Graph

27604 Commits

Author SHA1 Message Date
Oliver Stöneberg a8eb971670
CI-unixish.yml: removed usage of qmake from selfcheck (#5531)
We deprecated qmake so we should no longer use it ourselves.
2023-11-27 12:06:33 +01:00
Oliver Stöneberg a937862a5d
CmdLineParser: return enum from `parseFromArgs()` instead of using additional member (#5698) 2023-11-27 12:06:03 +01:00
Oliver Stöneberg 5fed6e7dd9
json.h: suppress `-Wzero-as-null-pointer-constant` Clang warning (#5701) 2023-11-27 11:16:20 +01:00
Oliver Stöneberg d1b42d0771
fixed #12056 - qt.cfg: implemented `Q_OBJECT` to get rid of `symbolDatabaseWarning` in selfcheck (#5533) 2023-11-26 14:42:11 +01:00
Oliver Stöneberg f2461781fd
added `xml.h` wrapper for TinyXML2 / cleaned up suppressions of Clang compiler warnings (#5700) 2023-11-26 14:04:35 +01:00
chrchr-github 42a64d4d39
Fix #12218 syntaxError with typedef in namespace (#5694) 2023-11-25 22:59:51 +01:00
chrchr-github 33981fe42c
Fix #12214 FN constParameterReference / #12216 FP constParameterReference (#5691) 2023-11-25 22:58:16 +01:00
chrchr-github c1f6132745
Fix #12219 FP constParameterCallback for template argument (#5695) 2023-11-25 22:57:07 +01:00
Oliver Stöneberg 1d3f9beb21
CppCheckExecutor: do not modify settings after they were passed to `CppCheck` (#5697) 2023-11-25 22:07:49 +01:00
Oliver Stöneberg 8e1ae7e412
CmdLineParser: various refactorings and cleanups as well as testing improvements (#5676) 2023-11-25 21:12:24 +01:00
Oliver Stöneberg 86bb7c98e4
enabled and mitigated `readability-const-return-type` clang-tidy warnings (#5644) 2023-11-24 18:45:48 +01:00
chrchr-github 331db40d3b
Revert recent changes in checkConstVariable(), add tests (refs #12203) (#5696) 2023-11-22 19:20:56 +01:00
chrchr-github 83b5cb5b2f
Fix #12203 false negative: constParameterReference when taking address (#5682) 2023-11-22 14:05:53 +01:00
Daniel Marjamäki 727d086dc4
Fix #12217 (misra 11.4: report conversion in macro) (#5692) 2023-11-22 12:47:48 +01:00
Oliver Stöneberg 693702d98d
compilerDefinitions.cmake: fixed faulty `add_compile_definitions()` value for MSVC (#5690)
also fixes `<command line>(7,9): error : macro name must be an
identifier` with `clang-cl` allowing the build to complete
2023-11-22 11:02:35 +01:00
chrchr-github 8b6cbe2e9e
Fix crash in SymbolDatabase::addClassFunction() (f'up to #12209) (#5689) 2023-11-21 12:57:38 +01:00
Oliver Stöneberg 2b61c9ef2f
Tokenizer: moved `VariableMap` into anonymous namespace (#5686) 2023-11-21 11:35:17 +01:00
chrchr-github f5630e7049
Fix #12209 "debug: Executable scope 'x' with unknown function." with anonymous namespace (#5688) 2023-11-20 22:28:38 +01:00
chrchr-github f9521cfb4e
Fix #12208 FN constParameterReference with nested struct/class (#5685) 2023-11-20 22:01:22 +01:00
andymacg f444696d5c
Fix #12198: Expect function pointers in Misra 17.7 check (#5675) 2023-11-20 20:19:20 +01:00
chrchr-github d09a6514cd
Fix #11012 FP unassignedVariable when passed in init list (#5684) 2023-11-20 19:43:29 +01:00
chrchr-github d7c7a39afe
Fix crash in CheckLeakAutoVar (f'up to #12186) (#5683) 2023-11-20 18:26:05 +01:00
Daniel Marjamäki 036df0aca9
Fix #12181 (Suppressions: allow that id with * is added) (#5681) 2023-11-20 11:54:41 +01:00
Oliver Stöneberg 3bafe164a3
enabled some clang-tidy warnings for non-GUI code (#5679)
There are some clang-tidy warnings which cannot properly handle the
extensions used in the Qt code so the produce lots of false positives
and were previously enabled. With clang-tidy now offering the
possibility to inherit the parent configuration we can enable these
across the project and simply disable them for the GUI code.

No additional warnings were found as they were already fixed in earlier
commits without enabling the checks in question.
2023-11-20 10:06:46 +01:00
Oliver Stöneberg 92c089d4ad
fixed some "Parameter can be made pointer/reference to const" Rider warnings (#5680) 2023-11-20 07:23:45 +01:00
chrchr-github cd21918520
Fix FP memleak with outparam allocation (f'up to #12186) (#5677)
I wonder if it is worth trying to get this right. We also have FPs when
the return value is assigned to a variable, and that seems much harder
to fix.
2023-11-19 19:51:32 +01:00
Oliver Stöneberg 4addad1643
moved settings-related code from `CppCheckExecutor` to `CmdLineParser` (#5672)
`CppCheckExecutor` contains some code which is not related to the
execution but actually to the creation of the settings. This is causing
inconsistencies in the error handling/logging as well as interfering
with the testability.
2023-11-19 19:45:10 +01:00
Daniel Marjamäki 56c7ac3771
Fix #12182 (speedup valueFlow by only running valueFlowNumber once) (#5678) 2023-11-19 18:56:48 +01:00
chrchr-github 61bd8fddbf
Partial fix for #11469 FP mismatchingContainerExpression warning (#5674) 2023-11-17 17:12:38 +01:00
chrchr-github 3e47acd580
Fix FP memleak (f'up to #12186) (#5671) 2023-11-16 18:35:32 +01:00
chrchr-github 4b9f3c68fb
Fix #12188 FN uninitvar with increment of struct member (#5665) 2023-11-16 18:11:12 +01:00
chrchr-github 831aec5c03
Fix #12185 FN constVariablePointer with stream (#5659) 2023-11-16 17:43:20 +01:00
Daniel Marjamäki e01e090f1c
Fix #10866 (no preprocessorErrorDirective and code generated in case of unconditional #error) (#5670) 2023-11-16 17:25:49 +01:00
Oliver Stöneberg e47300016b
moved some classes/structs into anonymous namespace (#5669) 2023-11-16 15:49:41 +01:00
chrchr-github 63a5a71c20
Fix #12186 FN memleak with outparam allocation (#5661) 2023-11-16 15:23:40 +01:00
Oliver Stöneberg 9cf0342f9d
optimized `ProgramMemory` a bit (#5668)
Scanning `common/file.c` of the `xrdp` project with `--force --std=c11
--std=c++11 --inline-suppr --enable=warning`:

Clang 16 `4,208,373,435` -> `4,156,024,955`
GCC 13 `4,336,042,153` -> `4,277,293,971`
2023-11-16 14:35:25 +01:00
chrchr-github 85172fe770
Don't report checkLibraryUseIgnore for known functions (refs #7719) (#5664) 2023-11-16 14:23:08 +01:00
Swasti Shrivastava 1ce901385a
Fix #12172:False positive: misra-11.1 function pointer assigned to array (#5667) 2023-11-16 13:57:27 +01:00
Oliver Stöneberg 682901ac2a
fixed #10760 - added file name to ValueFlow `--debug` output (#5655) 2023-11-16 13:44:50 +01:00
Oliver Stöneberg 8b69ccadd4
CppCheckExecutor: extracted logging instance related code into separate implementation class (#5658) 2023-11-16 10:35:43 +01:00
Swasti Shrivastava 81a03e7341
Fix #12184: false positive: misra 11.6, cast expression '0U' to 'void*' (#5666) 2023-11-16 09:06:58 +01:00
Daniel Marjamäki ae3f7bd800
Fixed #12187 (Windows build GUI with cmake) (#5662) 2023-11-15 16:56:46 +01:00
Oliver Stöneberg d3a8eb1ae2
config.h: improved and cleaned up some preprocessor checks (#5663) 2023-11-15 15:31:12 +01:00
Oliver Stöneberg e7f8985173
disabled some expensive and/or unnecessary clang-tidy checks (#5660)
Running clang-tidy with `--enable-check-profile` provides an overview of
the run-time of each check. This revealed some checks which take a
considerable amount of time which could be disabled.

Here's the times for the checks in question. The times are very similar
across most files:
```
   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Name ---
...
   0.4531 (  4.7%)   0.3906 (  6.1%)   0.8438 (  5.2%)   0.8127 (  5.1%)  misc-unused-using-decls
...
   0.3281 (  3.4%)   0.2344 (  3.7%)   0.5625 (  3.5%)   0.4509 (  2.8%)  modernize-macro-to-enum
...
   0.2188 (  2.2%)   0.2031 (  3.2%)   0.4219 (  2.6%)   0.3621 (  2.3%)  modernize-use-nullptr
```
2023-11-15 11:24:25 +01:00
chrchr-github 3bd5a034bd
Fix #12176 false positive: unassignedVariable (#5656) 2023-11-14 12:26:12 +01:00
chrchr-github 6ac804d209
Fix #12178 extern "C++" scope generates valueflow (#5654) 2023-11-14 10:02:41 +01:00
Oliver Stöneberg 9228b9e424
iwyu.yml: fixed `include-what-you-use` job / cleaned up includes (#5657)
As usual when the base clang version of a distro changes iwyu ends up
broken and needs additional packages and/or options applied to work
again.
2023-11-13 23:24:06 +01:00
Stefan van Kessel d3520943ad
Minor: fix msvc warning "not all control paths return a value" (#5650)
When building with /Od - default cmake debug build for me, the
__assume(false); trick does not work to get rid of the C4714 warnings

https://godbolt.org/z/a6xGnfP7d

D:\tmp\cppcheck\lib\keywords.cpp(205): warning C4715:
'Keywords::getOnly': not all control paths return a value
D:\tmp\cppcheck\lib\keywords.cpp(226): warning C4715:
'Keywords::getOnly': not all control paths return a value
D:\tmp\cppcheck\lib\keywords.cpp(168): warning C4715:
'Keywords::getAll': not all control paths return a value
D:\tmp\cppcheck\lib\keywords.cpp(188): warning C4715:
'Keywords::getAll': not all control paths return a value

Proposed fix: also define NORETURN to [[noreturn]] when according to
__has_cpp_attribute [[noreturn]] is supported
https://en.cppreference.com/w/cpp/feature_test

(For previous discussion see also
https://github.com/danmar/cppcheck/pull/5497)
2023-11-12 17:30:06 +01:00
orbitcowboy b201ef26cb
windows.cfg: Improved configuration of OpenThread() (#5653) 2023-11-12 11:37:29 +01:00
chrchr-github a6b7a8c1cc
Fix #12170 FP knownPointerToBool with function pointer (#5646) 2023-11-12 10:20:18 +01:00