summaryrefslogtreecommitdiff
path: root/gdb/macroexp.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2008-07-27 01:58:01 +0000
committerTom Tromey <tromey@redhat.com>2008-07-27 01:58:01 +0000
commit1482e9f1fcff4a88a184c2cff99709bd4657bdb9 (patch)
treea66aa83217bdb2e53cc13b414f3f380839010e0f /gdb/macroexp.c
parent12903607c24966168d9d7260e141b0fe8aa3db34 (diff)
downloadgdb-1482e9f1fcff4a88a184c2cff99709bd4657bdb9.tar.gz
gdb:
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.
Diffstat (limited to 'gdb/macroexp.c')
-rw-r--r--gdb/macroexp.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/gdb/macroexp.c b/gdb/macroexp.c
index 0cb9575678e..8102bc081f0 100644
--- a/gdb/macroexp.c
+++ b/gdb/macroexp.c
@@ -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
};