[03/13] RFC: ldbl-128ibm-compat: workaround C++ redirect limitations

Message ID 20200306203721.15886-4-murphyp@linux.vnet.ibm.com
State New
Headers show
Series
  • Enable IEEE binary128 long double on powerpc64le
Related show

Commit Message

Paul E. Murphy March 6, 2020, 8:37 p.m.
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(+)

-- 
2.21.1

Comments

Tulio Magno Quites Machado Filho March 24, 2020, 8:30 p.m. | #1
"Paul E. Murphy" <murphyp@linux.vnet.ibm.com> writes:

> 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?


I'm afraid -isystem is not an option in this case as it could change the
lookup order.  In other words: I don't have a better option than
what you proposed.

-- 
Tulio Magno

Patch

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