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: #import, #pragma once yadda yadda mumble grumble

Neil Booth <> writes:

> Geoffrey Keating wrote:-
> > Hi Neil,
> > 
> > This is great!  I want to make some improvements to it, but it's a much 
> > easier base to do that from than the previous code.  Thank you!
> What improvements do you want to make?  The only worthwhile change
> I can think of is improving #import efficiency; I intend to do
> something trivial but effective here soon.

There are three general categories of changes that I want to make:

- Use readdir() on each (top-level) directory in the include path.
  This is a big speed win when you have many (like, 100) entries in
  the include path.  It's actually a win even if you only have the
  default path, because the overhead of reading a large /usr/include
  is balanced by not having to search /usr/local/include.  An
  important sub-feature is that it should notice that, for instance,
  /usr/local/include/sys doesn't exist, and so "sys/types.h" can't be
  there, *without* doing readdir recursively (which wasn't a speed win
  for us).

- Generalise the concept of a search path entry, to include:
  - Apple's "framework" concept, basically <Carbon/Carbon.h> goes in
    (but with a bunch of other wrinkles).
  - Ask some other program how to find an item, over a pipe or
    something, for distcc-style compilations without having to
    transport preprocessed source (this would make many people happy,
    especially if you integrate it with PCH).

  I thought the easiest way to do this is to just have some kind of
  'search path entry' abstraction, with function pointers.  It seems like
  people often want to do weird target-specific things with header file
  searching (especially Apple, but there's stuff for Windows OSs too).

- Make #import work with PCH.  Despite rumors to the contrary, it still
  doesn't; there's just no code to save or restore the required data.  Apple
  has an implementation (that I wrote) that uses MD5 checksums, which seems
  to work well enough for us.  The only annoying feature is that when you
  create a PCH, even if you don't use #import, you must checksum every
  header file, because the PCH might have

#include "foo.h"

  and the main file might have

#import "foo.h"

  and you need to know that you've seen it already.  Of course, when
  you use the PCH, you don't have to look at the checksums unless
  someone has used #import, but you do have to have them available.

- Geoffrey Keating <>

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