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.