aboutsummaryrefslogtreecommitdiff
path: root/gdb/macroexp.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2008-12-12 17:03:37 +0000
committerTom Tromey <tromey@redhat.com>2008-12-12 17:03:37 +0000
commit17c8aaf5078f15d4cd621a5428a82080a7f4c516 (patch)
treefcedb227ffe2eabd84c347593e64bc3992776ce7 /gdb/macroexp.c
parentcc704ebecf3fd0ca95eadf7a89c6dfd4446e5c26 (diff)
downloadfsf-binutils-gdb-17c8aaf5078f15d4cd621a5428a82080a7f4c516.zip
fsf-binutils-gdb-17c8aaf5078f15d4cd621a5428a82080a7f4c516.tar.gz
fsf-binutils-gdb-17c8aaf5078f15d4cd621a5428a82080a7f4c516.tar.bz2
gdb
* macroexp.c (get_pp_number): Require digit after leading ".". Correctly handle suffixes. gdb/testsuite * gdb.base/macscp.exp: New regression test.
Diffstat (limited to 'gdb/macroexp.c')
-rw-r--r--gdb/macroexp.c18
1 files changed, 10 insertions, 8 deletions
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;
}