From: Chris Metcalf <cmetcalf@tilera.com>
To: <libc-ports@sourceware.org>, Roland McGrath <roland@hack.frob.com>
Subject: [PATCH] linux-generic: avoid "redefined" warnings for open_not_cancel{,_2}
Date: Tue, 15 May 2012 20:20:00 -0000 [thread overview]
Message-ID: <201205152020.q4FKKcxp014005@farm-0002.internal.tilera.com> (raw)
In general we just try to include <not-cancel.h> once, thus avoiding
any issues with redefinition.
However, the getaddrinfo sources are somewhat tangled, and .c files
include each other to get the final result. Each .c file currently has
its own include of <not-cancel.h>. While you could properly re-factor
this for the case of gai.c, the posix/tst-rfc3484.c tests directly include
one of the sub-files (sysdeps/posix/getaddrinfo.c), and it starts to
feel fragile.
We could also use a multiple-inclusion guard here, but since this is an
overriding sysdeps file that includes another sysdeps file, that also
feels fragile unless we spell out the full filename in the inclusion
guard, which feels clunky.
Just doing an undef seems simplest here.
---
ChangeLog.linux-generic | 6 ++++++
sysdeps/unix/sysv/linux/generic/not-cancel.h | 4 ++++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/ChangeLog.linux-generic b/ChangeLog.linux-generic
index 9f563e3..ec991c8 100644
--- a/ChangeLog.linux-generic
+++ b/ChangeLog.linux-generic
@@ -1,3 +1,9 @@
+2012-05-15 Chris Metcalf <cmetcalf@tilera.com>
+
+ * sysdeps/unix/sysv/linux/generic/not-cancel.h
+ (open_not_cancel, open_not_cancel_2): undef before including
+ the standard Linux not-cancel.h.
+
2012-05-14 Chris Metcalf <cmetcalf@tilera.com>
* sysdeps/unix/sysv/linux/generic/bits/stat.h,
diff --git a/sysdeps/unix/sysv/linux/generic/not-cancel.h b/sysdeps/unix/sysv/linux/generic/not-cancel.h
index ae46e16..421f863 100644
--- a/sysdeps/unix/sysv/linux/generic/not-cancel.h
+++ b/sysdeps/unix/sysv/linux/generic/not-cancel.h
@@ -17,7 +17,11 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
+/* If <not-cancel.h> is included a second time, avoid warnings. */
+#undef open_not_cancel
+#undef open_not_cancel_2
#include <sysdeps/unix/sysv/linux/not-cancel.h>
+
#include <fcntl.h>
/* Uncancelable open with openat. */
--
1.6.5.2
next reply other threads:[~2012-05-15 20:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-15 20:20 Chris Metcalf [this message]
2012-05-15 20:23 ` Roland McGrath
2012-05-15 20:38 ` Chris Metcalf
2012-05-15 20:46 ` Roland McGrath
2012-05-15 20:50 ` Chris Metcalf
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=201205152020.q4FKKcxp014005@farm-0002.internal.tilera.com \
--to=cmetcalf@tilera.com \
--cc=libc-ports@sourceware.org \
--cc=roland@hack.frob.com \
/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).