e.g.
#if 1 _Pragma("foo")
...
#endif
and stuff like
_Pragma("_Pragma(\"foo\")")
I have implemented these for GNU CPP, but don't know whether I
need have or not.
Do any other preprocessors implement _Pragma yet?
Thanks,
Neil.
It may appear anywhere that doesn't violate the syntax or the
constraints (e.g. #if _Pragma ("foo") meets the syntax but not the
constraint requiring #if to take an integer constant expression).
--
Clive D.W. Feather | Internet Expert | Work: <cl...@demon.net>
Tel: +44 20 8371 1138 | Demon Internet | Home: <cl...@davros.org>
Fax: +44 20 8371 1037 | Thus plc | Web: <http://www.davros.org>
Written on my laptop; please observe the Reply-To address
"Clive D.W. Feather" wrote:
> It may appear anywhere that doesn't violate the syntax or the
> constraints (e.g. #if _Pragma ("foo") meets the syntax but not the
> constraint requiring #if to take an integer constant expression).
The problem I have with this explanation is that you've just
changed the meaning of the example quoted in the standard
where _Pragma is used in a #define statement.
In the end this dilemma - why should it have an effect in e.g. #if
but not #define, that led my to treat _Pragma as a normal token
within directives.
Neil.
Another option is to treat _Pragma() as a special macro, which takes
one argument (which must be a string literal token) and is replaced by
nothing. It should be compatible with the standard, and that way, it is
perfectly clear why it might appear inside #if and not inside #define
directives: there is no macro substitution inside a #define.
The more I think about this scheme, the more elegant it seems to me. The
amount of code needed to handle this in the preprocessor is minimal,
since it uses standard macro invocation code.
I think I will just do that.
--Thomas Pornin