cppcheck icon indicating copy to clipboard operation
cppcheck copied to clipboard

enabled and fixed `performance-enum-size` clang-tidy warnings

Open firewave opened this issue 1 year ago • 11 comments

firewave avatar Apr 02 '24 20:04 firewave

This totally throws off several premium-only checks...

firewave avatar Apr 02 '24 20:04 firewave

CC @danmar

firewave avatar Apr 02 '24 20:04 firewave

Nevermind - it only occurs in the regular version.

firewave avatar Apr 02 '24 20:04 firewave

I am not able to reproduce these issues locally. I assume it is related to class : std::uint8_t which leads to it no longer being treated as an enum but as a class with inheritance.

firewave avatar Apr 02 '24 20:04 firewave

Here's a reproducer:

struct S {
    enum class E : std::uint8_t {
        E0
    };
    void f(S::E e) {
        if (e == S::E::E0) {}
    }
    char a[20];
};

chrchr-github avatar Apr 02 '24 21:04 chrchr-github

Here's a reproducer:

Thanks. That's very much the example I tried. I can reproduce it now on a different system. Maybe there is a Windows/Linux difference. Will check tomorrow.

I filed https://trac.cppcheck.net/ticket/12564 for it.

firewave avatar Apr 02 '24 22:04 firewave

In the regular selfcheck we only have passedByValue false positives. The additional ones are just with the premium version.

But there is also the following:

cli/processexecutor.cpp:72:1: debug: Scope::checkVariable found variable 'namespace' with varid 0. [varid0]
namespace {
^
lib/mathlib.h:39:5: debug: SymbolDatabase couldn't resolve all user defined types. [debug]
    class value {
    ^

And with the unusedFunction selfcheck:

cli/processexecutor.cpp:77:0: style: The function 'PipeWriter' is never used. [unusedFunction]
        explicit PipeWriter(int pipe) : mWpipe(pipe) {}
^

firewave avatar Apr 03 '24 00:04 firewave

@danmar After this passes the selfcheck we need an updated premium version which includes all the related fixes so it can pass the CI.

firewave avatar Apr 04 '24 10:04 firewave

Reduced FP: https://trac.cppcheck.net/ticket/12588

chrchr-github avatar Apr 04 '24 12:04 chrchr-github

All fixed, thanks. Now we just need an updated premium version.

firewave avatar Apr 04 '24 15:04 firewave

All fixed, thanks. Now we just need an updated premium version.

The related fixes are: 2b88ca8660411fba8eb3d22e9363a0994656a2fd 3170c17b32f415175b055da4a5b13a4b65d2c1b1 4503fbf6610381c8fa8ee7743846a094bae08b25

firewave avatar Apr 05 '24 11:04 firewave

@danmar We need a 2.14-based premium in the CI for this to land.

firewave avatar May 23 '24 12:05 firewave

The premium CI job is currently disabled because it started to interfere with other changes so this can be merged.

firewave avatar Jun 14 '24 15:06 firewave