This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH/RFC] Support for spec predicate expressions

On Wed, Oct 30, 2002 at 08:48:41AM -0800, Jason R Thorpe wrote:
> [ Moved to gcc-patches... ]
> On Mon, Oct 28, 2002 at 03:34:39PM -0500, DJ Delorie wrote:
>  > I wonder if it would be feasible and/or easy to add a
>  > function-call-type spec (like make uses) so that we can do some
>  > arbitrary extensions?  I'm thinking...
>  > 
>  > %{?boolean-function(args) {iftrue} {ifelse}}
> This turned out to be trivial to do.  Attached is a patch that adds
> support for this form of expression, and adds the lib-exists builtin
> that I need.

Couple of comments:

- I don't like this syntax; it adds yet another special case to %{...}
  handling.  I went to some trouble to get rid of these (over on
  basic-improvements) in order to implement N-way choice.

- It would be nice if the syntax allowed the function to return a
  string which would be substituted.  For instance, some of the work
  I'm doing could use the ability to get at environment variables in

I propose the syntax


to return a string which is substituted, and

  %:function(args) ? {iftrue} : {ifelse}
  %:function(args) ? {iftrue}
  %:function(args) ?: {ifelse}

for boolean notation.  In the latter case, the empty string is false
and any other return from the function is true.  The two degenerate
options reduce line noise.

For simplicity's sake, a ? anywhere but after a %: expression is not


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]