[Bug preprocessor/60875] `_Pragma("message \"foo\")"` doesn't work in expression contexts.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60875 --- Comment #6 from Nikita Kniazev --- > Those pragmas are all extensions, so the standard doesn't cover them. There was a Clang bug report recently with a pretty much same code I had posted previously and Clang developers said that it is ill-formed with a reference to the C11 standard https://bugs.llvm.org/show_bug.cgi?id=41514#c1
[Bug preprocessor/60875] `_Pragma("message \"foo\")"` doesn't work in expression contexts.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60875 --- Comment #5 from Jakub Jelinek --- Those pragmas are all extensions, so the standard doesn't cover them.
[Bug preprocessor/60875] `_Pragma("message \"foo\")"` doesn't work in expression contexts.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60875 Nikita Kniazev changed: What|Removed |Added CC||nok.raven at gmail dot com --- Comment #4 from Nikita Kniazev --- Is this forbidden by the standard? The Clang and MSVC are fine with such pragma usage. It really complicates warning suppression. int main() { return #pragma GCC diagnostic push 42; } : In function 'int main()': :4:9: error: '#pragma' is not allowed here 4 | #pragma GCC diagnostic push | ^~~ :4:12: error: expected ';' before numeric constant 4 | #pragma GCC diagnostic push |^ |; 5 | 42; | ~~ https://godbolt.org/z/mT1h0Z
[Bug preprocessor/60875] `_Pragma("message \"foo\")"` doesn't work in expression contexts.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60875 Ryan Lortie changed: What|Removed |Added CC||desrt at desrt dot ca --- Comment #3 from Ryan Lortie --- We want to do similar things in GLib in order to warn in the middle of arbitrary expressions or statements expanded from macros (essentially: support for deprecated macros).
[Bug preprocessor/60875] `_Pragma("message \"foo\")"` doesn't work in expression contexts.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60875 --- Comment #2 from thakis at chromium dot org --- That only works on declarations, not in an expression, right? (We do have a workaround that works with gcc. But "pragma message" matches the semantics of what we want to do, and it works with MSVC and clang, so it'd be nice if it worked in gcc too.)
[Bug preprocessor/60875] `_Pragma("message \"foo\")"` doesn't work in expression contexts.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60875 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek --- Use deprecated attribute instead?