/* YACC parser for Fortran expressions, for GDB.
- Copyright (C) 1986-2016 Free Software Foundation, Inc.
+ Copyright (C) 1986-2017 Free Software Foundation, Inc.
Contributed by Motorola. Adapted from the C parser by Farooq Butt
(fmbutt@engage.sps.mot.com).
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
#include "block.h"
#include <ctype.h>
+#include <algorithm>
#define parse_type(ps) builtin_type (parse_gdbarch (ps))
#define parse_f_type(ps) builtin_f_type (parse_gdbarch (ps))
static int yylex (void);
-void yyerror (char *);
+void yyerror (const char *);
static void growbuf_by_size (int);
/* There are four sorts of subrange types in F90. */
subrange: exp ':' exp %prec ABOVE_COMMA
- { write_exp_elt_opcode (pstate, OP_F90_RANGE);
+ { write_exp_elt_opcode (pstate, OP_RANGE);
write_exp_elt_longcst (pstate, NONE_BOUND_DEFAULT);
- write_exp_elt_opcode (pstate, OP_F90_RANGE); }
+ write_exp_elt_opcode (pstate, OP_RANGE); }
;
subrange: exp ':' %prec ABOVE_COMMA
- { write_exp_elt_opcode (pstate, OP_F90_RANGE);
+ { write_exp_elt_opcode (pstate, OP_RANGE);
write_exp_elt_longcst (pstate, HIGH_BOUND_DEFAULT);
- write_exp_elt_opcode (pstate, OP_F90_RANGE); }
+ write_exp_elt_opcode (pstate, OP_RANGE); }
;
subrange: ':' exp %prec ABOVE_COMMA
- { write_exp_elt_opcode (pstate, OP_F90_RANGE);
+ { write_exp_elt_opcode (pstate, OP_RANGE);
write_exp_elt_longcst (pstate, LOW_BOUND_DEFAULT);
- write_exp_elt_opcode (pstate, OP_F90_RANGE); }
+ write_exp_elt_opcode (pstate, OP_RANGE); }
;
subrange: ':' %prec ABOVE_COMMA
- { write_exp_elt_opcode (pstate, OP_F90_RANGE);
+ { write_exp_elt_opcode (pstate, OP_RANGE);
write_exp_elt_longcst (pstate, BOTH_BOUND_DEFAULT);
- write_exp_elt_opcode (pstate, OP_F90_RANGE); }
+ write_exp_elt_opcode (pstate, OP_RANGE); }
;
complexnum: exp ',' exp
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 ();
struct token
{
- char *oper;
+ const char *oper;
int token;
enum exp_opcode opcode;
};
struct f77_boolean_val
{
- char *name;
+ const char *name;
int value;
};
{
int growby;
- growby = max (count, GROWBY_MIN_SIZE);
+ growby = std::max (count, GROWBY_MIN_SIZE);
tempbufsize += growby;
if (tempbuf == NULL)
tempbuf = (char *) malloc (tempbufsize);
int
f_parse (struct parser_state *par_state)
{
- int result;
- struct cleanup *c = make_cleanup_clear_parser_state (&pstate);
-
/* Setting up the parser state. */
+ scoped_restore pstate_restore = make_scoped_restore (&pstate);
gdb_assert (par_state != NULL);
pstate = par_state;
- result = yyparse ();
- do_cleanups (c);
- return result;
+ return yyparse ();
}
void
-yyerror (char *msg)
+yyerror (const char *msg)
{
if (prev_lexptr)
lexptr = prev_lexptr;