[PATCH] Fix .opt file parsing to allow nested parentheses in option property arguments.

Dave Korn dave.korn.cygwin@googlemail.com
Thu Jul 9 13:01:00 GMT 2009


    Hi all,

  I ran into difficulty when I wanted to use the preprocessor "defined (X)"
operator in a Condition(...) option property.  The simple parsing in the awk
script got fooled by the closing parenthesis of the defined operator, taking
it for the end of the option property argument itself, and I ended up with a
line in $objdir/gcc/options.c looking like

#if defined (X

... which of course didn't work.  Rather than attempting to count the depth of
nested parentheses using a regex language I figured the simple approach would
just be to invent a way of quoting the argument string, and picked on curly
braces, which aren't currently used anywhere in .opt files (at least according
to "find gcc/ -name '*.opt' | xargs grep '{'", anyway).

gcc/ChangeLog:

	* opt-functions.awk (opt_args): Allow argument to be enclosed in
	curly braces.
	* doc/options.texi (Option properties):  Mention new quoting syntax.

  Tested by running the scripts manually and visually inspecting options.c,
then completing a bootstrap, and docs tested by "make doc info dvi html pdf".
 OK for head?

    cheers,
      DaveK

-------------- next part --------------
A non-text attachment was scrubbed...
Name: option-prop-quoting.diff
Type: text/x-c
Size: 1474 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20090709/5ef4dc7b/attachment.bin>


More information about the Gcc-patches mailing list