From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1968) id D28373894E6C; Thu, 30 Apr 2020 16:20:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D28373894E6C Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Paul E. Murphy To: glibc-cvs@sourceware.org Subject: [glibc] ldbl-128ibm-compat: workaround GCC 9 C++ PR90731 X-Act-Checkin: glibc X-Git-Author: Paul E. Murphy X-Git-Refname: refs/heads/master X-Git-Oldrev: ab54e26415ea82444a9529041427137bf27c615c X-Git-Newrev: 86005fdbf40d6fc84d84c824d75c656e7c1398e3 Message-Id: <20200430162052.D28373894E6C@sourceware.org> Date: Thu, 30 Apr 2020 16:20:52 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 16:20:52 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=86005fdbf40d6fc84d84c824d75c656e7c1398e3 commit 86005fdbf40d6fc84d84c824d75c656e7c1398e3 Author: Paul E. Murphy Date: Fri Mar 6 09:41:03 2020 -0600 ldbl-128ibm-compat: workaround GCC 9 C++ PR90731 GCC 9 has a bug (PR90731) whereby __typeof does not correctly copy exception specifiers[1]. Surprisingly, this can be quieted by declaring "#pragma system_header", or if the headers are installed in a system directory. Work around this by using the pragma for any gcc version between 9.0 and 9.2 to ensure tests continue to compile. [1] Example error from g++ 9.2.1: In file included from ../include/sys/cdefs.h:3, from ../include/features.h:465, from ../bits/libc-header-start.h:33, from ../math/math.h:27, from ../include/math.h:7, from test-math-isinff.cc:21: ../libio/bits/stdio-ldbl.h:25:20: error: declaration of ‘int sprintf(char*, const char*, ...)’ has a different exception specifier 25 | __LDBL_REDIR_DECL (sprintf) | ^~~~~~~ ../misc/sys/cdefs.h:461:26: note: in definition of macro ‘__LDBL_REDIR_DECL’ 461 | extern __typeof (name) name __asm (__ASMNAME ("__" #name "ieee128")); | ^~~~ In file included from ../include/stdio.h:5, from test-math-isinff.cc:22: ../libio/stdio.h:334:12: note: from previous declaration ‘int sprintf(char*, const char*, ...) throw ()’ 334 | extern int sprintf (char *__restrict __s, | ^~~~~~~ Reviewed-by: Tulio Magno Quites Machado Filho Diff: --- 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..bddc660ce2 100644 --- a/include/monetary.h +++ b/include/monetary.h @@ -1,3 +1,11 @@ +/* Workaround PR90731 with GCC 9 when using ldbl redirects in C++. */ +#include +#if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1 +# if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3) +# pragma GCC system_header +# endif +#endif + #include #ifndef _ISOMAC #include diff --git a/include/printf.h b/include/printf.h index d051514119..bdcfd29f63 100644 --- a/include/printf.h +++ b/include/printf.h @@ -1,5 +1,13 @@ #ifndef _PRINTF_H +/* Workaround PR90731 with GCC 9 when using ldbl redirects in C++. */ +#include +#if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1 +# if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3) +# pragma GCC system_header +# endif +#endif + #include # ifndef _ISOMAC diff --git a/include/stdio.h b/include/stdio.h index 6718af4108..1c09daf13a 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -2,8 +2,18 @@ # if !defined _ISOMAC && defined _IO_MTSAFE_IO # include # endif + +/* Workaround PR90731 with GCC 9 when using ldbl redirects in C++. */ +# include +# if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1 +# if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3) +# pragma GCC system_header +# endif +# endif + # include # ifndef _ISOMAC + # define _LIBC_STDIO_H 1 # include diff --git a/include/stdlib.h b/include/stdlib.h index 926f965f69..187a41e754 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -3,6 +3,15 @@ #ifndef _ISOMAC # include #endif + +/* Workaround PR90731 with GCC 9 when using ldbl redirects in C++. */ +#include +#if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1 +# if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3) +# pragma GCC system_header +# endif +#endif + #include /* Now define the internal interfaces. */ diff --git a/include/wchar.h b/include/wchar.h index 617906eb14..bb49d844be 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -1,4 +1,13 @@ #ifndef _WCHAR_H + +/* Workaround PR90731 with GCC 9 when using ldbl redirects in C++. */ +# include +# if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1 +# if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3) +# pragma GCC system_header +# endif +# endif + # include # ifndef _ISOMAC