This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 2/2] Better system header location detection for built-in macro tokens
- From: Mike Stump <mikestump at comcast dot net>
- To: Dodji Seketeli <dodji at redhat dot com>
- Cc: Jason Merrill <jason at redhat dot com>, Paolo Carlini <pcarlini at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Tom Tromey <tromey at redhat dot com>, Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>, Greta Yorsh <Greta dot Yorsh at arm dot com>
- Date: Mon, 4 Jun 2012 11:54:50 -0700
- Subject: Re: [PATCH 2/2] Better system header location detection for built-in macro tokens
- References: <m38vglfxko.fsf@redhat.com> <4FBA5A2F.9000206@redhat.com> <m3pq9vb7p7.fsf@redhat.com> <4FBD96EE.4040101@redhat.com> <m38vg54vwg.fsf@redhat.com> <C368943B-F20E-4584-A1B2-4D7A9DE47A19@oracle.com> <4FCAD9B5.4060409@redhat.com> <m3haur1cfs.fsf@redhat.com>
On Jun 4, 2012, at 5:36 AM, Dodji Seketeli wrote:
>>> - s = s; // { dg-message "synthesized|deleted" }
>>> + s = s;
>>
>> Why do we lose this error?
>
> Good question.
>
> This is the result of a weird behaviour of DejaGNU, I think.
Yup, that is truly weird. The problem is that the | operator is binding funny because there are no () around the substituted variables in the matching expressions in the .exp files, and the messages for a single line get the opportunity to match and eat multiple lines.
So, dejagnu is using:
{[0-9]+: error:[^\n]*const|operator}
instead of:
{[0-9]+: error:[^\n]*(const|operator)}
and that makes all the difference.
If you want, you can use just const, like so:
template <class T>
struct S { // { dg-error "const" }
S();
T t;
};
The key is not to use |, or if you want to use |, you can (for now, until the underlying bug is fix) use:
template <class T>
struct S { // { dg-error "(const|operator)" }
S();
T t;
}
to fix the underlying problem, we need something like:
Index: gcc-dg.exp
===================================================================
--- gcc-dg.exp (revision 188120)
+++ gcc-dg.exp (working copy)
@@ -744,6 +744,12 @@ if { [info procs saved-dg-error] == [lis
proc process-message { msgproc msgprefix dgargs } {
upvar dg-messages dg-messages
+ # We must enclose the expression in () to ensure any | in the
+ # pattern doesn't escape from this part of the expression.
+ set darg1 [lindex $dgargs 0]
+ set dgargs [lindex $dgargs 1]
+ set dgargs "$darg1 ($dgargs)"
+
# Process the dg- directive, including adding the regular expression
# to the new message entry in dg-messages.
set msgcnt [llength ${dg-messages}]
which I'll test and see how bad off any other test cases are. If people on fast machines want to weigh in, that'd be good.