[PATCH 2/2] Better system header location detection for built-in macro tokens

Mike Stump mikestump@comcast.net
Tue Jun 5 02:46:00 GMT 2012


On Jun 4, 2012, at 2:34 PM, Jason Merrill wrote:
> On 06/04/2012 05:27 PM, Mike Stump wrote:
>> That one is, the problem is the work that added error: and warning: processing differentiation puts together a new expression with concatenation and it is that use that _also_ needs protecting.
> 
> Aha!  Sneaky gcc-dg.exp.
> 
>> -	set expmsg [lindex $newentry 2]
>> +	set expmsg "([lindex $newentry 2])"
> 
> Looks good to me.

Curious, after reading the code a little more and a couple testsuite run, it can only be modified later...  so...  I tested:

Index: testsuite/lib/gcc-dg.exp
===================================================================
--- testsuite/lib/gcc-dg.exp	(revision 188120)
+++ testsuite/lib/gcc-dg.exp	(working copy)
@@ -766,14 +766,14 @@ proc process-message { msgproc msgprefix
 	# Remove "COLUMN:" from the original expression and move it
 	# to the proper place in the search expression.
 	regsub "^\[0-9\]+:" $expmsg "" expmsg
-	set expmsg "$column: $msgprefix\[^\n\]*$expmsg"
+	set expmsg "$column: $msgprefix\[^\n\]*($expmsg)"
     } elseif [string match "" [lindex $newentry 0]] {
 	# The specified line number is 0; don't expect a column number.
-	set expmsg "$msgprefix\[^\n\]*$expmsg"
+	set expmsg "$msgprefix\[^\n\]*($expmsg)"
     } else {
 	# There is no column number in the search expression, but we
 	# should expect one in the message itself.
-	set expmsg "\[0-9\]+: $msgprefix\[^\n\]*$expmsg"
+	set expmsg "\[0-9\]+: $msgprefix\[^\n\]*($expmsg)"
     }
 
     set newentry [lreplace $newentry 2 2 $expmsg]

and found:

Tests that now fail, but worked before:

g++.dg/cpp0x/pr31437.C  (test for errors, line 2)
g++.dg/cpp0x/regress/template-function1.C (test for excess errors)
g++.dg/other/warning1.C -std=c++11  (test for warnings, line 10)
g++.dg/other/warning1.C -std=c++11  (test for warnings, line 11)
g++.dg/other/warning1.C -std=c++11 (test for excess errors)
g++.dg/other/warning1.C -std=c++98  (test for warnings, line 10)
g++.dg/other/warning1.C -std=c++98  (test for warnings, line 11)
g++.dg/other/warning1.C -std=c++98 (test for excess errors)
g++.old-deja/g++.brendan/crash16.C -std=gnu++11 (test for excess errors)
g++.old-deja/g++.brendan/crash16.C -std=gnu++98 (test for excess errors)
gcc.dg/format/attr-3.c   (test for excess errors)
gcc.dg/format/attr-3.c   format on enum (test for errors, line 31)
gcc.dg/format/attr-3.c   format on struct (test for errors, line 29)
gcc.dg/format/attr-3.c   format on union (test for errors, line 30)
gcc.dg/format/attr-3.c   format_arg on enum (test for errors, line 35)
gcc.dg/format/attr-3.c   format_arg on struct (test for errors, line 33)
gcc.dg/format/attr-3.c   format_arg on union (test for errors, line 34)
gcc.dg/format/attr-3.c  -DWIDE  (test for excess errors)
gcc.dg/format/attr-3.c  -DWIDE  format on enum (test for errors, line 31)
gcc.dg/format/attr-3.c  -DWIDE  format on struct (test for errors, line 29)
gcc.dg/format/attr-3.c  -DWIDE  format on union (test for errors, line 30)
gcc.dg/format/attr-3.c  -DWIDE  format_arg on enum (test for errors, line 35)
gcc.dg/format/attr-3.c  -DWIDE  format_arg on struct (test for errors, line 33)
gcc.dg/format/attr-3.c  -DWIDE  format_arg on union (test for errors, line 34)
gcc.dg/format/sentinel-1.c   (test for excess errors)
gcc.dg/format/sentinel-1.c  -DWIDE  (test for excess errors)
gcc.dg/noncompile/940227-1.c  -O0  (test for excess errors)
gcc.dg/noncompile/940227-1.c  -O1  (test for excess errors)
gcc.dg/noncompile/940227-1.c  -O2  (test for excess errors)
gcc.dg/noncompile/940227-1.c  -O3 -fomit-frame-pointer  (test for excess errors)
gcc.dg/noncompile/940227-1.c  -O3 -g  (test for excess errors)
gcc.dg/noncompile/940227-1.c  -Os  (test for excess errors)
gcc.dg/noncompile/950825-1.c  -O0  (test for excess errors)
gcc.dg/noncompile/950825-1.c  -O1  (test for excess errors)
gcc.dg/noncompile/950825-1.c  -O2  (test for excess errors)
gcc.dg/noncompile/950825-1.c  -O3 -fomit-frame-pointer  (test for excess errors)
gcc.dg/noncompile/950825-1.c  -O3 -g  (test for excess errors)
gcc.dg/noncompile/950825-1.c  -Os  (test for excess errors)
gcc.dg/noncompile/init-1.c  -O0  (test for excess errors)
gcc.dg/noncompile/init-1.c  -O1  (test for excess errors)
gcc.dg/noncompile/init-1.c  -O2  (test for excess errors)
gcc.dg/noncompile/init-1.c  -O3 -fomit-frame-pointer  (test for excess errors)
gcc.dg/noncompile/init-1.c  -O3 -g  (test for excess errors)
gcc.dg/noncompile/init-1.c  -Os  (test for excess errors)
gfortran.dg/pr20865.f90  -O  (test for excess errors)

I'll have to check all these out before we can fix it, but my guess is all these tests are broken.  I checked the first one, and sure enough it was.  I'll start fixing them all so that we can fix this issue in the testsuite driver.  If anyone wants to help out...



More information about the Gcc-patches mailing list