How to add a flag to a tool if a particular define is present on the driver command line (using spec files)

Ian Lance Taylor iant@google.com
Wed May 11 18:52:00 GMT 2011


asharif <asharif@gcc.gnu.org> writes:

> Up until http://gcc.gnu.org/viewcvs?view=revision&revision=163770, you
> could have a line like this in the gcc driver spec file:
>
> cc1:
> %(cc1_cpu) %{profile:-p} %{DFOO: -foo}
>
> This would detect if -DFOO was given on the driver command line and
> would pass in -foo to cc1.
>
> However, after r163770 this stopped working.
>
> Is there a way to do this using current trunk (i.e., add a flag to a
> tool if a particular define is present on the gcc driver command
> line)? Was the old way broken or was there a bug introduced with
> revision r163770?

This doesn't work when preprocessing and compiling are separated, which
means that it doesn't work with distcc or ccache.  I don't see any way
to fix that, so I don't think we're likely to resurrect this
functionality.

Ian



More information about the Gcc-help mailing list