public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Olivier Hainque <hainque@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-3144] undef offsetof before defining it in stddef.h
Date: Fri,  7 Oct 2022 06:52:22 +0000 (GMT)	[thread overview]
Message-ID: <20221007065222.6964C3899429@sourceware.org> (raw)

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) \

                 reply	other threads:[~2022-10-07  6:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221007065222.6964C3899429@sourceware.org \
    --to=hainque@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).