From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout-p-103.mailbox.org (mout-p-103.mailbox.org [80.241.56.161]) by sourceware.org (Postfix) with ESMTPS id 82C0E3858D38; Wed, 5 Apr 2023 11:33:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 82C0E3858D38 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=aarsen.me Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=aarsen.me Received: from smtp1.mailbox.org (unknown [10.196.197.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4Ps2Yp5QJFz9sW3; Wed, 5 Apr 2023 13:33:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aarsen.me; s=MBO0001; t=1680694382; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=R6WodENU8Q+Kf3wVGFbQM/OHQ0WC4hbNy3ulVKBUQfc=; b=SgbG9Gtwk0BL4hSnIaEVHP40xb7gX9tUk7gfrhz0ebRqoQqOJ6M3V1F3askyhQPThgYO5B faRfnyO3xifo63DBQWfYE1DJbwdSFFuKXX4adeIoAHG/ibkMhP2wrtkZRwayfbhoKZto9i YbrXUsmHHMFpJYkd4r+Q+SOm7PHgAfslg4JjI1bfk8L1D2laj7bRHUeRBMFK10FKYAbkPu leuVPCyevlU+my9B49zaMwMcvt9cw4TGQ5Whb9a3V3w2VZ5aG2o/q6AE7ssLabkne+tmPC D6nlHx0c0NSEHSkZQHUCz0Zy6agYQblDoefd6GXluIoDDDD/7LGgLeP8CO731g== References: <20230404230950.158556-1-arsen@aarsen.me> <20230404230950.158556-2-arsen@aarsen.me> From: Arsen =?utf-8?Q?Arsenovi=C4=87?= To: Jonathan Wakely Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Subject: Re: [PATCH 2/4] libstdc++: Add a test for FTM redefinitions Date: Wed, 05 Apr 2023 13:31:16 +0200 In-reply-to: Message-ID: <86v8iaa7ir.fsf@aarsen.me> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_INFOUSMEBIZ,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS,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 List-Id: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Jonathan Wakely writes: > On 05/04/23 01:09 +0200, Arsen Arsenovi=C4=87 wrote: >>This test detects redefinitions by compiling stdc++.h with >>-Wsystem-headers. Thanks Patrick Palka for the suggestion. >> >>libstdc++-v3/ChangeLog: >> >> * testsuite/17_intro/versionconflict.cc: New test. >>--- >> libstdc++-v3/testsuite/17_intro/versionconflict.cc | 6 ++++++ >> 1 file changed, 6 insertions(+) >> create mode 100644 libstdc++-v3/testsuite/17_intro/versionconflict.cc >> >>diff --git a/libstdc++-v3/testsuite/17_intro/versionconflict.cc b/libstdc= ++-v3/testsuite/17_intro/versionconflict.cc >>new file mode 100644 >>index 00000000000..4191c7a2b08 >>--- /dev/null >>+++ b/libstdc++-v3/testsuite/17_intro/versionconflict.cc >>@@ -0,0 +1,6 @@ >>+// { dg-do preprocess } >>+// { dg-additional-options "-Wsystem-headers -Werror" } >>+ >>+// Test for redefinitions of FTMs using bits/stdc++.h. >>+#include >>+#include > > I'm concerned that this will fail if libc headers have macro > redefinition errors, or anything else that would usually be ignored. > > We could make it more robust by changing like so: > > --- a/libstdc++-v3/include/std/version > +++ b/libstdc++-v3/include/std/version > @@ -30,7 +30,9 @@ > #ifndef _GLIBCXX_VERSION_INCLUDED > #define _GLIBCXX_VERSION_INCLUDED > +#ifndef _GLIBCXX_TESTING_SYSHDR > #pragma GCC system_header > +#endif > #include > Then the test could define that macro instead of using -Wsystem-headers. > > Could you see if that works? Good idea. Both the positive and negative cases work when implemented like this: --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=0002-libstdc-Add-a-test-for-version-FTM-redefinitions.patch Content-Transfer-Encoding: quoted-printable Content-Description: (v2) libstdc++: Add a test for FTM redefinitions From=2098d302bab9a87d3f2daecf9d54d62f33ba216673 Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?Arsen=3D20Arsenovi=3DC4=3D87?=3D Date: Wed, 8 Mar 2023 17:01:24 +0100 Subject: [PATCH 2/4] libstdc++: Add a test for FTM redefinitions This test detects redefinitions by compiling stdc++.h with =2DWsystem-headers. Thanks Patrick Palka for the suggestion. libstdc++-v3/ChangeLog: * testsuite/17_intro/versionconflict.cc: New test. =2D-- libstdc++-v3/include/std/version | 5 ++++- libstdc++-v3/testsuite/17_intro/versionconflict.cc | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 libstdc++-v3/testsuite/17_intro/versionconflict.cc diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/ve= rsion index cdd24248c57..1069bc6c9f6 100644 =2D-- a/libstdc++-v3/include/std/version +++ b/libstdc++-v3/include/std/version @@ -30,7 +30,10 @@ #ifndef _GLIBCXX_VERSION_INCLUDED #define _GLIBCXX_VERSION_INCLUDED =20 =2D#pragma GCC system_header +// To facilitate testsuite/17_intro/versionconflict.cc +#ifndef _GLIBCXX_TESTING_SYSHDR +# pragma GCC system_header +#endif =20 #include =20 diff --git a/libstdc++-v3/testsuite/17_intro/versionconflict.cc b/libstdc++= -v3/testsuite/17_intro/versionconflict.cc new file mode 100644 index 00000000000..6c212980ab0 =2D-- /dev/null +++ b/libstdc++-v3/testsuite/17_intro/versionconflict.cc @@ -0,0 +1,7 @@ +// { dg-do preprocess } +// { dg-additional-options "-Werror" } + +// Test for redefinitions of FTMs using bits/stdc++.h. +#define _GLIBCXX_TESTING_SYSHDR +#include +#include =2D-=20 2.40.0 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable =2D-=20 Arsen Arsenovi=C4=87 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iOYEARYKAI4WIQT+4rPRE/wAoxYtYGFSwpQwHqLEkwUCZC1cbF8UgAAAAAAuAChp c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0RkVF MkIzRDExM0ZDMDBBMzE2MkQ2MDYxNTJDMjk0MzAxRUEyQzQ5MxAcYXJzZW5AYWFy c2VuLm1lAAoJEFLClDAeosST5JUA/iartB4XBMTgFBQQFBSYBxQ4s8jiJhTXMcDH TUvwSQlwAP41wtrFA5CGsUXU6nM/DgVq+xJrfu9zPbsePcopbbioBg== =280P -----END PGP SIGNATURE----- --==-=-=--