OSDN Git Service

gdb
authortromey <tromey>
Tue, 28 Apr 2009 01:03:21 +0000 (01:03 +0000)
committertromey <tromey>
Tue, 28 Apr 2009 01:03:21 +0000 (01:03 +0000)
* c-exp.y (yylex): Handle '[' and ']' like '(' and ')'.
gdb/testsuite
* gdb.base/printcmds.exp (test_printf): Test comma operator in [].

gdb/ChangeLog
gdb/c-exp.y
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/printcmds.exp

index 1d932f8..5dd33b2 100644 (file)
@@ -1,3 +1,7 @@
+2009-04-27  Tom Tromey  <tromey@redhat.com>
+
+       * c-exp.y (yylex): Handle '[' and ']' like '(' and ')'.
+
 2009-04-27  Jerome Guitton  <guitton@adacore.com>
 
        * symtab.c (append_exact_match_to_sals): New function, extracted
index 92d6c21..688c060 100644 (file)
@@ -1885,11 +1885,13 @@ yylex ()
       lexptr++;
       goto retry;
 
+    case '[':
     case '(':
       paren_depth++;
       lexptr++;
       return c;
 
+    case ']':
     case ')':
       if (paren_depth == 0)
        return 0;
@@ -1991,8 +1993,6 @@ yylex ()
     case '@':
     case '<':
     case '>':
-    case '[':
-    case ']':
     case '?':
     case ':':
     case '=':
index fa6cd7d..61aee21 100644 (file)
@@ -1,3 +1,7 @@
+2009-04-27  Tom Tromey  <tromey@redhat.com>
+
+       * gdb.base/printcmds.exp (test_printf): Test comma operator in [].
+
 2009-04-27  Doug Evans  <dje@google.com>
 
        * gdb.threads/watchthreads.c (main): Initialize args before starting
index b6f8a1f..65ab3a4 100644 (file)
@@ -666,6 +666,9 @@ proc test_printf {} {
     gdb_test "printf \"x=%d,y=%f,z=%d\\n\", 5, 6.0, 7" "x=5,y=6\.0+,z=7"
     gdb_test "printf \"%x %f, %c %x, %x, %f\\n\", 0xbad, -99.541, 'z',\
 0xfeedface, 0xdeadbeef, 5.0" "bad -99.54\[0-9\]+, z feedface, deadbeef, 5.0+"
+
+    # Regression test for C lexer bug.
+    gdb_test "printf \"%c\\n\", \"x\"\[1,0\]" "x"
 }
 
 #Test printing DFP values with printf