This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/55534] -Wno-missing-include-dirs does not work with gfortran


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55534

Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-09-09
                 CC|                            |manu at gcc dot gnu.org
         Depends on|                            |62226
     Ever confirmed|0                           |1

--- Comment #7 from Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> ---
The ideal fix for this would adding a function like:

+bool
+gfc_warning_cmdline (int opt, const char *gmsgid, ...)
+{
+  va_list argp;
+  diagnostic_info diagnostic;
+  bool ret;
+
+  va_start (argp, gmsgid);
+  diagnostic_set_info (&diagnostic, gmsgid, &argp, UNKNOWN_LOCATION,
+                      DK_WARNING);
+  diagnostic.option_index = opt;
+  ret = report_diagnostic (&diagnostic);
+  va_end (argp);
+  return ret;
+}
+

in error.c. Then calling:

Index: gcc/fortran/scanner.c
===================================================================
--- gcc/fortran/scanner.c       (revision 214251)
+++ gcc/fortran/scanner.c       (working copy)
@@ -326,13 +326,13 @@ add_path_to_list (gfc_directorylist **li
       if (errno != ENOENT)
        gfc_warning_now ("Include directory \"%s\": %s", path,
                         xstrerror(errno));
       else
        {
-         /* FIXME:  Also support -Wmissing-include-dirs.  */
          if (warn)
-           gfc_warning_now ("Nonexistent include directory \"%s\"", path);
+           gfc_warning_cmdline (OPT_Wmissing_include_dirs,
+                                "Nonexistent include directory \"%s\"", path);
        }
       return;
     }
   else if (!S_ISDIR (st.st_mode))
     {

Then, NOT adding gfc_option.warn_missing_include_dirs, but instead fixing
62226, and simply adding:

Index: gcc/fortran/lang.opt
===================================================================
--- gcc/fortran/lang.opt        (revision 194167)
+++ gcc/fortran/lang.opt        (working copy)
@@ -254,6 +254,10 @@
 Fortran Warning
 Warn on intrinsics not part of the selected standard

+Wmissing-include-dirs
+Fortran Warning
+; Documented in C
+
 Wreal-q-constant
 Fortran Warning
 Warn about real-literal-constants with 'q' exponent-letter

This automatically will give you:

* Setting cpp_opts, even when using #pragma, -Werror= and complicated
combinations.

* Colors!

* Printing [-Wmissing-include-dirs] in the warning message.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]