gdb:
authorTom Tromey <tromey@redhat.com>
Sun, 27 Jul 2008 01:58:01 +0000 (01:58 +0000)
committerTom Tromey <tromey@redhat.com>
Sun, 27 Jul 2008 01:58:01 +0000 (01:58 +0000)
PR gdb/1136:
* macroexp.c (get_punctuator) <punctuators>: Rearrange to put
longer tokens first.
gdb/testsuite:
* gdb.base/macscp.exp: Add test for macro lexing bug.

gdb/ChangeLog
gdb/macroexp.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/macscp.exp

index d1458ad4bf94aee67261dca07f8a75d662d806e2..5db0b0c53cf19f7b1a88c82a07d20dd8b1eaf007 100644 (file)
@@ -1,3 +1,9 @@
+2008-07-26  Tom Tromey  <tromey@redhat.com>
+
+       PR gdb/1136:
+       * macroexp.c (get_punctuator) <punctuators>: Rearrange to put
+       longer tokens first.
+
 2008-07-26  Vladimir Prus  <vladimir@codesourcery.com>
 
        Kill cmd_async_ok.
index 0cb9575678edf73398357348f4649dbc15bf7742..8102bc081f00b366a9e12e4a1487a6f73a755b71 100644 (file)
@@ -416,16 +416,27 @@ get_punctuator (struct macro_buffer *tok, char *p, char *end)
 {
   /* Here, speed is much less important than correctness and clarity.  */
 
-  /* ISO/IEC 9899:1999 (E)  Section 6.4.6  Paragraph 1  */
+  /* ISO/IEC 9899:1999 (E)  Section 6.4.6  Paragraph 1.
+     Note that this table is ordered in a special way.  A punctuator
+     which is a prefix of another punctuator must appear after its
+     "extension".  Otherwise, the wrong token will be returned.  */
   static const char * const punctuators[] = {
-    "[", "]", "(", ")", "{", "}", ".", "->", 
-    "++", "--", "&", "*", "+", "-", "~", "!",
-    "/", "%", "<<", ">>", "<", ">", "<=", ">=", "==", "!=", 
-    "^", "|", "&&", "||",
-    "?", ":", ";", "...",
-    "=", "*=", "/=", "%=", "+=", "-=", "<<=", ">>=", "&=", "^=", "|=",
-    ",", "#", "##",
-    "<:", ":>", "<%", "%>", "%:", "%:%:",
+    "[", "]", "(", ")", "{", "}", "?", ";", ",", "~",
+    "...", ".",
+    "->", "--", "-=", "-",
+    "++", "+=", "+",
+    "*=", "*",
+    "!=", "!",
+    "&&", "&=", "&",
+    "/=", "/",
+    "%>", "%:%:", "%:", "%=", "%",
+    "^=", "^",
+    "##", "#",
+    ":>", ":",
+    "||", "|=", "|",
+    "<<=", "<<", "<=", "<:", "<%", "<",
+    ">>=", ">>", ">=", ">",
+    "==", "=",
     0
   };
 
index 1a07bc1defe40f6bca5b001f98074e87e24a258c..4047c48bca0d72c16c443f637a098b795fa116c0 100644 (file)
@@ -1,3 +1,7 @@
+2008-07-26  Tom Tromey  <tromey@redhat.com>
+
+       * gdb.base/macscp.exp: Add test for macro lexing bug.
+
 2008-07-18  Tom Tromey  <tromey@redhat.com>
 
        * gdb.base/macscp.exp: Add macro tests.
index 90c2d9531f338b4e5ce16c035a45801ac2e49e97..15d3f2f6430d3d1bb33cd1105573d991bfc55530 100644 (file)
@@ -472,3 +472,8 @@ gdb_test "macro undef M" \
 gdb_test "print M" \
     "No symbol \"M\" in current context\." \
     "print expression with macro after user undef."
+
+# Regression test; this used to emit the wrong error.
+gdb_test "macro expand SPLICE(x, y)" \
+  "Token splicing is not implemented yet." \
+  "macro splicing lexes correctly"
This page took 0.038388 seconds and 4 git commands to generate.