Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow reexpansion of currently expanding macros during argument evaluation #364

Conversation

datadiode
Copy link
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.

…ation. This fixes danmar#31 as reproduced in TEST_CASE(define_define_11) without breaking code from @ydamigos's comment to danmar#225 as reproduced in TEST_CASE(define_define_11a).
@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 (danmar#66, danmar#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
@@ -888,7 +886,7 @@ void simplecpp::TokenList::readfile(Stream &stream, const std::string &filename,
}

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
Owner

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
Owner

danmar commented Sep 28, 2024

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

@danmar
Copy link
Owner

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 danmar:master Sep 28, 2024
16 checks passed
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