Skip to content

Conversation

@swasti16
Copy link
Contributor

No description provided.

@swasti16 swasti16 force-pushed the swasti/add_correct_column_for_enum branch from 21b3cac to 84595f8 Compare November 22, 2025 07:47
@sonarqubecloud
Copy link

tokenizer.tokenize(code);
const Token* tok = Token::findsimplematch(tokenizer.tokens(), "static");
ASSERT(tok);
ASSERT_EQUALS(tok->column(), 0);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest that we try to write a proper column value here. It would be shaky for premiumaddon to warn about static whenever column is 0 => since it is not known why it is 0.

}

void simplifyEnum2() {
const char code[] = "enum static E {A,B} ab;";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm this code is not valid. the enum name must be placed directly after the enum token. An alternative can be:

enum E {A,B} static ab;

or:

enum E {A,B};
enum E static ab;

btw.. I am not sure if we really need to move the static keyword in Cppcheck we could keep the token order. But probably this is a bigger task than just setting the column numbers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants