This is the mail archive of the 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: Add -iquote support

This response is probably way too late, but the -iquote changes only
recently came to my attention via a gcc upgrade that warns about -I-

Back in the late 80's (I've lost the exact date and refs) a Bell Labs
colleague submitted the original -I- patch at my prodding.  It was
related to the AT&T nmake and 3D filesystem, which are still in use

The main goal of -I- is to support viewpath/VPATH builds.  Users that
do not viewpath may reasonably reject rationale for both -I- and
-iquote.  And, the venue being unix, of course it is possible to patch
and reorganize this that and the other thing to get legacy -Idir to
include any exact list of headers from a hierarchy populated with
clashing duplicates.

The idea of -I-, however, is to allow exact and complete control over
the "..." vs. <...> header search without the need to modify source
files or directory structure.  There are many reasons for this.
Foremost would be the ability to patch one file in a local dir and do
viewpath builds of a standard source distribution without the need to
patch and re-patch the the standard files and directory structure for
each new source distribution.

For complete control there must be a way to disable the directory of
the including file.  If you were to add something like
-idisable-the-directory-of-the-including-file then you could have
-iquote and preserve -I- compatibility.  With both aspects of -I-
supported it is possible to add back the directory of the including
file at the desired location in the include search.

A typical viewpath application would be:

  cd /usr/src
  tar xzvf foo-1.2.3.tgz
      foo.c: #include "foo.h"
  cd $HOME/src/foo
    compile-debug-edit cycle on ./foo.h
    gcc -idisable-the-directory-of-the-including-file \
        -iquote . -iquote $SRC -I$SRC $SRC/foo.c
    # view the changes
    diff ./foo.h $SRC/foo.h

Note that this is probably not the usual gnu/autoconfig VPATH usage
(typically a binary view on top of a source view).  There are, however,
many projects that use multiple VPATH layers to separate different
stages of development, e.g., { development test stable }.

Some of this may seem complicated for a command line option, and
admittedly it is hard to conjure up manual situations that really need
-I- compatibility.  But remember that many gcc command lines are
generated by build applications that determine before compilation the
exact source files and headers that should be accessed by the compiler.
Reconciling the source list with the cc command line is what -I- (and
hopefully -iquote + one more option) addresses.

-- Glenn Fowler -- AT&T Research, Florham Park NJ --

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