What's Clang's equivalent to #pragma message
as used in GCC and MSVC?
Clang supports GCC's pragma for compatibility with existing source code, as well as several extensions. In addition to all of the functionality provided by GCC's pragma, Clang also allows you to push and pop the current warning state.
A typical use of the message pragma is to display informational messages at compile time. The message-string parameter can be a macro that expands to a string literal, and you can concatenate such macros with string literals in any combination.
GCC keeps track of the location of each pragma, and issues diagnostics according to the state as of that point in the source file. Thus, pragmas occurring after a line do not affect diagnostics caused by that line.
clang -cc1 is the frontend, clang is the driver. The driver invokes the frontend with options appropriate for your system. To see these options, run: $ clang -### -c hello.c. Some clang command line options are driver-only options, some are frontend-only options.
I've brought this up on the Clang mailing list, and it's in discussion now. It's subsequently been implemented as a warning, and hopefully soon it will be behave as it does in other compilers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With