Hi! (Sorry to David, apparently I've posted it only privately, not to gcc-patches, so reposting).
While testing the --with-documentation-root-url= changes, I run into [Wreturn-type] URL pointing to gfortran documentation where it obviously isn't documented. The following patch updates the list of options to match reality (on the other side -Wconversion-extra is gfortran only option documented in gfortran.texi). Or, perhaps better use the attached patch instead, which doesn't have a hardcoded list and instead uses the flags? I went through options.c and the updated list of options matches exactly the cases where CL_Fortran is set for "-W*" options together with CL_C and/or CL_CXX (ok, there is also -Wall and -Wextra, but hopefully we don't emit [Wall] or [Wextra] for anything). I have successfully bootstrapped/regtested the second patch (CL_C & CL_CXX) on x86_64-linux and i686-linux, ok for trunk, or do you prefer the first one? 2020-04-30 Jakub Jelinek <ja...@redhat.com> * opts.c (get_option_html_page): For OPT_Wconversion_extra look in gfortran documentation rather than in generic, while for OPT_Wmaybe_uninitialized, OPT_Wpedantic, OPT_Wreturn_type, OPT_Wuninitialized and OPT_Wunused look in generic documentation rather than gfortran. --- gcc/opts.c.jj 2020-04-30 09:37:17.039303011 +0200 +++ gcc/opts.c 2020-04-30 10:27:30.871585618 +0200 @@ -3151,9 +3151,13 @@ get_option_html_page (int option_index) case OPT_Wdate_time: case OPT_Wconversion: - case OPT_Wconversion_extra: + case OPT_Wmaybe_uninitialized: case OPT_Wmissing_include_dirs: case OPT_Wopenmp_simd: + case OPT_Wpedantic: + case OPT_Wreturn_type: + case OPT_Wuninitialized: + case OPT_Wunused: /* These warnings are marked in fortran/lang.opt as "Documented in C" and thus use the common Warning-Options page below. */ Jakub
2020-04-30 Jakub Jelinek <ja...@redhat.com> * opts.c (get_option_html_page): Instead of hardcoding a list of options common between C/C++ and Fortran only use gfortran/ documentation for warnings that have CL_Fortran set but not CL_C or CL_CXX. --- gcc/opts.c.jj 2020-04-30 09:37:17.039303011 +0200 +++ gcc/opts.c 2020-04-30 10:54:20.753713744 +0200 @@ -3141,25 +3141,17 @@ get_option_html_page (int option_index) return "gcc/Static-Analyzer-Options.html"; #ifdef CL_Fortran - if (cl_opt->flags & CL_Fortran) - { - switch (option_index) - { - default: - /* Most Fortran warnings are documented on this page. */ - return "gfortran/Error-and-Warning-Options.html"; - - case OPT_Wdate_time: - case OPT_Wconversion: - case OPT_Wconversion_extra: - case OPT_Wmissing_include_dirs: - case OPT_Wopenmp_simd: - /* These warnings are marked in fortran/lang.opt as - "Documented in C" and thus use the common - Warning-Options page below. */ - break; - } - } + if ((cl_opt->flags & CL_Fortran) != 0 + /* If it is option common to both C/C++ and Fortran, it is documented + in gcc/ rather than gfortran/ docs. */ +#ifdef CL_C + && (cl_opt->flags & CL_C) == 0 +#endif +#ifdef CL_CXX + && (cl_opt->flags & CL_CXX) == 0 +#endif + ) + return "gfortran/Error-and-Warning-Options.html"; #endif return "gcc/Warning-Options.html";