This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH/RFC] Support for spec predicate expressions
On Wed, Oct 30, 2002 at 02:27:41PM -0500, DJ Delorie wrote:
> * How about %!function(args) - the '!' implies "shell" which implies
> executable. The function is simply called, it returns either NULL
> or a string to be inserted. We need to specify whether the return
> string is then processed as a spec or inserted as-is. (although I'm
> ok with %: as ! might be confused with negation).
I definitely thing the return value of the function should be processed
as a spec. This allows for the greatest flexibility, I think.
> * We'd need access to do_spec_1 (and perhaps some local-expand helper,
> to parse args) and perhaps a split-args helper of some sort.
> Returning a string implies buffer management that using do_spec_1
> could avoid.
I think the args should be processed as a spec, as well. I think we
can avoid having to expose do_spec_1 by pre-expanding the args before
calling the function. Then we just pass a single string to the function,
and provide a split-args helper for it, if it wants one (though, I think
I might want to just hand-wave that for now ... I don't really want to
think about what the quoting rules might be right now :-)
> * We'd have to rename lib-exists to maybe-lib ;-)
>
> %!maybe-lib(crt1%O)
Actually, what I did was just change it to a "if-exists", so it can
be used like:
%:if-exists(crti%O%s)
...which returns the pathname to use if the file exists (so it just gets
looked up via the normal %s lookup rules, in this example). Note in the
patch I'll post in a few minutes, it's currently hard-wired to do lib
lookups ... I haven't done the expand-args-as-specs part yet...
--
-- Jason R. Thorpe <thorpej@wasabisystems.com>