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

CWG2937 [lex.phases] Grammar for preprocessing-file has no normative effect #615

Open
t3nsor opened this issue Sep 27, 2024 · 1 comment

Comments

@t3nsor
Copy link

t3nsor commented Sep 27, 2024

Full name of submitter: Brian Bi

Reference (section label): [lex.phases]

Issue description: [cpp.pre] defines the grammar production preprocessing-file but nothing in the standard specifies that a translation unit is ill-formed if it fails to match that grammar. Similarly, translation-unit has no normative effect.

Suggested resolution: Edit [lex.phases]/1.4:

The source file is analyzed as a preprocessing-file ([cpp.pre]). Preprocessing directives are executed, macro invocations are expanded, and _Pragma unary operator expressions are executed. A #include preprocessing directive causes the named header or source file to be processed from phase 1 through phase 4, recursively. All preprocessing directives are then deleted.

Edit [lex.phases]/1.7:

Whitespace characters separating tokens are no longer significant. Each preprocessing token is converted into a token ([lex.token]). The resulting tokens constitute a translation unit and are syntactically and semantically analyzed as a translation-unit ([basic.link]) and translated. [...]

@jensmaurer
Copy link
Member

CWG2937

@jensmaurer jensmaurer changed the title [lex.phases] Grammar for preprocessing-file has no normative effect CWG2937 [lex.phases] Grammar for preprocessing-file has no normative effect Oct 2, 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

No branches or pull requests

2 participants