Patchwork Patch RFA: Don't make -I filename be an error

login
register
mail settings
Submitter Ian Taylor
Date Sept. 15, 2010, 3:32 p.m.
Message ID <mcrhbhruimz.fsf@google.com>
Download mbox | patch
Permalink /patch/64836/
State New
Headers show

Comments

Ian Taylor - Sept. 15, 2010, 3:32 p.m.
Back in http://gcc.gnu.org/ml/gcc-patches/1998-11/msg00379.html Zack
added a check to cpplib for whether a name given with -I was a
directory.  If it was not, cpplib would issue an error.  The old cccp
preprocessor would not issue an error for this case.  The error still
exists today.  I think it should be a warning rather than an error.  If
I write gcc -I include and happen to have a file named "include" rather
than a directory, I don't see any reason for the compilation to fail.

This patch changes it from an error to a warning.  It has been
bootstrapped and tested on x86_64-unknown-linux-gnu.

OK for mainline?

Ian


2010-09-15  Ian Lance Taylor  <iant@google.com>

	* incpath.c (remove_duplicates): If name is not a directory, issue
	a warning rather than an error.
Joseph S. Myers - Sept. 15, 2010, 4:11 p.m.
On Wed, 15 Sep 2010, Ian Lance Taylor wrote:

> Back in http://gcc.gnu.org/ml/gcc-patches/1998-11/msg00379.html Zack
> added a check to cpplib for whether a name given with -I was a
> directory.  If it was not, cpplib would issue an error.  The old cccp
> preprocessor would not issue an error for this case.  The error still
> exists today.  I think it should be a warning rather than an error.  If
> I write gcc -I include and happen to have a file named "include" rather
> than a directory, I don't see any reason for the compilation to fail.
> 
> This patch changes it from an error to a warning.  It has been
> bootstrapped and tested on x86_64-unknown-linux-gnu.
> 
> OK for mainline?

OK.
Mark Mitchell - Sept. 22, 2010, 12:29 a.m.
On 9/15/2010 9:11 AM, Joseph S. Myers wrote:
> On Wed, 15 Sep 2010, Ian Lance Taylor wrote:
> 
>> Back in http://gcc.gnu.org/ml/gcc-patches/1998-11/msg00379.html Zack
>> added a check to cpplib for whether a name given with -I was a
>> directory. 

>> This patch changes it from an error to a warning. 

What happens in that case?  Do we still keep searching for a directory,
or do we stop after giving the warning?

I have no opinion; I just wonder if we ought to document whatever it is
we do.

Patch

Index: incpath.c
===================================================================
--- incpath.c	(revision 164305)
+++ 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
 	{