Fix warning URLs for Fortran and analyzer [PR 92830]
authorDavid Malcolm <dmalcolm@redhat.com>
Thu, 5 Dec 2019 19:47:35 +0000 (14:47 -0500)
committerDavid Malcolm <dmalcolm@redhat.com>
Mon, 27 Apr 2020 19:02:57 +0000 (15:02 -0400)
commitfa29cf0c3f19b648e30b16fd2485c3c17a528a6e
tree887f4679b10686e6d407e49c3815f8f0c4666601
parent76458c912b0cdda59e094fa64b98aea9ffee214a
Fix warning URLs for Fortran and analyzer [PR 92830]

PR 92830 reports that we always use "gcc/Warning-Options.html" when we
emit escaped documentation URLs when printing "[-Wname-of-option]" for
a warning.

This page is wrong for most Fortran warnings, and for analyzer warnings.

I considered various schemes involving adding extra tags to the .opt
format to capture where options are documented, but for now this patch
fixes the issue by introducing some special-casing logic.
It only fixes the URLs for warning options, not for other command-line
options, but those are the only options for which get_option_url is
currently called.

gcc/ChangeLog:
PR 92830
* configure.ac (DOCUMENTATION_ROOT_URL): Drop trailing "gcc/" from
default value, so that it can by supplied by get_option_html_page.
* configure: Regenerate.
* opts.c: Include "selftest.h".
(get_option_html_page): New function.
(get_option_url): Use it.  Reformat to place comments next to the
expressions they refer to.
(selftest::test_get_option_html_page): New.
(selftest::opts_c_tests): New.
* selftest-run-tests.c (selftest::run_tests): Call
selftest::opts_c_tests.
* selftest.h (selftest::opts_c_tests): New decl.
gcc/configure
gcc/configure.ac
gcc/opts.c
gcc/selftest-run-tests.c
gcc/selftest.h