[Bug c/91669] New: #pragma's and _Pragma's work but _Pragma's used in an equivalent macro don't
pskocik at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Sep 5 10:39:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91669
Bug ID: 91669
Summary: #pragma's and _Pragma's work but _Pragma's used in an
equivalent macro don't
Product: gcc
Version: 5.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: pskocik at gmail dot com
Target Milestone: ---
The problem appears to exist on all gcc versions.
Example Code:
#define BX_gcc_push(Category,...) BX_pragma(GCC Category push ) BX_pragma(GCC
Category __VA_ARGS__)
#define BX_gcc_pop(Category) BX_pragma(GCC Category pop)
#define BX_nodiag_push(DiagStr) BX_gcc_push(diagnostic, ignored DiagStr)
#define BX_nodiag_pop() BX_gcc_pop(diagnostic)
#define BX_pragma(...) _Pragma(#__VA_ARGS__)
int foo(void)
{
//This silences -Wreturn-type on the closing curly as it should
BX_nodiag_push("-Wreturn-type")
}
BX_nodiag_pop()
#define BX_retundef(Rbr) /*{{{*/ \
BX_nodiag_push("-Wreturn-type") \
Rbr \
BX_nodiag_pop()
/*}}}*/
int bar(void)
{
//This FAILS to silence -Wreturn on the closing curly
//(works on clang and the code obtained from text-expanding the macro (gcc -E)
//works on gcc too)
BX_retundef(})
More information about the Gcc-bugs
mailing list