Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A function-like macro name that only becomes a call after its neighbours were substituted was never expanded. This fixes #226.
simplecpp produced
HELLO ()where gcc and clang produce"Hello World". The same gap broke theDEFER/OBSTRUCT/EVALidioms (cloak.h style), so iteration macros likeREPEATandWHILEnever terminated correctly.(that came from a different argument or from the replacement list is expanded as a call.Token::skippedByRescanflag records that the rescan already passed a function-like name without finding(. A(produced later by another expansion does not turn it into a call, until the token is substituted into a new replacement list and rescanned again. This keepsEVAL(HELLO DEFER(EMPTY)() ())atHELLO (), matching gcc.expandTrailingCallsis the only place that expands a trailing macro name, with a parameter-aware lookahead for arguments that come from a parameter.Macro::expandmarks its own trailing token when a call expanded to nothing, and the argument pre-expansion clears the flag at the substitution point. The flag sits next towhitespaceahead, sosizeof(Token)is unchanged.