Open kukrimate opened 3 years ago
EDIT: misunderstood the original comment sorry. Leaving for additional clarifying reference to standard.
The first token in the sequence is a # preprocessing token ... that follows white space containing at least one new-line character.
x
is not white space. Maybe you are assuming x
is expanded. It is not. The second line x#define y z
is not a preprocessing directive.
Rationale: [ISO/IEC 9899:2017, 6.10, §8]
the sequence of preprocessing tokens on the second line is not a preprocessing directive, because it does not begin with a # at the start of translation phase 4, even though it will do so after the macro EMPTY has been replaced.
Wording of the issue title "non-directives" is possibly misleading.
[ISO/IEC 9899:2017, 6.10, §11n174]
Despite the name, a non-directive is a preprocessing directive.
The following code:
Should expand to:
But instead chibicc expands it to:
Rationale: ISO/IEC 9899:1999 6.10: