diff mbox

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

Message ID BABB605D-098C-444B-85DE-E9782CAE1D0D@comcast.net
State New
Headers show

Commit Message

Mike Stump June 5, 2012, 2:46 a.m. UTC
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:


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...

Comments

Mike Stump June 5, 2012, 4:14 a.m. UTC | #1
On Jun 4, 2012, at 7:46 PM, Mike Stump wrote:
> 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)

So, this one is not obvious.  The testcase checks for warning, and the compiler generates an error.  Could a C++ maintainer weigh in on it?
Jason Merrill June 5, 2012, 2:02 p.m. UTC | #2
On 06/05/2012 12:14 AM, Mike Stump wrote:
> On Jun 4, 2012, at 7:46 PM, Mike Stump wrote:
>> 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)
>
> So, this one is not obvious.  The testcase checks for warning, and the compiler generates an error.  Could a C++ maintainer weigh in on it?

The errors are correct; indeed, we have always given an error for this 
testcase with -pedantic-errors.  It does seem like a diagnostic quality 
regression that we no longer complain specifically about the division by 
0.  That regression seems to have happened in 4.3.  Since this PR was 
specifically about the formatting of 1.0f, that should have had its own 
dg-warning line instead of being lumped in with the initialization error.

Jason
diff mbox

Patch

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]