GNU bug report logs - #25987
25.2; support gcc fixit notes

Previous Next

Package: emacs;

Reported by: Tom Tromey <tom <at> tromey.com>

Date: Sun, 5 Mar 2017 21:49:01 UTC

Severity: wishlist

Merged with 29004

Found in versions 25.2, 27.0.50

Full log


View this message in rfc822 format

From: David Malcolm <dmalcolm <at> redhat.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 25987 <at> debbugs.gnu.org
Subject: bug#25987: 25.2; support gcc fixit notes
Date: Tue, 20 Oct 2020 10:52:05 -0400
[Message part 1 (text/plain, inline)]
On Tue, 2020-10-13 at 17:37 +0300, Eli Zaretskii wrote:
> > From: David Malcolm <dmalcolm <at> redhat.com>
> > Cc: 25987 <at> 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
[demo.out (text/plain, attachment)]
[0001-Add-GCC_EXTRA_DIAGNOSTIC_OUTPUT-environment-variable.patch (text/x-patch, attachment)]

This bug report was last modified 4 years and 248 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.