public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-3144] undef offsetof before defining it in stddef.h
@ 2022-10-07  6:52 Olivier Hainque
  0 siblings, 0 replies; only message in thread
From: Olivier Hainque @ 2022-10-07  6:52 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:8307b7d6d0335da952a87bf56015f830072ac431

commit r13-3144-g8307b7d6d0335da952a87bf56015f830072ac431
Author: Olivier Hainque <hainque@adacore.com>
Date:   Fri Jan 28 16:34:50 2022 +0000

    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  <hainque@adacore.com>
    
    gcc/
            * ginclude/stddef.h: #undef offsetof before #define.

Diff:
---
 gcc/ginclude/stddef.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
index 3d29213e8f1..2767edf51de 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) \

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-07  6:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-07  6:52 [gcc r13-3144] undef offsetof before defining it in stddef.h Olivier Hainque

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).