]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
diagnostics: get_option_html_page fixes
authorJakub Jelinek <jakub@redhat.com>
Mon, 4 May 2020 07:31:27 +0000 (09:31 +0200)
committerJakub Jelinek <jakub@redhat.com>
Thu, 7 May 2020 13:20:23 +0000 (15:20 +0200)
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).

2020-05-04  Jakub Jelinek  <jakub@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/ChangeLog
gcc/opts.c

index b8861a43f19c2928a059813dff6f136eddcebb72..577309a438f9084edb1fb4805d51194185cd31d2 100644 (file)
@@ -1,3 +1,10 @@
+2020-05-04  Jakub Jelinek  <jakub@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.
+
 2020-05-07  Jakub Jelinek  <jakub@redhat.com>
 
        * BASE-VER: Set to 10.1.1.
index c212a1a57dcfbdfb9cb419bfeaeb17aa9f23fdb0..4429d82e61f9d5c650e0215f6707005f949f2d73 100644 (file)
@@ -3141,25 +3141,15 @@ 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.  */
+      && (cl_opt->flags & CL_C) == 0
+#ifdef CL_CXX
+      && (cl_opt->flags & CL_CXX) == 0
+#endif
+     )
+    return "gfortran/Error-and-Warning-Options.html";
 #endif
 
   return "gcc/Warning-Options.html";