Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* 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, 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
* 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
* [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-10 14:38 [testsuite] gdb.c++/templates.exp Michael Elizabeth Chastain
2003-07-11  6:45 ` Michal Ludvig
  -- strict thread matches above, loose matches on Subject: below --
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 15:05 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
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