This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] linux-generic: avoid "redefined" warnings for open_not_cancel{,_2}


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]