From 9da75ad32ed2e8a5e8dad4ef019d7c31fe8c209e Mon Sep 17 00:00:00 2001 From: Fred Fish Date: Wed, 3 Feb 1993 00:28:54 +0000 Subject: [PATCH] * c-exp.y (lcurly, rcurly): New nonterminals. * c-exp.y (exp): Use lcurly and rcurly for arrays and UNOP_MEMVAL constructs. * parse.c (free_funcalls): Moved prototype from parser-defs.h, made function static. * parse.c (struct funcall): Moved struct def from parser-defs.h. * parse.c (funcall_chain): Moved from parser-defs.h, made static. * parse.c (start_arglist): * parser-defs.h (free_funcalls): Moved prototype to parse.c. * parser-defs.h (struct funcall): Moved struct def to parse.c. * parser-defs.h (funcall_chain): Moved to parse.c. * printcmd.c (print_frame_nameless_args): Fix prototype. * tm-mips.h (setup_arbitrary_frame): Fix prototype. * tm-sparc.h (setup_arbitrary_frame): Fix prototype. * valops.c (typecmp): Moved prototype from values.h. * value.h (typecmp): Moved prototype to valops.c, made static. **** start-sanitize-chill **** * ch-exp.y (yylex): Change way control sequences are disabled. **** end-sanitize-chill **** --- gdb/ChangeLog | 22 ++++++++++++++++++++++ gdb/c-exp.y | 20 ++++++++++++-------- gdb/ch-exp.y | 5 ++++- gdb/parse.c | 19 +++++++++++++++++-- gdb/parser-defs.h | 14 -------------- gdb/tm-mips.h | 4 +++- gdb/tm-sparc.h | 4 +++- 7 files changed, 61 insertions(+), 27 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f45db9f7d88..f715e334c81 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,25 @@ +Tue Feb 2 16:10:31 1993 Fred Fish (fnf@cygnus.com) + + * c-exp.y (lcurly, rcurly): New nonterminals. + * c-exp.y (exp): Use lcurly and rcurly for arrays and UNOP_MEMVAL + constructs. + * parse.c (free_funcalls): Moved prototype from parser-defs.h, + made function static. + * parse.c (struct funcall): Moved struct def from parser-defs.h. + * parse.c (funcall_chain): Moved from parser-defs.h, made static. + * parse.c (start_arglist): + * parser-defs.h (free_funcalls): Moved prototype to parse.c. + * parser-defs.h (struct funcall): Moved struct def to parse.c. + * parser-defs.h (funcall_chain): Moved to parse.c. + * printcmd.c (print_frame_nameless_args): Fix prototype. + * tm-mips.h (setup_arbitrary_frame): Fix prototype. + * tm-sparc.h (setup_arbitrary_frame): Fix prototype. + * valops.c (typecmp): Moved prototype from values.h. + * value.h (typecmp): Moved prototype to valops.c, made static. + **** start-sanitize-chill **** + * ch-exp.y (yylex): Change way control sequences are disabled. + **** end-sanitize-chill **** + Tue Feb 2 16:11:43 1993 John Gilmore (gnu@cygnus.com) * tm-mips.h, tm-sparc.h: Fix thinko in SETUP_ARBITRARY_FRAME. diff --git a/gdb/c-exp.y b/gdb/c-exp.y index a7f7320b496..981634a0eb1 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -128,7 +128,8 @@ static int parse_number PARAMS ((char *, int, int, YYSTYPE *)); %} -%type exp exp1 type_exp start variable qualified_name +%type exp exp1 type_exp start variable qualified_name lcurly +%type rcurly %type type typebase %type nonempty_typelist /* %type block */ @@ -307,6 +308,10 @@ exp : exp '(' write_exp_elt_opcode (OP_FUNCALL); } ; +lcurly : '{' + { start_arglist (); } + ; + arglist : ; @@ -318,18 +323,17 @@ arglist : arglist ',' exp %prec ABOVE_COMMA { arglist_len++; } ; -exp : '{' - /* This is to save the value of arglist_len - being accumulated by an outer function call. */ - { start_arglist (); } - arglist '}' %prec ARROW +rcurly : '}' + { $$ = end_arglist () - 1; } + ; +exp : lcurly arglist rcurly %prec ARROW { write_exp_elt_opcode (OP_ARRAY); write_exp_elt_longcst ((LONGEST) 0); - write_exp_elt_longcst ((LONGEST) end_arglist () - 1); + write_exp_elt_longcst ((LONGEST) $3); write_exp_elt_opcode (OP_ARRAY); } ; -exp : '{' type '}' exp %prec UNARY +exp : lcurly type rcurly exp %prec UNARY { write_exp_elt_opcode (UNOP_MEMVAL); write_exp_elt_type ($2); write_exp_elt_opcode (UNOP_MEMVAL); } diff --git a/gdb/ch-exp.y b/gdb/ch-exp.y index 1ee9c90f5d8..7233721e59c 100644 --- a/gdb/ch-exp.y +++ b/gdb/ch-exp.y @@ -1420,7 +1420,7 @@ match_character_literal () if ((*tokptr == '^') && (*(tokptr + 1) == '(')) { - return (0); /* Disable, see note above. */ +#if 0 /* Disable, see note above. -fnf */ /* Match and decode a control sequence. Return zero if we don't find a valid integer literal, or if the next unconsumed character after the integer literal is not the trailing ')'. @@ -1431,6 +1431,9 @@ match_character_literal () { return (0); } +#else + return (0); +#endif } else { diff --git a/gdb/parse.c b/gdb/parse.c index 9d9697593c6..4cec13b38b7 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -38,6 +38,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "language.h" #include "parser-defs.h" +static void +free_funcalls PARAMS ((void)); + static void prefixify_expression PARAMS ((struct expression *)); @@ -47,6 +50,17 @@ length_of_subexp PARAMS ((struct expression *, int)); static void prefixify_subexp PARAMS ((struct expression *, struct expression *, int, int)); +/* Data structure for saving values of arglist_len for function calls whose + arguments contain other function calls. */ + +struct funcall + { + struct funcall *next; + int arglist_len; + }; + +static struct funcall *funcall_chain; + /* Assign machine-independent names to certain registers (unless overridden by the REGISTER_NAMES table) */ @@ -82,8 +96,9 @@ unsigned num_std_regs = (sizeof std_regs / sizeof std_regs[0]); void start_arglist () { - register struct funcall *new = (struct funcall *) xmalloc (sizeof (struct funcall)); + register struct funcall *new; + new = (struct funcall *) xmalloc (sizeof (struct funcall)); new->next = funcall_chain; new->arglist_len = arglist_len; arglist_len = 0; @@ -107,7 +122,7 @@ end_arglist () /* Free everything in the funcall chain. Used when there is an error inside parsing. */ -void +static void free_funcalls () { register struct funcall *call, *next; diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h index 098cd39bfa7..c57511a2c9f 100644 --- a/gdb/parser-defs.h +++ b/gdb/parser-defs.h @@ -49,17 +49,6 @@ struct block *block_found; /* Number of arguments seen so far in innermost function call. */ int arglist_len; -/* Data structure for saving values of arglist_len - for function calls whose arguments contain other function calls. */ - -struct funcall - { - struct funcall *next; - int arglist_len; - }; - -struct funcall *funcall_chain; - /* A string token, either a char-string or bit-string. Char-strings are used, for example, for the names of symbols. */ @@ -129,9 +118,6 @@ start_arglist PARAMS ((void)); extern int end_arglist PARAMS ((void)); -extern void -free_funcalls PARAMS ((void)); - extern char * copy_name PARAMS ((struct stoken)); diff --git a/gdb/tm-mips.h b/gdb/tm-mips.h index ad09333d254..0075662b52a 100644 --- a/gdb/tm-mips.h +++ b/gdb/tm-mips.h @@ -367,6 +367,8 @@ typedef struct mips_extra_func_info { multiple functions with the same SP that are at different stack levels. */ #define SETUP_ARBITRARY_FRAME(argc, argv) setup_arbitrary_frame (argc, argv) -extern struct frame_info *setup_arbitrary_frame (); +/* FIXME: Depends on equivalence between FRAME and "struct frame_info *", + and equivalence between CORE_ADDR and FRAME_ADDR. */ +extern struct frame_info *setup_arbitrary_frame PARAMS ((int, CORE_ADDR *)); #define STAB_REG_TO_REGNUM(num) ((num) < 32 ? (num) : (num)+FP0_REGNUM-32) diff --git a/gdb/tm-sparc.h b/gdb/tm-sparc.h index a4c6d490640..9dcc7a423e2 100644 --- a/gdb/tm-sparc.h +++ b/gdb/tm-sparc.h @@ -552,7 +552,9 @@ extern void single_step (); "frame" or "info frame" command. */ #define SETUP_ARBITRARY_FRAME(argc, argv) setup_arbitrary_frame (argc, argv) -extern struct frame_info *setup_arbitrary_frame (); +/* FIXME: Depends on equivalence between FRAME and "struct frame_info *", + and equivalence between CORE_ADDR and FRAME_ADDR. */ +extern struct frame_info *setup_arbitrary_frame PARAMS ((int, CORE_ADDR *)); /* To print every pair of float registers as a double, we use this hook. */ -- 2.30.2