From: Olivier Hainque Date: Fri, 28 Jan 2022 16:34:50 +0000 (+0000) Subject: undef offsetof before defining it in stddef.h X-Git-Tag: basepoints/gcc-14~4063 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8307b7d6d0335da952a87bf56015f830072ac431;p=thirdparty%2Fgcc.git undef offsetof before defining it in stddef.h This prevents redefinition warnings by -Wsystem-headers on OSses where system headers happen to provide a definition of their own, such as VxWorks. 2022-02-15 Olivier Hainque gcc/ * ginclude/stddef.h: #undef offsetof before #define. --- diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h index 3d29213e8f15..2767edf51def 100644 --- a/gcc/ginclude/stddef.h +++ b/gcc/ginclude/stddef.h @@ -412,6 +412,7 @@ typedef __WINT_TYPE__ wint_t; #ifdef _STDDEF_H /* Offset of member MEMBER in a struct of type TYPE. */ +#undef offsetof /* in case a system header has defined it. */ #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER) #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) \