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: Cleanup C frontend function deferring


Gabriel Dos Reis <gdr@integrable-solutions.net> writes:

> Geoff Keating <geoffk@geoffk.org> writes:
>
> | (I bet there's a way to do this with GNU make that doesn't require you
> | to change three places every time you add or remove the only GTY in
> | a file.)
>
> That would be very helpful.  I, for one, almost forget to update that
> variable -- and I do read the docs :-/

I can see this being feasible to implement as part of automatic
dependency generation.  GCC has enough special needs for this, what
with all the .c and .h files that get generated at build time, that
I think it makes sense to implement a custom dependency generator,
based on cpplib.  I have a plan, too, but I don't have time to do
much of the coding for at least another couple months, so it's not
going to make 3.4 without serious help.

Step 0: Move cpplib out to its own top level directory.  This is
necessary so that cpplib can be built for the build machine as well as
the host (rather like libiberty is now).  The thing currently blocking
that is the use of GTY in hashtable.c; a standalone cpplib obviously
cannot use the garbage collector at all.

Step 1: Clone X11's 'makedepend' utility based on cpplib.  This is not
good enough for GCC but it is a useful stepping stone.  It would not
edit the Makefile itself, it would generate a dependencies file that
could get included.

Step 2: Augment this utility with sufficient special features to make
it work for GCC.  The obvious problem is generating dependencies for
files like insn-output.c: genoutput.c will have to be annotated so
that the utility can figure out what dependencies to generate for it.
The utility will also have to read the Makefile to determine the
contents of tm.h and the like, or else the Makefile will have to feed
that information down somehow.

There being all these special features already, it would not be hard
to have the GTFILES variable be built up by this program as well.

I do not see a way to avoid having to remember the #include "gt-foo.h".
One could do insanely clever things like

$(GTFILES): CPPFLAGS += -include gt-$*.h

except that that could only work with GCC, and I can think of a number
of reasons it wouldn't work at all.

zw


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