From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by sourceware.org (Postfix) with ESMTPS id 1D0003858CDA for ; Thu, 1 Dec 2022 18:23:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1D0003858CDA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-x102b.google.com with SMTP id k2-20020a17090a4c8200b002187cce2f92so6025532pjh.2 for ; Thu, 01 Dec 2022 10:23:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:from:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=1T7cM+nWDRguyekmara3RESWEfCc2rcJ/vl4uF/lxf8=; b=eyJCnnsRa0wm+rAE2UVU43XleAJq37DzzNkyKhxeoKtS8rqfLeBneaC0i912XwqmWd vUMhxMvkNzJbHcFcYAF1klS4Y4gcgOORdBjMcofvGvOvsepBduImI5xPqVsI3zpN5Bpj 7T2/lA6QSSgfYDjZEclKEtGmUqRKuPzbdUIHhIvrbMq7lcDo6EONgmgMvkUoT42B+vcN dldcnUJofWLw6/iwNwQlnmGqPtaBHd54Ul8Sy3UMyMq/hR4JtMM0oau+GdW5hXfPHVS2 jgNPKuAxtG95CDy42aKKXpIO+YQkd5wHXB2X3TZnfk5syT21uLCS81DnIJN7KFKFJu1E i0fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:from:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=1T7cM+nWDRguyekmara3RESWEfCc2rcJ/vl4uF/lxf8=; b=UBWBOMmk+cuaMUyTt1iD39RfCNIlHzwd7ge/AoX1wpZbEZNn2QmD2m7WNeKfmb5W96 EJSbVgQRsEx+f0iGRhzmZFEd32nk+ryHCEy47cdRe6Heu2SRKOd0ZhKtRaTgpcx1vA2g WCLC7PE87pPFX8Dfa2aqwkWL635ZEwDNw8s8A/Ge7L7H6xwZ7VOWhmJTvcJCYXNNWrgA cSrvmS7dyrTZToUjXTcTMWESyTs0+qgc26lLe8wsn7lA5BPcV6cHsJ0oa60XOmJf6t6v WsTBus7zudZK+dzHjNpLOgXfN+dmxlJE4qnQw+wVirLK3jp2f314luaOZuPCsZ3TK0pO qhSA== X-Gm-Message-State: ANoB5pncfQdLoYhyJL6QkzQVYH+ZOxFY6JPrNI/LPc2zzx1uE4UZ8Ff9 uLrBj6jU5d8q4o0tRFkBRnI= X-Google-Smtp-Source: AA0mqf57YSA7Ty72YxY1YQJWLBKrks7NYhkbQqgC1ZcsHJ2y593aPARgfy81W5GGqwS4SvAqd7G6ew== X-Received: by 2002:a17:903:2683:b0:189:7722:99da with SMTP id jf3-20020a170903268300b00189772299damr28315722plb.118.1669919016997; Thu, 01 Dec 2022 10:23:36 -0800 (PST) Received: from [0.0.0.0] ([2401:c080:1c01:981:ab82:f84e:7dce:d795]) by smtp.gmail.com with ESMTPSA id f5-20020a170902860500b00189951514c4sm3939439plo.206.2022.12.01.10.23.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 01 Dec 2022 10:23:36 -0800 (PST) Content-Type: multipart/alternative; boundary="------------eu9Hp6bUrmAt6ruGIkZdZCMs" Message-ID: <8767c6bc-5b37-ca10-1176-e341081c555f@gmail.com> Date: Fri, 2 Dec 2022 02:23:31 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [PATCH] libcpp: suppress builtin macro redefined warnings for __LINE__ To: Joseph Myers Cc: gcc-patches@gcc.gnu.org, sangyan@huawei.com References: <20221201043155.9369-1-luolongjuna@gmail.com> From: Longjun Luo In-Reply-To: X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,HTML_MESSAGE,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,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: This is a multi-part message in MIME format. --------------eu9Hp6bUrmAt6ruGIkZdZCMs Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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. For example, the following compilation will fail: /echo "void main(){}" | gcc -D__LINE__=0 -Werror -x c -/ The compilation output is: : error: "__LINE__" redefined [-Werror] cc1: all warnings being treated as errors As I know, most projects including Linux kernel enable '-Werror' by default. So if I try to redefine __LINE__ macro in this situation, it will be impossible. The reason that I want to redefine __LINE__ macro has been explained in the commit. Thanks for your patience and hope I hit the point. --------------eu9Hp6bUrmAt6ruGIkZdZCMs--