This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Add target hook in C front end
On Mon, Dec 17, 2001 at 04:32:49PM -0800, Eric Christopher wrote:
> Seriously, if you and Joseph both go for this lemme know what I'd have
> to do.
Add two new entries to struct cpp_callbacks in cpplib.h. One gets
called in cpp_handle_option, when you encounter an -m switch. (You'll
need to treat -m rather like -W.) The other gets called from
cpp_start_read right before we process -D switches.
Add two target macros, say TARGET_CPP_PROCESS_OPTIONS and
TARGET_CPP_POST_OPTIONS. If they are defined, have c_common_init set
the corresponding cpplib hooks from them. (I'd put them in the target
hooks instead, but I'm not sure that is possible without causing non-C
front ends to fail to link.)
Then define suitable hook routines in mips-c.c, and set the target
macros to them. The PROCESS_OPTIONS one just works out from -m
switches what size_t etc should be, and squirrels that away in static
variables. Then the POST_OPTIONS one calls cpp_define() to set up
__SIZE_TYPE__ etc appropriately.
How's that sound?