Commit Graph

27748 Commits

Author SHA1 Message Date
chrchr-github 30397f0d53
Fix FP initializerList with static member (#5864) 2024-01-09 19:42:23 +01:00
chrchr-github 9fceba4fbc
Fix FP initializerList with base member (#5862) 2024-01-09 14:52:32 +01:00
chrchr-github c21166565f
Fix #12322 detect usage of partially-initialized object in constructor (#5851) 2024-01-09 12:28:22 +01:00
Daniel Marjamäki 8903f0e4b1
daca: Add compare-normal-exhaustive.py script to compare normal and exhaustive check level (#5860) 2024-01-09 11:45:44 +01:00
Oliver Stöneberg 08d754d536
ClangImport: avoid unchecked pointer dereferences (#5856)
The `Tokenizer` and `TokenList` objects which are passed around always
need to exist so pass them by reference.
2024-01-08 19:46:12 +01:00
Oliver Stöneberg 30ca8e11b5
moved `Language` from `settings.h` to `standards.h` (#5854) 2024-01-07 22:53:39 +01:00
Oliver Stöneberg bbd2b2aa83
cleaned up includes based on `include-what-you-use` (#5855) 2024-01-07 11:07:51 +01:00
Oliver Stöneberg 81700b481d
some `TokenList` cleanups (#5848) 2024-01-06 23:49:25 +01:00
Maarten van der Schrieck 328f98b35a
test/cli/test-other.py: Fix test_showtime_top5_file. (#5847)
test_showtime_top5_file() assumes that all reported elements, of which
the "top 5" are validated, end with the string "- 1 result(s))".

This is clearly not the case when viewing the entire list:

```bash
$ cppcheck --showtime=summary --quiet empty.c  |grep "2 result"
valueFlowLifetime(tokenlist, errorLogger, settings): 3.4e-05s (avg. 1.7e-05s - 2 result(s))
valueFlowEnumValue(symboldatabase, settings): 3e-06s (avg. 1.5e-06s - 2 result(s))
```

As the order of items is non-deterministic, this test makes CI workflows
randomly fail.

This patch addresses the issue by adjusting the expected string to the
reported item.
2024-01-06 22:50:40 +01:00
Oliver Stöneberg e3b3048d00
test/helpers:h: fixed initialization order in `givenACodeSampleToTokenize` (#5849) 2024-01-06 18:36:34 +01:00
orbitcowboy 71212c7d66
std.cfg: Added support for invalidFunctionArg check to tgamma(). (#5850)
Reference: https://en.cppreference.com/w/cpp/numeric/math/tgamma
2024-01-06 14:59:43 +01:00
orbitcowboy 32cabecca9
Add support for InvalidFunctionArg lgamma() (#5845)
Reference: https://en.cppreference.com/w/cpp/numeric/math/lgamma
2024-01-05 23:34:08 +01:00
chrchr-github fde7ea6d17
Fix #12321 FP doubleFree within lambda (#5844) 2024-01-05 22:20:21 +01:00
Oliver Stöneberg 44ed53319e
CppCheck: extracted clang-specific code from `check(const std::string&)` into separate method (#5842) 2024-01-05 22:02:37 +01:00
Oliver Stöneberg bd9700b848
fixed cfg tests (#5843) 2024-01-05 18:08:00 +01:00
Oliver Stöneberg 028596f100
enabled and mitigated debug warnings in cfg tests (#5840) 2024-01-05 17:00:51 +01:00
orbitcowboy 950b285608
posix.cfg: Added support for strxfrm_l (#5839)
Reference: 
-
https://pubs.opengroup.org/onlinepubs/9699919799/functions/strxfrm_l.html
2024-01-05 16:41:28 +01:00
Oliver Stöneberg 42c3aebda9
AddonInfo: const-ified loading and improved errorhandling (#5834) 2024-01-05 15:01:02 +01:00
chrchr-github c7cd091a93
Fix #12141 debug: simplifyUsing: unmatched body end (#5620) 2024-01-05 14:11:41 +01:00
chrchr-github f9134a69d2
CheckLeakAutoVar: fix crash on unknown macro (#5836) 2024-01-05 13:24:01 +01:00
Oliver Stöneberg 02f474bc19
about.ui: added Boost to list of libraries and correct capitalization for existing ones (#5832)
Boost is only optional - but so is the PCRE-based rules support which is
also mentioned in the list.
2024-01-05 13:22:52 +01:00
Oliver Stöneberg 957096417e
fixed some `modernize-use-auto` clean-tidy warnings (#4663) 2024-01-05 13:22:37 +01:00
orbitcowboy 3241cf5966
Ticket 6306: Added regression test and mention suppression in comment (#5835) 2024-01-05 12:58:27 +01:00
Philip Chimento 8ca93c983b
gtk.cfg: Add more definitions for assert macros (#5830)
In particular, the missing definition of `g_assert_nonnull()` can cause
false positives because it's not recognized as `assert(expr != NULL)` by
cppcheck.
2024-01-05 12:32:05 +01:00
Oliver Stöneberg 6ef3224bd4
fixed signatures of deleted `operator=` (#5831) 2024-01-05 11:12:30 +01:00
Oliver Stöneberg 93a53af168
modernized and cleaned up CMake files / explicitly check for CMake 3.13 with Visual Studio (#5825) 2024-01-05 11:07:16 +01:00
Daniel Marjamäki fc1d4d6f7d
runformat: improve instructions [ci skip] (#5833) 2024-01-05 10:06:10 +01:00
chrchr-github 1eee68f039
Fix FN deallocuse with function call (refs #11409) (#5822) 2024-01-04 22:10:24 +01:00
chrchr-github efa8a08407
Set main version to 2.13.99 (#5818) 2024-01-04 22:00:30 +01:00
Oliver Stöneberg 87540e6ca6
testrunner: do not suppress duplicated error messages (#5736) 2024-01-04 21:46:42 +01:00
Oliver Stöneberg b2e0b3b425
refs #12171 - start generating unmatched suppressions with `FileSettings` / improved TestSuppressions / some cleanups (#5827) 2024-01-04 21:32:21 +01:00
Oliver Stöneberg 615e4c01c4
bumped minimum requirements to GCC 5.1 / Clang 3.5 / Visual Studio 2015 / CMake 3.5 (#5398)
The current versions only have partial C++11 support which fortunately
has caused us only few issues so far but it would be good to finally
have fully working C++11 support. This also gets rid of several CI
builds on very outdated platforms.

The outdated platforms were used to also test CMake 2.8 but as future
versions of CMake will drop combability with CMake < 3.5 this is a good
time to also drop that requirement on our part.

This PR does not remove or update any outdated code.
2024-01-04 21:31:08 +01:00
chrchr-github f24c7fdae9
Fix #12311 FP duplInheritedMember for const overload (#5829) 2024-01-04 20:59:09 +01:00
chrchr-github 73187e6e12
Fix #11998 FN (regression): comparisonError (#5826) 2024-01-04 20:58:39 +01:00
Daniel Marjamäki 9aae9aeb25
AUTHORS: Add thingsconnected [ci skip] (#5828) 2024-01-04 16:29:31 +01:00
Maarten van der Schrieck 21a9de7d42
addons/namingng.py: Reinstate dict-with-regexps, cosmetic overhaul. (#5824)
`namingng.py` somewhat supported specifying a dict instead of a list for
regular expressions, until the feature was broken by a patch of mine
recently. This PR contains a patch rewriting the feature and expanding
relevant unit tests.

To improve maintainability, a second patch is added that refactors the
code for better readability and structure.
2024-01-04 16:26:54 +01:00
chrchr-github 481d4578ab
Fix #12301 FP doubleFree with GTK functions (#5823) 2024-01-04 11:02:59 +01:00
thingsconnected 8261ded475
addons/namingng.py: Improve output and unit test. (#5820)
For naming issues reported, column was always set to `0`, which is now
fixed.

Global variable naming errors were reported as "Public member" issues,
which is also fixed.

The unit test now covers namespaces, class names, public and private
member variables.
2024-01-03 14:00:47 +01:00
chrchr-github 5e59652fd3
Add tests for #1644, #3929, #6109 (#5821) 2024-01-03 11:50:28 +01:00
Oliver Stöneberg dd869cf808
added CMake option `EXTERNALS_AS_SYSTEM` to treat external includes as `SYSTEM` ones (#5386)
Although these files are part of our repo changes are being done via
their original projects so it might make sense to treat these as system
includes for some people instead of local ones.

Co-authored-by: Daniel Marjamäki <daniel.marjamaki@gmail.com>
2024-01-03 11:05:32 +01:00
chrchr-github 8d64d12e5d
Fix #12252 Regression: constParameterPointer (#5819) 2024-01-02 20:07:35 +01:00
chrchr-github 14627ca6d2
Add tests for #2199, #11207, #11464 (#5817) 2024-01-02 15:49:47 +01:00
thingsconnected 98b9244bcb
addons/namingng.py: Add tests for include guards, config file validation. (#5815)
Include guard naming can be validated against various patterns:
- prefixes/suffixes (`_FILE_H`, `PROJECT_FILE_H`, `FILE_H_`)
- basename/full path (`FILE_H`, `SUB_DIR_INC_FILE_H`)
- upper- or lowercase (`FILE_H`, `file_h`)
- any combination of the above (`project_sub_dir_inc_file_h_`)

A regexp can be specified to match header filenames. The example matches
any filename not starting with / and ending with `.h`, intended to match
C header files while exluding system files.

The test is not limited to naming only; validity and presence of include
guards can also be tested by setting `"required":true` in the config
file.

Enabling this feature requires adding the key `"include_guard"` to the
namingng config file used.

The namingng unit test is extended to test various features of the
include guard test.

Also, config handling is improved, adding (superficial) validation and a
unit test.
2024-01-02 15:01:02 +01:00
chrchr-github d9d23d979d
Partial fix for #12302 internalAstError using lambda (#5816) 2024-01-02 13:33:22 +01:00
Daniel Marjamäki 0c8ee7895d
manual-premium.md: copy changes from manual.md (#5813) 2023-12-30 21:39:39 +01:00
thingsconnected 24133d4a59
addons/namingng.py: Fix commandline use. (#5793)
namingng.py was only usable in standalone mode, but now supports CLI
mode, i.e. with cppcheck --addon=namingng. It uses the generic reporting
provided by cppcheckdata.reportError(). All output other than reported
errors is suppressed.

A local function reportNamingError() is implemented to call through to
cppcheckdata.reportError(), filling in common defaults.

The collection of errors and the --verify feature are removed, including
related workflow and a test file. These are replaced by a unit test.
2023-12-30 20:54:03 +01:00
Daniel Marjamäki b7c5505550
CI: Update Cppcheck Premium version and license (#5814) 2023-12-30 20:47:30 +01:00
Swasti Shrivastava 681b15f5c9
Fix #12298: false positive: misra-c2012-9.3 (#5812) 2023-12-30 13:05:25 +01:00
thingsconnected 4c7aae3a16
addons/namingng.py: Improve file name checking feature. (#5802)
(note: comment updated after force push; initial PR was incomplete)

namingng.py attempted to derive the source filename from the name of the
dumpfile. However, the dumpfile is not necessarily named according to
this pattern, e.g. cppcheck will add the pid to the filename, making
RE_FILE rules
fail. Taking the first item of data.files seem to be more robust.

To get the basename of the file, `os.path.basename()` is used. This
solves (theoretical) issues on platforms with a different path
separator.

With this patch, all filenames are checked, not just those provided on
the cppcheck command line. This is useful as header files will now also
be part of this check, even if not explicitly specified on the command
line.

The "RE_FILE" key of the configuration JSON may contain a list of
regular expressions, where any match will lead to acceptance of the
filename.

Both the full path and the basename of the files are tested.

One use case for this combination of features is:

```
"RE_FILE":[
    "/.*\\.h\\Z",
    "[a-z][a-z0-9_]*[a-z0-9]\\.[ch]\\Z"
]
```
This will accept any file naming convention of the platform used
(assuming platform files are all referenced using an absolute path),
while enforcing a particular naming scheme for project files.
2023-12-27 18:56:29 +01:00
Paul Fultz II 4d9e69e42c
Fix 11985: False positive: uninitvar (valueflow) (#5781) 2023-12-27 18:11:57 +01:00