From patchwork Sat Jul 6 20:17:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1957635 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZrTRpiGF; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WGhXy4nTSz1xqb for ; Sun, 7 Jul 2024 06:18:42 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A631C388982E for ; Sat, 6 Jul 2024 20:18:40 +0000 (GMT) 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 D59C2385DDC2 for ; Sat, 6 Jul 2024 20:18:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D59C2385DDC2 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D59C2385DDC2 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720297097; cv=none; b=pDB4zxuQvVc39xp8MzfEvRlY9fmvb0nGLrnDENH9CsjtDKl98JSGw3An+L+0Fxt+xBxa16oJ3kmT8x4Zq2bv0pmNOlUrFO9Rke/pW8R4HEj5jfgTUSPcGd3SG46ztOVRfSJS5olkt1Xmlnx4NJbJeDJ7l/xXyzopfT4XX62o28U= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720297097; c=relaxed/simple; bh=SSX2O+LlSFIJC5BKOvmd+ZkzZKVDyKbk8bOaavoS8wk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=NvPWH2dhSQlJUD7wvML10nn0bX+VXUL7ObrS7+g7PH8WvUkpBAAVXKkRxRA0sjjC/zidyz4gYqWS1Tl1G8q19aW/mxVYsk9mcWBpp+wxq/2x+Dt0in+UnqTw3XJpL3U/xfkqGCvbpj3W/1jIJHGSdnRvFFAeNtFs2oOgHV2zkss= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1720297094; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MhYnTGeKbgUMJWCk2RVzyOa+JQqHiPgTxI/aaBVkon4=; b=ZrTRpiGFFXaC5tQheqNHNdtx9LoMUEDYgII5E7xeux1T/NklXPqugXKkgA3PHVA42c+6PQ qCGtRkwjWjHH1H4VkkY4thVnefB+aP1uYjMChQuEfY84CifKqVeh/33NxL3sSbbiJu8/xS mUrd3XGX5O6D6ZfXImfIXWHHsiaruJU= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-462-wQVnUQ4vOFuL7bBe0reRXQ-1; Sat, 06 Jul 2024 16:18:12 -0400 X-MC-Unique: wQVnUQ4vOFuL7bBe0reRXQ-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E19AD1955F3B; Sat, 6 Jul 2024 20:18:10 +0000 (UTC) Received: from localhost (unknown [10.42.28.19]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0B4441955F3B; Sat, 6 Jul 2024 20:18:09 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Restore support for including in extern "C" [PR115797] Date: Sat, 6 Jul 2024 21:17:44 +0100 Message-ID: <20240706201808.193336-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org Tested x86_64-linux. Pushed to trunk. -- >8 -- The r15-1857 change means that is included by for C++17 and up, which breaks code including inside an extern "C" block. Although doing that is not allowed by the C++ standard, there's lots of existing code which incorrectly thinks it's a good idea and so we try to support it. libstdc++-v3/ChangeLog: PR libstdc++/115797 * include/std/type_traits: Ensure "C++" language linkage. * testsuite/17_intro/headers/c++2011/linkage.cc: Replace dg-options with c++11 target selector. --- libstdc++-v3/include/std/type_traits | 3 +++ libstdc++-v3/testsuite/17_intro/headers/c++2011/linkage.cc | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index a31de2ee4ab..c39a3792537 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -62,6 +62,8 @@ #define __glibcxx_want_void_t #include +extern "C++" +{ namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -4111,6 +4113,7 @@ template _GLIBCXX_END_NAMESPACE_VERSION } // namespace std +} // extern "C++" #endif // C++11 diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++2011/linkage.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2011/linkage.cc index c43384efbaa..1825801cec9 100644 --- a/libstdc++-v3/testsuite/17_intro/headers/c++2011/linkage.cc +++ b/libstdc++-v3/testsuite/17_intro/headers/c++2011/linkage.cc @@ -15,8 +15,7 @@ // with this library; see the file COPYING3. If not see // . -// { dg-options "-std=gnu++11" } -// { dg-do compile } +// { dg-do compile { target c++11 } } // libstdc++/69386