This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [3.1-branch PATCH] fix mips CPP size specs for MEABI.
Eric Christopher wrote:-
> > Stand-alone CPP is dead (apart from -traditional). So we can
> > introduce target-dependence with ease, but Zack and I are only happy
> > doing so if there is an easy way for a stand-alone user of CPP to
> > provide the missing information. Basically, yes, let's do it. 8-)
> >
>
> Need to figure out what the best way to add target dependent hooks for
> things like __SIZE_TYPE__, etc would be. lang_hooks perhaps? something
> else?
No, I don't think langhooks are needed; the current hooks are more
than enough. What is needed is another cpplib callback, so that the
new macros can be added at the time of the existence of the "<built
in>" pseudo-file (see the dump produced by -dD; it also means that
redefinitions refer to the original definition as a built in).
Add a callback, add_builtins() maybe, to cpp_callbacks; the front-ends
set it at the same time as the other callbacks. Call it if non-NULL at
the end of init_builtins() in cppinit.c.
The front end sets any built-ins itself with calls to cpp_define(), and
then calls a new target-hook, maybe add_builtins() too, so the target
can set its own too. The targets will need to be aware of cpp_define(),
so it might be worth duplicating its prototype in c-lex.h.
Move the definition of _GXX_WEAK to the front ends from cppinit.c,
since in at least one case it uses a target flag (and therefore fails
for the stand-alone usage of cpplib).
Macros passed to the new cpp_define() need to be the same as a command
line option without the -D, e.g. "__unix__", or "foo=2". Zack has
ideas about an extra function that handles the underscore macros
specially; you may want to ask him about that.
The target or front end can also add its own assertions with cpp_assert()
if they like. They have the same form as a command-line option
without the -A, e.g. "cpu=alpha". Please use the '=' form and not the
parenthesized form.
That should do it. Fancy doing the work? It's not much.
Neil.