On 10/18/24 3:35 PM, Tobias Burnus wrote:
This patch was motivated by David's talk at Cauldron – and by
getting rather bad locations for some diagnostics, where I wanted
to use the column number to ensure that all items are found.

The main problem was a missing gobbling of spaces, but still
ranges are way nicer. As gfortran uses the common system, that
was trivial - except that during parsing something else is used
and that therefore need to support two formats, which required
a few changes. Still, it is rather non invasive and I think for
trans*.cc is also does a nice cleanup.

Unsurprisingly, there are more opportunities, both for fixing
the location issues due to treating whitespace and ranges instead
of a single locus; however, a single location is also fine. Note
that for 'a + b' the locus could be '~~1~~', i.e. pointing at '+'
but spanning the whole expression. Talking about unused features:
besides 'inform' we could also use fixit hints, providing patches.
And I note that gfc_error also supports %qD or %qE or ... to print
trees.

But back to this patch, an example is the following:

    27 |   deallocate(ALLOCS(1))
       |              1~~~~~~~~
Error: Allocate-object at (1) must be ALLOCATABLE or a POINTER

Tested on x86_64-gnu-linux.
Comments, suggestions, remarks?
OK for mainline?

After scanning through the whole long patch I think I get the pattern of it.

Looks Good To Me,  OK.

Jerry



Tobias

PS: Andre remarked that there was some issue, logged somewhere
in Bugzilla, due to the old/current handling of locations. I
have not searched Bugzilla and, thus, have no idea whether it
helps or not. Presumably not.

Reply via email to