* Re: [testsuite] gdb.c++/templates.exp
@ 2003-07-09 15:05 Michael Elizabeth Chastain
2003-07-09 15:16 ` Daniel Berlin
2003-07-10 7:51 ` Michal Ludvig
0 siblings, 2 replies; 12+ messages in thread
From: Michael Elizabeth Chastain @ 2003-07-09 15:05 UTC (permalink / raw)
To: gdb-patches, mludvig
Hi Michal,
This part is not quite correct:
\\(unsigned ?(long|)\\);
It would accept 'unsignedlong' which would be wrong.
Can you try:
\\(unsigned( long|)\\);
Or:
\\((unsigned|unsigned long)\\);
Also, I need to know how you tested it. It doesn't need to be an
extensive test, just say whether you've run it at least once,
and on which platform.
Michael C
===
2003-07-09 Michal Ludvig <mludvig@suse.cz>
* testsuite/gdb.c++/templates.exp (test_ptype_of_templates):
Recognize expansion of size_t to 'unsigned long', not only
to 'unsigned'.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [testsuite] gdb.c++/templates.exp
2003-07-09 15:05 [testsuite] gdb.c++/templates.exp Michael Elizabeth Chastain
@ 2003-07-09 15:16 ` Daniel Berlin
2003-07-09 15:20 ` Daniel Berlin
2003-07-10 7:51 ` Michal Ludvig
1 sibling, 1 reply; 12+ messages in thread
From: Daniel Berlin @ 2003-07-09 15:16 UTC (permalink / raw)
To: Michael Elizabeth Chastain; +Cc: gdb-patches, mludvig
On Wednesday, July 9, 2003, at 11:05 AM, Michael Elizabeth Chastain
wrote:
> Hi Michal,
>
> This part is not quite correct:
>
> \\(unsigned ?(long|)\\);
>
> It would accept 'unsignedlong' which would be wrong.
It shouldn't, unless the regex isn't whitespace sensitive
>
> Can you try:
>
> \\(unsigned( long|)\\);
Now *this* would accept unsignedlong, unless the regexps in expect are
unlike any other system i've seen.
This is because the alternation would be between " long" and "", *not*
"long" and "" (IE your regex would not be equivalent to
<space>long|<space>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [testsuite] gdb.c++/templates.exp
2003-07-09 15:16 ` Daniel Berlin
@ 2003-07-09 15:20 ` Daniel Berlin
2003-07-09 15:38 ` Daniel Jacobowitz
2003-07-09 15:43 ` Andreas Schwab
0 siblings, 2 replies; 12+ messages in thread
From: Daniel Berlin @ 2003-07-09 15:20 UTC (permalink / raw)
To: Daniel Berlin; +Cc: Michael Elizabeth Chastain, gdb-patches, mludvig
On Wednesday, July 9, 2003, at 11:15 AM, Daniel Berlin wrote:
>
> On Wednesday, July 9, 2003, at 11:05 AM, Michael Elizabeth Chastain
> wrote:
>
>> Hi Michal,
>>
>> This part is not quite correct:
>>
>> \\(unsigned ?(long|)\\);
>>
>> It would accept 'unsignedlong' which would be wrong.
>
> It shouldn't, unless the regex isn't whitespace sensitive
Just to be clear, this regex should accept nothing, "long", "unsigned
long", and "unsigned".
This may be *wrong*, but it certainly shouldn't accept "unsignedlong".
The ? should be applying to "unsigned ", not just the whitespace.
>>
>> Can you try:
>>
>> \\(unsigned( long|)\\);
>
> Now *this* would accept unsignedlong, unless the regexps in expect are
> unlike any other system i've seen.
> This is because the alternation would be between " long" and "", *not*
> "long" and "" (IE your regex would not be equivalent to
> <space>long|<space>
>
I was on crack here and read it wrong, time to take my medication.
:)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [testsuite] gdb.c++/templates.exp
2003-07-09 15:20 ` Daniel Berlin
@ 2003-07-09 15:38 ` Daniel Jacobowitz
2003-07-09 15:43 ` Andreas Schwab
1 sibling, 0 replies; 12+ messages in thread
From: Daniel Jacobowitz @ 2003-07-09 15:38 UTC (permalink / raw)
To: Daniel Berlin; +Cc: Michael Elizabeth Chastain, gdb-patches, mludvig
On Wed, Jul 09, 2003 at 11:20:05AM -0400, Daniel Berlin wrote:
>
> On Wednesday, July 9, 2003, at 11:15 AM, Daniel Berlin wrote:
>
> >
> >On Wednesday, July 9, 2003, at 11:05 AM, Michael Elizabeth Chastain
> >wrote:
> >
> >>Hi Michal,
> >>
> >>This part is not quite correct:
> >>
> >> \\(unsigned ?(long|)\\);
> >>
> >>It would accept 'unsignedlong' which would be wrong.
> >
> >It shouldn't, unless the regex isn't whitespace sensitive
>
> Just to be clear, this regex should accept nothing, "long", "unsigned
> long", and "unsigned".
> This may be *wrong*, but it certainly shouldn't accept "unsignedlong".
> The ? should be applying to "unsigned ", not just the whitespace.
I have never encountered a regex engine which worked that way. Unless
you parenthesize the ? will only apply to the previous character. At
least perl, TCL, and egrep are (for once!) consistent here. So is
procmail :P
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [testsuite] gdb.c++/templates.exp
2003-07-09 15:20 ` Daniel Berlin
2003-07-09 15:38 ` Daniel Jacobowitz
@ 2003-07-09 15:43 ` Andreas Schwab
1 sibling, 0 replies; 12+ messages in thread
From: Andreas Schwab @ 2003-07-09 15:43 UTC (permalink / raw)
To: Daniel Berlin; +Cc: Michael Elizabeth Chastain, gdb-patches, mludvig
Daniel Berlin <dberlin@dberlin.org> writes:
|> On Wednesday, July 9, 2003, at 11:15 AM, Daniel Berlin wrote:
|>
|> >
|> > On Wednesday, July 9, 2003, at 11:05 AM, Michael Elizabeth Chastain
|> > wrote:
|> >
|> >> Hi Michal,
|> >>
|> >> This part is not quite correct:
|> >>
|> >> \\(unsigned ?(long|)\\);
|> >>
|> >> It would accept 'unsignedlong' which would be wrong.
|> >
|> > It shouldn't, unless the regex isn't whitespace sensitive
|>
|> Just to be clear, this regex should accept nothing, "long", "unsigned
|> long", and "unsigned".
|> This may be *wrong*, but it certainly shouldn't accept "unsignedlong".
|> The ? should be applying to "unsigned ", not just the whitespace.
It surely doesn't. Repetition operators only apply to the smallest
preceding group.
The fixed prefix is "(unsigned", then comes an optional " ", then an
optional "long", then the fixed postfix ");". All in all it matches
exactly four strings:
"(unsigned);"
"(unsigned );"
"(unsignedlong);"
"(unsigned long);"
Only the first and the fourth are desired.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [testsuite] gdb.c++/templates.exp
2003-07-09 15:05 [testsuite] gdb.c++/templates.exp Michael Elizabeth Chastain
2003-07-09 15:16 ` Daniel Berlin
@ 2003-07-10 7:51 ` Michal Ludvig
1 sibling, 0 replies; 12+ messages in thread
From: Michal Ludvig @ 2003-07-10 7:51 UTC (permalink / raw)
To: Michael Elizabeth Chastain; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 409 bytes --]
Michael Elizabeth Chastain told me that:
> Can you try:
>
> \\(unsigned( long|)\\);
OK.
> Also, I need to know how you tested it. It doesn't need to be an
> extensive test, just say whether you've run it at least once,
> and on which platform.
I have run the testsuite on i386 and amd64 and it worked.
Michal Ludvig
--
* SuSE CR, s.r.o * mludvig@suse.cz
* (+420) 296.545.373 * http://www.suse.cz
[-- Attachment #2: testsuite-c++-templates-2.diff --]
[-- Type: text/plain, Size: 3033 bytes --]
2003-07-09 Michal Ludvig <mludvig@suse.cz>
* testsuite/gdb.c++/templates.exp (test_ptype_of_templates):
Recognize expansion of size_t to 'unsigned long', not only
to 'unsigned'.
Index: testsuite/gdb.c++/templates.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/templates.exp,v
retrieving revision 1.18
diff -u -p -r1.18 templates.exp
--- testsuite/gdb.c++/templates.exp 4 Mar 2003 17:02:20 -0000 1.18
+++ testsuite/gdb.c++/templates.exp 10 Jul 2003 06:55:05 -0000
@@ -61,7 +61,7 @@ proc test_ptype_of_templates {} {
-re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;((${ws}T5<int> & operator=\\(T5<int> const ?&\\);)|(${ws}T5\\(int\\);)|(${ws}T5\\((T5<int> const|const T5<int>) ?&\\);)|(${ws}~T5\\((void|)\\);)|(${ws}static void \\* operator new\\(unsigned( int| long)?\\);)|(${ws}static void operator delete\\(void ?\\*\\);)|(${ws}int value\\((void|)\\);))*${ws}\}\r\n$gdb_prompt $" {
pass "ptype T5<int> (obsolescent gcc or gdb)"
}
- -re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}void T5\\(int\\);${ws}void T5\\((T5<int> const|const T5<int>) ?&\\);${ws}~T5\\(int\\);${ws}static void \\* operator new\\(unsigned\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}\}\r\n$gdb_prompt $" {
+ -re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}void T5\\(int\\);${ws}void T5\\((T5<int> const|const T5<int>) ?&\\);${ws}~T5\\(int\\);${ws}static void \\* operator new\\(unsigned( long|)\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}\}\r\n$gdb_prompt $" {
# This also triggers gdb/1113...
kfail "gdb/1111" "ptype T5<int>"
}
@@ -87,7 +87,7 @@ proc test_ptype_of_templates {} {
-re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;((${ws}T5<int> & operator=\\(T5<int> const ?&\\);)|(${ws}T5\\(int\\);)|(${ws}T5\\(T5<int> const ?&\\);)|(${ws}~T5\\((void|)\\);)|(${ws}static void \\* operator new\\(unsigned( int| long)?\\);)|(${ws}static void operator delete\\(void ?\\*\\);)|(${ws}int value\\((void|)\\);))*${ws}\}\r\n$gdb_prompt $" {
pass "ptype t5i (obsolescent gcc or gdb)"
}
- -re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}void T5\\(int\\);${ws}void T5\\((T5<int> const|const T5<int>) ?&\\);${ws}~T5\\(int\\);${ws}static void \\* operator new\\(unsigned\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}\}\r\n$gdb_prompt $" {
+ -re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}void T5\\(int\\);${ws}void T5\\((T5<int> const|const T5<int>) ?&\\);${ws}~T5\\(int\\);${ws}static void \\* operator new\\(unsigned( long|)\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}\}\r\n$gdb_prompt $" {
# This also triggers gdb/1113...
kfail "gdb/1111" "ptype T5<int>"
}
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [testsuite] gdb.c++/templates.exp
2003-07-10 14:38 Michael Elizabeth Chastain
@ 2003-07-11 6:45 ` Michal Ludvig
0 siblings, 0 replies; 12+ messages in thread
From: Michal Ludvig @ 2003-07-11 6:45 UTC (permalink / raw)
To: Michael Elizabeth Chastain; +Cc: gdb-patches
Michael Elizabeth Chastain told me that:
> Beautiful! This patch is approved for both mainline and branch.
Thanks, committed.
Michal Ludvig
--
* SuSE CR, s.r.o * mludvig@suse.cz
* (+420) 296.545.373 * http://www.suse.cz
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [testsuite] gdb.c++/templates.exp
@ 2003-07-10 14:38 Michael Elizabeth Chastain
2003-07-11 6:45 ` Michal Ludvig
0 siblings, 1 reply; 12+ messages in thread
From: Michael Elizabeth Chastain @ 2003-07-10 14:38 UTC (permalink / raw)
To: mludvig; +Cc: gdb-patches
Beautiful! This patch is approved for both mainline and branch.
Michael C
===
2003-07-09 Michal Ludvig <mludvig@suse.cz>
* testsuite/gdb.c++/templates.exp (test_ptype_of_templates):
Recognize expansion of size_t to 'unsigned long', not only
to 'unsigned'.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [testsuite] gdb.c++/templates.exp
2003-07-09 15:50 Michael Elizabeth Chastain
@ 2003-07-09 16:19 ` Daniel Berlin
0 siblings, 0 replies; 12+ messages in thread
From: Daniel Berlin @ 2003-07-09 16:19 UTC (permalink / raw)
To: Michael Elizabeth Chastain; +Cc: gdb-patches, mludvig
On Wednesday, July 9, 2003, at 11:50 AM, Michael Elizabeth Chastain
wrote:
> Hi Daniel,
>
>>> \\(unsigned ?(long|)\\);
>
>> Just to be clear, this regex should accept nothing, "long", "unsigned
>> long", and "unsigned".
>> This may be *wrong*, but it certainly shouldn't accept "unsignedlong".
>> The ? should be applying to "unsigned ", not just the whitespace.
>
> The ? applies to one atom before it. An atom is just the single
> character ' ', not the whole string 'unsigned '. So says "Tcl and the
> Tk Toolkit", section 9.3.
>
> It's been that way in Unix regular expressions since the days of 'ed'.
>
> What with the fifty different regular expression implementations out
> there, maybe one of them does behave that way.
Two, actually.
> Not TCL or egrep or perl
> or vim though.
>
Of course, I never bothered to use one of these, i was working with a
C++ regex engine.
> Michael C
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [testsuite] gdb.c++/templates.exp
@ 2003-07-09 15:50 Michael Elizabeth Chastain
2003-07-09 16:19 ` Daniel Berlin
0 siblings, 1 reply; 12+ messages in thread
From: Michael Elizabeth Chastain @ 2003-07-09 15:50 UTC (permalink / raw)
To: dberlin; +Cc: gdb-patches, mludvig
Hi Daniel,
>> \\(unsigned ?(long|)\\);
> Just to be clear, this regex should accept nothing, "long", "unsigned
> long", and "unsigned".
> This may be *wrong*, but it certainly shouldn't accept "unsignedlong".
> The ? should be applying to "unsigned ", not just the whitespace.
The ? applies to one atom before it. An atom is just the single
character ' ', not the whole string 'unsigned '. So says "Tcl and the
Tk Toolkit", section 9.3.
It's been that way in Unix regular expressions since the days of 'ed'.
What with the fifty different regular expression implementations out
there, maybe one of them does behave that way. Not TCL or egrep or perl
or vim though.
Michael C
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [testsuite] gdb.c++/templates.exp
@ 2003-07-09 15:35 Michael Elizabeth Chastain
0 siblings, 0 replies; 12+ messages in thread
From: Michael Elizabeth Chastain @ 2003-07-09 15:35 UTC (permalink / raw)
To: dberlin; +Cc: gdb-patches, mludvig
Hi Daniel,
mec> \\(unsigned ?(long|)\\);
mec>
mec> It would accept 'unsignedlong' which would be wrong.
berlin> It shouldn't, unless the regex isn't whitespace sensitive
I think you have it backwards:
PATTERN TEXT
'unsigned' -> 'unsigned'
' ?' -> ''
'(long|)' -> 'long'
Matches 'unsignedlong'.
Try it with egrep:
$ egrep 'unsigned ?(long|)'
unsignedlong
unsignedlong
Try it with tclsh:
$ tclsh
% regexp "unsigned ?(long|)" unsignedlong
1
mec> Can you try:
mec>
mec> \\(unsigned( long|)\\);
berlin> Now *this* would accept unsignedlong, unless the regexps in expect are
berlin> unlike any other system i've seen.
berlin>
berlin> This is because the alternation would be between " long" and "", *not*
berlin> "long" and "" (IE your regex would not be equivalent to
berlin> <space>long|<space>
This accepts either '(unsigned);' or '(unsigned long);'.
It does not accept '(unsignedlong);'. Try it with egrep or tclsh.
I did.
$ tclsh
% regexp "\\(unsigned( long|)\\)" "(unsigned)"
1
% regexp "\\(unsigned( long|)\\)" "(unsigned long)"
1
% regexp "\\(unsigned( long|)\\)" "(unsignedlong)"
0
I agree that the alternation is between " long" and "".
These two regular expressions are equivalent:
\\(unsigned( long|)\\);
\\((unsigned long|unsigned)\\);
Michael C
^ permalink raw reply [flat|nested] 12+ messages in thread
* [testsuite] gdb.c++/templates.exp
@ 2003-07-09 13:26 Michal Ludvig
0 siblings, 0 replies; 12+ messages in thread
From: Michal Ludvig @ 2003-07-09 13:26 UTC (permalink / raw)
To: GDB Patches
[-- Attachment #1: Type: text/plain, Size: 211 bytes --]
Hi,
this is probably an obvious fix, but anyway. Someone please approve it
for both mainline and 6.0. Thanks!
Michal Ludvig
--
* SuSE CR, s.r.o * mludvig@suse.cz
* (+420) 296.545.373 * http://www.suse.cz
[-- Attachment #2: testsuite-c++-templates-1.diff --]
[-- Type: text/plain, Size: 3034 bytes --]
2003-07-09 Michal Ludvig <mludvig@suse.cz>
* testsuite/gdb.c++/templates.exp (test_ptype_of_templates):
Recognize expansion of size_t to 'unsigned long', not only
to 'unsigned'.
Index: testsuite/gdb.c++/templates.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/templates.exp,v
retrieving revision 1.18
diff -u -p -r1.18 templates.exp
--- testsuite/gdb.c++/templates.exp 4 Mar 2003 17:02:20 -0000 1.18
+++ testsuite/gdb.c++/templates.exp 9 Jul 2003 13:23:36 -0000
@@ -61,7 +61,7 @@ proc test_ptype_of_templates {} {
-re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;((${ws}T5<int> & operator=\\(T5<int> const ?&\\);)|(${ws}T5\\(int\\);)|(${ws}T5\\((T5<int> const|const T5<int>) ?&\\);)|(${ws}~T5\\((void|)\\);)|(${ws}static void \\* operator new\\(unsigned( int| long)?\\);)|(${ws}static void operator delete\\(void ?\\*\\);)|(${ws}int value\\((void|)\\);))*${ws}\}\r\n$gdb_prompt $" {
pass "ptype T5<int> (obsolescent gcc or gdb)"
}
- -re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}void T5\\(int\\);${ws}void T5\\((T5<int> const|const T5<int>) ?&\\);${ws}~T5\\(int\\);${ws}static void \\* operator new\\(unsigned\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}\}\r\n$gdb_prompt $" {
+ -re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}void T5\\(int\\);${ws}void T5\\((T5<int> const|const T5<int>) ?&\\);${ws}~T5\\(int\\);${ws}static void \\* operator new\\(unsigned ?(long|)\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}\}\r\n$gdb_prompt $" {
# This also triggers gdb/1113...
kfail "gdb/1111" "ptype T5<int>"
}
@@ -87,7 +87,7 @@ proc test_ptype_of_templates {} {
-re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;((${ws}T5<int> & operator=\\(T5<int> const ?&\\);)|(${ws}T5\\(int\\);)|(${ws}T5\\(T5<int> const ?&\\);)|(${ws}~T5\\((void|)\\);)|(${ws}static void \\* operator new\\(unsigned( int| long)?\\);)|(${ws}static void operator delete\\(void ?\\*\\);)|(${ws}int value\\((void|)\\);))*${ws}\}\r\n$gdb_prompt $" {
pass "ptype t5i (obsolescent gcc or gdb)"
}
- -re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}void T5\\(int\\);${ws}void T5\\((T5<int> const|const T5<int>) ?&\\);${ws}~T5\\(int\\);${ws}static void \\* operator new\\(unsigned\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}\}\r\n$gdb_prompt $" {
+ -re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}void T5\\(int\\);${ws}void T5\\((T5<int> const|const T5<int>) ?&\\);${ws}~T5\\(int\\);${ws}static void \\* operator new\\(unsigned ?(long|)\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}\}\r\n$gdb_prompt $" {
# This also triggers gdb/1113...
kfail "gdb/1111" "ptype T5<int>"
}
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2003-07-11 6:45 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-09 15:05 [testsuite] gdb.c++/templates.exp Michael Elizabeth Chastain
2003-07-09 15:16 ` Daniel Berlin
2003-07-09 15:20 ` Daniel Berlin
2003-07-09 15:38 ` Daniel Jacobowitz
2003-07-09 15:43 ` Andreas Schwab
2003-07-10 7:51 ` Michal Ludvig
-- strict thread matches above, loose matches on Subject: below --
2003-07-10 14:38 Michael Elizabeth Chastain
2003-07-11 6:45 ` Michal Ludvig
2003-07-09 15:50 Michael Elizabeth Chastain
2003-07-09 16:19 ` Daniel Berlin
2003-07-09 15:35 Michael Elizabeth Chastain
2003-07-09 13:26 Michal Ludvig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox