bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#25987: 25.2; support gcc fixit notes


From: David Malcolm
Subject: bug#25987: 25.2; support gcc fixit notes
Date: Tue, 20 Oct 2020 10:52:05 -0400
User-agent: Evolution 3.36.5 (3.36.5-1.fc32)

On Tue, 2020-10-13 at 17:37 +0300, Eli Zaretskii wrote:
> > From: David Malcolm <dmalcolm@redhat.com>
> > Cc: 25987@debbugs.gnu.org
> > Date: Mon, 12 Oct 2020 18:27:29 -0400
> > 
> > I like how -fdiagnostics-parseable-fixits adds extra lines of
> > output,
> > with a prefix that's ought to be easy to detect.
> 
> Yes, I think that's preferable, indeed.
> 
> > BTW, does Emacs set anything in the environment that GCC could
> > detect?
> 
> Yes, Emacs sets INSIDE_EMACS when it runs a sub-process.
> 
> > Does Emacs have an automated test suite that could test this
> > feature?
> 
> Yes, see the tests in the test/ subdirectory of the Emacs tree.
> 
> > Another complication to consider: the locations in a fix-it hint
> > refer
> > to the original source file, before any changes are made.  If the
> > user
> > interface supports the user e.g. clicking on fix-it hints and
> > selectively apply them one by one, then after each fix-it hint is
> > applied, all locations after that point potentially need to be
> > "fixed
> > up" somehow, to reflect the changes to the buffer.
> 
> That could be handled automatically by defining a marker at each
> hint's location, then they will move as text is edited.

Thanks Eli and Andrea.

I've implemented a proof-of-concept of this.

I'm attaching the patch for discussion/review purposes (it probably
doesn't quite apply cleanly to gcc master as I had some other
diagnostic stuff in that working copy; it also hasn't yet been
subjected to the usual testing for a gcc patch).

I'm also attaching the stderr with
  GCC_EXTRA_DIAGNOSTIC_OUTPUT=fixits-v2
in the env when using the patched gcc to compile the demo.c file from
message #82.

Hopefully the output looks consumable by Emacs.

One possible issue: in the final diagnostic, there's a fix-it hint with
non-ASCII replacement text, replacing "two_pi" with "two_π" (where the
final char in the latter is GREEK SMALL LETTER PI, U+03C0)

This replacement currently expressed as encoded bytes i.e:

fix-it:"demo.c":{51:10-51:16}:"two_\317\200"

where \317\200 is the octal-escaped representation of the two bytes of
the UTF-8 encoding of the character.

Is this going to work for Emacs?

Dave

Attachment: demo.out
Description: Text document

Attachment: 0001-Add-GCC_EXTRA_DIAGNOSTIC_OUTPUT-environment-variable.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]