From patchwork Thu Dec 1 14:22:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lewis Hyatt X-Patchwork-Id: 28408 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp289213wrr; Thu, 1 Dec 2022 06:23:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf5wnH5Sz5UXGVLM4Zg2i9Lcn6ayFxvSU+rm0XWqmbc2zEbrtCAop2XdnMmo066ZJAN4bhGD X-Received: by 2002:a50:fc8b:0:b0:46b:4b13:e18d with SMTP id f11-20020a50fc8b000000b0046b4b13e18dmr15693323edq.181.1669904611578; Thu, 01 Dec 2022 06:23:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669904611; cv=none; d=google.com; s=arc-20160816; b=D7+Yn2iFcppJKBuxkUTqF2pZjtY9gThpEytHfkAKiy8gKYgsKsIiDI2coajL1jZ2mY gUvfMeIe+dbcVcXpJuDb0YASYbqWUtvLCgzToHKVP2N9URH2VUtJUFdHkIzYM8sIHpRx pzb99lHlx+7VjJceqpSZbBmtPpbFIH30hezYwm2yzrSX+1skwkpmIZRseij3xahWry/u PROWIhF4Tzf6DA17N4096VMb53DJaLqMmfpj6Bg57n6E9AtfS1YFrPxqbkhG058QXOLf 7ApNq6SxYOJjDedFcBYcGskBidFXu8vKih1MpHSpUivovnWHkc6xbRxkqPQRQCLNVwQo uuYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:date:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=zfsXwYUyqT/igJUtUQvlldNBWvvXhTA5KODeeBn+YKg=; b=xAa7I3lYtsEBmTvQhuyI0IDHUDIa/s9Q4GECZT5oYzK8AL5qBbimPRg9Dm/2fGFJak PAqWOt+3AWT4TSGe6LBbfLSAHD6xCbMDsKbfb97+GXjP2XbMY8m+w6ijwuTv1mMOK6Lb PthK/y2xVHutzsSiQGySzeHH/MFpMGMB0PKe0+UOBlUM18GZT4NPFsdm7mxmCx8x+PZv cZ/1AJo3kV9o208TPAxLGXwNfsvdKuHCk9ZXWx5zcfvgQugaSdOwvbn2So3T4sA7/S6c THlX0RbYWXdIYdyZSFZ6rllo3mUmTYkErTVOCfT9Dqzb4ThyQu6E1N3+k9j/xQHKSnPd BHiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=F0URTR8Q; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id us11-20020a170906bfcb00b007c0a6535f67si2466750ejb.736.2022.12.01.06.23.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Dec 2022 06:23:31 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=F0URTR8Q; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0FB36385840C for ; Thu, 1 Dec 2022 14:23:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0FB36385840C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669904610; bh=zfsXwYUyqT/igJUtUQvlldNBWvvXhTA5KODeeBn+YKg=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=F0URTR8QSa07/ATLS2xCX9mmTQFScWXmwnHjzWMqHUFnInRLy4o4+O0PhFMhMBOP6 yk4n/D7dCEAlVdS1mwHdhhG+5oSPUEFd1vGEKDrmm+0BcCuzQkfWzazIMuHB1+AB4i 1+O4ojGSDjr7IaEMHlq96yOoSiqmmjXSH+aMaEZY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) by sourceware.org (Postfix) with ESMTPS id 2770E3858D32 for ; Thu, 1 Dec 2022 14:22:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2770E3858D32 Received: by mail-qk1-x736.google.com with SMTP id v8so1223474qkg.12 for ; Thu, 01 Dec 2022 06:22:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zfsXwYUyqT/igJUtUQvlldNBWvvXhTA5KODeeBn+YKg=; b=Up5WBPRHMINSzwnClpZ+rozXhhfuFsVeg/XBbqG6jLd6xFXOOFnK5qqrmzMZyFk2WH eYjy0Cmk61GPEXUIiISy3fxUwALMAB+P7m6xVWelzy/VOml1oH+WZnMrf+0mJYFTakb2 7Ax3E69nF/urBzBzyMMGUR2nGC/XDBHvfpfTmU2zaeYF/EwYRYsXT9Cg9Kk9tF/16Fhh dJLu4z8QDOAGgslJ855foHdtRUFg9zNAGPPKzqbM8yE6nIZS56jZ7hrnOiKgIXKXx7d9 5zGb14+X8xLBiowDi5D4T55bjdodg/n3tctE44shJXJ8aTfDdRQMILdGBx5LiXIBB6+U trTA== X-Gm-Message-State: ANoB5pnFxHh9XAcC9OqpsvXPlR8NBcGLVvu4Q3sxJG3rZBGbEYFdPL12 SPX4Qs87R3v/WbNIctuErg8g6G4XI4o= X-Received: by 2002:a37:9383:0:b0:6fa:3fbf:6b51 with SMTP id v125-20020a379383000000b006fa3fbf6b51mr42206451qkd.519.1669904558224; Thu, 01 Dec 2022 06:22:38 -0800 (PST) Received: from ldh-imac.local (96-67-140-173-static.hfc.comcastbusiness.net. [96.67.140.173]) by smtp.gmail.com with ESMTPSA id bs15-20020a05620a470f00b006fbdeecad51sm3439272qkb.48.2022.12.01.06.22.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Dec 2022 06:22:37 -0800 (PST) Date: Thu, 1 Dec 2022 09:22:35 -0500 To: gcc-patches List Subject: Ping^3: [PATCH] libcpp: Improve location for macro names [PR66290] Message-ID: <20221201142235.GA12562@ldh-imac.local> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-3039.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Lewis Hyatt via Gcc-patches From: Lewis Hyatt Reply-To: Lewis Hyatt Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751021898244568858?= X-GMAIL-MSGID: =?utf-8?q?1751021898244568858?= Hello- https://gcc.gnu.org/pipermail/gcc-patches/2022-August/599397.html May I please ping this one? Thanks! I have also re-attached the rebased patch here. -Lewis On Wed, Oct 12, 2022 at 06:37:50PM -0400, Lewis Hyatt wrote: > Hello- > > https://gcc.gnu.org/pipermail/gcc-patches/2022-August/599397.html > > Since Jeff was kind enough to ack one of my other preprocessor patches > today, I have become emboldened to ping this one again too :). Would > anyone have some time to take a look at it please? Thanks! > > -Lewis > > On Thu, Sep 15, 2022 at 6:31 PM Lewis Hyatt wrote: > > > > Hello- > > > > https://gcc.gnu.org/pipermail/gcc-patches/2022-August/599397.html > > May I please ping this patch? Thank you. > > > > -Lewis > > > > On Fri, Aug 5, 2022 at 12:14 PM Lewis Hyatt wrote: > > > > > > > > > When libcpp reports diagnostics whose locus is a macro name (such as for > > > -Wunused-macros), it uses the location in the cpp_macro object that was > > > stored by _cpp_new_macro. This is currently set to pfile->directive_line, > > > which contains the line number only and no column information. This patch > > > changes the stored location to the src_loc for the token defining the macro > > > name, which includes the location and range information. > > > > > > libcpp/ChangeLog: > > > > > > PR c++/66290 > > > * macro.cc (_cpp_create_definition): Add location argument. > > > * internal.h (_cpp_create_definition): Adjust prototype. > > > * directives.cc (do_define): Pass new location argument to > > > _cpp_create_definition. > > > (do_undef): Stop passing inferior location to cpp_warning_with_line; > > > the default from cpp_warning is better. > > > (cpp_pop_definition): Pass new location argument to > > > _cpp_create_definition. > > > * pch.cc (cpp_read_state): Likewise. > > > > > > gcc/testsuite/ChangeLog: > > > > > > PR c++/66290 > > > * c-c++-common/cpp/macro-ranges.c: New test. > > > * c-c++-common/cpp/line-2.c: Adapt to check for column information > > > on macro-related libcpp warnings. > > > * c-c++-common/cpp/line-3.c: Likewise. > > > * c-c++-common/cpp/macro-arg-count-1.c: Likewise. > > > * c-c++-common/cpp/pr58844-1.c: Likewise. > > > * c-c++-common/cpp/pr58844-2.c: Likewise. > > > * c-c++-common/cpp/warning-zero-location.c: Likewise. > > > * c-c++-common/pragma-diag-14.c: Likewise. > > > * c-c++-common/pragma-diag-15.c: Likewise. > > > * g++.dg/modules/macro-2_d.C: Likewise. > > > * g++.dg/modules/macro-4_d.C: Likewise. > > > * g++.dg/modules/macro-4_e.C: Likewise. > > > * g++.dg/spellcheck-macro-ordering.C: Likewise. > > > * gcc.dg/builtin-redefine.c: Likewise. > > > * gcc.dg/cpp/Wunused.c: Likewise. > > > * gcc.dg/cpp/redef2.c: Likewise. > > > * gcc.dg/cpp/redef3.c: Likewise. > > > * gcc.dg/cpp/redef4.c: Likewise. > > > * gcc.dg/cpp/ucnid-11-utf8.c: Likewise. > > > * gcc.dg/cpp/ucnid-11.c: Likewise. > > > * gcc.dg/cpp/undef2.c: Likewise. > > > * gcc.dg/cpp/warn-redefined-2.c: Likewise. > > > * gcc.dg/cpp/warn-redefined.c: Likewise. > > > * gcc.dg/cpp/warn-unused-macros-2.c: Likewise. > > > * gcc.dg/cpp/warn-unused-macros.c: Likewise. > > > --- > > > > > > Notes: > > > Hello- > > > > > > The PR (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66290) was originally > > > about the entirely wrong location for -Wunused-macros in C++ mode, which > > > behavior was fixed by r13-1903, but before closing it out I wanted to also > > > address a second point brought up in the PR comments, namely that we do not > > > include column information when emitting diagnostics for macro names, such as > > > is done for -Wunused-macros. The attached patch updates the location stored in > > > the cpp_macro object so that it includes the column and range information for > > > the token comprising the macro name; previously, the location was just the > > > generic one pointing to the whole line. > > > > > > The change to libcpp is very small, the reason for all the testsuite changes is > > > that I have updated all tests explicitly looking for the columnless diagnostics > > > (with the "-:" syntax to dg-warning et al) so that they expect a column > > > instead. I also added a new test which verifies the expected range information > > > in diagnostics with carets. > > > > > > Bootstrap + regtest on x86-64 Linux looks good. Please let me know if it looks > > > OK? Thanks! > > > > > > -Lewis > > > > > > libcpp/directives.cc | 13 +- > > > libcpp/internal.h | 2 +- > > > libcpp/macro.cc | 12 +- > > > libcpp/pch.cc | 2 +- > > > gcc/testsuite/c-c++-common/cpp/line-2.c | 2 +- > > > gcc/testsuite/c-c++-common/cpp/line-3.c | 2 +- > > > .../c-c++-common/cpp/macro-arg-count-1.c | 4 +- > > > gcc/testsuite/c-c++-common/cpp/macro-ranges.c | 52 ++ > > > gcc/testsuite/c-c++-common/cpp/pr58844-1.c | 4 +- > > > gcc/testsuite/c-c++-common/cpp/pr58844-2.c | 4 +- > > > .../c-c++-common/cpp/warning-zero-location.c | 2 +- > > > gcc/testsuite/c-c++-common/pragma-diag-14.c | 2 +- > > > gcc/testsuite/c-c++-common/pragma-diag-15.c | 2 +- > > > gcc/testsuite/g++.dg/modules/macro-2_d.C | 4 +- > > > gcc/testsuite/g++.dg/modules/macro-4_d.C | 4 +- > > > gcc/testsuite/g++.dg/modules/macro-4_e.C | 2 +- > > > .../g++.dg/spellcheck-macro-ordering.C | 2 +- > > > gcc/testsuite/gcc.dg/builtin-redefine.c | 18 +- > > > gcc/testsuite/gcc.dg/cpp/Wunused.c | 6 +- > > > gcc/testsuite/gcc.dg/cpp/redef2.c | 20 +- > > > gcc/testsuite/gcc.dg/cpp/redef3.c | 14 +- > > > gcc/testsuite/gcc.dg/cpp/redef4.c | 520 +++++++++--------- > > > gcc/testsuite/gcc.dg/cpp/ucnid-11-utf8.c | 12 +- > > > gcc/testsuite/gcc.dg/cpp/ucnid-11.c | 12 +- > > > gcc/testsuite/gcc.dg/cpp/undef2.c | 6 +- > > > gcc/testsuite/gcc.dg/cpp/warn-redefined-2.c | 10 +- > > > gcc/testsuite/gcc.dg/cpp/warn-redefined.c | 10 +- > > > .../gcc.dg/cpp/warn-unused-macros-2.c | 2 +- > > > gcc/testsuite/gcc.dg/cpp/warn-unused-macros.c | 2 +- > > > 29 files changed, 405 insertions(+), 342 deletions(-) > > > create mode 100644 gcc/testsuite/c-c++-common/cpp/macro-ranges.c > > > Subject: [PATCH] libcpp: Improve location for macro names [PR66290] When libcpp reports diagnostics whose locus is a macro name (such as for -Wunused-macros), it uses the location in the cpp_macro object that was stored by _cpp_new_macro. This is currently set to pfile->directive_line, which contains the line number only and no column information. This patch changes the stored location to the src_loc for the token defining the macro name, which includes the location and range information. libcpp/ChangeLog: PR c++/66290 * macro.cc (_cpp_create_definition): Add location argument. * internal.h (_cpp_create_definition): Adjust prototype. * directives.cc (do_define): Pass new location argument to _cpp_create_definition. (do_undef): Stop passing inferior location to cpp_warning_with_line; the default from cpp_warning is better. (cpp_pop_definition): Pass new location argument to _cpp_create_definition. * pch.cc (cpp_read_state): Likewise. gcc/testsuite/ChangeLog: PR c++/66290 * c-c++-common/cpp/macro-ranges.c: New test. * c-c++-common/cpp/line-2.c: Adapt to check for column information on macro-related libcpp warnings. * c-c++-common/cpp/line-3.c: Likewise. * c-c++-common/cpp/macro-arg-count-1.c: Likewise. * c-c++-common/cpp/pr58844-1.c: Likewise. * c-c++-common/cpp/pr58844-2.c: Likewise. * c-c++-common/cpp/warning-zero-location.c: Likewise. * c-c++-common/pragma-diag-14.c: Likewise. * c-c++-common/pragma-diag-15.c: Likewise. * g++.dg/modules/macro-2_d.C: Likewise. * g++.dg/modules/macro-4_d.C: Likewise. * g++.dg/modules/macro-4_e.C: Likewise. * g++.dg/spellcheck-macro-ordering.C: Likewise. * gcc.dg/builtin-redefine.c: Likewise. * gcc.dg/cpp/Wunused.c: Likewise. * gcc.dg/cpp/redef2.c: Likewise. * gcc.dg/cpp/redef3.c: Likewise. * gcc.dg/cpp/redef4.c: Likewise. * gcc.dg/cpp/ucnid-11-utf8.c: Likewise. * gcc.dg/cpp/ucnid-11.c: Likewise. * gcc.dg/cpp/undef2.c: Likewise. * gcc.dg/cpp/warn-redefined-2.c: Likewise. * gcc.dg/cpp/warn-redefined.c: Likewise. * gcc.dg/cpp/warn-unused-macros-2.c: Likewise. * gcc.dg/cpp/warn-unused-macros.c: Likewise. diff --git a/gcc/testsuite/c-c++-common/cpp/line-2.c b/gcc/testsuite/c-c++-common/cpp/line-2.c index 364ad0e3931..3ce23340871 100644 --- a/gcc/testsuite/c-c++-common/cpp/line-2.c +++ b/gcc/testsuite/c-c++-common/cpp/line-2.c @@ -8,4 +8,4 @@ int line4; // { dg-regexp {In file included from :\n[^\n]*/line-2.h:4:2: error: #error wrong\n} } -// { dg-regexp {[^\n]*/line-2.c:3:11: error: macro "bill" passed 1 arguments, but takes just 0\n[^\n]*/line-2.h:3: note: macro "bill" defined here\n} } +// { dg-regexp {[^\n]*/line-2.c:3:11: error: macro "bill" passed 1 arguments, but takes just 0\n[^\n]*/line-2.h:3:9: note: macro "bill" defined here\n} } diff --git a/gcc/testsuite/c-c++-common/cpp/line-3.c b/gcc/testsuite/c-c++-common/cpp/line-3.c index b254ae40041..b0672923756 100644 --- a/gcc/testsuite/c-c++-common/cpp/line-3.c +++ b/gcc/testsuite/c-c++-common/cpp/line-3.c @@ -15,6 +15,6 @@ int line4; // { dg-regexp {In file included from :\n[^\n]*/line-2.h:4:2: error: #error wrong\n} } -// { dg-regexp {[^\n]*/line-3.c:3:11: error: macro "bill" passed 1 arguments, but takes just 0\n[^\n]*/line-2.h:3: note: macro "bill" defined here\n} } +// { dg-regexp {[^\n]*/line-3.c:3:11: error: macro "bill" passed 1 arguments, but takes just 0\n[^\n]*/line-2.h:3:9: note: macro "bill" defined here\n} } // { dg-options "-fpreprocessed -fdirectives-only" } diff --git a/gcc/testsuite/c-c++-common/cpp/macro-arg-count-1.c b/gcc/testsuite/c-c++-common/cpp/macro-arg-count-1.c index 7773c47e765..103e88ecd4d 100644 --- a/gcc/testsuite/c-c++-common/cpp/macro-arg-count-1.c +++ b/gcc/testsuite/c-c++-common/cpp/macro-arg-count-1.c @@ -9,7 +9,7 @@ void test_1 () MACRO_1(42); ^ { dg-end-multiline-output "" } */ - /* { dg-message "-: macro .MACRO_1. defined here" "" { target *-*-* } def_of_MACRO_1 } + /* { dg-message "macro .MACRO_1. defined here" "" { target *-*-* } def_of_MACRO_1 } /* { dg-begin-multiline-output "" } #define MACRO_1(X,Y) @@ -33,7 +33,7 @@ void test_2 () MACRO_2(1, 2, 3); ^ { dg-end-multiline-output "" } */ - /* { dg-message "-: macro .MACRO_2. defined here" "" { target *-*-* } def_of_MACRO_2 } + /* { dg-message "macro .MACRO_2. defined here" "" { target *-*-* } def_of_MACRO_2 } /* { dg-begin-multiline-output "" } #define MACRO_2(X,Y) diff --git a/gcc/testsuite/c-c++-common/cpp/macro-ranges.c b/gcc/testsuite/c-c++-common/cpp/macro-ranges.c new file mode 100644 index 00000000000..72b026f85c0 --- /dev/null +++ b/gcc/testsuite/c-c++-common/cpp/macro-ranges.c @@ -0,0 +1,52 @@ +/* { dg-do preprocess } */ +/* { dg-additional-options "-fdiagnostics-show-caret -Wunused-macros -Wbuiltin-macro-redefined" } */ + +/* Verify that we output range information for diagnostics involving + macro definitions. */ + +#undef __TIME__ /* { dg-warning {undefining "__TIME__"} } */ +/* { dg-begin-multiline-output "" } + #undef __TIME__ + ^~~~~~~~ +/* { dg-end-multiline-output "" } */ + +#define XYZ 123 /* { dg-warning {macro "XYZ" is not used} } */ +/* { dg-begin-multiline-output "" } + #define XYZ 123 + ^~~ +/* { dg-end-multiline-output "" } */ + +#define MACRO initial_definition /* { dg-line def_line } */ + +/* This locus is output first for the unused warning... */ +/* { dg-warning {macro "MACRO" is not used} "" { target *-*-* } def_line } */ +/* { dg-begin-multiline-output "" } + #define MACRO initial_definition + ^~~~~ +/* { dg-end-multiline-output "" } */ + +/* ...then a second time for the redefinition warning. */ +/* { dg-note {this is the location of the previous definition} "" { target *-*-* } def_line } */ +/* { dg-begin-multiline-output "" } + #define MACRO initial_definition + ^~~~~ +/* { dg-end-multiline-output "" } */ + +#define MACRO /* { dg-warning {"MACRO" redefined} } */ +/* { dg-begin-multiline-output "" } + #define MACRO + ^~~~~ +{ dg-end-multiline-output "" } */ + +#define MACRO2(x,y) x /* { dg-note {macro "MACRO2" defined here} } */ +/* { dg-begin-multiline-output "" } + #define MACRO2(x,y) + ^~~~~~ +{ dg-end-multiline-output "" } */ + +MACRO2(MACRO, MACRO) +MACRO2(MACRO) /* { dg-error {macro "MACRO2" requires 2 arguments, but only 1 given} } */ +/* { dg-begin-multiline-output "" } + MACRO2(MACRO) + ^ +{ dg-end-multiline-output "" } */ diff --git a/gcc/testsuite/c-c++-common/cpp/pr58844-1.c b/gcc/testsuite/c-c++-common/cpp/pr58844-1.c index 2a2e277b0fc..3abf8a76803 100644 --- a/gcc/testsuite/c-c++-common/cpp/pr58844-1.c +++ b/gcc/testsuite/c-c++-common/cpp/pr58844-1.c @@ -4,5 +4,5 @@ #define A x######x int A = 1; -#define A x######x /* { dg-message "-:previous definition" } */ -#define A x##x /* { dg-warning "-:redefined" } */ +#define A x######x /* { dg-message "previous definition" } */ +#define A x##x /* { dg-warning "redefined" } */ diff --git a/gcc/testsuite/c-c++-common/cpp/pr58844-2.c b/gcc/testsuite/c-c++-common/cpp/pr58844-2.c index 52993b314be..1e219152fc5 100644 --- a/gcc/testsuite/c-c++-common/cpp/pr58844-2.c +++ b/gcc/testsuite/c-c++-common/cpp/pr58844-2.c @@ -4,5 +4,5 @@ #define A x######x int A = 1; -#define A x######x /* { dg-message "-:previous definition" } */ -#define A x##x /* { dg-warning "-:redefined" } */ +#define A x######x /* { dg-message "previous definition" } */ +#define A x##x /* { dg-warning "redefined" } */ diff --git a/gcc/testsuite/c-c++-common/cpp/warning-zero-location.c b/gcc/testsuite/c-c++-common/cpp/warning-zero-location.c index 57544b6aff1..2b9c9a95217 100644 --- a/gcc/testsuite/c-c++-common/cpp/warning-zero-location.c +++ b/gcc/testsuite/c-c++-common/cpp/warning-zero-location.c @@ -3,6 +3,6 @@ { dg-do compile } */ -#define _GNU_SOURCE /* { dg-warning "-:redefined" } */ +#define _GNU_SOURCE /* { dg-warning "redefined" } */ /* { dg-message "" "#define _GNU_SOURCE" {target *-*-* } 0 } */ diff --git a/gcc/testsuite/c-c++-common/pragma-diag-14.c b/gcc/testsuite/c-c++-common/pragma-diag-14.c index 618e7e1ef27..45dc4a38c5c 100644 --- a/gcc/testsuite/c-c++-common/pragma-diag-14.c +++ b/gcc/testsuite/c-c++-common/pragma-diag-14.c @@ -5,5 +5,5 @@ location was not tracked properly with -E or -save-temps; check that it works now. */ -#define X /* { dg-warning "-:-Wunused-macros" } */ +#define X /* { dg-warning "-Wunused-macros" } */ #pragma GCC diagnostic ignored "-Wunused-macros" diff --git a/gcc/testsuite/c-c++-common/pragma-diag-15.c b/gcc/testsuite/c-c++-common/pragma-diag-15.c index 8ffff88d5e3..5cb8c356ed6 100644 --- a/gcc/testsuite/c-c++-common/pragma-diag-15.c +++ b/gcc/testsuite/c-c++-common/pragma-diag-15.c @@ -9,5 +9,5 @@ because the location of the macro definition is incorrectly set. This is a separate issue, will resolve it in a later patch. */ -#define X /* { dg-warning "-:-Wunused-macros" } */ +#define X /* { dg-warning "-Wunused-macros" } */ #pragma GCC diagnostic ignored "-Wunused-macros" diff --git a/gcc/testsuite/g++.dg/modules/macro-2_d.C b/gcc/testsuite/g++.dg/modules/macro-2_d.C index 04b80fb3058..e78fc7cbb0d 100644 --- a/gcc/testsuite/g++.dg/modules/macro-2_d.C +++ b/gcc/testsuite/g++.dg/modules/macro-2_d.C @@ -8,7 +8,7 @@ import "macro-2_b.H"; int FOO_OK = BAR_OK(1); int BAR_BAD; -// { dg-regexp {[^\n]*macro-2_d.C:10:5: error: inconsistent imported macro definition 'BAR_BAD'\nIn module [^\n]*macro-2_a.H, imported at [^\n]*macro-2_d.C:5:\n[^\n]*macro-2_a.H:11: note: '#define BAR_BAD\(BAZ\) BINKY\(2\)'\nIn module [^\n]*macro-2_b.H, imported at [^\n]*macro-2_d.C:6:\n[^\n]*macro-2_b.H:21: note: '#define BAR_BAD\(BAZ\) BINKY\(3\)'\n} } +// { dg-regexp {[^\n]*macro-2_d.C:10:5: error: inconsistent imported macro definition 'BAR_BAD'\nIn module [^\n]*macro-2_a.H, imported at [^\n]*macro-2_d.C:5:\n[^\n]*macro-2_a.H:11:9: note: '#define BAR_BAD\(BAZ\) BINKY\(2\)'\nIn module [^\n]*macro-2_b.H, imported at [^\n]*macro-2_d.C:6:\n[^\n]*macro-2_b.H:21:9: note: '#define BAR_BAD\(BAZ\) BINKY\(3\)'\n} } int FOO_BAD; -// { dg-regexp {[^\n]*macro-2_d.C:13:5: error: inconsistent imported macro definition 'FOO_BAD'\nIn module [^\n]*macro-2_a.H, imported at [^\n]*macro-2_d.C:5:\n[^\n]*macro-2_a.H:10: note: '#define FOO_BAD foo'\nIn module [^\n]*macro-2_b.H, imported at [^\n]*macro-2_d.C:6:\n[^\n]*macro-2_b.H:20: note: '#define FOO_BAD foot'\n} } +// { dg-regexp {[^\n]*macro-2_d.C:13:5: error: inconsistent imported macro definition 'FOO_BAD'\nIn module [^\n]*macro-2_a.H, imported at [^\n]*macro-2_d.C:5:\n[^\n]*macro-2_a.H:10:9: note: '#define FOO_BAD foo'\nIn module [^\n]*macro-2_b.H, imported at [^\n]*macro-2_d.C:6:\n[^\n]*macro-2_b.H:20:9: note: '#define FOO_BAD foot'\n} } diff --git a/gcc/testsuite/g++.dg/modules/macro-4_d.C b/gcc/testsuite/g++.dg/modules/macro-4_d.C index bff9494281b..d9c08ce16be 100644 --- a/gcc/testsuite/g++.dg/modules/macro-4_d.C +++ b/gcc/testsuite/g++.dg/modules/macro-4_d.C @@ -3,6 +3,6 @@ import "macro-4_b.H"; import "macro-4_a.H"; -// { dg-regexp {[^\n]*macro-4_d.C: warning: inconsistent imported macro definition 'TWO' \[-Winvalid-imported-macros\]\nIn module [^\n]*macro-4_b.H, imported at [^\n]*macro-4_d.C:[0-9]*:\n[^\n]*macro-4_b.H:[0-9]*: note: .#define TWO 2a.\nIn module [^\n]*macro-4_a.H, imported at [^\n]*macro-4_d.C:[0-9]*:\n[^\n]*macro-4_a.H:[0-9]*: note: .#define TWO 2.\n} } +// { dg-regexp {[^\n]*macro-4_d.C: warning: inconsistent imported macro definition 'TWO' \[-Winvalid-imported-macros\]\nIn module [^\n]*macro-4_b.H, imported at [^\n]*macro-4_d.C:[0-9]*:\n[^\n]*macro-4_b.H:[0-9]*:[0-9]*: note: .#define TWO 2a.\nIn module [^\n]*macro-4_a.H, imported at [^\n]*macro-4_d.C:[0-9]*:\n[^\n]*macro-4_a.H:[0-9]*:[0-9]*: note: .#define TWO 2.\n} } -// { dg-regexp {[^\n]*macro-4_d.C: warning: inconsistent imported macro definition 'THREE' \[-Winvalid-imported-macros\]\nIn module [^\n]*macro-4_b.H, imported at [^\n]*macro-4_d.C:[0-9]*:\n[^\n]*macro-4_b.H:[0-9]*: note: .#define THREE 3b.\nIn module [^\n]*macro-4_a.H, imported at [^\n]*macro-4_d.C:[0-9]*:\n[^\n]*macro-4_a.H:[0-9]*: note: .#define THREE 3.\n} } +// { dg-regexp {[^\n]*macro-4_d.C: warning: inconsistent imported macro definition 'THREE' \[-Winvalid-imported-macros\]\nIn module [^\n]*macro-4_b.H, imported at [^\n]*macro-4_d.C:[0-9]*:\n[^\n]*macro-4_b.H:[0-9]*:[0-9]*: note: .#define THREE 3b.\nIn module [^\n]*macro-4_a.H, imported at [^\n]*macro-4_d.C:[0-9]*:\n[^\n]*macro-4_a.H:[0-9]*:[0-9]*: note: .#define THREE 3.\n} } diff --git a/gcc/testsuite/g++.dg/modules/macro-4_e.C b/gcc/testsuite/g++.dg/modules/macro-4_e.C index 38fa6c7feeb..392387f3a1c 100644 --- a/gcc/testsuite/g++.dg/modules/macro-4_e.C +++ b/gcc/testsuite/g++.dg/modules/macro-4_e.C @@ -10,4 +10,4 @@ int stop; #error bah! #endif -// { dg-regexp {[^\n]*macro-4_e.C: warning: inconsistent imported macro definition 'TWO' \[-Winvalid-imported-macros\]\nIn module [^\n]*macro-4_b.H, imported at [^\n]*macro-4_e.C:[0-9]*:\n[^\n]*macro-4_b.H:[0-9]*: note: .#define TWO 2a.\nIn module [^\n]*macro-4_a.H, imported at [^\n]*macro-4_e.C:[0-9]*:\n[^\n]*macro-4_a.H:[0-9]*: note: .#define TWO 2.\n} } +// { dg-regexp {[^\n]*macro-4_e.C: warning: inconsistent imported macro definition 'TWO' \[-Winvalid-imported-macros\]\nIn module [^\n]*macro-4_b.H, imported at [^\n]*macro-4_e.C:[0-9]*:\n[^\n]*macro-4_b.H:[0-9]*:[0-9]*: note: .#define TWO 2a.\nIn module [^\n]*macro-4_a.H, imported at [^\n]*macro-4_e.C:[0-9]*:\n[^\n]*macro-4_a.H:[0-9]*:[0-9]*: note: .#define TWO 2.\n} } diff --git a/gcc/testsuite/g++.dg/spellcheck-macro-ordering.C b/gcc/testsuite/g++.dg/spellcheck-macro-ordering.C index bbd41f48e09..59e9f8a9438 100644 --- a/gcc/testsuite/g++.dg/spellcheck-macro-ordering.C +++ b/gcc/testsuite/g++.dg/spellcheck-macro-ordering.C @@ -13,4 +13,4 @@ class DocTargetDriver { }; #define OVERRIDE override -// { dg-message "-:it was later defined here" "" { target *-*-* } .-1 } +// { dg-message "9:it was later defined here" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/gcc.dg/builtin-redefine.c b/gcc/testsuite/gcc.dg/builtin-redefine.c index 882b2210992..8090015f693 100644 --- a/gcc/testsuite/gcc.dg/builtin-redefine.c +++ b/gcc/testsuite/gcc.dg/builtin-redefine.c @@ -27,8 +27,8 @@ #define __TIME__ "X" /* Define while undefined. */ #define __TIME__ "X" /* Re-define while defined. */ /* { dg-line time_prev } */ -#define __TIME__ "Y" /* { dg-warning "-:\"__TIME__\" redefined" } */ -/* { dg-message "-:previous definition" "" { target *-*-* } time_prev } */ +#define __TIME__ "Y" /* { dg-warning "\"__TIME__\" redefined" } */ +/* { dg-message "previous definition" "" { target *-*-* } time_prev } */ #undef __TIME__ /* Undefine while defined. */ @@ -38,8 +38,8 @@ #define __DATE__ "X" /* Define while undefined. */ #define __DATE__ "X" /* Re-define while defined. */ /* { dg-line date_prev } */ -#define __DATE__ "Y" /* { dg-warning "-:\"__DATE__\" redefined" } */ -/* { dg-message "-:previous definition" "" { target *-*-* } date_prev } */ +#define __DATE__ "Y" /* { dg-warning "\"__DATE__\" redefined" } */ +/* { dg-message "previous definition" "" { target *-*-* } date_prev } */ #undef __DATE__ /* Undefine while defined. */ @@ -47,8 +47,8 @@ #define __TIMESTAMP__ "X" /* Define while already defined. */ #define __TIMESTAMP__ "X" /* Re-define while defined. */ /* { dg-line timestamp_prev } */ -#define __TIMESTAMP__ "Y" /* { dg-warning "-:\"__TIMESTAMP__\" redefined" } */ -/* { dg-message "-:previous definition" "" { target *-*-* } timestamp_prev } */ +#define __TIMESTAMP__ "Y" /* { dg-warning "\"__TIMESTAMP__\" redefined" } */ +/* { dg-message "previous definition" "" { target *-*-* } timestamp_prev } */ #undef __TIMESTAMP__ /* Undefine while defined. */ @@ -71,9 +71,9 @@ /* { 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" } */ +#define __LINE__ 0 /* { dg-warning "\"__LINE__\" redef" } */ +#define __INCLUDE_LEVEL__ 0 /* { dg-warning "\"__INCLUDE_LEVEL__\" redef" } */ +#define __COUNTER__ 0 /* { dg-warning "\"__COUNTER__\" redef" } */ int unused; /* Silence `ISO C forbids an empty translation unit' warning. */ diff --git a/gcc/testsuite/gcc.dg/cpp/Wunused.c b/gcc/testsuite/gcc.dg/cpp/Wunused.c index d6f76288cd7..ac363ad04b8 100644 --- a/gcc/testsuite/gcc.dg/cpp/Wunused.c +++ b/gcc/testsuite/gcc.dg/cpp/Wunused.c @@ -15,9 +15,9 @@ #define used3 /* { dg-bogus "used" } */ #define used4 used4 /* { dg-bogus "used" } */ -#define unused5 /* { dg-warning "-:used" } */ -#define unused6 /* { dg-warning "-:used" } */ -#define unused7() /* { dg-warning "-:used" } */ +#define unused5 /* { dg-warning "used" } */ +#define unused6 /* { dg-warning "used" } */ +#define unused7() /* { dg-warning "used" } */ #if defined used1 #endif diff --git a/gcc/testsuite/gcc.dg/cpp/redef2.c b/gcc/testsuite/gcc.dg/cpp/redef2.c index 439d33a7057..1dbc10033ed 100644 --- a/gcc/testsuite/gcc.dg/cpp/redef2.c +++ b/gcc/testsuite/gcc.dg/cpp/redef2.c @@ -17,15 +17,15 @@ #define foo(x) x #define foo(x)x /* { dg-bogus "redefined" "redefined foo" } */ -/* { dg-warning "-:redefined" "redef mac" { target *-*-* } 7 } - { dg-warning "-:redefined" "redef mac" { target *-*-* } 8 } - { dg-warning "-:redefined" "redef mac" { target *-*-* } 9 } - { dg-warning "-:redefined" "redef ro" { target *-*-* } 12 } - { dg-warning "-:redefined" "redef va" { target *-*-* } 15 } +/* { dg-warning "redefined" "redef mac" { target *-*-* } 7 } + { dg-warning "redefined" "redef mac" { target *-*-* } 8 } + { dg-warning "redefined" "redef mac" { target *-*-* } 9 } + { dg-warning "redefined" "redef ro" { target *-*-* } 12 } + { dg-warning "redefined" "redef va" { target *-*-* } 15 } - { dg-message "-:previous" "prev def mac" { target *-*-* } 6 } - { dg-message "-:previous" "prev def mac" { target *-*-* } 7 } - { dg-message "-:previous" "prev def mac" { target *-*-* } 8 } - { dg-message "-:previous" "prev def ro" { target *-*-* } 11 } - { dg-message "-:previous" "prev def va" { target *-*-* } 14 } + { dg-message "previous" "prev def mac" { target *-*-* } 6 } + { dg-message "previous" "prev def mac" { target *-*-* } 7 } + { dg-message "previous" "prev def mac" { target *-*-* } 8 } + { dg-message "previous" "prev def ro" { target *-*-* } 11 } + { dg-message "previous" "prev def va" { target *-*-* } 14 } */ diff --git a/gcc/testsuite/gcc.dg/cpp/redef3.c b/gcc/testsuite/gcc.dg/cpp/redef3.c index 4e4ef128b10..1c541a45bb1 100644 --- a/gcc/testsuite/gcc.dg/cpp/redef3.c +++ b/gcc/testsuite/gcc.dg/cpp/redef3.c @@ -11,11 +11,11 @@ #define D 1 2 #define E -/* { dg-warning "-:redefined" "redef A" { target *-*-* } 7 } - { dg-warning "-:redefined" "redef B" { target *-*-* } 9 } - { dg-warning "-:redefined" "redef D" { target *-*-* } 11 } - { dg-warning "-:redefined" "redef E" { target *-*-* } 12 } - { dg-message "-:previous" "prev def A" { target *-*-* } 6 } - { dg-message "-:previous" "prev def B" { target *-*-* } 8 } - { dg-message "-:previous" "prev def D/E" { target *-*-* } 0 } +/* { dg-warning "redefined" "redef A" { target *-*-* } 7 } + { dg-warning "redefined" "redef B" { target *-*-* } 9 } + { dg-warning "redefined" "redef D" { target *-*-* } 11 } + { dg-warning "redefined" "redef E" { target *-*-* } 12 } + { dg-message "previous" "prev def A" { target *-*-* } 6 } + { dg-message "previous" "prev def B" { target *-*-* } 8 } + { dg-message "previous" "prev def D/E" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/cpp/redef4.c b/gcc/testsuite/gcc.dg/cpp/redef4.c index aa6729b770b..b34635b2e42 100644 --- a/gcc/testsuite/gcc.dg/cpp/redef4.c +++ b/gcc/testsuite/gcc.dg/cpp/redef4.c @@ -4,41 +4,41 @@ /* { dg-do preprocess } */ /* { dg-options "" } */ -#define str(x) #x /* { dg-message "-:previous definition" } */ -#define str(x) %: x /* { dg-warning "-:redefined" } */ +#define str(x) #x /* { dg-message "previous definition" } */ +#define str(x) %: x /* { dg-warning "redefined" } */ #undef str -#define str(x) #x /* { dg-message "-:previous definition" } */ -#define str(x) # x /* { dg-warning "-:redefined" } */ +#define str(x) #x /* { dg-message "previous definition" } */ +#define str(x) # x /* { dg-warning "redefined" } */ #undef str -#define str(x) #x /* { dg-message "-:previous definition" } */ -#define str(x) %: x /* { dg-warning "-:redefined" } */ +#define str(x) #x /* { dg-message "previous definition" } */ +#define str(x) %: x /* { dg-warning "redefined" } */ #undef str -#define str(x) %:x /* { dg-message "-:previous definition" } */ -#define str(x) #x /* { dg-warning "-:redefined" } */ +#define str(x) %:x /* { dg-message "previous definition" } */ +#define str(x) #x /* { dg-warning "redefined" } */ #undef str -#define str(x) %:x /* { dg-message "-:previous definition" } */ -#define str(x) %: x /* { dg-warning "-:redefined" } */ +#define str(x) %:x /* { dg-message "previous definition" } */ +#define str(x) %: x /* { dg-warning "redefined" } */ #undef str -#define str(x) %:x /* { dg-message "-:previous definition" } */ -#define str(x) # x /* { dg-warning "-:redefined" } */ +#define str(x) %:x /* { dg-message "previous definition" } */ +#define str(x) # x /* { dg-warning "redefined" } */ #undef str -#define str(x) %:x /* { dg-message "-:previous definition" } */ -#define str(x) %: x /* { dg-warning "-:redefined" } */ +#define str(x) %:x /* { dg-message "previous definition" } */ +#define str(x) %: x /* { dg-warning "redefined" } */ #undef str -#define str(x) # x /* { dg-message "-:previous definition" } */ -#define str(x) #x /* { dg-warning "-:redefined" } */ +#define str(x) # x /* { dg-message "previous definition" } */ +#define str(x) #x /* { dg-warning "redefined" } */ #undef str -#define str(x) # x /* { dg-message "-:previous definition" } */ -#define str(x) %: x /* { dg-warning "-:redefined" } */ +#define str(x) # x /* { dg-message "previous definition" } */ +#define str(x) %: x /* { dg-warning "redefined" } */ #undef str -#define str(x) # x /* { dg-message "-:previous definition" } */ -#define str(x) %: x /* { dg-warning "-:redefined" } */ +#define str(x) # x /* { dg-message "previous definition" } */ +#define str(x) %: x /* { dg-warning "redefined" } */ #undef str -#define str(x) %: x /* { dg-message "-:previous definition" } */ -#define str(x) #x /* { dg-warning "-:redefined" } */ +#define str(x) %: x /* { dg-message "previous definition" } */ +#define str(x) #x /* { dg-warning "redefined" } */ #undef str -#define str(x) %: x /* { dg-message "-:previous definition" } */ -#define str(x) # x /* { dg-warning "-:redefined" } */ +#define str(x) %: x /* { dg-message "previous definition" } */ +#define str(x) # x /* { dg-warning "redefined" } */ #undef str #define str(x) #x @@ -54,173 +54,173 @@ #define str(x) %: x #undef str -#define astr(x) a#x /* { dg-message "-:previous definition" } */ -#define astr(x) a%: x /* { dg-warning "-:redefined" } */ +#define astr(x) a#x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a#x /* { dg-message "-:previous definition" } */ -#define astr(x) a# x /* { dg-warning "-:redefined" } */ +#define astr(x) a#x /* { dg-message "previous definition" } */ +#define astr(x) a# x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a#x /* { dg-message "-:previous definition" } */ -#define astr(x) a%: x /* { dg-warning "-:redefined" } */ +#define astr(x) a#x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a#x /* { dg-message "-:previous definition" } */ -#define astr(x) a #x /* { dg-warning "-:redefined" } */ +#define astr(x) a#x /* { dg-message "previous definition" } */ +#define astr(x) a #x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a#x /* { dg-message "-:previous definition" } */ -#define astr(x) a %:x /* { dg-warning "-:redefined" } */ +#define astr(x) a#x /* { dg-message "previous definition" } */ +#define astr(x) a %:x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a#x /* { dg-message "-:previous definition" } */ -#define astr(x) a # x /* { dg-warning "-:redefined" } */ +#define astr(x) a#x /* { dg-message "previous definition" } */ +#define astr(x) a # x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a#x /* { dg-message "-:previous definition" } */ -#define astr(x) a %: x /* { dg-warning "-:redefined" } */ +#define astr(x) a#x /* { dg-message "previous definition" } */ +#define astr(x) a %: x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a%:x /* { dg-message "-:previous definition" } */ -#define astr(x) a#x /* { dg-warning "-:redefined" } */ +#define astr(x) a%:x /* { dg-message "previous definition" } */ +#define astr(x) a#x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a%:x /* { dg-message "-:previous definition" } */ -#define astr(x) a%: x /* { dg-warning "-:redefined" } */ +#define astr(x) a%:x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a%:x /* { dg-message "-:previous definition" } */ -#define astr(x) a# x /* { dg-warning "-:redefined" } */ +#define astr(x) a%:x /* { dg-message "previous definition" } */ +#define astr(x) a# x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a%:x /* { dg-message "-:previous definition" } */ -#define astr(x) a%: x /* { dg-warning "-:redefined" } */ +#define astr(x) a%:x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a%:x /* { dg-message "-:previous definition" } */ -#define astr(x) a #x /* { dg-warning "-:redefined" } */ +#define astr(x) a%:x /* { dg-message "previous definition" } */ +#define astr(x) a #x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a%:x /* { dg-message "-:previous definition" } */ -#define astr(x) a %:x /* { dg-warning "-:redefined" } */ +#define astr(x) a%:x /* { dg-message "previous definition" } */ +#define astr(x) a %:x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a%:x /* { dg-message "-:previous definition" } */ -#define astr(x) a # x /* { dg-warning "-:redefined" } */ +#define astr(x) a%:x /* { dg-message "previous definition" } */ +#define astr(x) a # x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a%:x /* { dg-message "-:previous definition" } */ -#define astr(x) a %: x /* { dg-warning "-:redefined" } */ +#define astr(x) a%:x /* { dg-message "previous definition" } */ +#define astr(x) a %: x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a# x /* { dg-message "-:previous definition" } */ -#define astr(x) a#x /* { dg-warning "-:redefined" } */ +#define astr(x) a# x /* { dg-message "previous definition" } */ +#define astr(x) a#x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a# x /* { dg-message "-:previous definition" } */ -#define astr(x) a%: x /* { dg-warning "-:redefined" } */ +#define astr(x) a# x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a# x /* { dg-message "-:previous definition" } */ -#define astr(x) a%: x /* { dg-warning "-:redefined" } */ +#define astr(x) a# x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a# x /* { dg-message "-:previous definition" } */ -#define astr(x) a #x /* { dg-warning "-:redefined" } */ +#define astr(x) a# x /* { dg-message "previous definition" } */ +#define astr(x) a #x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a# x /* { dg-message "-:previous definition" } */ -#define astr(x) a %:x /* { dg-warning "-:redefined" } */ +#define astr(x) a# x /* { dg-message "previous definition" } */ +#define astr(x) a %:x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a# x /* { dg-message "-:previous definition" } */ -#define astr(x) a # x /* { dg-warning "-:redefined" } */ +#define astr(x) a# x /* { dg-message "previous definition" } */ +#define astr(x) a # x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a# x /* { dg-message "-:previous definition" } */ -#define astr(x) a %: x /* { dg-warning "-:redefined" } */ +#define astr(x) a# x /* { dg-message "previous definition" } */ +#define astr(x) a %: x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a%: x /* { dg-message "-:previous definition" } */ -#define astr(x) a#x /* { dg-warning "-:redefined" } */ +#define astr(x) a%: x /* { dg-message "previous definition" } */ +#define astr(x) a#x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a%: x /* { dg-message "-:previous definition" } */ -#define astr(x) a# x /* { dg-warning "-:redefined" } */ +#define astr(x) a%: x /* { dg-message "previous definition" } */ +#define astr(x) a# x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a%: x /* { dg-message "-:previous definition" } */ -#define astr(x) a #x /* { dg-warning "-:redefined" } */ +#define astr(x) a%: x /* { dg-message "previous definition" } */ +#define astr(x) a #x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a%: x /* { dg-message "-:previous definition" } */ -#define astr(x) a %:x /* { dg-warning "-:redefined" } */ +#define astr(x) a%: x /* { dg-message "previous definition" } */ +#define astr(x) a %:x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a%: x /* { dg-message "-:previous definition" } */ -#define astr(x) a # x /* { dg-warning "-:redefined" } */ +#define astr(x) a%: x /* { dg-message "previous definition" } */ +#define astr(x) a # x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a%: x /* { dg-message "-:previous definition" } */ -#define astr(x) a %: x /* { dg-warning "-:redefined" } */ +#define astr(x) a%: x /* { dg-message "previous definition" } */ +#define astr(x) a %: x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a #x /* { dg-message "-:previous definition" } */ -#define astr(x) a#x /* { dg-warning "-:redefined" } */ +#define astr(x) a #x /* { dg-message "previous definition" } */ +#define astr(x) a#x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a #x /* { dg-message "-:previous definition" } */ -#define astr(x) a%: x /* { dg-warning "-:redefined" } */ +#define astr(x) a #x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a #x /* { dg-message "-:previous definition" } */ -#define astr(x) a# x /* { dg-warning "-:redefined" } */ +#define astr(x) a #x /* { dg-message "previous definition" } */ +#define astr(x) a# x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a #x /* { dg-message "-:previous definition" } */ -#define astr(x) a%: x /* { dg-warning "-:redefined" } */ +#define astr(x) a #x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a #x /* { dg-message "-:previous definition" } */ -#define astr(x) a %:x /* { dg-warning "-:redefined" } */ +#define astr(x) a #x /* { dg-message "previous definition" } */ +#define astr(x) a %:x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a #x /* { dg-message "-:previous definition" } */ -#define astr(x) a # x /* { dg-warning "-:redefined" } */ +#define astr(x) a #x /* { dg-message "previous definition" } */ +#define astr(x) a # x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a #x /* { dg-message "-:previous definition" } */ -#define astr(x) a %: x /* { dg-warning "-:redefined" } */ +#define astr(x) a #x /* { dg-message "previous definition" } */ +#define astr(x) a %: x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a %:x /* { dg-message "-:previous definition" } */ -#define astr(x) a#x /* { dg-warning "-:redefined" } */ +#define astr(x) a %:x /* { dg-message "previous definition" } */ +#define astr(x) a#x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a %:x /* { dg-message "-:previous definition" } */ -#define astr(x) a%: x /* { dg-warning "-:redefined" } */ +#define astr(x) a %:x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a %:x /* { dg-message "-:previous definition" } */ -#define astr(x) a# x /* { dg-warning "-:redefined" } */ +#define astr(x) a %:x /* { dg-message "previous definition" } */ +#define astr(x) a# x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a %:x /* { dg-message "-:previous definition" } */ -#define astr(x) a%: x /* { dg-warning "-:redefined" } */ +#define astr(x) a %:x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a %:x /* { dg-message "-:previous definition" } */ -#define astr(x) a #x /* { dg-warning "-:redefined" } */ +#define astr(x) a %:x /* { dg-message "previous definition" } */ +#define astr(x) a #x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a %:x /* { dg-message "-:previous definition" } */ -#define astr(x) a # x /* { dg-warning "-:redefined" } */ +#define astr(x) a %:x /* { dg-message "previous definition" } */ +#define astr(x) a # x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a %:x /* { dg-message "-:previous definition" } */ -#define astr(x) a %: x /* { dg-warning "-:redefined" } */ +#define astr(x) a %:x /* { dg-message "previous definition" } */ +#define astr(x) a %: x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a # x /* { dg-message "-:previous definition" } */ -#define astr(x) a#x /* { dg-warning "-:redefined" } */ +#define astr(x) a # x /* { dg-message "previous definition" } */ +#define astr(x) a#x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a # x /* { dg-message "-:previous definition" } */ -#define astr(x) a%: x /* { dg-warning "-:redefined" } */ +#define astr(x) a # x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a # x /* { dg-message "-:previous definition" } */ -#define astr(x) a# x /* { dg-warning "-:redefined" } */ +#define astr(x) a # x /* { dg-message "previous definition" } */ +#define astr(x) a# x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a # x /* { dg-message "-:previous definition" } */ -#define astr(x) a%: x /* { dg-warning "-:redefined" } */ +#define astr(x) a # x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a # x /* { dg-message "-:previous definition" } */ -#define astr(x) a #x /* { dg-warning "-:redefined" } */ +#define astr(x) a # x /* { dg-message "previous definition" } */ +#define astr(x) a #x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a # x /* { dg-message "-:previous definition" } */ -#define astr(x) a %:x /* { dg-warning "-:redefined" } */ +#define astr(x) a # x /* { dg-message "previous definition" } */ +#define astr(x) a %:x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a # x /* { dg-message "-:previous definition" } */ -#define astr(x) a %: x /* { dg-warning "-:redefined" } */ +#define astr(x) a # x /* { dg-message "previous definition" } */ +#define astr(x) a %: x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a %: x /* { dg-message "-:previous definition" } */ -#define astr(x) a#x /* { dg-warning "-:redefined" } */ +#define astr(x) a %: x /* { dg-message "previous definition" } */ +#define astr(x) a#x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a %: x /* { dg-message "-:previous definition" } */ -#define astr(x) a%: x /* { dg-warning "-:redefined" } */ +#define astr(x) a %: x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a %: x /* { dg-message "-:previous definition" } */ -#define astr(x) a# x /* { dg-warning "-:redefined" } */ +#define astr(x) a %: x /* { dg-message "previous definition" } */ +#define astr(x) a# x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a %: x /* { dg-message "-:previous definition" } */ -#define astr(x) a%: x /* { dg-warning "-:redefined" } */ +#define astr(x) a %: x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a %: x /* { dg-message "-:previous definition" } */ -#define astr(x) a #x /* { dg-warning "-:redefined" } */ +#define astr(x) a %: x /* { dg-message "previous definition" } */ +#define astr(x) a #x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a %: x /* { dg-message "-:previous definition" } */ -#define astr(x) a %:x /* { dg-warning "-:redefined" } */ +#define astr(x) a %: x /* { dg-message "previous definition" } */ +#define astr(x) a %:x /* { dg-warning "redefined" } */ #undef astr -#define astr(x) a %: x /* { dg-message "-:previous definition" } */ -#define astr(x) a # x /* { dg-warning "-:redefined" } */ +#define astr(x) a %: x /* { dg-message "previous definition" } */ +#define astr(x) a # x /* { dg-warning "redefined" } */ #undef astr #define astr(x) a#x @@ -248,173 +248,173 @@ #define astr(x) a %: x #undef astr -#define cat(x,y) x##y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x##y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x##y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x## y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x##y /* { dg-message "previous definition" } */ +#define cat(x,y) x## y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x##y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x##y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x##y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x ##y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x##y /* { dg-message "previous definition" } */ +#define cat(x,y) x ##y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x##y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x %:%:y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x##y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%:y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x##y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x ## y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x##y /* { dg-message "previous definition" } */ +#define cat(x,y) x ## y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x##y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x %:%: y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x##y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%: y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x%:%:y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x##y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x%:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x##y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x%:%:y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x%:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x%:%:y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x## y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x%:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x## y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x%:%:y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x%:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x%:%:y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x ##y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x%:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x ##y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x%:%:y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x %:%:y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x%:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%:y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x%:%:y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x ## y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x%:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x ## y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x%:%:y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x %:%: y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x%:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%: y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x## y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x##y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x## y /* { dg-message "previous definition" } */ +#define cat(x,y) x##y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x## y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x## y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x## y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x## y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x## y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x ##y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x## y /* { dg-message "previous definition" } */ +#define cat(x,y) x ##y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x## y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x %:%:y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x## y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%:y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x## y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x ## y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x## y /* { dg-message "previous definition" } */ +#define cat(x,y) x ## y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x## y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x %:%: y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x## y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%: y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x%:%: y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x##y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x%:%: y /* { dg-message "previous definition" } */ +#define cat(x,y) x##y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x%:%: y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x## y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x%:%: y /* { dg-message "previous definition" } */ +#define cat(x,y) x## y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x%:%: y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x ##y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x%:%: y /* { dg-message "previous definition" } */ +#define cat(x,y) x ##y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x%:%: y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x %:%:y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x%:%: y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%:y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x%:%: y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x ## y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x%:%: y /* { dg-message "previous definition" } */ +#define cat(x,y) x ## y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x%:%: y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x %:%: y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x%:%: y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%: y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x ##y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x##y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x ##y /* { dg-message "previous definition" } */ +#define cat(x,y) x##y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x ##y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x ##y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x ##y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x## y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x ##y /* { dg-message "previous definition" } */ +#define cat(x,y) x## y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x ##y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x ##y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x ##y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x %:%:y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x ##y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%:y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x ##y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x ## y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x ##y /* { dg-message "previous definition" } */ +#define cat(x,y) x ## y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x ##y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x %:%: y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x ##y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%: y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x %:%:y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x##y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x %:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x##y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x %:%:y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x %:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x %:%:y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x## y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x %:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x## y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x %:%:y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x %:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x %:%:y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x ##y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x %:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x ##y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x %:%:y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x ## y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x %:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x ## y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x %:%:y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x %:%: y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x %:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%: y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x ## y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x##y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x ## y /* { dg-message "previous definition" } */ +#define cat(x,y) x##y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x ## y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x ## y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x ## y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x## y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x ## y /* { dg-message "previous definition" } */ +#define cat(x,y) x## y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x ## y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x ## y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x ## y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x ##y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x ## y /* { dg-message "previous definition" } */ +#define cat(x,y) x ##y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x ## y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x %:%:y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x ## y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%:y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x ## y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x %:%: y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x ## y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%: y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x %:%: y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x##y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x %:%: y /* { dg-message "previous definition" } */ +#define cat(x,y) x##y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x %:%: y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x %:%: y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x %:%: y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x## y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x %:%: y /* { dg-message "previous definition" } */ +#define cat(x,y) x## y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x %:%: y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x %:%: y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x %:%: y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x ##y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x %:%: y /* { dg-message "previous definition" } */ +#define cat(x,y) x ##y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x %:%: y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x %:%:y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x %:%: y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%:y /* { dg-warning "redefined" } */ #undef cat -#define cat(x,y) x %:%: y /* { dg-message "-:previous definition" } */ -#define cat(x,y) x ## y /* { dg-warning "-:redefined" } */ +#define cat(x,y) x %:%: y /* { dg-message "previous definition" } */ +#define cat(x,y) x ## y /* { dg-warning "redefined" } */ #undef cat #define cat(x,y) x##y @@ -442,28 +442,28 @@ #define cat(x,y) x %:%: y #undef cat -#define cat3(x,y,z) x##y##z /* { dg-message "-:previous definition" } */ -#define cat3(x,y,z) x##y####z /* { dg-warning "-:redefined" } */ +#define cat3(x,y,z) x##y##z /* { dg-message "previous definition" } */ +#define cat3(x,y,z) x##y####z /* { dg-warning "redefined" } */ #undef cat3 -#define cat3(x,y,z) x##y####z /* { dg-message "-:previous definition" } */ -#define cat3(x,y,z) x####y##z /* { dg-warning "-:redefined" } */ +#define cat3(x,y,z) x##y####z /* { dg-message "previous definition" } */ +#define cat3(x,y,z) x####y##z /* { dg-warning "redefined" } */ #undef cat3 -#define cat3(x,y,z) x##y####z /* { dg-message "-:previous definition" } */ -#define cat3(x,y,z) x##y## ##z /* { dg-warning "-:redefined" } */ +#define cat3(x,y,z) x##y####z /* { dg-message "previous definition" } */ +#define cat3(x,y,z) x##y## ##z /* { dg-warning "redefined" } */ #undef cat3 -#define cat3(x,y,z) x##y####z /* { dg-message "-:previous definition" } */ -#define cat3(x,y,z) x##y##%:%:z /* { dg-warning "-:redefined" } */ +#define cat3(x,y,z) x##y####z /* { dg-message "previous definition" } */ +#define cat3(x,y,z) x##y##%:%:z /* { dg-warning "redefined" } */ #undef cat3 -#define cat3(x,y,z) x##y######## ####z /* { dg-message "-:previous definition" } */ -#define cat3(x,y,z) x##y############z /* { dg-warning "-:redefined" } */ +#define cat3(x,y,z) x##y######## ####z /* { dg-message "previous definition" } */ +#define cat3(x,y,z) x##y############z /* { dg-warning "redefined" } */ #undef cat3 -#define cat3(x,y,z) x##y############z /* { dg-message "-:previous definition" } */ -#define cat3(x,y,z) x##y########%:%:##z /* { dg-warning "-:redefined" } */ +#define cat3(x,y,z) x##y############z /* { dg-message "previous definition" } */ +#define cat3(x,y,z) x##y########%:%:##z /* { dg-warning "redefined" } */ #undef cat3 #define cat3(x,y,z) x##y##z diff --git a/gcc/testsuite/gcc.dg/cpp/ucnid-11-utf8.c b/gcc/testsuite/gcc.dg/cpp/ucnid-11-utf8.c index 56b88f8be61..701765d1eca 100644 --- a/gcc/testsuite/gcc.dg/cpp/ucnid-11-utf8.c +++ b/gcc/testsuite/gcc.dg/cpp/ucnid-11-utf8.c @@ -4,23 +4,23 @@ /* { dg-options "-std=c99 -pedantic-errors" } */ /* Different spelling of UCN in expansion. */ -#define m1 \u00c1 /* { dg-message "-:previous definition" } */ -#define m1 Á /* { dg-error "-:redefined" } */ +#define m1 \u00c1 /* { dg-message "previous definition" } */ +#define m1 Á /* { dg-error "redefined" } */ #define m1ok Á #define m1ok Á /* Different spelling of UCN in argument name. */ -#define m2(\u00c1) /* { dg-message "-:previous definition" } */ -#define m2(Á) /* { dg-error "-:redefined" } */ +#define m2(\u00c1) /* { dg-message "previous definition" } */ +#define m2(Á) /* { dg-error "redefined" } */ #define m2ok(Á) #define m2ok(Á) /* Same spelling in argument name but different spelling when used in expansion. */ -#define m3(\u00c1) \u00c1 /* { dg-message "-:previous definition" } */ -#define m3(\u00c1) Á /* { dg-error "-:redefined" } */ +#define m3(\u00c1) \u00c1 /* { dg-message "previous definition" } */ +#define m3(\u00c1) Á /* { dg-error "redefined" } */ #define m3ok(\u00c1) Á #define m3ok(\u00c1) Á diff --git a/gcc/testsuite/gcc.dg/cpp/ucnid-11.c b/gcc/testsuite/gcc.dg/cpp/ucnid-11.c index b6956f54454..a44a3eaf421 100644 --- a/gcc/testsuite/gcc.dg/cpp/ucnid-11.c +++ b/gcc/testsuite/gcc.dg/cpp/ucnid-11.c @@ -4,23 +4,23 @@ /* { dg-options "-std=c99 -pedantic-errors" } */ /* Different spelling of UCN in expansion. */ -#define m1 \u00c1 /* { dg-message "-:previous definition" } */ -#define m1 \u00C1 /* { dg-error "-:redefined" } */ +#define m1 \u00c1 /* { dg-message "previous definition" } */ +#define m1 \u00C1 /* { dg-error "redefined" } */ #define m1ok \u00c1 #define m1ok \u00c1 /* Different spelling of UCN in argument name. */ -#define m2(\u00c1) /* { dg-message "-:previous definition" } */ -#define m2(\u00C1) /* { dg-error "-:redefined" } */ +#define m2(\u00c1) /* { dg-message "previous definition" } */ +#define m2(\u00C1) /* { dg-error "redefined" } */ #define m2ok(\u00c1) #define m2ok(\u00c1) /* Same spelling in argument name but different spelling when used in expansion. */ -#define m3(\u00c1) \u00c1 /* { dg-message "-:previous definition" } */ -#define m3(\u00c1) \u00C1 /* { dg-error "-:redefined" } */ +#define m3(\u00c1) \u00c1 /* { dg-message "previous definition" } */ +#define m3(\u00c1) \u00C1 /* { dg-error "redefined" } */ #define m3ok(\u00c1) \u00C1 #define m3ok(\u00c1) \u00C1 diff --git a/gcc/testsuite/gcc.dg/cpp/undef2.c b/gcc/testsuite/gcc.dg/cpp/undef2.c index 189a72dd9c2..f9b047b8a25 100644 --- a/gcc/testsuite/gcc.dg/cpp/undef2.c +++ b/gcc/testsuite/gcc.dg/cpp/undef2.c @@ -3,9 +3,9 @@ /* { dg-do preprocess } */ -#undef __DATE__ /* { dg-warning "-:undefining \"__DATE__\"" } */ -#undef __TIME__ /* { dg-warning "-:undefining \"__TIME__\"" } */ -#undef __FILE__ /* { dg-warning "-:undefining \"__FILE__\"" } */ +#undef __DATE__ /* { dg-warning "undefining \"__DATE__\"" } */ +#undef __TIME__ /* { dg-warning "undefining \"__TIME__\"" } */ +#undef __FILE__ /* { dg-warning "undefining \"__FILE__\"" } */ #undef __LINE__ /* { dg-warning "undefining \"__LINE__\"" } */ #undef __STDC__ /* { dg-warning "undefining \"__STDC__\"" } */ diff --git a/gcc/testsuite/gcc.dg/cpp/warn-redefined-2.c b/gcc/testsuite/gcc.dg/cpp/warn-redefined-2.c index ea5ad8170cd..3e2e57a79bb 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-redefined-2.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-redefined-2.c @@ -6,13 +6,13 @@ // { dg-bogus "__TIME__ builtin is not defined" "no-time" { target *-*-* } .-1 } #endif -#define __TIME__ "X" // { dg-error "-:\"__TIME__\" redefined .-Werror=builtin-macro-redefined." } +#define __TIME__ "X" // { dg-error "\"__TIME__\" redefined .-Werror=builtin-macro-redefined." } #define __TIME__ "Y" // { dg-bogus "-Wbuiltin-macro-redefined" } - // { dg-warning "-:\"__TIME__\" redefined" "not-builtin-1" { target *-*-* } .-1 } - // { dg-message "-:previous definition" "previous-1" { target *-*-* } 9 } + // { dg-warning "\"__TIME__\" redefined" "not-builtin-1" { target *-*-* } .-1 } + // { dg-message "previous definition" "previous-1" { target *-*-* } 9 } #define X "X" #define X "Y" // { dg-bogus "-Wbuiltin-macro-redefined" } - // { dg-warning "-:\"X\" redefined" "not-builtin-2" { target *-*-* } .-1 } - // { dg-message "-:previous definition" "previous-2" { target *-*-* } 15 } + // { dg-warning "\"X\" redefined" "not-builtin-2" { target *-*-* } .-1 } + // { dg-message "previous definition" "previous-2" { target *-*-* } 15 } diff --git a/gcc/testsuite/gcc.dg/cpp/warn-redefined.c b/gcc/testsuite/gcc.dg/cpp/warn-redefined.c index e0446689706..c562d072e40 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-redefined.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-redefined.c @@ -6,13 +6,13 @@ // { dg-bogus "__TIME__ builtin is not defined" "no-time" { target *-*-* } .-1 } #endif -#define __TIME__ "X" // { dg-warning "-:\"__TIME__\" redefined .-Wbuiltin-macro-redefined." } +#define __TIME__ "X" // { dg-warning "\"__TIME__\" redefined .-Wbuiltin-macro-redefined." } #define __TIME__ "Y" // { dg-bogus "-Wbuiltin-macro-redefined" } - // { dg-warning "-:\"__TIME__\" redefined" "not-builtin-1" { target *-*-* } .-1 } - // { dg-message "-:previous definition" "previous-1" { target *-*-* } 9 } + // { dg-warning "\"__TIME__\" redefined" "not-builtin-1" { target *-*-* } .-1 } + // { dg-message "previous definition" "previous-1" { target *-*-* } 9 } #define X "X" #define X "Y" // { dg-bogus "-Wbuiltin-macro-redefined" } - // { dg-warning "-:\"X\" redefined" "not-builtin-2" { target *-*-* } .-1 } - // { dg-message "-:previous definition" "previous-2" { target *-*-* } 15 } + // { dg-warning "\"X\" redefined" "not-builtin-2" { target *-*-* } .-1 } + // { dg-message "previous definition" "previous-2" { target *-*-* } 15 } diff --git a/gcc/testsuite/gcc.dg/cpp/warn-unused-macros-2.c b/gcc/testsuite/gcc.dg/cpp/warn-unused-macros-2.c index f82d67fe9c2..7c3efe05351 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-unused-macros-2.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-unused-macros-2.c @@ -1,4 +1,4 @@ // { dg-do preprocess } // { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=unused-macros" } /* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ -#define X X // { dg-error "-:macro \"X\" is not used .-Werror=unused-macros." } +#define X X // { dg-error "9:macro \"X\" is not used .-Werror=unused-macros." } diff --git a/gcc/testsuite/gcc.dg/cpp/warn-unused-macros.c b/gcc/testsuite/gcc.dg/cpp/warn-unused-macros.c index b18f506b13b..74df23971a9 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-unused-macros.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-unused-macros.c @@ -1,4 +1,4 @@ // { dg-do preprocess } // { dg-options "-std=gnu99 -fdiagnostics-show-option -Wunused-macros" } -#define X X // { dg-warning "-:macro \"X\" is not used .-Wunused-macros." } +#define X X // { dg-warning "9:macro \"X\" is not used .-Wunused-macros." } diff --git a/libcpp/directives.cc b/libcpp/directives.cc index 9dc4363c65a..63fe6a3be0b 100644 --- a/libcpp/directives.cc +++ b/libcpp/directives.cc @@ -655,6 +655,10 @@ do_define (cpp_reader *pfile) if (node) { + /* This is a better location than pfile->directive_line to store + as the macro location. */ + const location_t name_loc = cpp_diagnostic_get_current_location (pfile); + /* If we have been requested to expand comments into macros, then re-enable saving of comments. */ pfile->state.save_comments = @@ -663,7 +667,7 @@ do_define (cpp_reader *pfile) if (pfile->cb.before_define) pfile->cb.before_define (pfile); - if (_cpp_create_definition (pfile, node)) + if (_cpp_create_definition (pfile, node, name_loc)) if (pfile->cb.define) pfile->cb.define (pfile, pfile->directive_line, node); @@ -694,9 +698,8 @@ do_undef (cpp_reader *pfile) "undefining \"%s\"", NODE_NAME (node)); else if (cpp_builtin_macro_p (node) && CPP_OPTION (pfile, warn_builtin_macro_redefined)) - cpp_warning_with_line (pfile, CPP_W_BUILTIN_MACRO_REDEFINED, - pfile->directive_line, 0, - "undefining \"%s\"", NODE_NAME (node)); + cpp_warning (pfile, CPP_W_BUILTIN_MACRO_REDEFINED, + "undefining \"%s\"", NODE_NAME (node)); if (node->value.macro && CPP_OPTION (pfile, warn_unused_macros)) @@ -2637,7 +2640,7 @@ cpp_pop_definition (cpp_reader *pfile, struct def_pragma_macro *c) { _cpp_clean_line (pfile); nbuf->sysp = 1; - if (!_cpp_create_definition (pfile, h)) + if (!_cpp_create_definition (pfile, h, 0)) abort (); _cpp_pop_buffer (pfile); } diff --git a/libcpp/internal.h b/libcpp/internal.h index badfd1b40da..7da72d3bd5c 100644 --- a/libcpp/internal.h +++ b/libcpp/internal.h @@ -686,7 +686,7 @@ inline bool _cpp_maybe_notify_macro_use (cpp_reader *pfile, cpp_hashnode *node, } extern cpp_macro *_cpp_new_macro (cpp_reader *, cpp_macro_kind, void *); extern void _cpp_free_definition (cpp_hashnode *); -extern bool _cpp_create_definition (cpp_reader *, cpp_hashnode *); +extern bool _cpp_create_definition (cpp_reader *, cpp_hashnode *, location_t); extern void _cpp_pop_context (cpp_reader *); extern void _cpp_push_text_context (cpp_reader *, cpp_hashnode *, const unsigned char *, size_t); diff --git a/libcpp/macro.cc b/libcpp/macro.cc index 7d5a0d0fd2e..6a6d5f84a46 100644 --- a/libcpp/macro.cc +++ b/libcpp/macro.cc @@ -3819,7 +3819,8 @@ _cpp_new_macro (cpp_reader *pfile, cpp_macro_kind kind, void *placement) /* Parse a macro and save its expansion. Returns nonzero on success. */ bool -_cpp_create_definition (cpp_reader *pfile, cpp_hashnode *node) +_cpp_create_definition (cpp_reader *pfile, cpp_hashnode *node, + location_t name_loc) { cpp_macro *macro; @@ -3831,6 +3832,13 @@ _cpp_create_definition (cpp_reader *pfile, cpp_hashnode *node) if (!macro) return false; + /* _cpp_new_macro () has set macro->line to pfile->directive_line, which + denotes the line containing the #define with no column information. If + provided, change to name_loc, which will be the token src_loc for the + macro name, including the location and range information. */ + if (name_loc) + macro->line = name_loc; + if (cpp_macro_p (node)) { if (CPP_OPTION (pfile, warn_unused_macros)) @@ -3844,7 +3852,7 @@ _cpp_create_definition (cpp_reader *pfile, cpp_hashnode *node) bool warned = cpp_pedwarning_with_line (pfile, reason, - pfile->directive_line, 0, + macro->line, 0, "\"%s\" redefined", NODE_NAME (node)); if (warned && cpp_user_macro_p (node)) diff --git a/libcpp/pch.cc b/libcpp/pch.cc index 9aa589a044e..5638ffdd637 100644 --- a/libcpp/pch.cc +++ b/libcpp/pch.cc @@ -838,7 +838,7 @@ cpp_read_state (cpp_reader *r, const char *name, FILE *f, != NULL) { _cpp_clean_line (r); - if (!_cpp_create_definition (r, h)) + if (!_cpp_create_definition (r, h, 0)) abort (); _cpp_pop_buffer (r); }