On Sat, 2019-10-12 at 07:00 +0000, Bernd Edlinger wrote:
> Hi David,
> 
> I just wanted to say that this does not work right on ubuntu 14.04 at
> least:
> 
> g++ -Wshadow=local -Wno-shadow=compatible-local -S Wshadow-1.c 
> Wshadow-1.c: In function 'void foo(int*, int*)':
> Wshadow-1.c:8:9: warning: declaration of 'int d' shadows a parameter
> []8;;
> https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wshadow=local-Wshadow=local]8
> ;;]
>     8 |     int d = 0;             /* { dg-warning "Wshadow=local" }
> */
>       |         ^
> Wshadow-1.c:4:23: note: shadowed declaration is here
>     4 | void foo(int *c, int *d)   /* { dg-bogus   "Wshadow" } */
>       |                  ~~~~~^
> Wshadow-1.c: In function 'void bar(int*, int*)':
> Wshadow-1.c:15:15: warning: declaration of 'c' shadows a global
> declaration []8;;
> https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wshadow-Wshadow]8
> ;;]
>    15 | void bar(int *c, int *d)   /* { dg-warning "Wshadow" } */
>       |          ~~~~~^
> Wshadow-1.c:3:5: note: shadowed declaration is here
>     3 | int c;
>       |     ^
> Wshadow-1.c:19:9: warning: declaration of 'int d' shadows a parameter
> []8;;
> https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wshadow-Wshadow]8
> ;;]
>    19 |     int d = 0;             /* { dg-warning "Wshadow" } */
>       |         ^
> Wshadow-1.c:15:23: note: shadowed declaration is here
>    15 | void bar(int *c, int *d)   /* { dg-warning "Wshadow" } */
>       |                  ~~~~~^
> Wshadow-1.c:22:10: warning: declaration of 'e' shadows a previous
> local []8;;
> https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wshadow-Wshadow]8
> ;;]
>    22 |     int *e = 0;            /* { dg-warning "Wshadow" } */
>       |          ^
> Wshadow-1.c:17:8: note: shadowed declaration is here
>    17 |   int *e = d;
>       |        ^
> 
> Coloring works, even the hyperlinks seem to work, when clicked at,
> although they jump just
> to the top of the page, and one has to scroll down to the warning
> manually.
> But the warning name is very hard to spot in all that glibberish long
> text :-(

Thanks for the report.

Bother.

There are (at least) two issues here.

(a) It sounds like your terminal doesn't handle the escape sequence my
patch is emitting.  The expected outcome is that the terminal embeds
this URL:

https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wshadow=local

within:

[-Wshadow=local]

i.e. equivalent to:

[<a href="
https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wshadow=local";</a>
;;]

It seems like instead it's displaying this:

https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wshadow=local-Wshadow=local%1B]8

When you say "even the hyperlinks seem to work" it seems like that URL
fragment is being handled by the terminal's regular "look for URLs in
the text" logic.

Does your terminal have a "Copy URL" option (perhaps on a right-click
menu)?  If so, what URL is copied?

Which terminal (and version) are you seeing this with?  (if gnome
terminal, which vte version?)

What happens if you try this at the terminal:

  printf '\e]8;;http://example.com\e\\This is a link\e]8;;\e\\\n'

(hopefully that doesn't get mangled by my mailer; this is the example
from:
  https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
)

I don't yet know if there's a way to query the terminal to see if the
escape is supported.  My hope was that they would be silently
discarded.


> Do you see a way to find out if the escape sequences are supported,
> or how to disable this function per configure option?

Do you mean a GCC configure-time option to change the default?  We have
that for colors; we could add one for URLs.  (Though I'd prefer to know
more about the scope of the problem first)


The other problem:

(b) The URL itself is wrong; for this option it ought to be:

https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wshadow

(i.e. without the "=local").   As noted by Manu it sounds like the
implementation needs to be smarter about generating URLs.

Thanks again for the report.


Is this working/broken for other people?

Thanks
Dave

Reply via email to