_Pragma takes a parenthesized string literal
Ian Lance Taylor
iant@google.com
Sun Oct 17 03:01:00 GMT 2010
Jeffrey Walton <noloader@gmail.com> writes:
> I need to move the following into a define.
>
> // Windows, Linux, Apple
> #pragma message "Something interesting from cpp"
This the closest I can get. You have to write "message" explicitly in
the usage. I don't know how to avoid that, because string concatenation
is not done before _Pragma arguments are evaluated.
#define PRAGMA_MESSAGE(x) _Pragma(#x)
PRAGMA_MESSAGE(message "Something interesting from cpp")
Ian
More information about the Gcc-help
mailing list