Skip to content

Fix #653: defined() not recognizing ## token paste in its operand (GNU extension) - #694

Open
ludviggunne wants to merge 3 commits into
cppcheck-opensource:masterfrom
ludviggunne:653-defined-paste
Open

Fix #653: defined() not recognizing ## token paste in its operand (GNU extension)#694
ludviggunne wants to merge 3 commits into
cppcheck-opensource:masterfrom
ludviggunne:653-defined-paste

Conversation

@ludviggunne

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread simplecpp.cpp
Comment thread simplecpp.cpp Outdated
Comment thread simplecpp.cpp
macroName += defToken->next->next->next->str();
lastToken = defToken->next->next->next;
while (argTok->name) {
if (expandArg(temp, argTok, parametertokens))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I am not sure that we should expand macros unless they are operands. will this work:

#define x
#if defined(x)

the macroName will be empty string here now? and we will think that the condition is false?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It works, it takes a different execution path.

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