This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: [PATCH] config-ml.in options with single quotes (PR bootstrap/18033)


On Jan 12, 2005, Andreas Schwab <schwab@suse.de> 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:

'--with-foo=bar
baz'

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             http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}


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