This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 2/2] Documentation hyperlinks for [-Wname-of-option] (PR 87488)
- From: Bernd Edlinger <bernd dot edlinger at hotmail dot de>
- To: David Malcolm <dmalcolm at redhat dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 12 Oct 2019 15:31:40 +0000
- Subject: Re: [PATCH 2/2] Documentation hyperlinks for [-Wname-of-option] (PR 87488)
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nIz79+SSZ2cp6X8T05EuoLGpqzlhdniaEZmQ4gls36w=; b=jMd1BQrvWmYUvCVHGkvCZT7z0OdRmH+XcGdDpB0yb1XF++ul5l2l8WC2AdVLN5hKNAYCSH0pfl8clLSdzPPGy0YzNFNxShTj/n8NEz3ZiQ+9FZP3X0q01tFqK6kb0Rkhipfk1VEZwicmoT1NpetxegCTMDd9CXUG0/ZfkOlQIK+Lj1VQHRRP6NBL2to9PnA7olSI1acTOFzP9OMs64FoH+Q1P5+ZA7Zb8gVGkG+gn9lwoyIlaqwpVVhiOO+M9qKS6THyttNtSLrom3QlBqHG/+6zyKfEljT4F2bLomU6D8nFsJvvs8uTtvK7qigAl9RLUUj/IvZUPBCW9f1yZ36dMQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K7y35SRDfqOO+Joh3MneAwKZ16Xa7OqtNRq9CVNaxIBGZTFofWsjAPurJvF5BDP+P+llT33b9SKsGB4JMDXUNA/1J+uEdldYUNdl9XATBHjB9UTbzj9KIZc12E8QqY2WI7g8JGmQnMSnoIsyKTjU3bgp622qqHkRv62yMaE9yOE/3YgD9AIZVSKMHJyycIhkx7ds4hG8GQjT1T+4qT1p/VIKisNLJJlS43I0HWgDD/cFSFiE0S3y+s4Km4sEAuy0QcYsQi1MHZjAWVKSRp+Y6cjK+/kK/qtLqY7zBG+33x11QlQrJvb2AQN7mdjXNxh2NBWOvRIXo6u06Y2y17Tw+Q==
- References: <VI1PR03MB4528ACC2E77EE416A2365B94E4960@VI1PR03MB4528.eurprd03.prod.outlook.com> <232f309fbdf9ff0ec7889e89f394979f9b55a75e.camel@redhat.com>
On 10/12/19 4:21 PM, David Malcolm wrote:
> 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?
>
Yes, the URL is
"https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wshadow-Wshadow"
> Which terminal (and version) are you seeing this with? (if gnome
> terminal, which vte version?)
>
I think the process that hosts the "Terminal" is
/usr/bin/xfce4-terminal
The a Help/About menu says:
xfce4-terminal 0.6.3
> What happens if you try this at the terminal:
>
> printf '\e]8;;http://example.com\e\\This is a link\e]8;;\e\\\n'
>
I see this:
]8;;http://example.comThis is a link]8;;
the ] is actually a little square with little 0101 in it.
again the URL is copied. This time it is "http://example.comThis"
> (hopefully that doesn't get mangled by my mailer; this is the example
> from:
> https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
> )
>
Both show the same info.
> 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.
>
I wonder why this is not done with a ncurses function?
In case it helps this is the environment I have:
$ export
declare -x CLUTTER_IM_MODULE="xim"
declare -x COLORTERM="xfce4-terminal"
declare -x DBUS_SESSION_BUS_ADDRESS="unix:abstract=/tmp/dbus-Wh3VZkTGvf"
declare -x DEFAULTS_PATH="/usr/share/gconf/ubuntustudio.default.path"
declare -x DESKTOP_SESSION="ubuntustudio"
declare -x DISPLAY=":0.0"
declare -x GDMSESSION="ubuntustudio"
declare -x GDM_LANG="de_DE"
declare -x GLADE_CATALOG_PATH=":"
declare -x GLADE_MODULE_PATH=":"
declare -x GLADE_PIXMAP_PATH=":"
declare -x GNOME_KEYRING_CONTROL="/run/user/1000/keyring-V870cQ"
declare -x GNOME_KEYRING_PID="1770"
declare -x GPG_AGENT_INFO="/run/user/1000/keyring-V870cQ/gpg:0:1"
declare -x GTK_IM_MODULE="xim"
declare -x HOME="/home/ed"
declare -x IM_CONFIG_PHASE="1"
declare -x INSTANCE=""
declare -x JOB="dbus"
declare -x LANG="de_DE.UTF-8"
declare -x LANGUAGE="de_DE"
declare -x LESSCLOSE="/usr/bin/lesspipe %s %s"
declare -x LESSOPEN="| /usr/bin/lesspipe %s"
declare -x LOGNAME="ed"
declare -x LS_COLORS="rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:"
declare -x MANDATORY_PATH="/usr/share/gconf/ubuntustudio.mandatory.path"
declare -x OLDPWD
declare -x PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
declare -x PWD="/home/ed"
declare -x QT4_IM_MODULE="xim"
declare -x SELINUX_INIT="YES"
declare -x SESSION="ubuntustudio"
declare -x SESSIONTYPE=""
declare -x SESSION_MANAGER="local/w-ed:@/tmp/.ICE-unix/1891,unix/w-ed:/tmp/.ICE-unix/1891"
declare -x SHELL="/bin/bash"
declare -x SHLVL="1"
declare -x SSH_AGENT_PID="1911"
declare -x SSH_AUTH_SOCK="/tmp/ssh-M2NF9s1ZmbAq/agent.1910"
declare -x TERM="xterm"
declare -x TEXTDOMAIN="im-config"
declare -x TEXTDOMAINDIR="/usr/share/locale/"
declare -x UPSTART_EVENTS="started xsession"
declare -x UPSTART_INSTANCE=""
declare -x UPSTART_JOB="startxfce4"
declare -x UPSTART_SESSION="unix:abstract=/com/ubuntu/upstart-session/1000/1773"
declare -x USER="ed"
declare -x WINDOWID="56623795"
declare -x XAUTHORITY="/home/ed/.Xauthority"
declare -x XDG_CONFIG_DIRS="/etc/xdg/xdg-ubuntustudio:/usr/share/upstart/xdg:/etc/xdg:/etc/xdg"
declare -x XDG_CURRENT_DESKTOP="XFCE"
declare -x XDG_DATA_DIRS="/usr/share/ubuntustudio:/usr/share/xfce4:/usr/local/share/:/usr/share/:/usr/share"
declare -x XDG_GREETER_DATA_DIR="/var/lib/lightdm-data/ed"
declare -x XDG_MENU_PREFIX="xfce-"
declare -x XDG_RUNTIME_DIR="/run/user/1000"
declare -x XDG_SEAT="seat0"
declare -x XDG_SEAT_PATH="/org/freedesktop/DisplayManager/Seat0"
declare -x XDG_SESSION_ID="c2"
declare -x XDG_SESSION_PATH="/org/freedesktop/DisplayManager/Session0"
declare -x XDG_VTNR="7"
declare -x XMODIFIERS="@im=none"
>
>> 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)
>
Yes, me too.
>
> 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.
>
I think the "=" in =local may be a problem, the html page
would need
https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wshadow_003dlocal
However when it works the browser jumps just 2 lines too far down,
so you don't see the headline anymore, and you don't know what warning is described
here.
> Thanks again for the report.
>
>
> Is this working/broken for other people?
>
> Thanks
> Dave
>
Thanks
Bernd.