[Bug c/58988] -Werror=missing-include-dirs does not work

manu at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Nov 6 06:37:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58988

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
I think this should fix it, but I haven't even tried to compile it.

Index: incpath.c
===================================================================
--- incpath.c   (revision 204219)
+++ incpath.c   (working copy)
@@ -261,11 +261,12 @@ remove_duplicates (cpp_reader *pfile, st
          else
            {
              /* If -Wmissing-include-dirs is given, warn.  */
              cpp_options *opts = cpp_get_options (pfile);
              if (opts->warn_missing_include_dirs && cur->user_supplied_p)
-               cpp_errno (pfile, CPP_DL_WARNING, cur->name);
+               cpp_warning (pfile, CPP_W_MISSING_INCLUDE_DIRS, "%s: %s",
+                            cur->name, xstrerror (errno));
              reason = REASON_NOENT;
            }
        }
       else if (!S_ISDIR (st.st_mode))
        cpp_error_with_line (pfile, CPP_DL_WARNING, 0, 0,

A better fix is probably to add a variant of cpp_errno that takes a reason like
cpp_warning does. The current cpp_errno will then call this new variant with
CPP_W_NONE. These should be added to libcpp/errors.c and exported from
libcpp/include/cpplib.h

This should be an easy hack for someone to start contributing to GCC.


More information about the Gcc-bugs mailing list