From 17c8aaf5078f15d4cd621a5428a82080a7f4c516 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 12 Dec 2008 17:03:37 +0000 Subject: gdb * macroexp.c (get_pp_number): Require digit after leading ".". Correctly handle suffixes. gdb/testsuite * gdb.base/macscp.exp: New regression test. --- gdb/macroexp.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'gdb/macroexp.c') diff --git a/gdb/macroexp.c b/gdb/macroexp.c index 7fb23ce..dda3592 100644 --- a/gdb/macroexp.c +++ b/gdb/macroexp.c @@ -278,20 +278,22 @@ get_pp_number (struct macro_buffer *tok, char *p, char *end) { if (p < end && (macro_is_digit (*p) - || *p == '.')) + || (*p == '.' + && p + 2 <= end + && macro_is_digit (p[1])))) { char *tok_start = p; while (p < end) { - if (macro_is_digit (*p) - || macro_is_identifier_nondigit (*p) - || *p == '.') - p++; - else if (p + 2 <= end - && strchr ("eEpP.", *p) - && (p[1] == '+' || p[1] == '-')) + if (p + 2 <= end + && strchr ("eEpP", *p) + && (p[1] == '+' || p[1] == '-')) p += 2; + else if (macro_is_digit (*p) + || macro_is_identifier_nondigit (*p) + || *p == '.') + p++; else break; } -- cgit v1.1