From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4269 invoked by alias); 16 Dec 2015 18:33:25 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 4259 invoked by uid 89); 16 Dec 2015 18:33:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:1494, pain X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 16 Dec 2015 18:33:24 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 3FCF5C0B9304; Wed, 16 Dec 2015 18:33:23 +0000 (UTC) Received: from [10.3.238.63] (vpn-238-63.phx2.redhat.com [10.3.238.63]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tBGIXMik014101; Wed, 16 Dec 2015 13:33:22 -0500 Message-ID: <1450290801.1916.45.camel@surprise> Subject: Re: [PATCH] Better error recovery for merge-conflict markers (v5) From: David Malcolm To: Bernd Schmidt Cc: gcc-patches@gcc.gnu.org, Joseph Myers , Jason Merrill Date: Wed, 16 Dec 2015 18:33:00 -0000 In-Reply-To: <5670A7CF.6010005@redhat.com> References: <563A0E7D.3070804@redhat.com> <1450207837-18324-1-git-send-email-dmalcolm@redhat.com> <5670A7CF.6010005@redhat.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-12/txt/msg01648.txt.bz2 On Wed, 2015-12-16 at 00:52 +0100, Bernd Schmidt wrote: > On 12/15/2015 08:30 PM, David Malcolm wrote: > > > I got thinking about what we'd have to do to support Perforce-style > > markers, and began to find my token-matching approach to be a little > > clunky (in conjunction with reading Martin's observations on > > c_parser_peek_nth_token). > > > > Here's a reimplementation of the patch which takes a much simpler > > approach, and avoids the need to touch the C lexer: check that we're > > not in a macro expansion and then read in the source line, and > > textually compare against the various possible conflict markers. > > This adds the requirement that the source file be readable, so it > > won't detect conflict markers in a .i file from -save-temps, > > How come? Is source file defined as the one before preprocessing? Yes, unless you manually strip the #line directives. So unless the original source files are still around in the right path relative to where you're compiling the .i file, the calls to location_get_source_line will fail. > And I do think this is an unfortunate limitation (given that we often > load .i files into cc1 for debugging and we'd ideally like that to be > consistent with normal compilation as much as possible). I'd rather go > with the original patch based on this. (nods) This can be a pain when debugging diagnostic_show_locus, but there's not much that can be done about it.