From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id 7720A3858CDA for ; Thu, 1 Dec 2022 19:07:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7720A3858CDA Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.96,210,1665475200"; d="scan'208";a="88316997" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 01 Dec 2022 11:07:26 -0800 IronPort-SDR: vWyIqw+tMEud2xkTlcIRwTXzQ5safQie+xHz5FvZCgZwx5pf1B3TQ8Dad0wfaaRf3kdx5OuJ2X zlwHb7dQdp9D1Jd6mIrdsuw6yz6cnk0penHKG5b9m7ssQ8nP1WS0LzZPhQzSOXJvp5MPEevzHS z3M5ve+xmHqWtBP4Ohub4F7seF23krqVE9ADaiDj2cmHtGwtMpwX6oT3Z0stJKn6QEFDc9vvBQ a5XlxF6SMbcSGLFgraJLojwYu9Enrk/MFDfjR2P3KrkcNX7ZWoNHAhAdaypogrAsFKLHoP4hLW lE0= Date: Thu, 1 Dec 2022 19:07:21 +0000 From: Joseph Myers To: Longjun Luo CC: , Subject: Re: [PATCH] libcpp: suppress builtin macro redefined warnings for __LINE__ In-Reply-To: <8767c6bc-5b37-ca10-1176-e341081c555f@gmail.com> Message-ID: <587de9c9-e46f-b69e-84d8-7356a19db74@codesourcery.com> References: <20221201043155.9369-1-luolongjuna@gmail.com> <8767c6bc-5b37-ca10-1176-e341081c555f@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-15.mgc.mentorg.com (139.181.222.15) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-3115.8 required=5.0 tests=BAYES_00,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,SPF_HELO_PASS,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: On Fri, 2 Dec 2022, Longjun Luo via Gcc-patches wrote: > > On 12/2/2022 1:01 AM, Joseph Myers wrote: > > On Thu, 1 Dec 2022, Longjun Luo via Gcc-patches wrote: > > > > > diff --git a/gcc/testsuite/gcc.dg/builtin-redefine.c > > > b/gcc/testsuite/gcc.dg/builtin-redefine.c > > > index 882b2210992..9d5b42252ee 100644 > > > --- a/gcc/testsuite/gcc.dg/builtin-redefine.c > > > +++ b/gcc/testsuite/gcc.dg/builtin-redefine.c > > > @@ -71,7 +71,6 @@ > > > /* { dg-bogus "Expected built-in is not defined" "" { target *-*-* } .-1 > > > } */ > > > #endif > > > -#define __LINE__ 0 /* { dg-warning "-:\"__LINE__\" redef" } > > > */ > > > #define __INCLUDE_LEVEL__ 0 /* { dg-warning "-:\"__INCLUDE_LEVEL__\" > > > redef" } */ > > > #define __COUNTER__ 0 /* { dg-warning "-:\"__COUNTER__\" redef" } > > > */ > > Is there some existing test that verifies that this redefinition is still > > diagnosed by default (in the absence of -Wno-builtin-macro-redefined)? > > I am not sure I have fully understood your meaning. The problem here is that > if I try to redefine __LINE__ macro in the situation that projects use the > option '-Werror', the compile will fail. There are two cases: (a) Is redefinition of __LINE__ diagnosed *without* -Wno-builtin-macro-redefined? (b) Is redefinition of __LINE__ diagnosed *with* -Wno-builtin-macro-redefined? My understanding is that both (a) and (b) have answer "yes" at present, and your patch would change the answer to (b) to "no", without changing the answer to (a). My question is about whether there is a test verifying the answer to (a). If not, I think the patch should add one. -- Joseph S. Myers joseph@codesourcery.com