public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] linux-generic: avoid "redefined" warnings for open_not_cancel{,_2}
@ 2012-05-15 20:20 Chris Metcalf
  2012-05-15 20:23 ` Roland McGrath
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Metcalf @ 2012-05-15 20:20 UTC (permalink / raw)
  To: libc-ports, Roland McGrath

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-05-15 20:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-15 20:20 [PATCH] linux-generic: avoid "redefined" warnings for open_not_cancel{,_2} Chris Metcalf
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

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