From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id 8C6AD3858D20; Fri, 27 Jan 2023 19:13:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8C6AD3858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674846823; bh=tv7aKSu0bKV7rkRXLX5wiwbwUBRf2RcWctJecmkUHCI=; h=From:To:Subject:Date:From; b=iaPdCnq+uDHvEQ4kSV/3GHEMfWEPSp2HYeDWbk3oZWoFTsvXXeppR258fydirQ2sQ ER3XZMltaT88gY3NOX+NzJi/J1LbaQMLTcUT1+0CYFjo+kskjlRtXBljpaKQRyx3pa fGYX0JdbonMq9ia97d09XvWH1ve6e62wXP98D+tc= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jakub Jelinek To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r13-5461] libstdc++: Fix up FAIL in 17_intro/names.cc on glibc < 2.19 [PR108568] X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/heads/master X-Git-Oldrev: 0fd52972c600c432d9df74dad427243b916317a0 X-Git-Newrev: 815e5740162d2d0b7b54031f72c201065016d58c Message-Id: <20230127191343.8C6AD3858D20@sourceware.org> Date: Fri, 27 Jan 2023 19:13:43 +0000 (GMT) List-Id: https://gcc.gnu.org/g:815e5740162d2d0b7b54031f72c201065016d58c commit r13-5461-g815e5740162d2d0b7b54031f72c201065016d58c Author: Jakub Jelinek Date: Fri Jan 27 20:11:20 2023 +0100 libstdc++: Fix up FAIL in 17_intro/names.cc on glibc < 2.19 [PR108568] On gcc112 which has glibc 2.17 I've noticed FAIL: 17_intro/names.cc (test for excess errors) FAIL: experimental/names.cc (test for excess errors) These are because glibc < 2.19 used __unused as field member of various structs, including mcontext_t in sys/ucontext.h on ppc64le. This was changed in glibc with https://gcc.gnu.org/pipermail/libc-alpha/2013-November/045766.html names.cc even has #ifdef __GLIBC_PREREQ #if ! __GLIBC_PREREQ(2, 19) // Glibc defines this prior to 2.19 #undef __unused #endif #endif for it, but it doesn't work. The reason is that __GLIBC_PREREQ is defined in but nothing included that header before this spot (it is included later from bits/stdc++.h). The following patch on Linux/Hurd conditionally includes features.h to get the needed macros before deciding if __unused should be undefined or not. If needed, I could use __GLIBC_PREREQ then but would need to check if it is defined and between 1996 and 1999 it wasn't. 2023-01-27 Jakub Jelinek PR libstdc++/108568 * testsuite/17_intro/names.cc (__unused): For linux or GNU hurd include features.h if present and then check __GLIBC__ and __GLIBC_MINOR__ macros for glibc prior to 2.19, instead of testing __GLIBC_PREREQ which isn't defined yet. Diff: --- libstdc++-v3/testsuite/17_intro/names.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/testsuite/17_intro/names.cc b/libstdc++-v3/testsuite/17_intro/names.cc index 6fe9350aec6..d3e0db9bab6 100644 --- a/libstdc++-v3/testsuite/17_intro/names.cc +++ b/libstdc++-v3/testsuite/17_intro/names.cc @@ -252,12 +252,15 @@ #undef y #endif -#ifdef __GLIBC_PREREQ -#if ! __GLIBC_PREREQ(2, 19) +#if defined (__linux__) || defined (__gnu_hurd__) +#if __has_include() +#include +#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 19 // Glibc defines this prior to 2.19 #undef __unused #endif #endif +#endif #if __has_include() // newlib's defines these as macros.