Message ID | CAFiYyc0dLpM_zwRB2JJVySY3NwKhaYKxr9DTSS=smjO84ioKxg@mail.gmail.com |
---|---|
State | New |
Headers | show |
On 03/23/2016 01:41 PM, Richard Biener wrote: > Btw, the issue in the PR is also fixed with a simple > > Index: libcpp/line-map.c > =================================================================== > --- libcpp/line-map.c (revision 234415) > +++ libcpp/line-map.c (working copy) > @@ -543,7 +543,7 @@ linemap_add (struct line_maps *set, enum > to_file); > > /* A TO_FILE of NULL is special - we use the natural values. */ > - if (error || to_file == NULL) > + if (to_file == NULL) > { > to_file = ORDINARY_MAP_FILE_NAME (from); > to_line = SOURCE_LINE (from, from[1].start_location); I looked at that, but that made it hard to add the testcase as the line numbers no longer match the dg-error directives. By moving this code we can ignore the erroneous #line directive, and for this one testcase at least, that makes the line numbers (and caret diagnostics etc.) come out right. Bernd
On Wed, Mar 23, 2016 at 2:15 PM, Bernd Schmidt <bschmidt@redhat.com> wrote: > On 03/23/2016 01:41 PM, Richard Biener wrote: >> >> Btw, the issue in the PR is also fixed with a simple >> >> Index: libcpp/line-map.c >> =================================================================== >> --- libcpp/line-map.c (revision 234415) >> +++ libcpp/line-map.c (working copy) >> @@ -543,7 +543,7 @@ linemap_add (struct line_maps *set, enum >> to_file); >> >> /* A TO_FILE of NULL is special - we use the natural values. */ >> - if (error || to_file == NULL) >> + if (to_file == NULL) >> { >> to_file = ORDINARY_MAP_FILE_NAME (from); >> to_line = SOURCE_LINE (from, from[1].start_location); > > > I looked at that, but that made it hard to add the testcase as the line > numbers no longer match the dg-error directives. By moving this code we can > ignore the erroneous #line directive, and for this one testcase at least, > that makes the line numbers (and caret diagnostics etc.) come out right. After some more digging and looking at your patch I'd approve that if it would emit a warning rather than an error - so can you please adjust it? Thanks, Richard. > > Bernd
Index: libcpp/line-map.c =================================================================== --- libcpp/line-map.c (revision 234415) +++ libcpp/line-map.c (working copy) @@ -543,7 +543,7 @@ linemap_add (struct line_maps *set, enum to_file); /* A TO_FILE of NULL is special - we use the natural values. */ - if (error || to_file == NULL) + if (to_file == NULL) { to_file = ORDINARY_MAP_FILE_NAME (from); to_line = SOURCE_LINE (from, from[1].start_location);