On Fri, 5 Jun 2015, Mikhail Maltsev wrote: > There are other issues with macros in glibc headers (well, not as > significant as performance-related concerns, but never the less). > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24016#c3 > > > #include <string.h> > > int foo(void *x) { > > return strcmp(x + 1, "test"); > > } > > > > does not cause warnings when compiled with -Wpointer-arith -O1 > > (glibc v. 2.17). It can be reduced to: > > > > int foo(void *x) { > > return __extension__({ __builtin_strcmp(x + 1, "test"); }); > > } > > In this case __extension__ inhibits -Wpointer-arith, because void* > arithmetics is a valid GNU extension, but the user does not even know > that he is using it.
In <https://gcc.gnu.org/ml/gcc/2001-04/msg00642.html> I suggested __unextension__ to allow macros to avoid suppressing such warnings inside the expansion of macro arguments (given that feature, lots of macro definitions would then need to change to use __unextension__ (ARG) instead of just (ARG)). -- Joseph S. Myers jos...@codesourcery.com