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 87CCF385AC33 for ; Wed, 27 Jul 2022 17:28:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 87CCF385AC33 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.93,196,1654588800"; d="scan'208";a="80416632" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 27 Jul 2022 09:28:26 -0800 IronPort-SDR: Uce30H4nJ8zCrw8KvQsecJsLZ1SpwAB0dQ2enwlVJCGwPQVO+gdd4DuT9ROAf9aLD1nJsrrM9r Lfj3t99F4BaAnNDB5HS5Ve+iFBeFJh8VPxDUfpusJx6TRStPKczQXZP/11B93MUUNtQjp44bJw ZjL7c7tEGL/0XsXgfZUXfyGgyplyx9mj+s5M7s9gng2Uq6RmPKhreytyfgDpudp5PSB0ZWp5RW ncFMn2x4QVBpACAswkQ1mUYqAseB27Oq0aKxOQfbLZhn8f42Dskz53mvmGnyXABtteGBOFbgCC Zrc= Date: Wed, 27 Jul 2022 17:28:20 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: Lewis Hyatt CC: Subject: Re: [PATCH] preprocessor: Set input_location to the most recently seen token In-Reply-To: <20220711211719.GA61164@ldh-imac.local> Message-ID: References: <20220711211719.GA61164@ldh-imac.local> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) 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=-3112.2 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no 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-List-Received-Date: Wed, 27 Jul 2022 17:28:31 -0000 On Mon, 11 Jul 2022, Lewis Hyatt via Gcc-patches wrote: > Hello- > > As discussed here: > https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598136.html > > Here is another short patch that improves "#pragma GCC diagnostic" handling. > Longer term, it will be desirable to make the handling of this pragma > independent of the global input_location. But in the meantime, some glitches > like this one can be readily addressed by making input_location point to > something better. In this case, input_location during preprocessing (-E or > -save-temps) is made to point to the most recently seen token rather than the > beginning of the file. To the best of my knowledge, nothing else besides > "#pragma GCC diagnostic" handling can observe input_location during > token streaming, so this is expected not to have any other > repercussions. Bootstrap + regtest does look clean on x86-64 Linux. > > By the way, the new testcase fails when compiled with C++, but it's not > because of pragma handling, it's rather because the C++ frontend changes the > location on the warning to the wrong place. Once done_lexing has been set to > true, it changes the location of all warnings to input_location, however > that's not correct when the location is the cached location of a macro > definition; the original location is preferable. I will file a separate PR > about that, and have xfailed that testcase for now, since I am not quite there > with grokking the reason it behaves this way, and anyway it's not related to > this 1-line fix for gcc -E. > > Please let me know how it looks? Thanks! OK. -- Joseph S. Myers joseph@codesourcery.com