summaryrefslogtreecommitdiff
path: root/gdb/p-exp.y
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/p-exp.y')
-rw-r--r--gdb/p-exp.y35
1 files changed, 28 insertions, 7 deletions
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index eee4fa94b3..64e81898e3 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -89,7 +89,7 @@ static char *uptok (const char *, int);
struct type *type;
} typed_val_int;
struct {
- DOUBLEST dval;
+ gdb_byte val[16];
struct type *type;
} typed_val_float;
struct symbol *sym;
@@ -511,11 +511,11 @@ exp : NAME_OR_INT
exp : FLOAT
- { write_exp_elt_opcode (pstate, OP_DOUBLE);
+ { write_exp_elt_opcode (pstate, OP_FLOAT);
write_exp_elt_type (pstate, $1.type);
current_type = $1.type;
- write_exp_elt_dblcst (pstate, $1.dval);
- write_exp_elt_opcode (pstate, OP_DOUBLE); }
+ write_exp_elt_floatcst (pstate, $1.val);
+ write_exp_elt_opcode (pstate, OP_FLOAT); }
;
exp : variable
@@ -854,9 +854,30 @@ parse_number (struct parser_state *par_state,
if (parsed_float)
{
- if (! parse_c_float (parse_gdbarch (par_state), p, len,
- &putithere->typed_val_float.dval,
- &putithere->typed_val_float.type))
+ /* Handle suffixes: 'f' for float, 'l' for long double.
+ FIXME: This appears to be an extension -- do we want this? */
+ if (len >= 1 && tolower (p[len - 1]) == 'f')
+ {
+ putithere->typed_val_float.type
+ = parse_type (par_state)->builtin_float;
+ len--;
+ }
+ else if (len >= 1 && tolower (p[len - 1]) == 'l')
+ {
+ putithere->typed_val_float.type
+ = parse_type (par_state)->builtin_long_double;
+ len--;
+ }
+ /* Default type for floating-point literals is double. */
+ else
+ {
+ putithere->typed_val_float.type
+ = parse_type (par_state)->builtin_double;
+ }
+
+ if (!parse_float (p, len,
+ putithere->typed_val_float.type,
+ putithere->typed_val_float.val))
return ERROR;
return FLOAT;
}