projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add a new 'info proc files' subcommand of 'info proc'.
[deliverable/binutils-gdb.git]
/
gdb
/
f-exp.y
diff --git
a/gdb/f-exp.y
b/gdb/f-exp.y
index 420f18e56334c826870291941e8f9468243bf2d3..5ef16125f5dad844820d2c3280b1d57b6247879a 100644
(file)
--- a/
gdb/f-exp.y
+++ b/
gdb/f-exp.y
@@
-1,6
+1,6
@@
/* YACC parser for Fortran expressions, for GDB.
/* YACC parser for Fortran expressions, for GDB.
- Copyright (C) 1986-201
6
Free Software Foundation, Inc.
+ Copyright (C) 1986-201
8
Free Software Foundation, Inc.
Contributed by Motorola. Adapted from the C parser by Farooq Butt
(fmbutt@engage.sps.mot.com).
Contributed by Motorola. Adapted from the C parser by Farooq Butt
(fmbutt@engage.sps.mot.com).
@@
-72,7
+72,7
@@
int yyparse (void);
static int yylex (void);
static int yylex (void);
-
void yyerror (
char *);
+
static void yyerror (const
char *);
static void growbuf_by_size (int);
static void growbuf_by_size (int);
@@
-91,7
+91,10
@@
static int match_string_literal (void);
LONGEST val;
struct type *type;
} typed_val;
LONGEST val;
struct type *type;
} typed_val;
- DOUBLEST dval;
+ struct {
+ gdb_byte val[16];
+ struct type *type;
+ } typed_val_float;
struct symbol *sym;
struct type *tval;
struct stoken sval;
struct symbol *sym;
struct type *tval;
struct stoken sval;
@@
-122,7
+125,7
@@
static int parse_number (struct parser_state *, const char *, int,
%type <tval> ptype
%token <typed_val> INT
%type <tval> ptype
%token <typed_val> INT
-%token <
dval
> FLOAT
+%token <
typed_val_float
> FLOAT
/* Both NAME and TYPENAME tokens represent symbols in the input,
and both convey their data as strings.
/* Both NAME and TYPENAME tokens represent symbols in the input,
and both convey their data as strings.
@@
-414,12
+417,10
@@
exp : NAME_OR_INT
;
exp : FLOAT
;
exp : FLOAT
- { write_exp_elt_opcode (pstate, OP_DOUBLE);
- write_exp_elt_type (pstate,
- parse_f_type (pstate)
- ->builtin_real_s8);
- write_exp_elt_dblcst (pstate, $1);
- write_exp_elt_opcode (pstate, OP_DOUBLE); }
+ { write_exp_elt_opcode (pstate, OP_FLOAT);
+ write_exp_elt_type (pstate, $1.type);
+ write_exp_elt_floatcst (pstate, $1.val);
+ write_exp_elt_opcode (pstate, OP_FLOAT); }
;
exp : variable
;
exp : variable
@@
-460,12
+461,7
@@
variable: name_not_typename
if (sym.symbol)
{
if (symbol_read_needs_frame (sym.symbol))
if (sym.symbol)
{
if (symbol_read_needs_frame (sym.symbol))
- {
- if (innermost_block == 0
- || contained_in (sym.block,
- innermost_block))
- innermost_block = sym.block;
- }
+ innermost_block.update (sym);
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
write_exp_elt_block (pstate, sym.block);
write_exp_elt_sym (pstate, sym.symbol);
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
write_exp_elt_block (pstate, sym.block);
write_exp_elt_sym (pstate, sym.symbol);
@@
-513,7
+509,7
@@
ptype : typebase
follow_type = lookup_pointer_type (follow_type);
break;
case tp_reference:
follow_type = lookup_pointer_type (follow_type);
break;
case tp_reference:
- follow_type = lookup_reference_type (follow_type);
+ follow_type = lookup_
lvalue_
reference_type (follow_type);
break;
case tp_array:
array_size = pop_type_int ();
break;
case tp_array:
array_size = pop_type_int ();
@@
-647,16
+643,22
@@
parse_number (struct parser_state *par_state,
if (parsed_float)
{
/* It's a float since it contains a point or an exponent. */
if (parsed_float)
{
/* It's a float since it contains a point or an exponent. */
- /* [dD] is not understood as an exponent by atof, change it to 'e'. */
+ /* [dD] is not understood as an exponent by parse_float,
+ change it to 'e'. */
char *tmp, *tmp2;
tmp = xstrdup (p);
for (tmp2 = tmp; *tmp2; ++tmp2)
if (*tmp2 == 'd' || *tmp2 == 'D')
*tmp2 = 'e';
char *tmp, *tmp2;
tmp = xstrdup (p);
for (tmp2 = tmp; *tmp2; ++tmp2)
if (*tmp2 == 'd' || *tmp2 == 'D')
*tmp2 = 'e';
- putithere->dval = atof (tmp);
+
+ /* FIXME: Should this use different types? */
+ putithere->typed_val_float.type = parse_f_type (pstate)->builtin_real_s8;
+ bool parsed = parse_float (tmp, len,
+ putithere->typed_val_float.type,
+ putithere->typed_val_float.val);
free (tmp);
free (tmp);
- return
FLOAT
;
+ return
parsed? FLOAT : ERROR
;
}
/* Handle base-switching prefixes 0x, 0t, 0d, 0 */
}
/* Handle base-switching prefixes 0x, 0t, 0d, 0 */
@@
-773,7
+775,7
@@
parse_number (struct parser_state *par_state,
struct token
{
struct token
{
- char *oper;
+ c
onst c
har *oper;
int token;
enum exp_opcode opcode;
};
int token;
enum exp_opcode opcode;
};
@@
-807,7
+809,7
@@
static const struct token dot_ops[] =
struct f77_boolean_val
{
struct f77_boolean_val
{
- char *name;
+ c
onst c
har *name;
int value;
};
int value;
};
@@
-1006,7
+1008,7
@@
yylex (void)
/* Might be a floating point number. */
if (lexptr[1] < '0' || lexptr[1] > '9')
goto symbol; /* Nope, must be a symbol. */
/* Might be a floating point number. */
if (lexptr[1] < '0' || lexptr[1] > '9')
goto symbol; /* Nope, must be a symbol. */
- /* FALL THRU
into number case
. */
+ /* FALL THRU. */
case '0':
case '1':
case '0':
case '1':
@@
-1206,23
+1208,19
@@
yylex (void)
int
f_parse (struct parser_state *par_state)
{
int
f_parse (struct parser_state *par_state)
{
- int result;
- struct cleanup *c = make_cleanup_clear_parser_state (&pstate);
-
/* Setting up the parser state. */
/* Setting up the parser state. */
+ scoped_restore pstate_restore = make_scoped_restore (&pstate);
gdb_assert (par_state != NULL);
pstate = par_state;
gdb_assert (par_state != NULL);
pstate = par_state;
- result = yyparse ();
- do_cleanups (c);
- return result;
+ return yyparse ();
}
}
-void
-yyerror (char *msg)
+
static
void
+yyerror (c
onst c
har *msg)
{
if (prev_lexptr)
lexptr = prev_lexptr;
{
if (prev_lexptr)
lexptr = prev_lexptr;
- error (_("A %s in expression, near `%s'."),
(msg ? msg : "error")
, lexptr);
+ error (_("A %s in expression, near `%s'."),
msg
, lexptr);
}
}
This page took
0.029313 seconds
and
4
git commands to generate.