The fix is almost trivial. Just use the appropriate flags when warning.

Bootstrapped and regression tested on x86_64-linux-gnu.

OK?


gcc/ChangeLog:

2014-08-20  Manuel López-Ibáñez  <m...@gcc.gnu.org>

    * incpath.c (remove_duplicates): Use cpp_warning.

gcc/c-family/ChangeLog:

2014-08-20  Manuel López-Ibáñez  <m...@gcc.gnu.org>

    * c-common.c (struct reason_option_codes_t option_codes):
    Add CPP_W_MISSING_INCLUDE_DIRS. Sort alphabetically.

gcc/testsuite/ChangeLog:

2014-08-20  Manuel López-Ibáñez  <m...@gcc.gnu.org>

    * gcc.dg/cpp/Wmissingdirs.c: Test for the warning option.
Index: gcc/c-family/c-common.c
===================================================================
--- gcc/c-family/c-common.c     (revision 214136)
+++ gcc/c-family/c-common.c     (working copy)
@@ -9678,27 +9678,28 @@ struct reason_option_codes_t
   const int reason;            /* cpplib message reason.  */
   const int option_code;       /* gcc option that controls this message.  */
 };
 
 static const struct reason_option_codes_t option_codes[] = {
-  {CPP_W_DEPRECATED,                   OPT_Wdeprecated},
+  {CPP_W_BUILTIN_MACRO_REDEFINED,      OPT_Wbuiltin_macro_redefined},
   {CPP_W_COMMENTS,                     OPT_Wcomment},
-  {CPP_W_TRIGRAPHS,                    OPT_Wtrigraphs},
+  {CPP_W_CXX_OPERATOR_NAMES,           OPT_Wc___compat},
+  {CPP_W_DATE_TIME,                    OPT_Wdate_time},
+  {CPP_W_DEPRECATED,                   OPT_Wdeprecated},
+  {CPP_W_ENDIF_LABELS,                 OPT_Wendif_labels},
+  {CPP_W_INVALID_PCH,                  OPT_Winvalid_pch},
+  {CPP_W_LITERAL_SUFFIX,               OPT_Wliteral_suffix},
+  {CPP_W_LONG_LONG,                    OPT_Wlong_long},
+  {CPP_W_MISSING_INCLUDE_DIRS,          OPT_Wmissing_include_dirs},
   {CPP_W_MULTICHAR,                    OPT_Wmultichar},
+  {CPP_W_NORMALIZE,                    OPT_Wnormalized_},
   {CPP_W_TRADITIONAL,                  OPT_Wtraditional},
-  {CPP_W_LONG_LONG,                    OPT_Wlong_long},
-  {CPP_W_ENDIF_LABELS,                 OPT_Wendif_labels},
-  {CPP_W_VARIADIC_MACROS,              OPT_Wvariadic_macros},
-  {CPP_W_BUILTIN_MACRO_REDEFINED,      OPT_Wbuiltin_macro_redefined},
+  {CPP_W_TRIGRAPHS,                    OPT_Wtrigraphs},
   {CPP_W_UNDEF,                                OPT_Wundef},
   {CPP_W_UNUSED_MACROS,                        OPT_Wunused_macros},
-  {CPP_W_CXX_OPERATOR_NAMES,           OPT_Wc___compat},
-  {CPP_W_NORMALIZE,                    OPT_Wnormalized_},
-  {CPP_W_INVALID_PCH,                  OPT_Winvalid_pch},
+  {CPP_W_VARIADIC_MACROS,              OPT_Wvariadic_macros},
   {CPP_W_WARNING_DIRECTIVE,            OPT_Wcpp},
-  {CPP_W_LITERAL_SUFFIX,               OPT_Wliteral_suffix},
-  {CPP_W_DATE_TIME,                    OPT_Wdate_time},
   {CPP_W_NONE,                         0}
 };
 
 /* Return the gcc option code associated with the reason for a cpp
    message, or 0 if none.  */
Index: gcc/incpath.c
===================================================================
--- gcc/incpath.c       (revision 214136)
+++ gcc/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,
Index: gcc/testsuite/gcc.dg/cpp/Wmissingdirs.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/Wmissingdirs.c     (revision 214136)
+++ gcc/testsuite/gcc.dg/cpp/Wmissingdirs.c     (working copy)
@@ -2,6 +2,6 @@
 /* { dg-options "-std=gnu99 -I /jolly/well/better/not/exist 
-Wmissing-include-dirs" } */
 
 /* Test that -Wmissing-include-dirs issues a warning when a specified
    directory does not exist.  Source Ben Elliston, 2004-05-13.  */
 
-/* { dg-warning "No such file or directory" "-Wmissing-include-dirs" { target 
*-*-* } 0 } */
+/* { dg-warning "No such file or directory.*Wmissing-include-dirs" 
"-Wmissing-include-dirs" { target *-*-* } 0 } */

Reply via email to