On Mon, Jul 13, 2020 at 03:04:20PM -0400, David Malcolm wrote: > > +@item -fdiagnostics-column-unit=@var{UNIT} > > +@opindex fdiagnostics-column-unit > > +Select the units for the column number. This affects traditional > > diagnostics > > +(in the absence of @option{-fno-show-column}), as well as JSON format > > +diagnostics if requested. > > + > > +The default @var{UNIT}, @samp{display}, considers the number of display > > +columns occupied by each character. This may be larger than the number > > +of bytes required to encode the character, in the case of tab > > +characters, or it may be smaller, in the case of multibyte characters. > > +For example, the character ``@U{03C0}'' occupies one display column, > > +and its UTF-8 encoding requires two bytes; the character ``@U{1F642}'' > > +occupies two display columns, and its UTF-8 encoding requires four > > +bytes. > > Thanks for reworking this. > > I'm wary of those @U commands - does the generated HTML from "make > html" work? (similarly for the man page). Would it be safer to express > them in the following form? > > For example, the character ``GREEK SMALL LETTER PI (U+03C0)'' occupies one > display column, and its UTF-8 encoding requires two bytes; the character > ``SLIGHTLY SMILING FACE' (U+1F642)'' occupies two display columns, and > its UTF-8 encoding requires four bytes. > > or somesuch?
The HTML works, yes, but I hadn't thought to check the man page. Seems the @U notation is carried through unmodified there, which isn't so clear. I changed it to your suggestion, no need to overcomplicate it. > > > +Setting @var{UNIT} to @samp{byte} changes the column number to the raw byte > > +count in all cases, as was traditionally output by GCC prior to version > > 11.1.0. > > [...snip...] > > > @item -fdiagnostics-format=@var{FORMAT} > > @opindex fdiagnostics-format > > Select a different format for printing diagnostics. > > @@ -4764,11 +4791,15 @@ might be printed in JSON form (after formatting) > > like this: > > "locations": [ > > @{ > > "caret": @{ > > + "display-column": 3, > > + "byte-column": 3, > > "column": 3, > > "file": "misleading-indentation.c", > > "line": 15 > > @}, > > "finish": @{ > > + "display-column": 4, > > + "byte-column": 4, > > "column": 4, > > "file": "misleading-indentation.c", > > "line": 15 > > Nit: the new fields don't line up with the old ones. > > > @@ -4784,6 +4815,8 @@ might be printed in JSON form (after formatting) like > > this: > > "locations": [ > > @{ > > "caret": @{ > > + "display-column": 5, > > + "byte-column": 5, > > "column": 5, > > "file": "misleading-indentation.c", > > "line": 17 > > Likewise. You are referring to the source code as opposed to the generated HTML, correct? Both look fine to me, I think above effect is due to mixed tabs+spaces convention in the git diff ironically :). I'll make sure it looks right in any case. > > [...snip...] > > > diff --git a/gcc/opts.c b/gcc/opts.c > > index 340d99434b3..525f44d079f 100644 > > --- a/gcc/opts.c > > +++ b/gcc/opts.c > > @@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see > > #include "opt-suggestions.h" > > #include "diagnostic-color.h" > > #include "selftest.h" > > +#include "cpplib.h" > > Is this new #include still needed? > > [...snip...] > > > OK for trunk with those nits fixed. > > Dave > > Thanks again for your time! I will address the above and then push in a day or two. -Lewis