Re: [Bug bootstrap/53607] opt-functions.awk --> "awk: There is a regular expression error."

2013-01-06 Thread Daniel Richard G.
This patch addresses a build failure on HP-UX due to the vendor
awk(1) apparently treating a lone curly-brace as an incomplete
repetition operator:

[...]
awk -f /home/src/gcc-4.7.2/gcc/opt-functions.awk -f
/home/src/gcc-4.7.2/gcc/opt-read.awk \
   -f /home/src/gcc-4.7.2/gcc/opth-gen.awk \
   < optionlist > tmp-options.h
awk: There is a regular expression error.
?, *, or + not preceded by valid regular expression
 The source line number is 90.
 The error context is
if (flags ~ >>>  "^{") <<< 
gmake[3]: *** [s-options-h] Error 2
gmake[3]: Leaving directory `/tmp/gcc-build/gcc'
gmake[2]: *** [all-stage1-gcc] Error 2
gmake[2]: Leaving directory `/tmp/gcc-build'
gmake[1]: *** [stage1-bubble] Error 2
gmake[1]: Leaving directory `/tmp/gcc-build'
gmake: *** [bootstrap-lean] Error 2


Fixed by escaping two curly-braces with backslashes.

Tested by getting past that point in the bootstrap successfully on
hppa2.0w-hp-hpux11.00; formal test case not applicable.

ChangeLog entry:

PR bootstrap/53607
* opt-functions.awk: Fix compatibility with HP-UX awk.

Patch: See attached.


--Daniel


On Sun, 2012 Dec 23 3:18+, danglin at gcc dot gnu.org wrote:
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53607
> 
> --- Comment #1 from John David Anglin <...> 2012-12-23 03:18:19 UTC ---
> Please send patch with ChangeLog to gcc-patches and CC me.  I will
> apply if approved.
> 
> -- 
> Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
> ------- You are receiving this mail because: ---
> You reported the bug.

-- 
Daniel Richard G. || sk...@iskunk.org
My ASCII-art .sig got a bad case of Times New Roman.
Index: gcc/opt-functions.awk
===
--- gcc/opt-functions.awk	(revision 194916)
+++ gcc/opt-functions.awk	(working copy)
@@ -62,9 +62,9 @@
 	if (flags !~ " " name "\\(")
 		return ""
 	sub(".* " name "\\(", "", flags)
-	if (flags ~ "^{")
+	if (flags ~ "^\{")
 	{
-		sub ("^{", "", flags)
+		sub ("^\{", "", flags)
 		sub("}\\).*", "", flags)
 	}
 	else


Re: [Bug bootstrap/53607] opt-functions.awk --> "awk: There is a regular expression error."

2013-01-06 Thread Daniel Richard G.
On Sun, 2013 Jan  6 18:45+0100, Andreas Schwab wrote:
>
> > sub(".* " name "\\(", "", flags)
> > -   if (flags ~ "^{")
> > +   if (flags ~ "^\{")
> > {
> > -   sub ("^{", "", flags)
> > +   sub ("^\{", "", flags)
> > sub("}\\).*", "", flags)
> 
> You need to escape the backslash inside a string.

Revised patch attached; awk behavior/output is same as before.


--Daniel


-- 
Daniel Richard G. || sk...@iskunk.org
My ASCII-art .sig got a bad case of Times New Roman.
Index: gcc/opt-functions.awk
===
--- gcc/opt-functions.awk	(revision 194916)
+++ gcc/opt-functions.awk	(working copy)
@@ -62,9 +62,9 @@
 	if (flags !~ " " name "\\(")
 		return ""
 	sub(".* " name "\\(", "", flags)
-	if (flags ~ "^{")
+	if (flags ~ "^\\{")
 	{
-		sub ("^{", "", flags)
+		sub ("^\\{", "", flags)
 		sub("}\\).*", "", flags)
 	}
 	else