cppcheck icon indicating copy to clipboard operation
cppcheck copied to clipboard

Fixed #11807 - dump: C typedef enum not in <typedef-info>

Open nicoHarel opened this issue 2 years ago • 3 comments

  • Enum typedefs were removed from simplifyTypedefCpp "tok" list instead of unions.

As mentioned by Daniel here, the latest cppcheck version seems to not be affected by the issue anymore. But this is the fix nonetheless.

It was tested on the newest version (no effect) and an older version (commit 579938a6ff on main).

nicoHarel avatar Dec 20 '23 10:12 nicoHarel

Ok so apparently this makes an enum test fail. I don't really understand what's the test purpose nor what it's testing.

nicoHarel avatar Dec 21 '23 08:12 nicoHarel

With your fix applied, we produce invalid code like namespace N { enum E { } ; } void g ( int ) ; void f ( ) { g ( sizeof ( enum enum E ) ) ; } for certain inputs. You said that the original problem is already fixed anyway? It would be nice to add a test for that, so regressions can be avoided in the future.

chrchr-github avatar Dec 21 '23 10:12 chrchr-github

With your fix applied, we produce invalid code like namespace N { enum E { } ; } void g ( int ) ; void f ( ) { g ( sizeof ( enum enum E ) ) ; } for certain inputs. You said that the original problem is already fixed anyway? It would be nice to add a test for that, so regressions can be avoided in the future.

Yes, that makes sense actually. Since the new version adds the enum typedef in some other way that I'm not familiar with, it is very possible enum typedefs are now added twice with this fix.

I'll look into how the tests work.

nicoHarel avatar Dec 21 '23 12:12 nicoHarel