[Bug c++/84127] New: pragmas to disable -Wexpansion-to-defined compiler warnings seems to be broken since 7.x
davydden at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Jan 30 13:34:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84127
Bug ID: 84127
Summary: pragmas to disable -Wexpansion-to-defined compiler
warnings seems to be broken since 7.x
Product: gcc
Version: 7.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: davydden at gmail dot com
Target Milestone: ---
Dear all,
Looks like GCC 7.x changed in the way pragmas are processed. Below is a small
example which still produces compiler warning -Wexpansion-to-defined:
# define DISABLE_EXTRA_DIAGNOSTICS \
_Pragma("GCC diagnostic push") /*!*/ \
_Pragma("GCC diagnostic ignored \"-Wexpansion-to-defined\"") \
# define ENABLE_EXTRA_DIAGNOSTICS \
_Pragma("GCC diagnostic pop")
DISABLE_EXTRA_DIAGNOSTICS
#define BLA defined(FOO)
#if BLA
int k=0;
#endif
ENABLE_EXTRA_DIAGNOSTICS
int z = 0;
the actual pragmas used in the open-source library are here
https://github.com/dealii/dealii/blob/master/include/deal.II/base/config.h.in#L336-L374
and the discussion of this issue in the context of the library is here
https://github.com/dealii/dealii/issues/5466#issuecomment-360076509
here's a link to the same example compiled online: https://godbolt.org/g/tAv4yd
Regards,
Denis.
More information about the Gcc-bugs
mailing list