This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 03/13] RFC: ldbl-128ibm-compat: workaround C++ redirect limitations
- From: "Paul E. Murphy" <murphyp at linux dot vnet dot ibm dot com>
- To: libc-alpha at sourceware dot org
- Date: Fri, 6 Mar 2020 14:37:11 -0600
- Subject: [PATCH 03/13] RFC: ldbl-128ibm-compat: workaround C++ redirect limitations
- References: <20200306203721.15886-1-murphyp@linux.vnet.ibm.com>
GCC 8+ is more pedantic about type checking the redirect declarations
for non-system headers. I am not sure if there is less obtrusive way
to dodge these warnings when building C++ tests using the headers from
the glibc under construction.
Does a better option than explicitly specifying these headers via
the #pragma GCC system_header?
---
include/monetary.h | 8 ++++++++
include/printf.h | 8 ++++++++
include/stdio.h | 10 ++++++++++
include/stdlib.h | 9 +++++++++
include/wchar.h | 9 +++++++++
5 files changed, 44 insertions(+)
diff --git a/include/monetary.h b/include/monetary.h
index 240925e87d..81933a2c5e 100644
--- a/include/monetary.h
+++ b/include/monetary.h
@@ -1,3 +1,11 @@
+/* This is needed to keep GCC >= 9 happy when using redirects inside system
+ headers. glibc builds some C++ tests which use these headers which do
+ not get marked as system headers. */
+#include <bits/floatn.h>
+#if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1
+# pragma GCC system_header
+#endif
+
#include <stdlib/monetary.h>
#ifndef _ISOMAC
#include <stdarg.h>
diff --git a/include/printf.h b/include/printf.h
index d051514119..9e74e35678 100644
--- a/include/printf.h
+++ b/include/printf.h
@@ -1,5 +1,13 @@
#ifndef _PRINTF_H
+/* This is needed to keep GCC >= 9 happy when using redirects inside system
+ headers. glibc builds some C++ tests which use these headers which do
+ not get marked as system headers. */
+#include <bits/floatn.h>
+#if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1
+# pragma GCC system_header
+#endif
+
#include <stdio-common/printf.h>
# ifndef _ISOMAC
diff --git a/include/stdio.h b/include/stdio.h
index 6718af4108..517d53837f 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -2,8 +2,18 @@
# if !defined _ISOMAC && defined _IO_MTSAFE_IO
# include <stdio-lock.h>
# endif
+
+/* This is needed to keep GCC >= 9 happy when using redirects inside system
+ headers. glibc builds some C++ tests which use these headers which do
+ not get marked as system headers. */
+# include <bits/floatn.h>
+# if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1
+# pragma GCC system_header
+# endif
+
# include <libio/stdio.h>
# ifndef _ISOMAC
+
# define _LIBC_STDIO_H 1
# include <libio/libio.h>
diff --git a/include/stdlib.h b/include/stdlib.h
index 926f965f69..7929e45386 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -3,6 +3,15 @@
#ifndef _ISOMAC
# include <stddef.h>
#endif
+
+/* This is needed to keep GCC >= 9 happy when using redirects inside system
+ headers. glibc builds some C++ tests which use these headers which do
+ not get marked as system headers. */
+#include <bits/floatn.h>
+#if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1
+# pragma GCC system_header
+#endif
+
#include <stdlib/stdlib.h>
/* Now define the internal interfaces. */
diff --git a/include/wchar.h b/include/wchar.h
index 617906eb14..64355dd6fb 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -1,4 +1,13 @@
#ifndef _WCHAR_H
+
+/* This is needed to keep GCC >= 9 happy when using redirects inside system
+ headers. glibc builds some C++ tests which use these headers which do
+ not get marked as system headers. */
+# include <bits/floatn.h>
+# if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1
+# pragma GCC system_header
+# endif
+
# include <wcsmbs/wchar.h>
# ifndef _ISOMAC
--
2.21.1