Sounds good!
 

Von: Hadriel Kaplan <hkaplan@juniper.net>
Gesendet: Fr 20.10.2023 10:15

> Just mentioning, there is a small difference to _Pragma:

> According to lex.phases _Pragma is evaluated in phase 4, string encoding and concatenation in phases 5 and 6.

Yup, and the things I was talking about are also being done in phase-4: during the macro-invocation expansion - i.e., when the preprocessor is expanding preprocessing-tokens that match a defined object-like or function-like macro; which is the same time it "expands" _Pragma().

I'm not proposing some new early or intermediate phase, or anything like that.

I should have made that clearer.

There is, though, one difference relative to _Pragma(). The _Pragma() operator passes the modified string to the lexer, but does not truly then process the new tokens through stage-4 again. It only processes pragma directives from those lex'ed output tokens.

Whereas this new thing needs to run them through stage-4 again... but NOT exactly all of stage-4 - only macro expansions, not directives. (for example, we would not allow a `#include` or `#ifdef` statement to work within it)

So maybe I shouldn't even describe it as "stage-4 but not xyz", but instead describe it as only "macro-invocation expansion".

-hadriel



Juniper Business Use Only