Message ID | Y9OZibQSy8DYxwbd@tucnak |
---|---|
State | Committed |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5EB3A3858C36 for <patchwork@sourceware.org>; Fri, 27 Jan 2023 09:31:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5EB3A3858C36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674811861; bh=5lGT3wbX9ere8JmhB7u6/8In5T5JFsaScpk80E9+Vgk=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=a+iaMMC0Ws0vY8ltm/gz00wpUctASTHGOsLC6O5bhuHfOXap9QouS4CzPyZxJ21vu VFULy9dRjncB3ebUUtabFGVkErDiZSp0FzA4q2EJlqWr1azwFkJG5lNWeGS5rU8Gbb k9eZMe/EZQbIcfGX5prjGAVWgQDy45AXaNakj2Og= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 412E33858D37 for <gcc-patches@gcc.gnu.org>; Fri, 27 Jan 2023 09:29:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 412E33858D37 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-668-iSMqwafhMCG4_v6-X8YaXw-1; Fri, 27 Jan 2023 04:29:49 -0500 X-MC-Unique: iSMqwafhMCG4_v6-X8YaXw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B7DFB800B30; Fri, 27 Jan 2023 09:29:48 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.223]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 70E152026D4B; Fri, 27 Jan 2023 09:29:48 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 30R9TkTs681981 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 27 Jan 2023 10:29:46 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 30R9TjfE681980; Fri, 27 Jan 2023 10:29:45 +0100 Date: Fri, 27 Jan 2023 10:29:45 +0100 To: Jonathan Wakely <jwakely@redhat.com> Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] libstdc++: Fix up FAIL in 17_intro/names.cc on glibc < 2.19 [PR108568] Message-ID: <Y9OZibQSy8DYxwbd@tucnak> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Jakub Jelinek via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Jakub Jelinek <jakub@redhat.com> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
libstdc++: Fix up FAIL in 17_intro/names.cc on glibc < 2.19 [PR108568]
|
|
Commit Message
Jakub Jelinek
Jan. 27, 2023, 9:29 a.m. UTC
Hi! 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 <features.h> 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. Tested on powerpc64le-linux with glibc 2.17 (where it fixes the regressions), on x86_64-linux with glibc 2.35 (where it still PASSes), plus on the latter with -E -dD on the test to verify __unused is just defined and not undefined later on, ok for trunk? 2023-01-27 Jakub Jelinek <jakub@redhat.com> 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. Jakub
Comments
On Fri, 27 Jan 2023 at 09:29, Jakub Jelinek <jakub@redhat.com> wrote: > > Hi! > > 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 > <features.h> 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. > > Tested on powerpc64le-linux with glibc 2.17 (where it fixes the > regressions), on x86_64-linux with glibc 2.35 (where it still PASSes), > plus on the latter with -E -dD on the test to verify __unused is just > defined and not undefined later on, ok for trunk? OK, thanks.
--- libstdc++-v3/testsuite/17_intro/names.cc.jj 2023-01-16 23:19:06.292716661 +0100 +++ libstdc++-v3/testsuite/17_intro/names.cc 2023-01-27 10:20:20.787645823 +0100 @@ -252,12 +252,15 @@ #undef y #endif -#ifdef __GLIBC_PREREQ -#if ! __GLIBC_PREREQ(2, 19) +#if defined (__linux__) || defined (__gnu_hurd__) +#if __has_include(<features.h>) +#include <features.h> +#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 19 // Glibc defines this prior to 2.19 #undef __unused #endif #endif +#endif #if __has_include(<newlib.h>) // newlib's <sys/cdefs.h> defines these as macros.