This is the mail archive of the gcc@gcc.gnu.org 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]

Re: Style question $()


On Sat, 13 Feb 1999 08:57:27 -0700, Donn Terry wrote:
>A recent change to gcc configure and Makefile.in has created
>a situation where nested substitution marks (``) need to be used.
>Substitution marks cannot be nested without using \ quotation
>(because they're the strongest of the quotemarks), and introducing
>\s here will be messy (if even possible) given the amount
>of macro substitution involved.
>
>(In the absence of symlinks, @cc_set_by_configure@ contains
>substitution marks.  When used in computing SIBDIR_FLAGS_TO_PASS
>in Makefile.in, this creates nested substitution marks.   The result is
>a literal string in Makefile containing the nested substitution marks,
>and the make falls over with a shell error.)
>
>$() was invented to fix this problem, and in this case does.
>How strong is the dislike for/prohibition of $() ?  (That is, do
>we really have to allow for shells old enough not to handle
>$()?)  I can submit a patch for the problem in minutes using
>that, but without it, who knows?

$() is not understood by /bin/sh on Solaris or Irix6, so I'd say we
can't use it.  

In general, portable sh scripts can't use anything that wasn't in V7
/bin/sh.  Current OS's still ship V7 /bin/sh with some of the bugs
fixed.

Why don't you see if we can get rid of the need for the substitution
marks entirely?  IIRC it's a construct of the form

VAR=`echo $(othervar) | sed 's/foo/bar'`

We ought to be able to precompute the sed-transformation, or something
like that.  In some cases I don't see the point at all, like the ones
where we strip "./" out of pathnames.

zw


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