summaryrefslogtreecommitdiff
path: root/gdb/objc-exp.y
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2010-08-19 13:33:10 +0000
committerDoug Evans <dje@google.com>2010-08-19 13:33:10 +0000
commit135ac82a029af8c6d2e5de354cd4fad68047dd8c (patch)
treec97de5c6cd7b5a35179a11ebbefab4896833b166 /gdb/objc-exp.y
parent724d4482b9db1aced5ae391ad624f76877991232 (diff)
downloadgdb-135ac82a029af8c6d2e5de354cd4fad68047dd8c.tar.gz
PR exp/11926
* parser-defs.h (parse_float, parse_c_float): Declare. * parse.c (parse_float, parse_c_float): New function. * c-exp.y (parse_number): Call parse_c_float. * objc-exp.y (parse_number): Ditto. * p-exp.y (parse_number): Ditto. Use ANSI/ISO-style definition. * jv-exp.y (parse_number): Call parse_float, fix suffix handling. testsuite/ * gdb.base/printcmds.exp (test_float_accepted): New function. Move existing float tests there. Add tests for floats with suffixes. (test_float_rejected): New function. * gdb.java/jv-print.exp (test_float_accepted): New function. (test_float_rejected): New function. * gdb.objc/print.exp: New file. * gdb.pascal/print.exp: New file. * lib/objc.exp: New file.
Diffstat (limited to 'gdb/objc-exp.y')
-rw-r--r--gdb/objc-exp.y22
1 files changed, 3 insertions, 19 deletions
diff --git a/gdb/objc-exp.y b/gdb/objc-exp.y
index 888bd201e4f..1f3d1e7fa7e 100644
--- a/gdb/objc-exp.y
+++ b/gdb/objc-exp.y
@@ -1012,26 +1012,10 @@ parse_number (p, len, parsed_float, putithere)
if (parsed_float)
{
- char c;
-
- /* It's a float since it contains a point or an exponent. */
-
- sscanf (p, "%" DOUBLEST_SCAN_FORMAT "%c",
- &putithere->typed_val_float.dval, &c);
-
- /* See if it has `f' or `l' suffix (float or long double). */
-
- c = tolower (p[len - 1]);
-
- if (c == 'f')
- putithere->typed_val_float.type = parse_type->builtin_float;
- else if (c == 'l')
- putithere->typed_val_float.type = parse_type->builtin_long_double;
- else if (isdigit (c) || c == '.')
- putithere->typed_val_float.type = parse_type->builtin_double;
- else
+ if (! parse_c_float (parse_gdbarch, p, len,
+ &putithere->typed_val_float.dval,
+ &putithere->typed_val_float.type))
return ERROR;
-
return FLOAT;
}