This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Add target hook in C front end
- From: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 18 Dec 2001 22:36:41 +0000
- Subject: Re: [PATCH] Add target hook in C front end
> 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.
Is this necessary? I suspect we can handle this without touching
cpplib at all.
The -m switches in the front ends are handled, to the best of my
knowledge, by toplev.c's independent_decode_option(). This in turn
passes it on to set_target_switch().
We are just looking for a short-term fix here until something
universal and better comes along, so, why can't the target-specific
code figure it out for itself? Then all we need to do is give the
target-specific code a chance (if one doesn't exist already) to call
cpp_define once the options are all parsed. This could, at worst, be
done with a couple of lines in toplev.c. Sound reasonable?
> Add two target macros, say TARGET_CPP_PROCESS_OPTIONS and
> TARGET_CPP_POST_OPTIONS [...]
I _think_ this is overkill, though I'm by no means sure.