[PATCH diagnostics/fortran] Handle two locations for the same diagnostic. Convert all gfc_warning_1 and gfc_notify_std_1 calls

Tobias Burnus tobias.burnus@physik.fu-berlin.de
Wed May 6 07:21:00 GMT 2015


Dear all,

Dodji: The gcc/*.[ch] part is your realm.
David: I added you as CC because you looked into fancier diagnostics before

Manuel López-Ibáñez wrote:
> The Fortran FE allows diagnostics with two different locations. [...]
> This is the last remaining issue

Thanks for working on this - and sorry for the slow review.

> In addition, I added a new function gfc_warning_at to pass an explicit
> location. I think this is better than having another %-code in
> gfc_format_decoder. As you can see in that function, we are now doing
> a lot of work just to print (1) and (2), when the location_t could
> simply be passed explicitly to the diagnostic functions and replace
> all %L and %C with explicit (1) and (2) in the calls. This will remove
> completely gfc_format_decoder. But I'll leave that to Fortran devs if
> they are interested in going that route.

Yes, that would be a possibility. I am not completely sure how much it
would help at the call side/localization but for error.c it would
surely be a nice cleanup. Let's defer this.

> I had to decide what to print for -fno-diagnostics-show-caret and
> multiple locations. It has to be something that can be distinguished
> from a duplicate diagnostic, such that the testsuite can parse it as
> such. I chose to print:

I think that's okay. It's still readable and the "at (1)" wording is
hard-coded in the message - thus, one has not that much leeway.

> Bootstrapped and regression tested on x86_64-linux-gnu.
> OK?

The Fortran part looks good to me. Thanks!

Tobias



More information about the Gcc-patches mailing list