PATCH RFA: -I existing-file should be a warning, not an error

View: New views
1 Messages — Rating Filter:   Alert me  

PATCH RFA: -I existing-file should be a warning, not an error

by Ian Lance Taylor-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> gcc -I some-random-string -c hello.c
=> no output, compilation successful

>  gcc -I hello.c -c hello.c
cc1: error: hello.c: not a directory
=> error message, compilation fails

I noticed this when I happened to create an executable with the same
name as the gcc source directory I was building.  The libgcc build
using -I with a ../.. during the build, and found the executable
rather than the source directory.  It all worked fine after I deleted
the executable.

I see no benefit to making this an error.  I propose the following
patch to make it a warning instead.  Bootstrapped and tested on
i686-unknown-linux-gnu.  OK for mainline?

Ian


2009-11-06  Ian Lance Taylor  <iant@...>

        * incpath.c (remove_duplicates): Change "not a directory"
        diagnostic from error to warning.



Index: incpath.c
===================================================================
--- incpath.c (revision 153981)
+++ incpath.c (working copy)
@@ -239,7 +239,7 @@ remove_duplicates (cpp_reader *pfile, st
     }
  }
       else if (!S_ISDIR (st.st_mode))
- cpp_error_with_line (pfile, CPP_DL_ERROR, 0, 0,
+ cpp_error_with_line (pfile, CPP_DL_WARNING, 0, 0,
      "%s: not a directory", cur->name);
       else
  {