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] options with single quotes (PR bootstrap/18033)

On Jan 12, 2005, Andreas Schwab <> wrote:

> That should better be done with eval to remove all quoting.

> case $option in
> \'*\') eval option=$option;;
> esac

eval "option=$option" is safer, since it forces the assignment to be
parsed as a single word, not dropping blanks that $option might expand
to, nor running commands should $option expand to multiple words.

That said, the idea of doing this processing on a per-option basis
sounds like a very bad idea to me.  If $ac_configure_args contains say
'--with-foo=bar baz', the enclosing loop will end up parsing the
following two arguments:


The right approach, it seems to me, is to run something like:

eval set fnord $ac_configure_args; shift

And then loop over the arguments normally.

Should you need to preserve the argument list, save $#, add \"\$@\"
to the set command, skip the arguments from "$@" somehow (a counter),
then shift the $ac_configure_args expansion out.  Or something :-)

Alexandre Oliva   
Red Hat Compiler Engineer   aoliva@{,}
Free Software Evangelist  oliva@{,}

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