* How to write a SPEC function that gets all arguments passed?
@ 2010-09-02 14:15 Georg Lay
2010-09-08 0:23 ` Ian Lance Taylor
0 siblings, 1 reply; 2+ messages in thread
From: Georg Lay @ 2010-09-02 14:15 UTC (permalink / raw)
To: gcc
Hi, when calling gcc with -frecord-gcc-switch the options passed to cc1
will differ depending on if -save-temps is present or not. E.g. if
calling gcc foo.c -I Z -DX=... -UY ...
in the forst case (with -save-temps) options_passed is: "-fpreprocessed
foo.i ..."
in the second case (without -save-temps) options_passed is: "-IZ
-isystem ... -iprefix ... -DX=... -UY foo.c ..."
What is relevant to the user is the second string because that is the
way he calls gcc. What's internally going on when -save-temps is present
should be transparent. Therefore, I am looking for a way to pass the
arguments from gcc to cc1 and tried to implement this with the help of
some spec function. But I could not find out how to actually write down
the specs.
My idea was to add a spec function to DRIVER_SELF_SPECS that collects
all options and passes them as a string to cc1, but there seem to be no
way to call the function like
%{*:%:my_record_switches(%*)}
or
%:my_record_switches(%(cpp_options))
I also tries to use the %Z that collects all options but eigher I get
NULL as input or the thing crashes.
What am I missing?
Moreover, there will be a problem because the C function that actually
implements my_record_switches must return a string starting with '-',
there is no way to return "" or NULL to indicate that the function won't
produce anything.
Would anyone guide me through that specs jungle?
Georg
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: How to write a SPEC function that gets all arguments passed?
2010-09-02 14:15 How to write a SPEC function that gets all arguments passed? Georg Lay
@ 2010-09-08 0:23 ` Ian Lance Taylor
0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2010-09-08 0:23 UTC (permalink / raw)
To: Georg Lay; +Cc: gcc
Georg Lay <avr@gjlay.de> writes:
> Moreover, there will be a problem because the C function that actually
> implements my_record_switches must return a string starting with '-',
> there is no way to return "" or NULL to indicate that the function won't
> produce anything.
I would consider writing something like
-frecorded-gcc-switches=%(cc1_options)
to override the default behaviour. It seems to me that it should be
possible to get to where you want, although it might be a little painful
to get it all correct.
Ian
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-09-08 0:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-02 14:15 How to write a SPEC function that gets all arguments passed? Georg Lay
2010-09-08 0:23 ` Ian Lance Taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).