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.
This commit is contained in:
Tom Tromey 2008-07-27 01:58:01 +00:00
parent d27eff1ca4
commit ccb3ac8a12
4 changed files with 35 additions and 9 deletions

View 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.

View 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
};

View 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.

View 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"