Preprocessing & #error

Eljay Love-Jensen
Wed Dec 10 13:20:00 GMT 2003

Hi Alex,

>Is it possible?

It is POSSIBLE, but you'd have to write your own pre-pre-processor.  (Perhaps in Perl?)

Without doing to that extra-ordinary effort, it isn't possible with the pre-processor.  AFAIK.

Or you could change the line to read...
#error BUG : 100 != 200
...but I presume that defeats the intent of having the token macro-expanded.

You could also modify your GCC to perform macro expansion on the error line.  That may be more effort than writing your own pre-pre-processor (unless you are already familiar with GCC internals).  And you'd have a custom one-off pre-processor in your GCC.

Pre-processor info here <>.


More information about the Gcc-help mailing list