This is the mail archive of the gcc-patches@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]

Re: getting back the quote_ignores_source_dir behavior of -I-


Zack Weinberg wrote:

I am quite surprised to hear that behavior 2 (ignoring the source file's
directory) does something useful for you ... it tends to break the
standard (libc) headers.



I have code that looks like this:


$PWD/foo/a.c         -> #include "bar/file.h"
$PWD/foo/bar/file.h
$PWD/bar/file.h

Our build system calls gcc from $PWD in a way that is similar to:

gcc -I- -I$PWD -I/some/other/dir -o foo/a.o -c foo/a.c

All our #include directives are relative to "stable" points ($PWD, /some/other/dir, ...) in a VPATH manner.

Without -I-, there is no way to get $PWD/bar/file.h from the a.c file (other than using an absolute path, which is not an option). Of course, I could rename $PWD/foo/bar/file.h, but I expect two "modules" (foo and bar here) to be independent w.r.t. internal file naming conventions (and of course $PWD/foo/bar/file.h has this name because it relates to $PWD/bar/file.h ...).

I've never had problems with standard headers and I've used -I- (exclusively for behavior 2) on several platforms (linux, solaris, hpux, aix) for several years, so it might not be a problem for "users" of libc (by opposition to developers).

I would prefer that you leave -I- entirely deprecated and add a new
option, say -ino-file-directory, which has only the effect of setting
quote_ignores_source_dir. (As usual when I suggest option names, better
name suggestions are welcome.)


Noted.

With this change, one can use -I- before
any -I without any other unwanted side effects (such as losing the
result of previous -iquote options).



This sounds like a bugfix which we should apply independent of your other
changes, but it would be even better if you appended the BRACKET chain
to the QUOTE chain if it wasn't empty; thus e.g.
-iquote foo -I bar -I- -I quux
would not lose 'foo' from the QUOTE chain.



That's fine for me.


Please resubmit the bugfix and the new option as two separate patches
(with the above suggested change, and test cases if you can hack 'em in
the dejagnu framework - see gcc.dg/cpp/ for existing examples, and note
the 'inc' subdirectory of that directory).


I'll look at this later this week. Thanks for the feedback. -- Daniel


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