Skip to content

Allow reexpansion of currently expanding macros during argument evaluation#364

Merged
danmar merged 10 commits intocppcheck-opensource:masterfrom
datadiode:issue_31_revisited_allow_to_reexpand_currently_expanding_macros_during_argument_evaluation
Sep 28, 2024
Merged

Allow reexpansion of currently expanding macros during argument evaluation#364
danmar merged 10 commits intocppcheck-opensource:masterfrom
datadiode:issue_31_revisited_allow_to_reexpand_currently_expanding_macros_during_argument_evaluation

Conversation

@datadiode
Copy link
Copy Markdown
Contributor

@datadiode datadiode commented Aug 28, 2024

This fixes #31 as reproduced in TEST_CASE(define_define_11) without breaking code from @ydamigos's comment to #225 as reproduced in TEST_CASE(define_define_11a). It thereby also fixes #293.

Subsequent commits in this PR address #66, #130, #241, #296.

@datadiode datadiode force-pushed the issue_31_revisited_allow_to_reexpand_currently_expanding_macros_during_argument_evaluation branch from 1a921fc to 91f42e6 Compare August 29, 2024 14:46
@firewave firewave marked this pull request as draft August 29, 2024 15:50
…sion for empty varargs, to yield gcc-like behavior also in cases where varargs isn't empty (cppcheck-opensource#66, cppcheck-opensource#130)
@datadiode datadiode force-pushed the issue_31_revisited_allow_to_reexpand_currently_expanding_macros_during_argument_evaluation branch from 9d084ad to f773611 Compare August 29, 2024 16:31
@datadiode datadiode force-pushed the issue_31_revisited_allow_to_reexpand_currently_expanding_macros_during_argument_evaluation branch from 170ce4c to de03748 Compare August 30, 2024 07:29
@datadiode datadiode marked this pull request as ready for review August 30, 2024 08:47
@datadiode datadiode force-pushed the issue_31_revisited_allow_to_reexpand_currently_expanding_macros_during_argument_evaluation branch from f017409 to 912d924 Compare September 2, 2024 13:38
Comment thread simplecpp.cpp

if (prefix.empty())
push_back(new Token(s, location)); // push string without newlines
push_back(new Token(s, location, isspace(stream.peekChar()))); // push string without newlines
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 believe this is not guaranteed to be portable. we include the <cctype> so we should call std::isspace.

@danmar
Copy link
Copy Markdown
Collaborator

danmar commented Sep 28, 2024

@datadiode I am very sorry for so slow review!! Excellent work.

@danmar
Copy link
Copy Markdown
Collaborator

danmar commented Sep 28, 2024

I would just like to replace the isspace with std::isspace but I can try to do that later.

@danmar danmar merged commit 0442161 into cppcheck-opensource:master Sep 28, 2024
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.

Fail to expand macros Nested macros are not (always) expanded

2 participants