1991-09-19 10:31:00 +00:00
|
|
|
|
/* YACC parser for C expressions, for GDB.
|
1997-03-22 10:50:18 +00:00
|
|
|
|
Copyright (C) 1986, 1989, 1990, 1991, 1993, 1994, 1996, 1997
|
* README: Remove note about gcc warnings on alpha, these should be
gone now.
* c-exp.y, ch-exp.y, core.c, corelow.c, eval.c, fork-child.c,
m2-exp.y, minsyms.c, nlmread.c, parse.c, putenv.c, regex.c
remote-utils.c, stabsread.c: Include <string.h>.
* regex.c: Include "defs.h", change re_comp argument to const char *.
* infptrace.c (fetch_register, store_inferior_registers): Change
regaddr to type CORE_ADDR.
* config/alpha/alpha-nw.mt, config/alpha/alpha-osf1.mt (MT_CFLAGS):
Remove, no longer necessary now that we use bfd_vma for a CORE_ADDR.
1994-02-08 09:01:03 +00:00
|
|
|
|
Free Software Foundation, Inc.
|
1991-09-19 10:31:00 +00:00
|
|
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
1995-08-02 03:41:12 +00:00
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
1991-09-19 10:31:00 +00:00
|
|
|
|
|
|
|
|
|
/* Parse a C expression from text in a string,
|
|
|
|
|
and return the result as a struct expression pointer.
|
|
|
|
|
That structure contains arithmetic operations in reverse polish,
|
|
|
|
|
with constants represented by operations that are followed by special data.
|
|
|
|
|
See expression.h for the details of the format.
|
|
|
|
|
What is important here is that it can be built up sequentially
|
|
|
|
|
during the process of parsing; the lower levels of the tree always
|
1992-10-31 00:35:08 +00:00
|
|
|
|
come first in the result.
|
|
|
|
|
|
|
|
|
|
Note that malloc's and realloc's in this file are transformed to
|
|
|
|
|
xmalloc and xrealloc respectively by the same sed command in the
|
|
|
|
|
makefile that remaps any other malloc/realloc inserted by the parser
|
|
|
|
|
generator. Doing this with #defines and trying to control the interaction
|
|
|
|
|
with include files (<malloc.h> and <stdlib.h> for example) just became
|
|
|
|
|
too messy, particularly when such includes can be inserted at random
|
|
|
|
|
times by the parser generator. */
|
1991-09-19 10:31:00 +00:00
|
|
|
|
|
|
|
|
|
%{
|
|
|
|
|
|
|
|
|
|
#include "defs.h"
|
1996-04-05 04:22:08 +00:00
|
|
|
|
#include "gdb_string.h"
|
|
|
|
|
#include <ctype.h>
|
1991-09-19 10:31:00 +00:00
|
|
|
|
#include "expression.h"
|
|
|
|
|
#include "value.h"
|
1993-10-24 23:42:02 +00:00
|
|
|
|
#include "parser-defs.h"
|
1991-09-19 10:31:00 +00:00
|
|
|
|
#include "language.h"
|
* c-exp.y, m2-exp.y: Migrate code that has nothing to do with
expression parsing into c-lang.c and m2-lang.c respectively.
* c-lang.c, m2-lang.c: New files, code migrated from c-exp.y and
m2-exp.y respectively.
* c-lang.h, m2-lang.h: New files, internal interfaces between c-*
and m2-* files respectively.
* Makefile.in (SFILES_MAINDIR): Add c-lang.c, m2-lang.c.
* Makefile.in (HFILES): Add c-lang.h, m2-lang.h.
* Makefile.in (OBS): Add c-lang.o, m2-lang.o.
* expression.h (struct block): Forward declaration for prototypes.
* language.h (struct objfile): Forward declaration for prototypes.
**** start-sanitize-chill ****
* Makefile.in (SFILES_MAINDIR): Add ch-lang.c.
* Makefile.in (HFILES): Add ch-lang.h.
* Makefile.in (OBS): Add ch-lang.o.
* ch-exp.y: Migrate code that has nothing to do with expression
parsing into ch-lang.c.
* ch-lang.c: New file, code migrated from c-exp.y.
* ch-lang.h: New file, internal interface between ch-* files.
**** end-sanitize-chill ****
1992-12-09 06:50:30 +00:00
|
|
|
|
#include "c-lang.h"
|
* Makefile.in (c-exp.tab.o): Remove notice about shift/reduce conflicts
which no longer occur.
gcc -Wall lint:
* findvar.c (symbol_read_needs_frame), corelow.c (ignore),
inflow.c (gdb_has_a_terminal): Make sure to return a value.
* regex.h: Declare re_set_syntax.
* printcmd.c: Include valprint.h.
* infcmd.c, exec.c, maint.c, core.c: Include language.h.
* maint.c: Include expression.h.
* infrun.c, fork-child.c, corelow.c, inflow.c: Include thread.h.
* inftarg.c: Include command.h.
* coredep.c: Include value.h.
* c-exp.y, m2-exp.y, ch-exp.y: Include bfd.h, symfile.h and objfiles.h.
* ch-typeprint.c: Include typeprint.h.
* ch-valprint.c: Include c-lang.h.
* nlmread.c: Include buildsym.h.
* environ.c: Include gdbcore.h. Only include defs.h once.
(set_in_environ): Cast const char * to char * when passing to
set_gnutarget.
Remove unused variables:
* printcmd.c (printf_command): args_to_vprintf.
* coffread.c (coff_symfile_init): strsection.
Move variables to within the #ifdefs where they are used:
* symtab.c (gdb_mangle_name): opname.
* inftarg.c (child_attach): pid and exec_file.
* inftarg.c (child_detach): siggnal.
* objfiles.c (allocate_objfile): mapto, md, and fd.
* objfiles.c (free_objfile): mmfd.
* infrun.c (wait_for_inferior): Include BPSTAT_WHAT_LAST in switch.
* infrun.c (wait_for_inferior): Remove unused same_pid label.
* inferior.h: Declare set_sigint_trap and clear_sigint_trap.
* parser-defs.h: Declare write_exp_elt_block.
* stabsread.h: Declare elfstab_offset_sections and
coffstab_build_psymtabs.
1993-10-21 20:41:50 +00:00
|
|
|
|
#include "bfd.h" /* Required by objfiles.h. */
|
|
|
|
|
#include "symfile.h" /* Required by objfiles.h. */
|
|
|
|
|
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
|
1991-09-19 10:31:00 +00:00
|
|
|
|
|
* Makefile.in (BISON): Add comment that when bison is used, it
must include the "-y" option.
* c-exp.y, m2-exp.y (yyrule, yyname, yyss, yyssp, yyvs, yyvsp):
Remove defines to remap non-yacc symbols, thus backing out of
previous recent changes. Standard policy is that non-yacc parser
generators get fixed, rather than adding bug workarounds in gdb
for each new one that pops up. Expand comment to note this.
* c-exp.y, m2-exp.y (YYDEBUG): Revert back to disabled by default.
1992-12-31 19:08:08 +00:00
|
|
|
|
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
|
|
|
|
|
as well as gratuitiously global symbol names, so we can have multiple
|
|
|
|
|
yacc generated parsers in gdb. Note that these are only the variables
|
|
|
|
|
produced by yacc. If other parser generators (bison, byacc, etc) produce
|
|
|
|
|
additional global names that conflict at link time, then those parser
|
|
|
|
|
generators need to be fixed instead of adding those names to this list. */
|
|
|
|
|
|
1991-11-19 15:59:55 +00:00
|
|
|
|
#define yymaxdepth c_maxdepth
|
1991-09-19 10:31:00 +00:00
|
|
|
|
#define yyparse c_parse
|
|
|
|
|
#define yylex c_lex
|
|
|
|
|
#define yyerror c_error
|
|
|
|
|
#define yylval c_lval
|
|
|
|
|
#define yychar c_char
|
|
|
|
|
#define yydebug c_debug
|
|
|
|
|
#define yypact c_pact
|
|
|
|
|
#define yyr1 c_r1
|
|
|
|
|
#define yyr2 c_r2
|
|
|
|
|
#define yydef c_def
|
|
|
|
|
#define yychk c_chk
|
|
|
|
|
#define yypgo c_pgo
|
|
|
|
|
#define yyact c_act
|
|
|
|
|
#define yyexca c_exca
|
1991-09-20 19:30:36 +00:00
|
|
|
|
#define yyerrflag c_errflag
|
|
|
|
|
#define yynerrs c_nerrs
|
1991-09-28 01:30:41 +00:00
|
|
|
|
#define yyps c_ps
|
|
|
|
|
#define yypv c_pv
|
|
|
|
|
#define yys c_s
|
1991-11-19 15:59:55 +00:00
|
|
|
|
#define yy_yys c_yys
|
1991-09-28 01:30:41 +00:00
|
|
|
|
#define yystate c_state
|
|
|
|
|
#define yytmp c_tmp
|
|
|
|
|
#define yyv c_v
|
1991-11-19 15:59:55 +00:00
|
|
|
|
#define yy_yyv c_yyv
|
1991-09-28 01:30:41 +00:00
|
|
|
|
#define yyval c_val
|
|
|
|
|
#define yylloc c_lloc
|
* c-exp.y, m2-exp.y (yyreds, yytoks): Remap like other yy* names.
* c-exp.y, m2-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* c-exp.y (strncmp): Replace throughout with STREQN, missed
them during the previous replacements.
* printcmd.c (_initialize_printcmd): Update internal documentation
for "set" command to note that the assignment syntax is language
dependent.
**** start-sanitize-chill ****
* ch-exp.y (yyreds, yytoks): Remap like other yy* names.
* ch-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* ch-exp.y (GDB_REGNAME, GDB_LAST, GDB_VARIABLE, GDB_ASSIGNMENT,
single_assignment_action): New terminals and nonterminal for gdb
extensions to chill expression grammer.
* ch-exp.y (match_dollar_tokens): Lexer routine to match all
tokens that start with '$' (register names, convenience vars, etc).
* ch-exp.y (tokentab2): Add GDB_ASSIGNMENT.
* ch-exp.y (yylex): Call match_dollar_tokens.
**** end-sanitize-chill ****
1992-12-31 04:05:05 +00:00
|
|
|
|
#define yyreds c_reds /* With YYDEBUG defined */
|
|
|
|
|
#define yytoks c_toks /* With YYDEBUG defined */
|
1995-03-01 17:23:41 +00:00
|
|
|
|
#define yylhs c_yylhs
|
|
|
|
|
#define yylen c_yylen
|
|
|
|
|
#define yydefred c_yydefred
|
|
|
|
|
#define yydgoto c_yydgoto
|
|
|
|
|
#define yysindex c_yysindex
|
|
|
|
|
#define yyrindex c_yyrindex
|
|
|
|
|
#define yygindex c_yygindex
|
|
|
|
|
#define yytable c_yytable
|
|
|
|
|
#define yycheck c_yycheck
|
* Makefile.in (BISON): Add comment that when bison is used, it
must include the "-y" option.
* c-exp.y, m2-exp.y (yyrule, yyname, yyss, yyssp, yyvs, yyvsp):
Remove defines to remap non-yacc symbols, thus backing out of
previous recent changes. Standard policy is that non-yacc parser
generators get fixed, rather than adding bug workarounds in gdb
for each new one that pops up. Expand comment to note this.
* c-exp.y, m2-exp.y (YYDEBUG): Revert back to disabled by default.
1992-12-31 19:08:08 +00:00
|
|
|
|
|
|
|
|
|
#ifndef YYDEBUG
|
|
|
|
|
#define YYDEBUG 0 /* Default to no yydebug support */
|
|
|
|
|
#endif
|
1991-09-19 10:31:00 +00:00
|
|
|
|
|
1992-03-30 22:19:14 +00:00
|
|
|
|
int
|
1992-02-22 01:46:16 +00:00
|
|
|
|
yyparse PARAMS ((void));
|
|
|
|
|
|
* Makefile.in (BISON): Add comment that when bison is used, it
must include the "-y" option.
* c-exp.y, m2-exp.y (yyrule, yyname, yyss, yyssp, yyvs, yyvsp):
Remove defines to remap non-yacc symbols, thus backing out of
previous recent changes. Standard policy is that non-yacc parser
generators get fixed, rather than adding bug workarounds in gdb
for each new one that pops up. Expand comment to note this.
* c-exp.y, m2-exp.y (YYDEBUG): Revert back to disabled by default.
1992-12-31 19:08:08 +00:00
|
|
|
|
static int
|
1992-02-22 01:46:16 +00:00
|
|
|
|
yylex PARAMS ((void));
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
yyerror PARAMS ((char *));
|
1991-09-19 10:31:00 +00:00
|
|
|
|
|
|
|
|
|
%}
|
|
|
|
|
|
|
|
|
|
/* Although the yacc "value" of an expression is not used,
|
|
|
|
|
since the result is stored in the structure being created,
|
|
|
|
|
other node types do have values. */
|
|
|
|
|
|
|
|
|
|
%union
|
|
|
|
|
{
|
|
|
|
|
LONGEST lval;
|
1992-11-06 18:37:20 +00:00
|
|
|
|
struct {
|
|
|
|
|
LONGEST val;
|
|
|
|
|
struct type *type;
|
* Add native support for long double data type.
* c-exp.y (%union): Change dval to typed_val_float. Use DOUBLEST
to store actual data. Change types of INT and FLOAT tokens to
typed_val_int and typed_val_float respectively. Create new token
DOUBLE_KEYWORD to specify the string `double'. Make production
for FLOAT use type determined by parse_number. Add production for
"long double" data type.
* (parse_number): Use sscanf to parse numbers as float, double or
long double depending upon the type of typed_val_float.dval. Also
allow user to specify `f' or `l' suffix to explicitly specify
float or long double constants. Change typed_val to
typed_val_int.
* (yylex): Change typed_val to typed_val_int. Also, scan for
"double" keyword.
* coffread.c (decode_base_type): Add support for T_LNGDBL basic
type.
* configure, configure.in: Add check for long double support in
the host compiler.
* defs.h: Define DOUBLEST appropriatly depending on whether
HAVE_LONG_DOUBLE (from autoconf) is defined. Also, fix prototypes
for functions that handle this type.
* expression.h (union exp_element): doubleconst is now type
DOUBLEST.
* m2-exp.y f-exp.y (%union): dval becomes type DOUBLEST.
* findvar.c (extract_floating): Make return value be DOUBLEST.
Also, add support for numbers with size of long double.
* (store_floating): Arg `val' is now type DOUBLEST. Handle all
floating types.
* parser-defs.h parse.c (write_exp_elt_dblcst): Arg expelt is now
DOUBLEST.
* valarith.c (value_binop): Change temp variables v1, v2 and v to
type DOUBLEST. Coerce type of result to long double if either op
was of that type.
* valops.c (value_arg_coerce): If argument type is bigger than
double, coerce to long double.
* (call_function_by_hand): If REG_STRUCT_HAS_ADDR is defined, and
arg type is float and > 8 bytes, then use pointer-to-object
calling conventions.
* valprint.c (print_floating): Arg doub is now type DOUBLEST.
Use appropriate format and precision to print out floating point
values.
* value.h: Fixup prototypes for value_as_double,
value_from_double, and unpack_double to use DOUBLEST.
* values.c (record_latest_value): Remove check for invalid
floats. Allow history to store them so that people may examine
them in hex if they want.
* (value_as_double unpack_double): Change return value to DOUBLEST.
* (value_from_double): Arg `num' is now DOUBLEST.
* (using_struct_return): Use RETURN_VALUE_ON_STACK macro (target
specific) to expect certain types to always be returned on the stack.
1996-02-17 00:07:35 +00:00
|
|
|
|
} typed_val_int;
|
|
|
|
|
struct {
|
|
|
|
|
DOUBLEST dval;
|
|
|
|
|
struct type *type;
|
|
|
|
|
} typed_val_float;
|
1991-09-19 10:31:00 +00:00
|
|
|
|
struct symbol *sym;
|
|
|
|
|
struct type *tval;
|
|
|
|
|
struct stoken sval;
|
|
|
|
|
struct ttype tsym;
|
|
|
|
|
struct symtoken ssym;
|
|
|
|
|
int voidval;
|
|
|
|
|
struct block *bval;
|
|
|
|
|
enum exp_opcode opcode;
|
|
|
|
|
struct internalvar *ivar;
|
|
|
|
|
|
|
|
|
|
struct type **tvec;
|
|
|
|
|
int *ivec;
|
|
|
|
|
}
|
|
|
|
|
|
1992-02-22 01:46:16 +00:00
|
|
|
|
%{
|
|
|
|
|
/* YYSTYPE gets defined by %union */
|
|
|
|
|
static int
|
|
|
|
|
parse_number PARAMS ((char *, int, int, YYSTYPE *));
|
|
|
|
|
%}
|
|
|
|
|
|
1993-02-03 00:28:54 +00:00
|
|
|
|
%type <voidval> exp exp1 type_exp start variable qualified_name lcurly
|
|
|
|
|
%type <lval> rcurly
|
1992-09-10 00:07:06 +00:00
|
|
|
|
%type <tval> type typebase
|
1991-09-19 10:31:00 +00:00
|
|
|
|
%type <tvec> nonempty_typelist
|
|
|
|
|
/* %type <bval> block */
|
|
|
|
|
|
|
|
|
|
/* Fancy type parsing. */
|
|
|
|
|
%type <voidval> func_mod direct_abs_decl abs_decl
|
|
|
|
|
%type <tval> ptype
|
|
|
|
|
%type <lval> array_mod
|
|
|
|
|
|
* Add native support for long double data type.
* c-exp.y (%union): Change dval to typed_val_float. Use DOUBLEST
to store actual data. Change types of INT and FLOAT tokens to
typed_val_int and typed_val_float respectively. Create new token
DOUBLE_KEYWORD to specify the string `double'. Make production
for FLOAT use type determined by parse_number. Add production for
"long double" data type.
* (parse_number): Use sscanf to parse numbers as float, double or
long double depending upon the type of typed_val_float.dval. Also
allow user to specify `f' or `l' suffix to explicitly specify
float or long double constants. Change typed_val to
typed_val_int.
* (yylex): Change typed_val to typed_val_int. Also, scan for
"double" keyword.
* coffread.c (decode_base_type): Add support for T_LNGDBL basic
type.
* configure, configure.in: Add check for long double support in
the host compiler.
* defs.h: Define DOUBLEST appropriatly depending on whether
HAVE_LONG_DOUBLE (from autoconf) is defined. Also, fix prototypes
for functions that handle this type.
* expression.h (union exp_element): doubleconst is now type
DOUBLEST.
* m2-exp.y f-exp.y (%union): dval becomes type DOUBLEST.
* findvar.c (extract_floating): Make return value be DOUBLEST.
Also, add support for numbers with size of long double.
* (store_floating): Arg `val' is now type DOUBLEST. Handle all
floating types.
* parser-defs.h parse.c (write_exp_elt_dblcst): Arg expelt is now
DOUBLEST.
* valarith.c (value_binop): Change temp variables v1, v2 and v to
type DOUBLEST. Coerce type of result to long double if either op
was of that type.
* valops.c (value_arg_coerce): If argument type is bigger than
double, coerce to long double.
* (call_function_by_hand): If REG_STRUCT_HAS_ADDR is defined, and
arg type is float and > 8 bytes, then use pointer-to-object
calling conventions.
* valprint.c (print_floating): Arg doub is now type DOUBLEST.
Use appropriate format and precision to print out floating point
values.
* value.h: Fixup prototypes for value_as_double,
value_from_double, and unpack_double to use DOUBLEST.
* values.c (record_latest_value): Remove check for invalid
floats. Allow history to store them so that people may examine
them in hex if they want.
* (value_as_double unpack_double): Change return value to DOUBLEST.
* (value_from_double): Arg `num' is now DOUBLEST.
* (using_struct_return): Use RETURN_VALUE_ON_STACK macro (target
specific) to expect certain types to always be returned on the stack.
1996-02-17 00:07:35 +00:00
|
|
|
|
%token <typed_val_int> INT
|
|
|
|
|
%token <typed_val_float> FLOAT
|
1991-09-19 10:31:00 +00:00
|
|
|
|
|
|
|
|
|
/* Both NAME and TYPENAME tokens represent symbols in the input,
|
|
|
|
|
and both convey their data as strings.
|
|
|
|
|
But a TYPENAME is a string that happens to be defined as a typedef
|
|
|
|
|
or builtin type name (such as int or char)
|
|
|
|
|
and a NAME is any other symbol.
|
|
|
|
|
Contexts where this distinction is not important can use the
|
|
|
|
|
nonterminal "name", which matches either NAME or TYPENAME. */
|
|
|
|
|
|
|
|
|
|
%token <sval> STRING
|
|
|
|
|
%token <ssym> NAME /* BLOCKNAME defined below to give it higher precedence. */
|
|
|
|
|
%token <tsym> TYPENAME
|
|
|
|
|
%type <sval> name
|
|
|
|
|
%type <ssym> name_not_typename
|
|
|
|
|
%type <tsym> typename
|
|
|
|
|
|
|
|
|
|
/* A NAME_OR_INT is a symbol which is not known in the symbol table,
|
|
|
|
|
but which would parse as a valid number in the current input radix.
|
|
|
|
|
E.g. "c" when input_radix==16. Depending on the parse, it will be
|
1992-11-06 18:37:20 +00:00
|
|
|
|
turned into a name or into a number. */
|
1991-09-19 10:31:00 +00:00
|
|
|
|
|
1992-11-06 18:37:20 +00:00
|
|
|
|
%token <ssym> NAME_OR_INT
|
1991-09-19 10:31:00 +00:00
|
|
|
|
|
1992-07-09 04:40:39 +00:00
|
|
|
|
%token STRUCT CLASS UNION ENUM SIZEOF UNSIGNED COLONCOLON
|
1991-11-15 23:16:29 +00:00
|
|
|
|
%token TEMPLATE
|
1991-09-19 10:31:00 +00:00
|
|
|
|
%token ERROR
|
|
|
|
|
|
|
|
|
|
/* Special type cases, put in to allow the parser to distinguish different
|
|
|
|
|
legal basetypes. */
|
* Add native support for long double data type.
* c-exp.y (%union): Change dval to typed_val_float. Use DOUBLEST
to store actual data. Change types of INT and FLOAT tokens to
typed_val_int and typed_val_float respectively. Create new token
DOUBLE_KEYWORD to specify the string `double'. Make production
for FLOAT use type determined by parse_number. Add production for
"long double" data type.
* (parse_number): Use sscanf to parse numbers as float, double or
long double depending upon the type of typed_val_float.dval. Also
allow user to specify `f' or `l' suffix to explicitly specify
float or long double constants. Change typed_val to
typed_val_int.
* (yylex): Change typed_val to typed_val_int. Also, scan for
"double" keyword.
* coffread.c (decode_base_type): Add support for T_LNGDBL basic
type.
* configure, configure.in: Add check for long double support in
the host compiler.
* defs.h: Define DOUBLEST appropriatly depending on whether
HAVE_LONG_DOUBLE (from autoconf) is defined. Also, fix prototypes
for functions that handle this type.
* expression.h (union exp_element): doubleconst is now type
DOUBLEST.
* m2-exp.y f-exp.y (%union): dval becomes type DOUBLEST.
* findvar.c (extract_floating): Make return value be DOUBLEST.
Also, add support for numbers with size of long double.
* (store_floating): Arg `val' is now type DOUBLEST. Handle all
floating types.
* parser-defs.h parse.c (write_exp_elt_dblcst): Arg expelt is now
DOUBLEST.
* valarith.c (value_binop): Change temp variables v1, v2 and v to
type DOUBLEST. Coerce type of result to long double if either op
was of that type.
* valops.c (value_arg_coerce): If argument type is bigger than
double, coerce to long double.
* (call_function_by_hand): If REG_STRUCT_HAS_ADDR is defined, and
arg type is float and > 8 bytes, then use pointer-to-object
calling conventions.
* valprint.c (print_floating): Arg doub is now type DOUBLEST.
Use appropriate format and precision to print out floating point
values.
* value.h: Fixup prototypes for value_as_double,
value_from_double, and unpack_double to use DOUBLEST.
* values.c (record_latest_value): Remove check for invalid
floats. Allow history to store them so that people may examine
them in hex if they want.
* (value_as_double unpack_double): Change return value to DOUBLEST.
* (value_from_double): Arg `num' is now DOUBLEST.
* (using_struct_return): Use RETURN_VALUE_ON_STACK macro (target
specific) to expect certain types to always be returned on the stack.
1996-02-17 00:07:35 +00:00
|
|
|
|
%token SIGNED_KEYWORD LONG SHORT INT_KEYWORD CONST_KEYWORD VOLATILE_KEYWORD DOUBLE_KEYWORD
|
1991-09-19 10:31:00 +00:00
|
|
|
|
|
1995-10-05 22:15:49 +00:00
|
|
|
|
%token <voidval> VARIABLE
|
1991-09-19 10:31:00 +00:00
|
|
|
|
|
|
|
|
|
%token <opcode> ASSIGN_MODIFY
|
|
|
|
|
|
|
|
|
|
/* C++ */
|
|
|
|
|
%token THIS
|
|
|
|
|
|
|
|
|
|
%left ','
|
|
|
|
|
%left ABOVE_COMMA
|
|
|
|
|
%right '=' ASSIGN_MODIFY
|
|
|
|
|
%right '?'
|
1992-02-20 19:23:42 +00:00
|
|
|
|
%left OROR
|
|
|
|
|
%left ANDAND
|
1991-09-19 10:31:00 +00:00
|
|
|
|
%left '|'
|
|
|
|
|
%left '^'
|
|
|
|
|
%left '&'
|
|
|
|
|
%left EQUAL NOTEQUAL
|
|
|
|
|
%left '<' '>' LEQ GEQ
|
|
|
|
|
%left LSH RSH
|
|
|
|
|
%left '@'
|
|
|
|
|
%left '+' '-'
|
|
|
|
|
%left '*' '/' '%'
|
|
|
|
|
%right UNARY INCREMENT DECREMENT
|
|
|
|
|
%right ARROW '.' '[' '('
|
|
|
|
|
%token <ssym> BLOCKNAME
|
1998-06-10 23:29:59 +00:00
|
|
|
|
%token <bval> FILENAME
|
1991-09-19 10:31:00 +00:00
|
|
|
|
%type <bval> block
|
|
|
|
|
%left COLONCOLON
|
1992-06-10 02:05:20 +00:00
|
|
|
|
|
1992-07-09 11:47:50 +00:00
|
|
|
|
|
|
|
|
|
%%
|
|
|
|
|
|
1991-09-19 10:31:00 +00:00
|
|
|
|
start : exp1
|
|
|
|
|
| type_exp
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
type_exp: type
|
|
|
|
|
{ write_exp_elt_opcode(OP_TYPE);
|
|
|
|
|
write_exp_elt_type($1);
|
|
|
|
|
write_exp_elt_opcode(OP_TYPE);}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* Expressions, including the comma operator. */
|
|
|
|
|
exp1 : exp
|
|
|
|
|
| exp1 ',' exp
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_COMMA); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* Expressions, not including the comma operator. */
|
|
|
|
|
exp : '*' exp %prec UNARY
|
|
|
|
|
{ write_exp_elt_opcode (UNOP_IND); }
|
|
|
|
|
|
|
|
|
|
exp : '&' exp %prec UNARY
|
|
|
|
|
{ write_exp_elt_opcode (UNOP_ADDR); }
|
|
|
|
|
|
|
|
|
|
exp : '-' exp %prec UNARY
|
|
|
|
|
{ write_exp_elt_opcode (UNOP_NEG); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : '!' exp %prec UNARY
|
* Makefile.in (SFILES_MAINDIR): Add ch-exp.y.
* Makefile.in (YYFILES): Add ch-exp.tab.c.
* Makefile.in (YYOBJ): Add ch-exp.tab.o.
* Makefile.in (saber_gdb): Add unload of ch-exp.y and load
of ch-exp.tab.c.
* Makefile.in (distclean): Add target ch-exp.tab.c.
* Makefile.in (realclean): Add rm of ch-exp.tab.c.
* Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on
Makefile since it contains sed patterns used in generation.
Add sed pattern to also delete #include of any malloc.h.
* Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets.
* ch-exp.y: New expression parser, for GNU-Chill.
* c-exp.y, expr.c, expression.h, language.c, m2-exp.y,
parser-defs.h, valarith.c, valops.c, value.h: Remap macros and
function names to conform to K&R terminology with respect to
logical and bitwise operators:
UNOP_ZEROP => UNOP_LOGICAL_NOT
UNOP_LOGNOT => UNOP_COMPLEMENT
BINOP_LOGAND => BINOP_BITWISE_AND
BINOP_LOGXOR => BINOP_BITWISE_XOR
BINOP_LOGIOR => BINOP_BITWISE_IOR
BINOP_AND => BINOP_LOGICAL_AND
BINOP_OR => BINOP_LOGICAL_OR
PREC_OR => PREC_LOGICAL_OR
PREC_AND => PREC_LOGICAL_AND
PREC_LOGIOR => PREC_BITWISE_IOR
PREC_LOGXOR => PREC_BITWISE_XOR
PREC_LOGAND => PREC_BITWISE_AND
value_zerop() => value_logical_not()
value_lognot() => value_complement()
* c-exp.y (c_op_print_tab): Add explicit empty terminator.
* m2-exp.y (m2_op_print_tab): Add explicit empty terminator.
* defs.h (enum language): Add language_chill.
* dwarfread.c (set_cu_language): Add LANG_CHILL case and make
LANG_MODULA2 a recognized language.
* eval.c (evaluate_subexp): Add OP_BOOL case.
* expprint.c (print_subexp): Add OP_BOOL case.
* gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for
Chill as well as Modula-2.
* gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long,
builtin_type_chill_ulong, builtin_type_chill_real): Add.
* i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary
and is nonexistant in some SVR4 based systems.
* language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4.
* language.c (set_language_command): Add chill.
* language.c (binop_result_type, integral_type, character_type,
boolean_type, structured_type, value_true, binop_type_check):
Add language_chill cases.
* language.h (_LANG_chill): Define.
* m2-exp.y (number_sign, modblock): Make static, #ifdef out
unused modblock.
* m2-exp.y (ANDAND): Rename to LOGICAL_AND.
* source.c (source_info): Fix minor nits, print "1 line" rather
than "1 lines", and "language is <lang>".
* symfile.c (deduce_language_from_filename): Recognize the
filename extensions ".chill", ".c186", and ".c286" for Chill.
* valarith.c (value_binop): Handle TYPE_CODE_BOOL as well
as TYPE_CODE_INT and TYPE_CODE_FLOAT.
* valprint.c (val_print): Print TYPE_CODE_BOOL type values as
"TRUE" or "FALSE".
* valprint.c (typedef_print): Add case for language_chill.
* values.c (value_from_longest): Handle TYPE_CODE_BOOL.
1992-11-15 17:28:02 +00:00
|
|
|
|
{ write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
|
1991-09-19 10:31:00 +00:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : '~' exp %prec UNARY
|
* Makefile.in (SFILES_MAINDIR): Add ch-exp.y.
* Makefile.in (YYFILES): Add ch-exp.tab.c.
* Makefile.in (YYOBJ): Add ch-exp.tab.o.
* Makefile.in (saber_gdb): Add unload of ch-exp.y and load
of ch-exp.tab.c.
* Makefile.in (distclean): Add target ch-exp.tab.c.
* Makefile.in (realclean): Add rm of ch-exp.tab.c.
* Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on
Makefile since it contains sed patterns used in generation.
Add sed pattern to also delete #include of any malloc.h.
* Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets.
* ch-exp.y: New expression parser, for GNU-Chill.
* c-exp.y, expr.c, expression.h, language.c, m2-exp.y,
parser-defs.h, valarith.c, valops.c, value.h: Remap macros and
function names to conform to K&R terminology with respect to
logical and bitwise operators:
UNOP_ZEROP => UNOP_LOGICAL_NOT
UNOP_LOGNOT => UNOP_COMPLEMENT
BINOP_LOGAND => BINOP_BITWISE_AND
BINOP_LOGXOR => BINOP_BITWISE_XOR
BINOP_LOGIOR => BINOP_BITWISE_IOR
BINOP_AND => BINOP_LOGICAL_AND
BINOP_OR => BINOP_LOGICAL_OR
PREC_OR => PREC_LOGICAL_OR
PREC_AND => PREC_LOGICAL_AND
PREC_LOGIOR => PREC_BITWISE_IOR
PREC_LOGXOR => PREC_BITWISE_XOR
PREC_LOGAND => PREC_BITWISE_AND
value_zerop() => value_logical_not()
value_lognot() => value_complement()
* c-exp.y (c_op_print_tab): Add explicit empty terminator.
* m2-exp.y (m2_op_print_tab): Add explicit empty terminator.
* defs.h (enum language): Add language_chill.
* dwarfread.c (set_cu_language): Add LANG_CHILL case and make
LANG_MODULA2 a recognized language.
* eval.c (evaluate_subexp): Add OP_BOOL case.
* expprint.c (print_subexp): Add OP_BOOL case.
* gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for
Chill as well as Modula-2.
* gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long,
builtin_type_chill_ulong, builtin_type_chill_real): Add.
* i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary
and is nonexistant in some SVR4 based systems.
* language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4.
* language.c (set_language_command): Add chill.
* language.c (binop_result_type, integral_type, character_type,
boolean_type, structured_type, value_true, binop_type_check):
Add language_chill cases.
* language.h (_LANG_chill): Define.
* m2-exp.y (number_sign, modblock): Make static, #ifdef out
unused modblock.
* m2-exp.y (ANDAND): Rename to LOGICAL_AND.
* source.c (source_info): Fix minor nits, print "1 line" rather
than "1 lines", and "language is <lang>".
* symfile.c (deduce_language_from_filename): Recognize the
filename extensions ".chill", ".c186", and ".c286" for Chill.
* valarith.c (value_binop): Handle TYPE_CODE_BOOL as well
as TYPE_CODE_INT and TYPE_CODE_FLOAT.
* valprint.c (val_print): Print TYPE_CODE_BOOL type values as
"TRUE" or "FALSE".
* valprint.c (typedef_print): Add case for language_chill.
* values.c (value_from_longest): Handle TYPE_CODE_BOOL.
1992-11-15 17:28:02 +00:00
|
|
|
|
{ write_exp_elt_opcode (UNOP_COMPLEMENT); }
|
1991-09-19 10:31:00 +00:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : INCREMENT exp %prec UNARY
|
|
|
|
|
{ write_exp_elt_opcode (UNOP_PREINCREMENT); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : DECREMENT exp %prec UNARY
|
|
|
|
|
{ write_exp_elt_opcode (UNOP_PREDECREMENT); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp INCREMENT %prec UNARY
|
|
|
|
|
{ write_exp_elt_opcode (UNOP_POSTINCREMENT); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp DECREMENT %prec UNARY
|
|
|
|
|
{ write_exp_elt_opcode (UNOP_POSTDECREMENT); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : SIZEOF exp %prec UNARY
|
|
|
|
|
{ write_exp_elt_opcode (UNOP_SIZEOF); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp ARROW name
|
|
|
|
|
{ write_exp_elt_opcode (STRUCTOP_PTR);
|
|
|
|
|
write_exp_string ($3);
|
|
|
|
|
write_exp_elt_opcode (STRUCTOP_PTR); }
|
|
|
|
|
;
|
|
|
|
|
|
1992-09-10 00:07:06 +00:00
|
|
|
|
exp : exp ARROW qualified_name
|
|
|
|
|
{ /* exp->type::name becomes exp->*(&type::name) */
|
|
|
|
|
/* Note: this doesn't work if name is a
|
|
|
|
|
static member! FIXME */
|
|
|
|
|
write_exp_elt_opcode (UNOP_ADDR);
|
|
|
|
|
write_exp_elt_opcode (STRUCTOP_MPTR); }
|
1992-03-20 21:57:17 +00:00
|
|
|
|
;
|
1991-09-19 10:31:00 +00:00
|
|
|
|
exp : exp ARROW '*' exp
|
|
|
|
|
{ write_exp_elt_opcode (STRUCTOP_MPTR); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp '.' name
|
|
|
|
|
{ write_exp_elt_opcode (STRUCTOP_STRUCT);
|
|
|
|
|
write_exp_string ($3);
|
|
|
|
|
write_exp_elt_opcode (STRUCTOP_STRUCT); }
|
|
|
|
|
;
|
|
|
|
|
|
1992-09-10 00:07:06 +00:00
|
|
|
|
exp : exp '.' qualified_name
|
|
|
|
|
{ /* exp.type::name becomes exp.*(&type::name) */
|
|
|
|
|
/* Note: this doesn't work if name is a
|
|
|
|
|
static member! FIXME */
|
|
|
|
|
write_exp_elt_opcode (UNOP_ADDR);
|
|
|
|
|
write_exp_elt_opcode (STRUCTOP_MEMBER); }
|
1992-03-20 21:57:17 +00:00
|
|
|
|
;
|
|
|
|
|
|
1991-09-19 10:31:00 +00:00
|
|
|
|
exp : exp '.' '*' exp
|
|
|
|
|
{ write_exp_elt_opcode (STRUCTOP_MEMBER); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp '[' exp1 ']'
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_SUBSCRIPT); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp '('
|
|
|
|
|
/* This is to save the value of arglist_len
|
|
|
|
|
being accumulated by an outer function call. */
|
|
|
|
|
{ start_arglist (); }
|
|
|
|
|
arglist ')' %prec ARROW
|
|
|
|
|
{ write_exp_elt_opcode (OP_FUNCALL);
|
|
|
|
|
write_exp_elt_longcst ((LONGEST) end_arglist ());
|
|
|
|
|
write_exp_elt_opcode (OP_FUNCALL); }
|
|
|
|
|
;
|
|
|
|
|
|
1993-02-03 00:28:54 +00:00
|
|
|
|
lcurly : '{'
|
|
|
|
|
{ start_arglist (); }
|
|
|
|
|
;
|
|
|
|
|
|
1991-09-19 10:31:00 +00:00
|
|
|
|
arglist :
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
arglist : exp
|
|
|
|
|
{ arglist_len = 1; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
arglist : arglist ',' exp %prec ABOVE_COMMA
|
|
|
|
|
{ arglist_len++; }
|
|
|
|
|
;
|
|
|
|
|
|
1993-02-03 00:28:54 +00:00
|
|
|
|
rcurly : '}'
|
|
|
|
|
{ $$ = end_arglist () - 1; }
|
|
|
|
|
;
|
|
|
|
|
exp : lcurly arglist rcurly %prec ARROW
|
1993-01-19 23:00:19 +00:00
|
|
|
|
{ write_exp_elt_opcode (OP_ARRAY);
|
|
|
|
|
write_exp_elt_longcst ((LONGEST) 0);
|
1993-02-03 00:28:54 +00:00
|
|
|
|
write_exp_elt_longcst ((LONGEST) $3);
|
1993-01-19 23:00:19 +00:00
|
|
|
|
write_exp_elt_opcode (OP_ARRAY); }
|
|
|
|
|
;
|
|
|
|
|
|
1993-02-03 00:28:54 +00:00
|
|
|
|
exp : lcurly type rcurly exp %prec UNARY
|
1991-09-19 10:31:00 +00:00
|
|
|
|
{ write_exp_elt_opcode (UNOP_MEMVAL);
|
|
|
|
|
write_exp_elt_type ($2);
|
|
|
|
|
write_exp_elt_opcode (UNOP_MEMVAL); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : '(' type ')' exp %prec UNARY
|
|
|
|
|
{ write_exp_elt_opcode (UNOP_CAST);
|
|
|
|
|
write_exp_elt_type ($2);
|
|
|
|
|
write_exp_elt_opcode (UNOP_CAST); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : '(' exp1 ')'
|
|
|
|
|
{ }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* Binary operators in order of decreasing precedence. */
|
|
|
|
|
|
|
|
|
|
exp : exp '@' exp
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_REPEAT); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp '*' exp
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_MUL); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp '/' exp
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_DIV); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp '%' exp
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_REM); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp '+' exp
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_ADD); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp '-' exp
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_SUB); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp LSH exp
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_LSH); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp RSH exp
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_RSH); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp EQUAL exp
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_EQUAL); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp NOTEQUAL exp
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_NOTEQUAL); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp LEQ exp
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_LEQ); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp GEQ exp
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_GEQ); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp '<' exp
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_LESS); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp '>' exp
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_GTR); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp '&' exp
|
* Makefile.in (SFILES_MAINDIR): Add ch-exp.y.
* Makefile.in (YYFILES): Add ch-exp.tab.c.
* Makefile.in (YYOBJ): Add ch-exp.tab.o.
* Makefile.in (saber_gdb): Add unload of ch-exp.y and load
of ch-exp.tab.c.
* Makefile.in (distclean): Add target ch-exp.tab.c.
* Makefile.in (realclean): Add rm of ch-exp.tab.c.
* Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on
Makefile since it contains sed patterns used in generation.
Add sed pattern to also delete #include of any malloc.h.
* Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets.
* ch-exp.y: New expression parser, for GNU-Chill.
* c-exp.y, expr.c, expression.h, language.c, m2-exp.y,
parser-defs.h, valarith.c, valops.c, value.h: Remap macros and
function names to conform to K&R terminology with respect to
logical and bitwise operators:
UNOP_ZEROP => UNOP_LOGICAL_NOT
UNOP_LOGNOT => UNOP_COMPLEMENT
BINOP_LOGAND => BINOP_BITWISE_AND
BINOP_LOGXOR => BINOP_BITWISE_XOR
BINOP_LOGIOR => BINOP_BITWISE_IOR
BINOP_AND => BINOP_LOGICAL_AND
BINOP_OR => BINOP_LOGICAL_OR
PREC_OR => PREC_LOGICAL_OR
PREC_AND => PREC_LOGICAL_AND
PREC_LOGIOR => PREC_BITWISE_IOR
PREC_LOGXOR => PREC_BITWISE_XOR
PREC_LOGAND => PREC_BITWISE_AND
value_zerop() => value_logical_not()
value_lognot() => value_complement()
* c-exp.y (c_op_print_tab): Add explicit empty terminator.
* m2-exp.y (m2_op_print_tab): Add explicit empty terminator.
* defs.h (enum language): Add language_chill.
* dwarfread.c (set_cu_language): Add LANG_CHILL case and make
LANG_MODULA2 a recognized language.
* eval.c (evaluate_subexp): Add OP_BOOL case.
* expprint.c (print_subexp): Add OP_BOOL case.
* gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for
Chill as well as Modula-2.
* gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long,
builtin_type_chill_ulong, builtin_type_chill_real): Add.
* i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary
and is nonexistant in some SVR4 based systems.
* language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4.
* language.c (set_language_command): Add chill.
* language.c (binop_result_type, integral_type, character_type,
boolean_type, structured_type, value_true, binop_type_check):
Add language_chill cases.
* language.h (_LANG_chill): Define.
* m2-exp.y (number_sign, modblock): Make static, #ifdef out
unused modblock.
* m2-exp.y (ANDAND): Rename to LOGICAL_AND.
* source.c (source_info): Fix minor nits, print "1 line" rather
than "1 lines", and "language is <lang>".
* symfile.c (deduce_language_from_filename): Recognize the
filename extensions ".chill", ".c186", and ".c286" for Chill.
* valarith.c (value_binop): Handle TYPE_CODE_BOOL as well
as TYPE_CODE_INT and TYPE_CODE_FLOAT.
* valprint.c (val_print): Print TYPE_CODE_BOOL type values as
"TRUE" or "FALSE".
* valprint.c (typedef_print): Add case for language_chill.
* values.c (value_from_longest): Handle TYPE_CODE_BOOL.
1992-11-15 17:28:02 +00:00
|
|
|
|
{ write_exp_elt_opcode (BINOP_BITWISE_AND); }
|
1991-09-19 10:31:00 +00:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp '^' exp
|
* Makefile.in (SFILES_MAINDIR): Add ch-exp.y.
* Makefile.in (YYFILES): Add ch-exp.tab.c.
* Makefile.in (YYOBJ): Add ch-exp.tab.o.
* Makefile.in (saber_gdb): Add unload of ch-exp.y and load
of ch-exp.tab.c.
* Makefile.in (distclean): Add target ch-exp.tab.c.
* Makefile.in (realclean): Add rm of ch-exp.tab.c.
* Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on
Makefile since it contains sed patterns used in generation.
Add sed pattern to also delete #include of any malloc.h.
* Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets.
* ch-exp.y: New expression parser, for GNU-Chill.
* c-exp.y, expr.c, expression.h, language.c, m2-exp.y,
parser-defs.h, valarith.c, valops.c, value.h: Remap macros and
function names to conform to K&R terminology with respect to
logical and bitwise operators:
UNOP_ZEROP => UNOP_LOGICAL_NOT
UNOP_LOGNOT => UNOP_COMPLEMENT
BINOP_LOGAND => BINOP_BITWISE_AND
BINOP_LOGXOR => BINOP_BITWISE_XOR
BINOP_LOGIOR => BINOP_BITWISE_IOR
BINOP_AND => BINOP_LOGICAL_AND
BINOP_OR => BINOP_LOGICAL_OR
PREC_OR => PREC_LOGICAL_OR
PREC_AND => PREC_LOGICAL_AND
PREC_LOGIOR => PREC_BITWISE_IOR
PREC_LOGXOR => PREC_BITWISE_XOR
PREC_LOGAND => PREC_BITWISE_AND
value_zerop() => value_logical_not()
value_lognot() => value_complement()
* c-exp.y (c_op_print_tab): Add explicit empty terminator.
* m2-exp.y (m2_op_print_tab): Add explicit empty terminator.
* defs.h (enum language): Add language_chill.
* dwarfread.c (set_cu_language): Add LANG_CHILL case and make
LANG_MODULA2 a recognized language.
* eval.c (evaluate_subexp): Add OP_BOOL case.
* expprint.c (print_subexp): Add OP_BOOL case.
* gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for
Chill as well as Modula-2.
* gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long,
builtin_type_chill_ulong, builtin_type_chill_real): Add.
* i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary
and is nonexistant in some SVR4 based systems.
* language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4.
* language.c (set_language_command): Add chill.
* language.c (binop_result_type, integral_type, character_type,
boolean_type, structured_type, value_true, binop_type_check):
Add language_chill cases.
* language.h (_LANG_chill): Define.
* m2-exp.y (number_sign, modblock): Make static, #ifdef out
unused modblock.
* m2-exp.y (ANDAND): Rename to LOGICAL_AND.
* source.c (source_info): Fix minor nits, print "1 line" rather
than "1 lines", and "language is <lang>".
* symfile.c (deduce_language_from_filename): Recognize the
filename extensions ".chill", ".c186", and ".c286" for Chill.
* valarith.c (value_binop): Handle TYPE_CODE_BOOL as well
as TYPE_CODE_INT and TYPE_CODE_FLOAT.
* valprint.c (val_print): Print TYPE_CODE_BOOL type values as
"TRUE" or "FALSE".
* valprint.c (typedef_print): Add case for language_chill.
* values.c (value_from_longest): Handle TYPE_CODE_BOOL.
1992-11-15 17:28:02 +00:00
|
|
|
|
{ write_exp_elt_opcode (BINOP_BITWISE_XOR); }
|
1991-09-19 10:31:00 +00:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp '|' exp
|
* Makefile.in (SFILES_MAINDIR): Add ch-exp.y.
* Makefile.in (YYFILES): Add ch-exp.tab.c.
* Makefile.in (YYOBJ): Add ch-exp.tab.o.
* Makefile.in (saber_gdb): Add unload of ch-exp.y and load
of ch-exp.tab.c.
* Makefile.in (distclean): Add target ch-exp.tab.c.
* Makefile.in (realclean): Add rm of ch-exp.tab.c.
* Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on
Makefile since it contains sed patterns used in generation.
Add sed pattern to also delete #include of any malloc.h.
* Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets.
* ch-exp.y: New expression parser, for GNU-Chill.
* c-exp.y, expr.c, expression.h, language.c, m2-exp.y,
parser-defs.h, valarith.c, valops.c, value.h: Remap macros and
function names to conform to K&R terminology with respect to
logical and bitwise operators:
UNOP_ZEROP => UNOP_LOGICAL_NOT
UNOP_LOGNOT => UNOP_COMPLEMENT
BINOP_LOGAND => BINOP_BITWISE_AND
BINOP_LOGXOR => BINOP_BITWISE_XOR
BINOP_LOGIOR => BINOP_BITWISE_IOR
BINOP_AND => BINOP_LOGICAL_AND
BINOP_OR => BINOP_LOGICAL_OR
PREC_OR => PREC_LOGICAL_OR
PREC_AND => PREC_LOGICAL_AND
PREC_LOGIOR => PREC_BITWISE_IOR
PREC_LOGXOR => PREC_BITWISE_XOR
PREC_LOGAND => PREC_BITWISE_AND
value_zerop() => value_logical_not()
value_lognot() => value_complement()
* c-exp.y (c_op_print_tab): Add explicit empty terminator.
* m2-exp.y (m2_op_print_tab): Add explicit empty terminator.
* defs.h (enum language): Add language_chill.
* dwarfread.c (set_cu_language): Add LANG_CHILL case and make
LANG_MODULA2 a recognized language.
* eval.c (evaluate_subexp): Add OP_BOOL case.
* expprint.c (print_subexp): Add OP_BOOL case.
* gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for
Chill as well as Modula-2.
* gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long,
builtin_type_chill_ulong, builtin_type_chill_real): Add.
* i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary
and is nonexistant in some SVR4 based systems.
* language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4.
* language.c (set_language_command): Add chill.
* language.c (binop_result_type, integral_type, character_type,
boolean_type, structured_type, value_true, binop_type_check):
Add language_chill cases.
* language.h (_LANG_chill): Define.
* m2-exp.y (number_sign, modblock): Make static, #ifdef out
unused modblock.
* m2-exp.y (ANDAND): Rename to LOGICAL_AND.
* source.c (source_info): Fix minor nits, print "1 line" rather
than "1 lines", and "language is <lang>".
* symfile.c (deduce_language_from_filename): Recognize the
filename extensions ".chill", ".c186", and ".c286" for Chill.
* valarith.c (value_binop): Handle TYPE_CODE_BOOL as well
as TYPE_CODE_INT and TYPE_CODE_FLOAT.
* valprint.c (val_print): Print TYPE_CODE_BOOL type values as
"TRUE" or "FALSE".
* valprint.c (typedef_print): Add case for language_chill.
* values.c (value_from_longest): Handle TYPE_CODE_BOOL.
1992-11-15 17:28:02 +00:00
|
|
|
|
{ write_exp_elt_opcode (BINOP_BITWISE_IOR); }
|
1991-09-19 10:31:00 +00:00
|
|
|
|
;
|
|
|
|
|
|
1992-02-20 19:23:42 +00:00
|
|
|
|
exp : exp ANDAND exp
|
* Makefile.in (SFILES_MAINDIR): Add ch-exp.y.
* Makefile.in (YYFILES): Add ch-exp.tab.c.
* Makefile.in (YYOBJ): Add ch-exp.tab.o.
* Makefile.in (saber_gdb): Add unload of ch-exp.y and load
of ch-exp.tab.c.
* Makefile.in (distclean): Add target ch-exp.tab.c.
* Makefile.in (realclean): Add rm of ch-exp.tab.c.
* Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on
Makefile since it contains sed patterns used in generation.
Add sed pattern to also delete #include of any malloc.h.
* Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets.
* ch-exp.y: New expression parser, for GNU-Chill.
* c-exp.y, expr.c, expression.h, language.c, m2-exp.y,
parser-defs.h, valarith.c, valops.c, value.h: Remap macros and
function names to conform to K&R terminology with respect to
logical and bitwise operators:
UNOP_ZEROP => UNOP_LOGICAL_NOT
UNOP_LOGNOT => UNOP_COMPLEMENT
BINOP_LOGAND => BINOP_BITWISE_AND
BINOP_LOGXOR => BINOP_BITWISE_XOR
BINOP_LOGIOR => BINOP_BITWISE_IOR
BINOP_AND => BINOP_LOGICAL_AND
BINOP_OR => BINOP_LOGICAL_OR
PREC_OR => PREC_LOGICAL_OR
PREC_AND => PREC_LOGICAL_AND
PREC_LOGIOR => PREC_BITWISE_IOR
PREC_LOGXOR => PREC_BITWISE_XOR
PREC_LOGAND => PREC_BITWISE_AND
value_zerop() => value_logical_not()
value_lognot() => value_complement()
* c-exp.y (c_op_print_tab): Add explicit empty terminator.
* m2-exp.y (m2_op_print_tab): Add explicit empty terminator.
* defs.h (enum language): Add language_chill.
* dwarfread.c (set_cu_language): Add LANG_CHILL case and make
LANG_MODULA2 a recognized language.
* eval.c (evaluate_subexp): Add OP_BOOL case.
* expprint.c (print_subexp): Add OP_BOOL case.
* gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for
Chill as well as Modula-2.
* gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long,
builtin_type_chill_ulong, builtin_type_chill_real): Add.
* i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary
and is nonexistant in some SVR4 based systems.
* language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4.
* language.c (set_language_command): Add chill.
* language.c (binop_result_type, integral_type, character_type,
boolean_type, structured_type, value_true, binop_type_check):
Add language_chill cases.
* language.h (_LANG_chill): Define.
* m2-exp.y (number_sign, modblock): Make static, #ifdef out
unused modblock.
* m2-exp.y (ANDAND): Rename to LOGICAL_AND.
* source.c (source_info): Fix minor nits, print "1 line" rather
than "1 lines", and "language is <lang>".
* symfile.c (deduce_language_from_filename): Recognize the
filename extensions ".chill", ".c186", and ".c286" for Chill.
* valarith.c (value_binop): Handle TYPE_CODE_BOOL as well
as TYPE_CODE_INT and TYPE_CODE_FLOAT.
* valprint.c (val_print): Print TYPE_CODE_BOOL type values as
"TRUE" or "FALSE".
* valprint.c (typedef_print): Add case for language_chill.
* values.c (value_from_longest): Handle TYPE_CODE_BOOL.
1992-11-15 17:28:02 +00:00
|
|
|
|
{ write_exp_elt_opcode (BINOP_LOGICAL_AND); }
|
1991-09-19 10:31:00 +00:00
|
|
|
|
;
|
|
|
|
|
|
1992-02-20 19:23:42 +00:00
|
|
|
|
exp : exp OROR exp
|
* Makefile.in (SFILES_MAINDIR): Add ch-exp.y.
* Makefile.in (YYFILES): Add ch-exp.tab.c.
* Makefile.in (YYOBJ): Add ch-exp.tab.o.
* Makefile.in (saber_gdb): Add unload of ch-exp.y and load
of ch-exp.tab.c.
* Makefile.in (distclean): Add target ch-exp.tab.c.
* Makefile.in (realclean): Add rm of ch-exp.tab.c.
* Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on
Makefile since it contains sed patterns used in generation.
Add sed pattern to also delete #include of any malloc.h.
* Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets.
* ch-exp.y: New expression parser, for GNU-Chill.
* c-exp.y, expr.c, expression.h, language.c, m2-exp.y,
parser-defs.h, valarith.c, valops.c, value.h: Remap macros and
function names to conform to K&R terminology with respect to
logical and bitwise operators:
UNOP_ZEROP => UNOP_LOGICAL_NOT
UNOP_LOGNOT => UNOP_COMPLEMENT
BINOP_LOGAND => BINOP_BITWISE_AND
BINOP_LOGXOR => BINOP_BITWISE_XOR
BINOP_LOGIOR => BINOP_BITWISE_IOR
BINOP_AND => BINOP_LOGICAL_AND
BINOP_OR => BINOP_LOGICAL_OR
PREC_OR => PREC_LOGICAL_OR
PREC_AND => PREC_LOGICAL_AND
PREC_LOGIOR => PREC_BITWISE_IOR
PREC_LOGXOR => PREC_BITWISE_XOR
PREC_LOGAND => PREC_BITWISE_AND
value_zerop() => value_logical_not()
value_lognot() => value_complement()
* c-exp.y (c_op_print_tab): Add explicit empty terminator.
* m2-exp.y (m2_op_print_tab): Add explicit empty terminator.
* defs.h (enum language): Add language_chill.
* dwarfread.c (set_cu_language): Add LANG_CHILL case and make
LANG_MODULA2 a recognized language.
* eval.c (evaluate_subexp): Add OP_BOOL case.
* expprint.c (print_subexp): Add OP_BOOL case.
* gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for
Chill as well as Modula-2.
* gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long,
builtin_type_chill_ulong, builtin_type_chill_real): Add.
* i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary
and is nonexistant in some SVR4 based systems.
* language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4.
* language.c (set_language_command): Add chill.
* language.c (binop_result_type, integral_type, character_type,
boolean_type, structured_type, value_true, binop_type_check):
Add language_chill cases.
* language.h (_LANG_chill): Define.
* m2-exp.y (number_sign, modblock): Make static, #ifdef out
unused modblock.
* m2-exp.y (ANDAND): Rename to LOGICAL_AND.
* source.c (source_info): Fix minor nits, print "1 line" rather
than "1 lines", and "language is <lang>".
* symfile.c (deduce_language_from_filename): Recognize the
filename extensions ".chill", ".c186", and ".c286" for Chill.
* valarith.c (value_binop): Handle TYPE_CODE_BOOL as well
as TYPE_CODE_INT and TYPE_CODE_FLOAT.
* valprint.c (val_print): Print TYPE_CODE_BOOL type values as
"TRUE" or "FALSE".
* valprint.c (typedef_print): Add case for language_chill.
* values.c (value_from_longest): Handle TYPE_CODE_BOOL.
1992-11-15 17:28:02 +00:00
|
|
|
|
{ write_exp_elt_opcode (BINOP_LOGICAL_OR); }
|
1991-09-19 10:31:00 +00:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp '?' exp ':' exp %prec '?'
|
|
|
|
|
{ write_exp_elt_opcode (TERNOP_COND); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp '=' exp
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_ASSIGN); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp ASSIGN_MODIFY exp
|
|
|
|
|
{ write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
|
|
|
|
|
write_exp_elt_opcode ($2);
|
|
|
|
|
write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : INT
|
|
|
|
|
{ write_exp_elt_opcode (OP_LONG);
|
1992-11-06 18:37:20 +00:00
|
|
|
|
write_exp_elt_type ($1.type);
|
|
|
|
|
write_exp_elt_longcst ((LONGEST)($1.val));
|
1991-09-19 10:31:00 +00:00
|
|
|
|
write_exp_elt_opcode (OP_LONG); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : NAME_OR_INT
|
|
|
|
|
{ YYSTYPE val;
|
|
|
|
|
parse_number ($1.stoken.ptr, $1.stoken.length, 0, &val);
|
|
|
|
|
write_exp_elt_opcode (OP_LONG);
|
* Add native support for long double data type.
* c-exp.y (%union): Change dval to typed_val_float. Use DOUBLEST
to store actual data. Change types of INT and FLOAT tokens to
typed_val_int and typed_val_float respectively. Create new token
DOUBLE_KEYWORD to specify the string `double'. Make production
for FLOAT use type determined by parse_number. Add production for
"long double" data type.
* (parse_number): Use sscanf to parse numbers as float, double or
long double depending upon the type of typed_val_float.dval. Also
allow user to specify `f' or `l' suffix to explicitly specify
float or long double constants. Change typed_val to
typed_val_int.
* (yylex): Change typed_val to typed_val_int. Also, scan for
"double" keyword.
* coffread.c (decode_base_type): Add support for T_LNGDBL basic
type.
* configure, configure.in: Add check for long double support in
the host compiler.
* defs.h: Define DOUBLEST appropriatly depending on whether
HAVE_LONG_DOUBLE (from autoconf) is defined. Also, fix prototypes
for functions that handle this type.
* expression.h (union exp_element): doubleconst is now type
DOUBLEST.
* m2-exp.y f-exp.y (%union): dval becomes type DOUBLEST.
* findvar.c (extract_floating): Make return value be DOUBLEST.
Also, add support for numbers with size of long double.
* (store_floating): Arg `val' is now type DOUBLEST. Handle all
floating types.
* parser-defs.h parse.c (write_exp_elt_dblcst): Arg expelt is now
DOUBLEST.
* valarith.c (value_binop): Change temp variables v1, v2 and v to
type DOUBLEST. Coerce type of result to long double if either op
was of that type.
* valops.c (value_arg_coerce): If argument type is bigger than
double, coerce to long double.
* (call_function_by_hand): If REG_STRUCT_HAS_ADDR is defined, and
arg type is float and > 8 bytes, then use pointer-to-object
calling conventions.
* valprint.c (print_floating): Arg doub is now type DOUBLEST.
Use appropriate format and precision to print out floating point
values.
* value.h: Fixup prototypes for value_as_double,
value_from_double, and unpack_double to use DOUBLEST.
* values.c (record_latest_value): Remove check for invalid
floats. Allow history to store them so that people may examine
them in hex if they want.
* (value_as_double unpack_double): Change return value to DOUBLEST.
* (value_from_double): Arg `num' is now DOUBLEST.
* (using_struct_return): Use RETURN_VALUE_ON_STACK macro (target
specific) to expect certain types to always be returned on the stack.
1996-02-17 00:07:35 +00:00
|
|
|
|
write_exp_elt_type (val.typed_val_int.type);
|
|
|
|
|
write_exp_elt_longcst ((LONGEST)val.typed_val_int.val);
|
1991-09-19 10:31:00 +00:00
|
|
|
|
write_exp_elt_opcode (OP_LONG);
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exp : FLOAT
|
|
|
|
|
{ write_exp_elt_opcode (OP_DOUBLE);
|
* Add native support for long double data type.
* c-exp.y (%union): Change dval to typed_val_float. Use DOUBLEST
to store actual data. Change types of INT and FLOAT tokens to
typed_val_int and typed_val_float respectively. Create new token
DOUBLE_KEYWORD to specify the string `double'. Make production
for FLOAT use type determined by parse_number. Add production for
"long double" data type.
* (parse_number): Use sscanf to parse numbers as float, double or
long double depending upon the type of typed_val_float.dval. Also
allow user to specify `f' or `l' suffix to explicitly specify
float or long double constants. Change typed_val to
typed_val_int.
* (yylex): Change typed_val to typed_val_int. Also, scan for
"double" keyword.
* coffread.c (decode_base_type): Add support for T_LNGDBL basic
type.
* configure, configure.in: Add check for long double support in
the host compiler.
* defs.h: Define DOUBLEST appropriatly depending on whether
HAVE_LONG_DOUBLE (from autoconf) is defined. Also, fix prototypes
for functions that handle this type.
* expression.h (union exp_element): doubleconst is now type
DOUBLEST.
* m2-exp.y f-exp.y (%union): dval becomes type DOUBLEST.
* findvar.c (extract_floating): Make return value be DOUBLEST.
Also, add support for numbers with size of long double.
* (store_floating): Arg `val' is now type DOUBLEST. Handle all
floating types.
* parser-defs.h parse.c (write_exp_elt_dblcst): Arg expelt is now
DOUBLEST.
* valarith.c (value_binop): Change temp variables v1, v2 and v to
type DOUBLEST. Coerce type of result to long double if either op
was of that type.
* valops.c (value_arg_coerce): If argument type is bigger than
double, coerce to long double.
* (call_function_by_hand): If REG_STRUCT_HAS_ADDR is defined, and
arg type is float and > 8 bytes, then use pointer-to-object
calling conventions.
* valprint.c (print_floating): Arg doub is now type DOUBLEST.
Use appropriate format and precision to print out floating point
values.
* value.h: Fixup prototypes for value_as_double,
value_from_double, and unpack_double to use DOUBLEST.
* values.c (record_latest_value): Remove check for invalid
floats. Allow history to store them so that people may examine
them in hex if they want.
* (value_as_double unpack_double): Change return value to DOUBLEST.
* (value_from_double): Arg `num' is now DOUBLEST.
* (using_struct_return): Use RETURN_VALUE_ON_STACK macro (target
specific) to expect certain types to always be returned on the stack.
1996-02-17 00:07:35 +00:00
|
|
|
|
write_exp_elt_type ($1.type);
|
|
|
|
|
write_exp_elt_dblcst ($1.dval);
|
1991-09-19 10:31:00 +00:00
|
|
|
|
write_exp_elt_opcode (OP_DOUBLE); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : variable
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : VARIABLE
|
1995-10-05 22:15:49 +00:00
|
|
|
|
/* Already written by write_dollar_variable. */
|
1991-09-19 10:31:00 +00:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : SIZEOF '(' type ')' %prec UNARY
|
|
|
|
|
{ write_exp_elt_opcode (OP_LONG);
|
|
|
|
|
write_exp_elt_type (builtin_type_int);
|
* alpha-tdep.c, c-exp.y, h8500-tdep.c, f-exp.y, f-valprint.c,
findvar.c, hppa-tdep.c, infcmd.c, language.c, printcmd.c,
rs6000-tdep.c, symmisc.c, symtab.c:
Add check_typedef/CHECK_TYPEDEF as needed.
1995-11-30 01:43:37 +00:00
|
|
|
|
CHECK_TYPEDEF ($3);
|
1991-09-19 10:31:00 +00:00
|
|
|
|
write_exp_elt_longcst ((LONGEST) TYPE_LENGTH ($3));
|
|
|
|
|
write_exp_elt_opcode (OP_LONG); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : STRING
|
1993-01-16 05:15:58 +00:00
|
|
|
|
{ /* C strings are converted into array constants with
|
|
|
|
|
an explicit null byte added at the end. Thus
|
|
|
|
|
the array upper bound is the string length.
|
|
|
|
|
There is no such thing in C as a completely empty
|
|
|
|
|
string. */
|
|
|
|
|
char *sp = $1.ptr; int count = $1.length;
|
|
|
|
|
while (count-- > 0)
|
|
|
|
|
{
|
|
|
|
|
write_exp_elt_opcode (OP_LONG);
|
|
|
|
|
write_exp_elt_type (builtin_type_char);
|
|
|
|
|
write_exp_elt_longcst ((LONGEST)(*sp++));
|
|
|
|
|
write_exp_elt_opcode (OP_LONG);
|
|
|
|
|
}
|
|
|
|
|
write_exp_elt_opcode (OP_LONG);
|
|
|
|
|
write_exp_elt_type (builtin_type_char);
|
|
|
|
|
write_exp_elt_longcst ((LONGEST)'\0');
|
|
|
|
|
write_exp_elt_opcode (OP_LONG);
|
|
|
|
|
write_exp_elt_opcode (OP_ARRAY);
|
|
|
|
|
write_exp_elt_longcst ((LONGEST) 0);
|
|
|
|
|
write_exp_elt_longcst ((LONGEST) ($1.length));
|
|
|
|
|
write_exp_elt_opcode (OP_ARRAY); }
|
1991-09-19 10:31:00 +00:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* C++. */
|
|
|
|
|
exp : THIS
|
|
|
|
|
{ write_exp_elt_opcode (OP_THIS);
|
|
|
|
|
write_exp_elt_opcode (OP_THIS); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* end of C++. */
|
|
|
|
|
|
|
|
|
|
block : BLOCKNAME
|
|
|
|
|
{
|
1998-06-10 23:29:59 +00:00
|
|
|
|
if ($1.sym)
|
|
|
|
|
$$ = SYMBOL_BLOCK_VALUE ($1.sym);
|
1991-09-19 10:31:00 +00:00
|
|
|
|
else
|
1998-06-10 23:29:59 +00:00
|
|
|
|
error ("No file or function \"%s\".",
|
|
|
|
|
copy_name ($1.stoken));
|
|
|
|
|
}
|
|
|
|
|
| FILENAME
|
|
|
|
|
{
|
|
|
|
|
$$ = $1;
|
1991-09-19 10:31:00 +00:00
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
block : block COLONCOLON name
|
|
|
|
|
{ struct symbol *tem
|
|
|
|
|
= lookup_symbol (copy_name ($3), $1,
|
1993-07-30 21:20:56 +00:00
|
|
|
|
VAR_NAMESPACE, (int *) NULL,
|
|
|
|
|
(struct symtab **) NULL);
|
1991-09-19 10:31:00 +00:00
|
|
|
|
if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
|
|
|
|
|
error ("No function \"%s\" in specified context.",
|
|
|
|
|
copy_name ($3));
|
|
|
|
|
$$ = SYMBOL_BLOCK_VALUE (tem); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
variable: block COLONCOLON name
|
|
|
|
|
{ struct symbol *sym;
|
|
|
|
|
sym = lookup_symbol (copy_name ($3), $1,
|
1993-07-30 21:20:56 +00:00
|
|
|
|
VAR_NAMESPACE, (int *) NULL,
|
|
|
|
|
(struct symtab **) NULL);
|
1991-09-19 10:31:00 +00:00
|
|
|
|
if (sym == 0)
|
|
|
|
|
error ("No symbol \"%s\" in specified context.",
|
|
|
|
|
copy_name ($3));
|
|
|
|
|
|
|
|
|
|
write_exp_elt_opcode (OP_VAR_VALUE);
|
1993-08-18 19:33:39 +00:00
|
|
|
|
/* block_found is set by lookup_symbol. */
|
|
|
|
|
write_exp_elt_block (block_found);
|
1991-09-19 10:31:00 +00:00
|
|
|
|
write_exp_elt_sym (sym);
|
|
|
|
|
write_exp_elt_opcode (OP_VAR_VALUE); }
|
|
|
|
|
;
|
|
|
|
|
|
1992-09-10 00:07:06 +00:00
|
|
|
|
qualified_name: typebase COLONCOLON name
|
1991-09-19 10:31:00 +00:00
|
|
|
|
{
|
|
|
|
|
struct type *type = $1;
|
|
|
|
|
if (TYPE_CODE (type) != TYPE_CODE_STRUCT
|
|
|
|
|
&& TYPE_CODE (type) != TYPE_CODE_UNION)
|
|
|
|
|
error ("`%s' is not defined as an aggregate type.",
|
|
|
|
|
TYPE_NAME (type));
|
|
|
|
|
|
|
|
|
|
write_exp_elt_opcode (OP_SCOPE);
|
|
|
|
|
write_exp_elt_type (type);
|
1992-09-10 00:07:06 +00:00
|
|
|
|
write_exp_string ($3);
|
1991-09-19 10:31:00 +00:00
|
|
|
|
write_exp_elt_opcode (OP_SCOPE);
|
|
|
|
|
}
|
1992-09-10 00:07:06 +00:00
|
|
|
|
| typebase COLONCOLON '~' name
|
1991-09-19 10:31:00 +00:00
|
|
|
|
{
|
|
|
|
|
struct type *type = $1;
|
1992-03-20 21:57:17 +00:00
|
|
|
|
struct stoken tmp_token;
|
1991-09-19 10:31:00 +00:00
|
|
|
|
if (TYPE_CODE (type) != TYPE_CODE_STRUCT
|
|
|
|
|
&& TYPE_CODE (type) != TYPE_CODE_UNION)
|
|
|
|
|
error ("`%s' is not defined as an aggregate type.",
|
|
|
|
|
TYPE_NAME (type));
|
|
|
|
|
|
1992-09-10 00:07:06 +00:00
|
|
|
|
tmp_token.ptr = (char*) alloca ($4.length + 2);
|
|
|
|
|
tmp_token.length = $4.length + 1;
|
1992-03-20 21:57:17 +00:00
|
|
|
|
tmp_token.ptr[0] = '~';
|
1992-09-10 00:07:06 +00:00
|
|
|
|
memcpy (tmp_token.ptr+1, $4.ptr, $4.length);
|
1992-03-20 21:57:17 +00:00
|
|
|
|
tmp_token.ptr[tmp_token.length] = 0;
|
1996-12-14 09:17:22 +00:00
|
|
|
|
|
|
|
|
|
/* Check for valid destructor name. */
|
|
|
|
|
destructor_name_p (tmp_token.ptr, type);
|
1991-09-19 10:31:00 +00:00
|
|
|
|
write_exp_elt_opcode (OP_SCOPE);
|
|
|
|
|
write_exp_elt_type (type);
|
1992-03-20 21:57:17 +00:00
|
|
|
|
write_exp_string (tmp_token);
|
1991-09-19 10:31:00 +00:00
|
|
|
|
write_exp_elt_opcode (OP_SCOPE);
|
|
|
|
|
}
|
1992-03-20 21:57:17 +00:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
variable: qualified_name
|
1991-09-19 10:31:00 +00:00
|
|
|
|
| COLONCOLON name
|
|
|
|
|
{
|
|
|
|
|
char *name = copy_name ($2);
|
|
|
|
|
struct symbol *sym;
|
1992-02-22 01:46:16 +00:00
|
|
|
|
struct minimal_symbol *msymbol;
|
1991-09-19 10:31:00 +00:00
|
|
|
|
|
|
|
|
|
sym =
|
1993-07-30 21:20:56 +00:00
|
|
|
|
lookup_symbol (name, (const struct block *) NULL,
|
|
|
|
|
VAR_NAMESPACE, (int *) NULL,
|
|
|
|
|
(struct symtab **) NULL);
|
1991-09-19 10:31:00 +00:00
|
|
|
|
if (sym)
|
|
|
|
|
{
|
|
|
|
|
write_exp_elt_opcode (OP_VAR_VALUE);
|
1993-08-18 19:33:39 +00:00
|
|
|
|
write_exp_elt_block (NULL);
|
1991-09-19 10:31:00 +00:00
|
|
|
|
write_exp_elt_sym (sym);
|
|
|
|
|
write_exp_elt_opcode (OP_VAR_VALUE);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
* config/sparc/tm-sun4sol2.h, dbxread.c: Rename
N_SO_ADDRESS_MAYBE_MISSING to SOFUN_ADDRESS_MAYBE_MISSING.
* symtab.h (minimal_symbol) [SOFUN_ADDRESS_MAYBE_MISSING]: Add
filename field.
* elfread.c (record_minimal_symbol_and_info),
minsyms.c, symtab.h (prim_record_minimal_symbol_and_info): Return
newly created symbol.
* elfread.c (elf_symtab_read) [SOFUN_ADDRESS_MAYBE_MISSING]:
Set filename field of minimal symbol.
* symmisc.c (dump_msymbols) [SOFUN_ADDRESS_MAYBE_MISSING]:
Print filename field.
* minsyms.c, symtab.h (lookup_minimal_symbol): New arg sfile.
* symm-tdep.c, somsolib.c, hppa-tdep.c, c-exp.y, f-exp.y,
m2-exp.y, nindy-tdep.c, m3-nat.c, irix5-nat.c, hpread.c,
os9kread.c, breakpoint.c, alpha-tdep.c, valops.c, symtab.c,
printcmd.c, dbxread.c: Change callers to pass NULL for sfile.
* dbxread.c (process_one_symbol) [SOFUN_ADDRESS_MAYBE_MISSING]:
Find address of function from minimal symbols.
* partial-stab.h, case 'f', 'F': Call find_stab_function_addr
instead of getting pst->textlow from the stab.
* minsyms.c (find_stab_function_addr): New function.
1995-02-09 07:00:45 +00:00
|
|
|
|
msymbol = lookup_minimal_symbol (name, NULL, NULL);
|
1992-02-22 01:46:16 +00:00
|
|
|
|
if (msymbol != NULL)
|
1991-09-19 10:31:00 +00:00
|
|
|
|
{
|
1993-10-24 23:42:02 +00:00
|
|
|
|
write_exp_msymbol (msymbol,
|
|
|
|
|
lookup_function_type (builtin_type_int),
|
|
|
|
|
builtin_type_int);
|
1991-09-19 10:31:00 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
1992-02-22 01:46:16 +00:00
|
|
|
|
if (!have_full_symbols () && !have_partial_symbols ())
|
1991-09-19 10:31:00 +00:00
|
|
|
|
error ("No symbol table is loaded. Use the \"file\" command.");
|
|
|
|
|
else
|
|
|
|
|
error ("No symbol \"%s\" in current context.", name);
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
variable: name_not_typename
|
|
|
|
|
{ struct symbol *sym = $1.sym;
|
|
|
|
|
|
|
|
|
|
if (sym)
|
|
|
|
|
{
|
1993-10-08 20:33:22 +00:00
|
|
|
|
if (symbol_read_needs_frame (sym))
|
1991-09-19 10:31:00 +00:00
|
|
|
|
{
|
|
|
|
|
if (innermost_block == 0 ||
|
|
|
|
|
contained_in (block_found,
|
|
|
|
|
innermost_block))
|
|
|
|
|
innermost_block = block_found;
|
|
|
|
|
}
|
1993-10-08 20:33:22 +00:00
|
|
|
|
|
1991-09-19 10:31:00 +00:00
|
|
|
|
write_exp_elt_opcode (OP_VAR_VALUE);
|
1993-08-18 19:33:39 +00:00
|
|
|
|
/* We want to use the selected frame, not
|
|
|
|
|
another more inner frame which happens to
|
|
|
|
|
be in the same block. */
|
|
|
|
|
write_exp_elt_block (NULL);
|
1991-09-19 10:31:00 +00:00
|
|
|
|
write_exp_elt_sym (sym);
|
|
|
|
|
write_exp_elt_opcode (OP_VAR_VALUE);
|
|
|
|
|
}
|
|
|
|
|
else if ($1.is_a_field_of_this)
|
|
|
|
|
{
|
|
|
|
|
/* C++: it hangs off of `this'. Must
|
|
|
|
|
not inadvertently convert from a method call
|
|
|
|
|
to data ref. */
|
|
|
|
|
if (innermost_block == 0 ||
|
|
|
|
|
contained_in (block_found, innermost_block))
|
|
|
|
|
innermost_block = block_found;
|
|
|
|
|
write_exp_elt_opcode (OP_THIS);
|
|
|
|
|
write_exp_elt_opcode (OP_THIS);
|
|
|
|
|
write_exp_elt_opcode (STRUCTOP_PTR);
|
|
|
|
|
write_exp_string ($1.stoken);
|
|
|
|
|
write_exp_elt_opcode (STRUCTOP_PTR);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
1992-02-22 01:46:16 +00:00
|
|
|
|
struct minimal_symbol *msymbol;
|
1991-09-19 10:31:00 +00:00
|
|
|
|
register char *arg = copy_name ($1.stoken);
|
|
|
|
|
|
* config/sparc/tm-sun4sol2.h, dbxread.c: Rename
N_SO_ADDRESS_MAYBE_MISSING to SOFUN_ADDRESS_MAYBE_MISSING.
* symtab.h (minimal_symbol) [SOFUN_ADDRESS_MAYBE_MISSING]: Add
filename field.
* elfread.c (record_minimal_symbol_and_info),
minsyms.c, symtab.h (prim_record_minimal_symbol_and_info): Return
newly created symbol.
* elfread.c (elf_symtab_read) [SOFUN_ADDRESS_MAYBE_MISSING]:
Set filename field of minimal symbol.
* symmisc.c (dump_msymbols) [SOFUN_ADDRESS_MAYBE_MISSING]:
Print filename field.
* minsyms.c, symtab.h (lookup_minimal_symbol): New arg sfile.
* symm-tdep.c, somsolib.c, hppa-tdep.c, c-exp.y, f-exp.y,
m2-exp.y, nindy-tdep.c, m3-nat.c, irix5-nat.c, hpread.c,
os9kread.c, breakpoint.c, alpha-tdep.c, valops.c, symtab.c,
printcmd.c, dbxread.c: Change callers to pass NULL for sfile.
* dbxread.c (process_one_symbol) [SOFUN_ADDRESS_MAYBE_MISSING]:
Find address of function from minimal symbols.
* partial-stab.h, case 'f', 'F': Call find_stab_function_addr
instead of getting pst->textlow from the stab.
* minsyms.c (find_stab_function_addr): New function.
1995-02-09 07:00:45 +00:00
|
|
|
|
msymbol =
|
|
|
|
|
lookup_minimal_symbol (arg, NULL, NULL);
|
1992-02-22 01:46:16 +00:00
|
|
|
|
if (msymbol != NULL)
|
1991-09-19 10:31:00 +00:00
|
|
|
|
{
|
1993-10-24 23:42:02 +00:00
|
|
|
|
write_exp_msymbol (msymbol,
|
|
|
|
|
lookup_function_type (builtin_type_int),
|
|
|
|
|
builtin_type_int);
|
1991-09-19 10:31:00 +00:00
|
|
|
|
}
|
1992-02-22 01:46:16 +00:00
|
|
|
|
else if (!have_full_symbols () && !have_partial_symbols ())
|
1991-09-19 10:31:00 +00:00
|
|
|
|
error ("No symbol table is loaded. Use the \"file\" command.");
|
|
|
|
|
else
|
|
|
|
|
error ("No symbol \"%s\" in current context.",
|
|
|
|
|
copy_name ($1.stoken));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ptype : typebase
|
1993-10-18 01:10:25 +00:00
|
|
|
|
/* "const" and "volatile" are curently ignored. A type qualifier
|
1993-10-18 18:01:51 +00:00
|
|
|
|
before the type is currently handled in the typebase rule.
|
|
|
|
|
The reason for recognizing these here (shift/reduce conflicts)
|
|
|
|
|
might be obsolete now that some pointer to member rules have
|
|
|
|
|
been deleted. */
|
1993-10-18 01:10:25 +00:00
|
|
|
|
| typebase CONST_KEYWORD
|
|
|
|
|
| typebase VOLATILE_KEYWORD
|
1991-09-19 10:31:00 +00:00
|
|
|
|
| typebase abs_decl
|
1993-10-18 01:10:25 +00:00
|
|
|
|
{ $$ = follow_types ($1); }
|
|
|
|
|
| typebase CONST_KEYWORD abs_decl
|
|
|
|
|
{ $$ = follow_types ($1); }
|
|
|
|
|
| typebase VOLATILE_KEYWORD abs_decl
|
|
|
|
|
{ $$ = follow_types ($1); }
|
1991-09-19 10:31:00 +00:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
abs_decl: '*'
|
|
|
|
|
{ push_type (tp_pointer); $$ = 0; }
|
|
|
|
|
| '*' abs_decl
|
|
|
|
|
{ push_type (tp_pointer); $$ = $2; }
|
|
|
|
|
| '&'
|
|
|
|
|
{ push_type (tp_reference); $$ = 0; }
|
|
|
|
|
| '&' abs_decl
|
|
|
|
|
{ push_type (tp_reference); $$ = $2; }
|
|
|
|
|
| direct_abs_decl
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
direct_abs_decl: '(' abs_decl ')'
|
|
|
|
|
{ $$ = $2; }
|
|
|
|
|
| direct_abs_decl array_mod
|
|
|
|
|
{
|
|
|
|
|
push_type_int ($2);
|
|
|
|
|
push_type (tp_array);
|
|
|
|
|
}
|
|
|
|
|
| array_mod
|
|
|
|
|
{
|
|
|
|
|
push_type_int ($1);
|
|
|
|
|
push_type (tp_array);
|
|
|
|
|
$$ = 0;
|
|
|
|
|
}
|
1993-10-18 01:10:25 +00:00
|
|
|
|
|
1991-09-19 10:31:00 +00:00
|
|
|
|
| direct_abs_decl func_mod
|
|
|
|
|
{ push_type (tp_function); }
|
|
|
|
|
| func_mod
|
|
|
|
|
{ push_type (tp_function); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
array_mod: '[' ']'
|
|
|
|
|
{ $$ = -1; }
|
|
|
|
|
| '[' INT ']'
|
1992-11-06 18:37:20 +00:00
|
|
|
|
{ $$ = $2.val; }
|
1991-09-19 10:31:00 +00:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
func_mod: '(' ')'
|
|
|
|
|
{ $$ = 0; }
|
1991-11-12 22:20:02 +00:00
|
|
|
|
| '(' nonempty_typelist ')'
|
1992-03-29 23:26:47 +00:00
|
|
|
|
{ free ((PTR)$2); $$ = 0; }
|
1991-09-19 10:31:00 +00:00
|
|
|
|
;
|
|
|
|
|
|
1993-10-18 18:01:51 +00:00
|
|
|
|
/* We used to try to recognize more pointer to member types here, but
|
|
|
|
|
that didn't work (shift/reduce conflicts meant that these rules never
|
|
|
|
|
got executed). The problem is that
|
|
|
|
|
int (foo::bar::baz::bizzle)
|
|
|
|
|
is a function type but
|
|
|
|
|
int (foo::bar::baz::bizzle::*)
|
|
|
|
|
is a pointer to member type. Stroustrup loses again! */
|
|
|
|
|
|
1991-09-19 10:31:00 +00:00
|
|
|
|
type : ptype
|
1992-09-10 00:07:06 +00:00
|
|
|
|
| typebase COLONCOLON '*'
|
|
|
|
|
{ $$ = lookup_member_type (builtin_type_int, $1); }
|
1991-09-19 10:31:00 +00:00
|
|
|
|
;
|
|
|
|
|
|
1992-10-19 19:46:05 +00:00
|
|
|
|
typebase /* Implements (approximately): (type-qualifier)* type-specifier */
|
1991-09-19 10:31:00 +00:00
|
|
|
|
: TYPENAME
|
|
|
|
|
{ $$ = $1.type; }
|
|
|
|
|
| INT_KEYWORD
|
|
|
|
|
{ $$ = builtin_type_int; }
|
|
|
|
|
| LONG
|
|
|
|
|
{ $$ = builtin_type_long; }
|
|
|
|
|
| SHORT
|
|
|
|
|
{ $$ = builtin_type_short; }
|
|
|
|
|
| LONG INT_KEYWORD
|
|
|
|
|
{ $$ = builtin_type_long; }
|
|
|
|
|
| UNSIGNED LONG INT_KEYWORD
|
|
|
|
|
{ $$ = builtin_type_unsigned_long; }
|
|
|
|
|
| LONG LONG
|
|
|
|
|
{ $$ = builtin_type_long_long; }
|
|
|
|
|
| LONG LONG INT_KEYWORD
|
|
|
|
|
{ $$ = builtin_type_long_long; }
|
|
|
|
|
| UNSIGNED LONG LONG
|
|
|
|
|
{ $$ = builtin_type_unsigned_long_long; }
|
|
|
|
|
| UNSIGNED LONG LONG INT_KEYWORD
|
|
|
|
|
{ $$ = builtin_type_unsigned_long_long; }
|
|
|
|
|
| SHORT INT_KEYWORD
|
|
|
|
|
{ $$ = builtin_type_short; }
|
|
|
|
|
| UNSIGNED SHORT INT_KEYWORD
|
|
|
|
|
{ $$ = builtin_type_unsigned_short; }
|
* Add native support for long double data type.
* c-exp.y (%union): Change dval to typed_val_float. Use DOUBLEST
to store actual data. Change types of INT and FLOAT tokens to
typed_val_int and typed_val_float respectively. Create new token
DOUBLE_KEYWORD to specify the string `double'. Make production
for FLOAT use type determined by parse_number. Add production for
"long double" data type.
* (parse_number): Use sscanf to parse numbers as float, double or
long double depending upon the type of typed_val_float.dval. Also
allow user to specify `f' or `l' suffix to explicitly specify
float or long double constants. Change typed_val to
typed_val_int.
* (yylex): Change typed_val to typed_val_int. Also, scan for
"double" keyword.
* coffread.c (decode_base_type): Add support for T_LNGDBL basic
type.
* configure, configure.in: Add check for long double support in
the host compiler.
* defs.h: Define DOUBLEST appropriatly depending on whether
HAVE_LONG_DOUBLE (from autoconf) is defined. Also, fix prototypes
for functions that handle this type.
* expression.h (union exp_element): doubleconst is now type
DOUBLEST.
* m2-exp.y f-exp.y (%union): dval becomes type DOUBLEST.
* findvar.c (extract_floating): Make return value be DOUBLEST.
Also, add support for numbers with size of long double.
* (store_floating): Arg `val' is now type DOUBLEST. Handle all
floating types.
* parser-defs.h parse.c (write_exp_elt_dblcst): Arg expelt is now
DOUBLEST.
* valarith.c (value_binop): Change temp variables v1, v2 and v to
type DOUBLEST. Coerce type of result to long double if either op
was of that type.
* valops.c (value_arg_coerce): If argument type is bigger than
double, coerce to long double.
* (call_function_by_hand): If REG_STRUCT_HAS_ADDR is defined, and
arg type is float and > 8 bytes, then use pointer-to-object
calling conventions.
* valprint.c (print_floating): Arg doub is now type DOUBLEST.
Use appropriate format and precision to print out floating point
values.
* value.h: Fixup prototypes for value_as_double,
value_from_double, and unpack_double to use DOUBLEST.
* values.c (record_latest_value): Remove check for invalid
floats. Allow history to store them so that people may examine
them in hex if they want.
* (value_as_double unpack_double): Change return value to DOUBLEST.
* (value_from_double): Arg `num' is now DOUBLEST.
* (using_struct_return): Use RETURN_VALUE_ON_STACK macro (target
specific) to expect certain types to always be returned on the stack.
1996-02-17 00:07:35 +00:00
|
|
|
|
| DOUBLE_KEYWORD
|
|
|
|
|
{ $$ = builtin_type_double; }
|
|
|
|
|
| LONG DOUBLE_KEYWORD
|
|
|
|
|
{ $$ = builtin_type_long_double; }
|
1991-09-19 10:31:00 +00:00
|
|
|
|
| STRUCT name
|
|
|
|
|
{ $$ = lookup_struct (copy_name ($2),
|
|
|
|
|
expression_context_block); }
|
1992-07-09 04:40:39 +00:00
|
|
|
|
| CLASS name
|
|
|
|
|
{ $$ = lookup_struct (copy_name ($2),
|
|
|
|
|
expression_context_block); }
|
1991-09-19 10:31:00 +00:00
|
|
|
|
| UNION name
|
|
|
|
|
{ $$ = lookup_union (copy_name ($2),
|
|
|
|
|
expression_context_block); }
|
|
|
|
|
| ENUM name
|
|
|
|
|
{ $$ = lookup_enum (copy_name ($2),
|
|
|
|
|
expression_context_block); }
|
|
|
|
|
| UNSIGNED typename
|
|
|
|
|
{ $$ = lookup_unsigned_typename (TYPE_NAME($2.type)); }
|
|
|
|
|
| UNSIGNED
|
|
|
|
|
{ $$ = builtin_type_unsigned_int; }
|
1992-02-20 19:23:42 +00:00
|
|
|
|
| SIGNED_KEYWORD typename
|
1992-07-10 23:30:40 +00:00
|
|
|
|
{ $$ = lookup_signed_typename (TYPE_NAME($2.type)); }
|
1992-02-20 19:23:42 +00:00
|
|
|
|
| SIGNED_KEYWORD
|
1991-09-19 10:31:00 +00:00
|
|
|
|
{ $$ = builtin_type_int; }
|
1991-11-15 23:16:29 +00:00
|
|
|
|
| TEMPLATE name '<' type '>'
|
|
|
|
|
{ $$ = lookup_template_type(copy_name($2), $4,
|
|
|
|
|
expression_context_block);
|
|
|
|
|
}
|
1993-10-18 01:10:25 +00:00
|
|
|
|
/* "const" and "volatile" are curently ignored. A type qualifier
|
|
|
|
|
after the type is handled in the ptype rule. I think these could
|
|
|
|
|
be too. */
|
1992-10-19 19:46:05 +00:00
|
|
|
|
| CONST_KEYWORD typebase { $$ = $2; }
|
|
|
|
|
| VOLATILE_KEYWORD typebase { $$ = $2; }
|
1991-09-19 10:31:00 +00:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
typename: TYPENAME
|
|
|
|
|
| INT_KEYWORD
|
|
|
|
|
{
|
|
|
|
|
$$.stoken.ptr = "int";
|
|
|
|
|
$$.stoken.length = 3;
|
|
|
|
|
$$.type = builtin_type_int;
|
|
|
|
|
}
|
|
|
|
|
| LONG
|
|
|
|
|
{
|
|
|
|
|
$$.stoken.ptr = "long";
|
|
|
|
|
$$.stoken.length = 4;
|
|
|
|
|
$$.type = builtin_type_long;
|
|
|
|
|
}
|
|
|
|
|
| SHORT
|
|
|
|
|
{
|
|
|
|
|
$$.stoken.ptr = "short";
|
|
|
|
|
$$.stoken.length = 5;
|
|
|
|
|
$$.type = builtin_type_short;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
nonempty_typelist
|
|
|
|
|
: type
|
1992-10-31 00:35:08 +00:00
|
|
|
|
{ $$ = (struct type **) malloc (sizeof (struct type *) * 2);
|
1992-05-17 23:54:32 +00:00
|
|
|
|
$<ivec>$[0] = 1; /* Number of types in vector */
|
1991-09-19 10:31:00 +00:00
|
|
|
|
$$[1] = $1;
|
|
|
|
|
}
|
|
|
|
|
| nonempty_typelist ',' type
|
1992-05-17 23:54:32 +00:00
|
|
|
|
{ int len = sizeof (struct type *) * (++($<ivec>1[0]) + 1);
|
1992-10-31 00:35:08 +00:00
|
|
|
|
$$ = (struct type **) realloc ((char *) $1, len);
|
1991-09-19 10:31:00 +00:00
|
|
|
|
$$[$<ivec>$[0]] = $3;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
name : NAME { $$ = $1.stoken; }
|
|
|
|
|
| BLOCKNAME { $$ = $1.stoken; }
|
|
|
|
|
| TYPENAME { $$ = $1.stoken; }
|
|
|
|
|
| NAME_OR_INT { $$ = $1.stoken; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
name_not_typename : NAME
|
|
|
|
|
| BLOCKNAME
|
|
|
|
|
/* These would be useful if name_not_typename was useful, but it is just
|
|
|
|
|
a fake for "variable", so these cause reduce/reduce conflicts because
|
|
|
|
|
the parser can't tell whether NAME_OR_INT is a name_not_typename (=variable,
|
|
|
|
|
=exp) or just an exp. If name_not_typename was ever used in an lvalue
|
|
|
|
|
context where only a name could occur, this might be useful.
|
|
|
|
|
| NAME_OR_INT
|
|
|
|
|
*/
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
%%
|
|
|
|
|
|
|
|
|
|
/* Take care of parsing a number (anything that starts with a digit).
|
|
|
|
|
Set yylval and return the token type; update lexptr.
|
|
|
|
|
LEN is the number of characters in it. */
|
|
|
|
|
|
|
|
|
|
/*** Needs some error checking for the float case ***/
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
parse_number (p, len, parsed_float, putithere)
|
|
|
|
|
register char *p;
|
|
|
|
|
register int len;
|
|
|
|
|
int parsed_float;
|
|
|
|
|
YYSTYPE *putithere;
|
|
|
|
|
{
|
1994-01-15 17:14:18 +00:00
|
|
|
|
/* FIXME: Shouldn't these be unsigned? We don't deal with negative values
|
|
|
|
|
here, and we do kind of silly things like cast to unsigned. */
|
1991-09-19 10:31:00 +00:00
|
|
|
|
register LONGEST n = 0;
|
|
|
|
|
register LONGEST prevn = 0;
|
1996-11-12 23:33:32 +00:00
|
|
|
|
ULONGEST un;
|
1994-01-15 17:14:18 +00:00
|
|
|
|
|
1993-09-08 21:23:41 +00:00
|
|
|
|
register int i = 0;
|
1991-09-19 10:31:00 +00:00
|
|
|
|
register int c;
|
|
|
|
|
register int base = input_radix;
|
|
|
|
|
int unsigned_p = 0;
|
1994-01-15 17:14:18 +00:00
|
|
|
|
|
|
|
|
|
/* Number of "L" suffixes encountered. */
|
1992-11-06 18:37:20 +00:00
|
|
|
|
int long_p = 0;
|
1994-01-15 17:14:18 +00:00
|
|
|
|
|
|
|
|
|
/* We have found a "L" or "U" suffix. */
|
|
|
|
|
int found_suffix = 0;
|
|
|
|
|
|
1996-11-12 23:33:32 +00:00
|
|
|
|
ULONGEST high_bit;
|
1992-11-06 18:37:20 +00:00
|
|
|
|
struct type *signed_type;
|
|
|
|
|
struct type *unsigned_type;
|
1991-09-19 10:31:00 +00:00
|
|
|
|
|
|
|
|
|
if (parsed_float)
|
|
|
|
|
{
|
|
|
|
|
/* It's a float since it contains a point or an exponent. */
|
1997-04-29 01:02:37 +00:00
|
|
|
|
char c;
|
|
|
|
|
int num = 0; /* number of tokens scanned by scanf */
|
|
|
|
|
char saved_char = p[len];
|
* Add native support for long double data type.
* c-exp.y (%union): Change dval to typed_val_float. Use DOUBLEST
to store actual data. Change types of INT and FLOAT tokens to
typed_val_int and typed_val_float respectively. Create new token
DOUBLE_KEYWORD to specify the string `double'. Make production
for FLOAT use type determined by parse_number. Add production for
"long double" data type.
* (parse_number): Use sscanf to parse numbers as float, double or
long double depending upon the type of typed_val_float.dval. Also
allow user to specify `f' or `l' suffix to explicitly specify
float or long double constants. Change typed_val to
typed_val_int.
* (yylex): Change typed_val to typed_val_int. Also, scan for
"double" keyword.
* coffread.c (decode_base_type): Add support for T_LNGDBL basic
type.
* configure, configure.in: Add check for long double support in
the host compiler.
* defs.h: Define DOUBLEST appropriatly depending on whether
HAVE_LONG_DOUBLE (from autoconf) is defined. Also, fix prototypes
for functions that handle this type.
* expression.h (union exp_element): doubleconst is now type
DOUBLEST.
* m2-exp.y f-exp.y (%union): dval becomes type DOUBLEST.
* findvar.c (extract_floating): Make return value be DOUBLEST.
Also, add support for numbers with size of long double.
* (store_floating): Arg `val' is now type DOUBLEST. Handle all
floating types.
* parser-defs.h parse.c (write_exp_elt_dblcst): Arg expelt is now
DOUBLEST.
* valarith.c (value_binop): Change temp variables v1, v2 and v to
type DOUBLEST. Coerce type of result to long double if either op
was of that type.
* valops.c (value_arg_coerce): If argument type is bigger than
double, coerce to long double.
* (call_function_by_hand): If REG_STRUCT_HAS_ADDR is defined, and
arg type is float and > 8 bytes, then use pointer-to-object
calling conventions.
* valprint.c (print_floating): Arg doub is now type DOUBLEST.
Use appropriate format and precision to print out floating point
values.
* value.h: Fixup prototypes for value_as_double,
value_from_double, and unpack_double to use DOUBLEST.
* values.c (record_latest_value): Remove check for invalid
floats. Allow history to store them so that people may examine
them in hex if they want.
* (value_as_double unpack_double): Change return value to DOUBLEST.
* (value_from_double): Arg `num' is now DOUBLEST.
* (using_struct_return): Use RETURN_VALUE_ON_STACK macro (target
specific) to expect certain types to always be returned on the stack.
1996-02-17 00:07:35 +00:00
|
|
|
|
|
1997-04-29 01:02:37 +00:00
|
|
|
|
p[len] = 0; /* null-terminate the token */
|
* Add native support for long double data type.
* c-exp.y (%union): Change dval to typed_val_float. Use DOUBLEST
to store actual data. Change types of INT and FLOAT tokens to
typed_val_int and typed_val_float respectively. Create new token
DOUBLE_KEYWORD to specify the string `double'. Make production
for FLOAT use type determined by parse_number. Add production for
"long double" data type.
* (parse_number): Use sscanf to parse numbers as float, double or
long double depending upon the type of typed_val_float.dval. Also
allow user to specify `f' or `l' suffix to explicitly specify
float or long double constants. Change typed_val to
typed_val_int.
* (yylex): Change typed_val to typed_val_int. Also, scan for
"double" keyword.
* coffread.c (decode_base_type): Add support for T_LNGDBL basic
type.
* configure, configure.in: Add check for long double support in
the host compiler.
* defs.h: Define DOUBLEST appropriatly depending on whether
HAVE_LONG_DOUBLE (from autoconf) is defined. Also, fix prototypes
for functions that handle this type.
* expression.h (union exp_element): doubleconst is now type
DOUBLEST.
* m2-exp.y f-exp.y (%union): dval becomes type DOUBLEST.
* findvar.c (extract_floating): Make return value be DOUBLEST.
Also, add support for numbers with size of long double.
* (store_floating): Arg `val' is now type DOUBLEST. Handle all
floating types.
* parser-defs.h parse.c (write_exp_elt_dblcst): Arg expelt is now
DOUBLEST.
* valarith.c (value_binop): Change temp variables v1, v2 and v to
type DOUBLEST. Coerce type of result to long double if either op
was of that type.
* valops.c (value_arg_coerce): If argument type is bigger than
double, coerce to long double.
* (call_function_by_hand): If REG_STRUCT_HAS_ADDR is defined, and
arg type is float and > 8 bytes, then use pointer-to-object
calling conventions.
* valprint.c (print_floating): Arg doub is now type DOUBLEST.
Use appropriate format and precision to print out floating point
values.
* value.h: Fixup prototypes for value_as_double,
value_from_double, and unpack_double to use DOUBLEST.
* values.c (record_latest_value): Remove check for invalid
floats. Allow history to store them so that people may examine
them in hex if they want.
* (value_as_double unpack_double): Change return value to DOUBLEST.
* (value_from_double): Arg `num' is now DOUBLEST.
* (using_struct_return): Use RETURN_VALUE_ON_STACK macro (target
specific) to expect certain types to always be returned on the stack.
1996-02-17 00:07:35 +00:00
|
|
|
|
if (sizeof (putithere->typed_val_float.dval) <= sizeof (float))
|
1997-06-13 14:51:32 +00:00
|
|
|
|
num = sscanf (p, "%g%c", (float *) &putithere->typed_val_float.dval,&c);
|
* Add native support for long double data type.
* c-exp.y (%union): Change dval to typed_val_float. Use DOUBLEST
to store actual data. Change types of INT and FLOAT tokens to
typed_val_int and typed_val_float respectively. Create new token
DOUBLE_KEYWORD to specify the string `double'. Make production
for FLOAT use type determined by parse_number. Add production for
"long double" data type.
* (parse_number): Use sscanf to parse numbers as float, double or
long double depending upon the type of typed_val_float.dval. Also
allow user to specify `f' or `l' suffix to explicitly specify
float or long double constants. Change typed_val to
typed_val_int.
* (yylex): Change typed_val to typed_val_int. Also, scan for
"double" keyword.
* coffread.c (decode_base_type): Add support for T_LNGDBL basic
type.
* configure, configure.in: Add check for long double support in
the host compiler.
* defs.h: Define DOUBLEST appropriatly depending on whether
HAVE_LONG_DOUBLE (from autoconf) is defined. Also, fix prototypes
for functions that handle this type.
* expression.h (union exp_element): doubleconst is now type
DOUBLEST.
* m2-exp.y f-exp.y (%union): dval becomes type DOUBLEST.
* findvar.c (extract_floating): Make return value be DOUBLEST.
Also, add support for numbers with size of long double.
* (store_floating): Arg `val' is now type DOUBLEST. Handle all
floating types.
* parser-defs.h parse.c (write_exp_elt_dblcst): Arg expelt is now
DOUBLEST.
* valarith.c (value_binop): Change temp variables v1, v2 and v to
type DOUBLEST. Coerce type of result to long double if either op
was of that type.
* valops.c (value_arg_coerce): If argument type is bigger than
double, coerce to long double.
* (call_function_by_hand): If REG_STRUCT_HAS_ADDR is defined, and
arg type is float and > 8 bytes, then use pointer-to-object
calling conventions.
* valprint.c (print_floating): Arg doub is now type DOUBLEST.
Use appropriate format and precision to print out floating point
values.
* value.h: Fixup prototypes for value_as_double,
value_from_double, and unpack_double to use DOUBLEST.
* values.c (record_latest_value): Remove check for invalid
floats. Allow history to store them so that people may examine
them in hex if they want.
* (value_as_double unpack_double): Change return value to DOUBLEST.
* (value_from_double): Arg `num' is now DOUBLEST.
* (using_struct_return): Use RETURN_VALUE_ON_STACK macro (target
specific) to expect certain types to always be returned on the stack.
1996-02-17 00:07:35 +00:00
|
|
|
|
else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double))
|
1997-06-13 14:51:32 +00:00
|
|
|
|
num = sscanf (p, "%lg%c", (double *) &putithere->typed_val_float.dval,&c);
|
* Add native support for long double data type.
* c-exp.y (%union): Change dval to typed_val_float. Use DOUBLEST
to store actual data. Change types of INT and FLOAT tokens to
typed_val_int and typed_val_float respectively. Create new token
DOUBLE_KEYWORD to specify the string `double'. Make production
for FLOAT use type determined by parse_number. Add production for
"long double" data type.
* (parse_number): Use sscanf to parse numbers as float, double or
long double depending upon the type of typed_val_float.dval. Also
allow user to specify `f' or `l' suffix to explicitly specify
float or long double constants. Change typed_val to
typed_val_int.
* (yylex): Change typed_val to typed_val_int. Also, scan for
"double" keyword.
* coffread.c (decode_base_type): Add support for T_LNGDBL basic
type.
* configure, configure.in: Add check for long double support in
the host compiler.
* defs.h: Define DOUBLEST appropriatly depending on whether
HAVE_LONG_DOUBLE (from autoconf) is defined. Also, fix prototypes
for functions that handle this type.
* expression.h (union exp_element): doubleconst is now type
DOUBLEST.
* m2-exp.y f-exp.y (%union): dval becomes type DOUBLEST.
* findvar.c (extract_floating): Make return value be DOUBLEST.
Also, add support for numbers with size of long double.
* (store_floating): Arg `val' is now type DOUBLEST. Handle all
floating types.
* parser-defs.h parse.c (write_exp_elt_dblcst): Arg expelt is now
DOUBLEST.
* valarith.c (value_binop): Change temp variables v1, v2 and v to
type DOUBLEST. Coerce type of result to long double if either op
was of that type.
* valops.c (value_arg_coerce): If argument type is bigger than
double, coerce to long double.
* (call_function_by_hand): If REG_STRUCT_HAS_ADDR is defined, and
arg type is float and > 8 bytes, then use pointer-to-object
calling conventions.
* valprint.c (print_floating): Arg doub is now type DOUBLEST.
Use appropriate format and precision to print out floating point
values.
* value.h: Fixup prototypes for value_as_double,
value_from_double, and unpack_double to use DOUBLEST.
* values.c (record_latest_value): Remove check for invalid
floats. Allow history to store them so that people may examine
them in hex if they want.
* (value_as_double unpack_double): Change return value to DOUBLEST.
* (value_from_double): Arg `num' is now DOUBLEST.
* (using_struct_return): Use RETURN_VALUE_ON_STACK macro (target
specific) to expect certain types to always be returned on the stack.
1996-02-17 00:07:35 +00:00
|
|
|
|
else
|
1996-03-31 01:04:37 +00:00
|
|
|
|
{
|
1997-11-24 06:50:12 +00:00
|
|
|
|
#ifdef SCANF_HAS_LONG_DOUBLE
|
1997-04-29 01:02:37 +00:00
|
|
|
|
num = sscanf (p, "%Lg%c", &putithere->typed_val_float.dval,&c);
|
1996-03-31 01:04:37 +00:00
|
|
|
|
#else
|
|
|
|
|
/* Scan it into a double, then assign it to the long double.
|
|
|
|
|
This at least wins with values representable in the range
|
|
|
|
|
of doubles. */
|
|
|
|
|
double temp;
|
1997-04-29 01:02:37 +00:00
|
|
|
|
num = sscanf (p, "%lg%c", &temp,&c);
|
1996-03-31 01:04:37 +00:00
|
|
|
|
putithere->typed_val_float.dval = temp;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
1997-04-29 01:02:37 +00:00
|
|
|
|
p[len] = saved_char; /* restore the input stream */
|
|
|
|
|
if (num != 1) /* check scanf found ONLY a float ... */
|
|
|
|
|
return ERROR;
|
* Add native support for long double data type.
* c-exp.y (%union): Change dval to typed_val_float. Use DOUBLEST
to store actual data. Change types of INT and FLOAT tokens to
typed_val_int and typed_val_float respectively. Create new token
DOUBLE_KEYWORD to specify the string `double'. Make production
for FLOAT use type determined by parse_number. Add production for
"long double" data type.
* (parse_number): Use sscanf to parse numbers as float, double or
long double depending upon the type of typed_val_float.dval. Also
allow user to specify `f' or `l' suffix to explicitly specify
float or long double constants. Change typed_val to
typed_val_int.
* (yylex): Change typed_val to typed_val_int. Also, scan for
"double" keyword.
* coffread.c (decode_base_type): Add support for T_LNGDBL basic
type.
* configure, configure.in: Add check for long double support in
the host compiler.
* defs.h: Define DOUBLEST appropriatly depending on whether
HAVE_LONG_DOUBLE (from autoconf) is defined. Also, fix prototypes
for functions that handle this type.
* expression.h (union exp_element): doubleconst is now type
DOUBLEST.
* m2-exp.y f-exp.y (%union): dval becomes type DOUBLEST.
* findvar.c (extract_floating): Make return value be DOUBLEST.
Also, add support for numbers with size of long double.
* (store_floating): Arg `val' is now type DOUBLEST. Handle all
floating types.
* parser-defs.h parse.c (write_exp_elt_dblcst): Arg expelt is now
DOUBLEST.
* valarith.c (value_binop): Change temp variables v1, v2 and v to
type DOUBLEST. Coerce type of result to long double if either op
was of that type.
* valops.c (value_arg_coerce): If argument type is bigger than
double, coerce to long double.
* (call_function_by_hand): If REG_STRUCT_HAS_ADDR is defined, and
arg type is float and > 8 bytes, then use pointer-to-object
calling conventions.
* valprint.c (print_floating): Arg doub is now type DOUBLEST.
Use appropriate format and precision to print out floating point
values.
* value.h: Fixup prototypes for value_as_double,
value_from_double, and unpack_double to use DOUBLEST.
* values.c (record_latest_value): Remove check for invalid
floats. Allow history to store them so that people may examine
them in hex if they want.
* (value_as_double unpack_double): Change return value to DOUBLEST.
* (value_from_double): Arg `num' is now DOUBLEST.
* (using_struct_return): Use RETURN_VALUE_ON_STACK macro (target
specific) to expect certain types to always be returned on the stack.
1996-02-17 00:07:35 +00:00
|
|
|
|
/* 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 = builtin_type_float;
|
|
|
|
|
else if (c == 'l')
|
|
|
|
|
putithere->typed_val_float.type = builtin_type_long_double;
|
|
|
|
|
else if (isdigit (c) || c == '.')
|
|
|
|
|
putithere->typed_val_float.type = builtin_type_double;
|
|
|
|
|
else
|
|
|
|
|
return ERROR;
|
|
|
|
|
|
1991-09-19 10:31:00 +00:00
|
|
|
|
return FLOAT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Handle base-switching prefixes 0x, 0t, 0d, 0 */
|
|
|
|
|
if (p[0] == '0')
|
|
|
|
|
switch (p[1])
|
|
|
|
|
{
|
|
|
|
|
case 'x':
|
|
|
|
|
case 'X':
|
|
|
|
|
if (len >= 3)
|
|
|
|
|
{
|
|
|
|
|
p += 2;
|
|
|
|
|
base = 16;
|
|
|
|
|
len -= 2;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 't':
|
|
|
|
|
case 'T':
|
|
|
|
|
case 'd':
|
|
|
|
|
case 'D':
|
|
|
|
|
if (len >= 3)
|
|
|
|
|
{
|
|
|
|
|
p += 2;
|
|
|
|
|
base = 10;
|
|
|
|
|
len -= 2;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
base = 8;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (len-- > 0)
|
|
|
|
|
{
|
|
|
|
|
c = *p++;
|
|
|
|
|
if (c >= 'A' && c <= 'Z')
|
|
|
|
|
c += 'a' - 'A';
|
|
|
|
|
if (c != 'l' && c != 'u')
|
|
|
|
|
n *= base;
|
|
|
|
|
if (c >= '0' && c <= '9')
|
1994-01-15 17:14:18 +00:00
|
|
|
|
{
|
|
|
|
|
if (found_suffix)
|
|
|
|
|
return ERROR;
|
|
|
|
|
n += i = c - '0';
|
|
|
|
|
}
|
1991-09-19 10:31:00 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (base > 10 && c >= 'a' && c <= 'f')
|
1994-01-15 17:14:18 +00:00
|
|
|
|
{
|
|
|
|
|
if (found_suffix)
|
|
|
|
|
return ERROR;
|
|
|
|
|
n += i = c - 'a' + 10;
|
|
|
|
|
}
|
|
|
|
|
else if (c == 'l')
|
|
|
|
|
{
|
|
|
|
|
++long_p;
|
|
|
|
|
found_suffix = 1;
|
|
|
|
|
}
|
|
|
|
|
else if (c == 'u')
|
|
|
|
|
{
|
|
|
|
|
unsigned_p = 1;
|
|
|
|
|
found_suffix = 1;
|
|
|
|
|
}
|
1991-09-19 10:31:00 +00:00
|
|
|
|
else
|
|
|
|
|
return ERROR; /* Char not a digit */
|
|
|
|
|
}
|
|
|
|
|
if (i >= base)
|
|
|
|
|
return ERROR; /* Invalid digit in this base */
|
1992-11-06 18:37:20 +00:00
|
|
|
|
|
1991-12-05 11:56:20 +00:00
|
|
|
|
/* Portably test for overflow (only works for nonzero values, so make
|
1994-01-15 17:14:18 +00:00
|
|
|
|
a second check for zero). FIXME: Can't we just make n and prevn
|
|
|
|
|
unsigned and avoid this? */
|
|
|
|
|
if (c != 'l' && c != 'u' && (prevn >= n) && n != 0)
|
|
|
|
|
unsigned_p = 1; /* Try something unsigned */
|
|
|
|
|
|
|
|
|
|
/* Portably test for unsigned overflow.
|
|
|
|
|
FIXME: This check is wrong; for example it doesn't find overflow
|
|
|
|
|
on 0x123456789 when LONGEST is 32 bits. */
|
|
|
|
|
if (c != 'l' && c != 'u' && n != 0)
|
|
|
|
|
{
|
1996-11-12 23:33:32 +00:00
|
|
|
|
if ((unsigned_p && (ULONGEST) prevn >= (ULONGEST) n))
|
1994-01-15 17:14:18 +00:00
|
|
|
|
error ("Numeric constant too large.");
|
|
|
|
|
}
|
|
|
|
|
prevn = n;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* An integer constant is an int, a long, or a long long. An L
|
|
|
|
|
suffix forces it to be long; an LL suffix forces it to be long
|
|
|
|
|
long. If not forced to a larger size, it gets the first type of
|
|
|
|
|
the above that it fits in. To figure out whether it fits, we
|
|
|
|
|
shift it right and see whether anything remains. Note that we
|
|
|
|
|
can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one
|
|
|
|
|
operation, because many compilers will warn about such a shift
|
|
|
|
|
(which always produces a zero result). Sometimes TARGET_INT_BIT
|
|
|
|
|
or TARGET_LONG_BIT will be that big, sometimes not. To deal with
|
|
|
|
|
the case where it is we just always shift the value more than
|
|
|
|
|
once, with fewer bits each time. */
|
|
|
|
|
|
1996-11-12 23:33:32 +00:00
|
|
|
|
un = (ULONGEST)n >> 2;
|
1994-01-15 17:14:18 +00:00
|
|
|
|
if (long_p == 0
|
1994-01-17 00:23:49 +00:00
|
|
|
|
&& (un >> (TARGET_INT_BIT - 2)) == 0)
|
1994-01-15 17:14:18 +00:00
|
|
|
|
{
|
1996-11-12 23:33:32 +00:00
|
|
|
|
high_bit = ((ULONGEST)1) << (TARGET_INT_BIT-1);
|
1994-01-15 17:14:18 +00:00
|
|
|
|
|
|
|
|
|
/* A large decimal (not hex or octal) constant (between INT_MAX
|
|
|
|
|
and UINT_MAX) is a long or unsigned long, according to ANSI,
|
|
|
|
|
never an unsigned int, but this code treats it as unsigned
|
|
|
|
|
int. This probably should be fixed. GCC gives a warning on
|
|
|
|
|
such constants. */
|
|
|
|
|
|
|
|
|
|
unsigned_type = builtin_type_unsigned_int;
|
|
|
|
|
signed_type = builtin_type_int;
|
|
|
|
|
}
|
|
|
|
|
else if (long_p <= 1
|
1994-01-17 00:23:49 +00:00
|
|
|
|
&& (un >> (TARGET_LONG_BIT - 2)) == 0)
|
1994-01-15 17:14:18 +00:00
|
|
|
|
{
|
1996-11-12 23:33:32 +00:00
|
|
|
|
high_bit = ((ULONGEST)1) << (TARGET_LONG_BIT-1);
|
1994-01-15 17:14:18 +00:00
|
|
|
|
unsigned_type = builtin_type_unsigned_long;
|
|
|
|
|
signed_type = builtin_type_long;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
1996-11-12 23:33:32 +00:00
|
|
|
|
high_bit = (((ULONGEST)1)
|
1994-01-15 19:51:56 +00:00
|
|
|
|
<< (TARGET_LONG_LONG_BIT - 32 - 1)
|
|
|
|
|
<< 16
|
|
|
|
|
<< 16);
|
|
|
|
|
if (high_bit == 0)
|
|
|
|
|
/* A long long does not fit in a LONGEST. */
|
gcc -Wall lint:
* breakpoint.c (watchpoint_check): Remove unused variable b.
* stack.c (print_frame_info): Move sp and buf inside #if.
* eval.c (evaluate_subexp): Remove unused variables pp,
mangle_ptr, ptr, and mangle_tstr.
* valarith.c (value_x_binop): Remove unused variables mangle_tstr
and mangle_ptr.
* symtab.c (lookup_symtab): Put variable copy inside #if.
(decode_line_1): Put variable q1 inside #if 0.
* target.h: Declare target_link.
* infrun.c (wait_for_inferior): Remove unused variables signame.
* remote.c (remote_resume): Remove unused variable name.
* c-exp.y (parse_number): Parenthesize operand of shift.
* dbxread.c (record_minimal_symbol): Parenthesize operand of &&
(this is a semantic change, the warning seems to have detected a bug).
* dbxread.c (end_psymtab): Move variable p1 inside #if.
* coffread.c: Move variable temptype inside #if.
* ch-typeprint.c (chill_type_print_base): Remove unused variable
name.
* ch-valprint.c: #include typeprint.h and ch-lang.h.
(chill_val_print): Remove unused variable in_range.
(chill_val_print): Remove statement "length > TYPE_LENGTH (type);".
(chill_val_print): Add default case for switch.
* stabsread.h: Declare stabsect_build_psymtabs.
* os9kread.c (read_minimal_symbols): Make this return void.
(os9k_symfile_read): Remove unused variables stb_exist and val.
(os9k_symfile_init): Remove unused variable val.
(fill_sym): Remove unused variable id.
(read_os9k_psymtab): Put variable back_to inside #if 0. Remove
unused variable nsl.
Remove unused variable symfile_bfd.
#if 0 unused variables lbrac_unmatched_complaint and
lbrac_mismatch_complaint.
Remove declaration for non-existent function os9k_next_symbol_text.
* annotate.c, annotate.h: New files, containing a function for
each annotation which outputs it.
* Move breakpoints_changed from breakpoint.c to annotate.c.
* breakpoint.c, blockframe.c, infrun.c, cp-valprint.c, main.c,
printcmd.c, source.c, stack.c, utils.c, valprint.c:
Use annotate.c functions to output annotations.
* Makefile.in (OBS): Add annotate.o.
1994-05-13 18:18:57 +00:00
|
|
|
|
high_bit =
|
1996-11-12 23:33:32 +00:00
|
|
|
|
(ULONGEST)1 << (sizeof (LONGEST) * HOST_CHAR_BIT - 1);
|
1994-01-15 17:14:18 +00:00
|
|
|
|
unsigned_type = builtin_type_unsigned_long_long;
|
|
|
|
|
signed_type = builtin_type_long_long;
|
1991-09-19 10:31:00 +00:00
|
|
|
|
}
|
1992-11-06 18:37:20 +00:00
|
|
|
|
|
* Add native support for long double data type.
* c-exp.y (%union): Change dval to typed_val_float. Use DOUBLEST
to store actual data. Change types of INT and FLOAT tokens to
typed_val_int and typed_val_float respectively. Create new token
DOUBLE_KEYWORD to specify the string `double'. Make production
for FLOAT use type determined by parse_number. Add production for
"long double" data type.
* (parse_number): Use sscanf to parse numbers as float, double or
long double depending upon the type of typed_val_float.dval. Also
allow user to specify `f' or `l' suffix to explicitly specify
float or long double constants. Change typed_val to
typed_val_int.
* (yylex): Change typed_val to typed_val_int. Also, scan for
"double" keyword.
* coffread.c (decode_base_type): Add support for T_LNGDBL basic
type.
* configure, configure.in: Add check for long double support in
the host compiler.
* defs.h: Define DOUBLEST appropriatly depending on whether
HAVE_LONG_DOUBLE (from autoconf) is defined. Also, fix prototypes
for functions that handle this type.
* expression.h (union exp_element): doubleconst is now type
DOUBLEST.
* m2-exp.y f-exp.y (%union): dval becomes type DOUBLEST.
* findvar.c (extract_floating): Make return value be DOUBLEST.
Also, add support for numbers with size of long double.
* (store_floating): Arg `val' is now type DOUBLEST. Handle all
floating types.
* parser-defs.h parse.c (write_exp_elt_dblcst): Arg expelt is now
DOUBLEST.
* valarith.c (value_binop): Change temp variables v1, v2 and v to
type DOUBLEST. Coerce type of result to long double if either op
was of that type.
* valops.c (value_arg_coerce): If argument type is bigger than
double, coerce to long double.
* (call_function_by_hand): If REG_STRUCT_HAS_ADDR is defined, and
arg type is float and > 8 bytes, then use pointer-to-object
calling conventions.
* valprint.c (print_floating): Arg doub is now type DOUBLEST.
Use appropriate format and precision to print out floating point
values.
* value.h: Fixup prototypes for value_as_double,
value_from_double, and unpack_double to use DOUBLEST.
* values.c (record_latest_value): Remove check for invalid
floats. Allow history to store them so that people may examine
them in hex if they want.
* (value_as_double unpack_double): Change return value to DOUBLEST.
* (value_from_double): Arg `num' is now DOUBLEST.
* (using_struct_return): Use RETURN_VALUE_ON_STACK macro (target
specific) to expect certain types to always be returned on the stack.
1996-02-17 00:07:35 +00:00
|
|
|
|
putithere->typed_val_int.val = n;
|
1992-11-06 18:37:20 +00:00
|
|
|
|
|
|
|
|
|
/* If the high bit of the worked out type is set then this number
|
|
|
|
|
has to be unsigned. */
|
|
|
|
|
|
|
|
|
|
if (unsigned_p || (n & high_bit))
|
|
|
|
|
{
|
* Add native support for long double data type.
* c-exp.y (%union): Change dval to typed_val_float. Use DOUBLEST
to store actual data. Change types of INT and FLOAT tokens to
typed_val_int and typed_val_float respectively. Create new token
DOUBLE_KEYWORD to specify the string `double'. Make production
for FLOAT use type determined by parse_number. Add production for
"long double" data type.
* (parse_number): Use sscanf to parse numbers as float, double or
long double depending upon the type of typed_val_float.dval. Also
allow user to specify `f' or `l' suffix to explicitly specify
float or long double constants. Change typed_val to
typed_val_int.
* (yylex): Change typed_val to typed_val_int. Also, scan for
"double" keyword.
* coffread.c (decode_base_type): Add support for T_LNGDBL basic
type.
* configure, configure.in: Add check for long double support in
the host compiler.
* defs.h: Define DOUBLEST appropriatly depending on whether
HAVE_LONG_DOUBLE (from autoconf) is defined. Also, fix prototypes
for functions that handle this type.
* expression.h (union exp_element): doubleconst is now type
DOUBLEST.
* m2-exp.y f-exp.y (%union): dval becomes type DOUBLEST.
* findvar.c (extract_floating): Make return value be DOUBLEST.
Also, add support for numbers with size of long double.
* (store_floating): Arg `val' is now type DOUBLEST. Handle all
floating types.
* parser-defs.h parse.c (write_exp_elt_dblcst): Arg expelt is now
DOUBLEST.
* valarith.c (value_binop): Change temp variables v1, v2 and v to
type DOUBLEST. Coerce type of result to long double if either op
was of that type.
* valops.c (value_arg_coerce): If argument type is bigger than
double, coerce to long double.
* (call_function_by_hand): If REG_STRUCT_HAS_ADDR is defined, and
arg type is float and > 8 bytes, then use pointer-to-object
calling conventions.
* valprint.c (print_floating): Arg doub is now type DOUBLEST.
Use appropriate format and precision to print out floating point
values.
* value.h: Fixup prototypes for value_as_double,
value_from_double, and unpack_double to use DOUBLEST.
* values.c (record_latest_value): Remove check for invalid
floats. Allow history to store them so that people may examine
them in hex if they want.
* (value_as_double unpack_double): Change return value to DOUBLEST.
* (value_from_double): Arg `num' is now DOUBLEST.
* (using_struct_return): Use RETURN_VALUE_ON_STACK macro (target
specific) to expect certain types to always be returned on the stack.
1996-02-17 00:07:35 +00:00
|
|
|
|
putithere->typed_val_int.type = unsigned_type;
|
1992-11-06 18:37:20 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
* Add native support for long double data type.
* c-exp.y (%union): Change dval to typed_val_float. Use DOUBLEST
to store actual data. Change types of INT and FLOAT tokens to
typed_val_int and typed_val_float respectively. Create new token
DOUBLE_KEYWORD to specify the string `double'. Make production
for FLOAT use type determined by parse_number. Add production for
"long double" data type.
* (parse_number): Use sscanf to parse numbers as float, double or
long double depending upon the type of typed_val_float.dval. Also
allow user to specify `f' or `l' suffix to explicitly specify
float or long double constants. Change typed_val to
typed_val_int.
* (yylex): Change typed_val to typed_val_int. Also, scan for
"double" keyword.
* coffread.c (decode_base_type): Add support for T_LNGDBL basic
type.
* configure, configure.in: Add check for long double support in
the host compiler.
* defs.h: Define DOUBLEST appropriatly depending on whether
HAVE_LONG_DOUBLE (from autoconf) is defined. Also, fix prototypes
for functions that handle this type.
* expression.h (union exp_element): doubleconst is now type
DOUBLEST.
* m2-exp.y f-exp.y (%union): dval becomes type DOUBLEST.
* findvar.c (extract_floating): Make return value be DOUBLEST.
Also, add support for numbers with size of long double.
* (store_floating): Arg `val' is now type DOUBLEST. Handle all
floating types.
* parser-defs.h parse.c (write_exp_elt_dblcst): Arg expelt is now
DOUBLEST.
* valarith.c (value_binop): Change temp variables v1, v2 and v to
type DOUBLEST. Coerce type of result to long double if either op
was of that type.
* valops.c (value_arg_coerce): If argument type is bigger than
double, coerce to long double.
* (call_function_by_hand): If REG_STRUCT_HAS_ADDR is defined, and
arg type is float and > 8 bytes, then use pointer-to-object
calling conventions.
* valprint.c (print_floating): Arg doub is now type DOUBLEST.
Use appropriate format and precision to print out floating point
values.
* value.h: Fixup prototypes for value_as_double,
value_from_double, and unpack_double to use DOUBLEST.
* values.c (record_latest_value): Remove check for invalid
floats. Allow history to store them so that people may examine
them in hex if they want.
* (value_as_double unpack_double): Change return value to DOUBLEST.
* (value_from_double): Arg `num' is now DOUBLEST.
* (using_struct_return): Use RETURN_VALUE_ON_STACK macro (target
specific) to expect certain types to always be returned on the stack.
1996-02-17 00:07:35 +00:00
|
|
|
|
putithere->typed_val_int.type = signed_type;
|
1992-11-06 18:37:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return INT;
|
1991-09-19 10:31:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct token
|
|
|
|
|
{
|
|
|
|
|
char *operator;
|
|
|
|
|
int token;
|
|
|
|
|
enum exp_opcode opcode;
|
|
|
|
|
};
|
|
|
|
|
|
* Makefile.in (VERSION): Bump to 4.7.4.
* Makefile.in (SFILES_MAINDIR): Add typeprint.c, c-typeprint.c,
m2-typeprint.c, c-valprint.c cp-valprint.c m2-valprint.c.
* Makefile.in (HFILES): Add valprint.h.
* Makefile.in (OBS): Add typeprint.o, c-typeprint.o,
m2-typeprint.o, c-valprint.o, cp-valprint.o m2-valprint.o.
* typeprint.c, typeprint.h: New files for language independent
type printing functions.
* c-typeprint.c, m2-typeprint.c: New files for language dependent
type printing functions and definitions.
* valprint.h: New include file for language independent value
printing definitions.
* c-valprint.c, cp-valprint.c, m2-valprint.c: New files for language
dependent value printing functions.
* c-exp.y (production ptype): Add range_type variable and use new
create_range_type function.
* c-exp.y (tokentab2, tokentab3), c-lang.c (c_op_print_tab),
infcmd.c (path_var_name), language.c (unk_op_print_tab),
m2-lang.c (m2_op_print_tab): Change from ANSI-obsolescent
"const static" to ANSI-conformant "static const".
* c-exp.y (c_create_fundamental_type): Remove unused nbytes.
* c-exp.y (c_language_defn, cplus_language_defn): Add c_print_type,
and c_val_print.
* c-lang.h (c_print_type, c_val_print): Add prototypes.
* coffread.c (decode_type): Add range_type variable and call to
new create_range_type function.
* complaints.c (complain): Remove unused val variable.
* complaints.c (_initialize_complaints): Make it void.
* convex-tdep.c (value_of_trapped_internalvar): Add range_type
variable and call new create_range_type function.
* defs.h (enum val_prettyprint): Move enum from value.h to here
so we can avoid having to include value.h just for prototypes that
need the enum (thanks ANSI).
* dwarfread.c (struct_type): Local anonymous_size variable is
only used if !BITS_BIG_ENDIAN.
* dwarfread.c (decode_subscript_data_item): Add rangetype
variable and call new create_range_type function.
* elfread.c (elf_symfile_read): Remove unused dbx and text_sect
variables.
* eval.c (evaluate_subexp): Remove unused local variable name
and the statement with no side effects that initializes it.
* expprint.c (print_subexp): Change local_printstr to
LA_PRINT_STRING.
* gdbtypes.c (create_range_type): New function that creates
a range type using code fragments from object file readers as
an example of what has to be initialized.
* gdbtypes.c (create_array_type): Removed index_type, low_bound,
and high_bound parameters, replaced with a single range_type
parameter. Change function body to use passed in range_type
rather than handcrafting one.
* gdbtypes.h (create_range_type): Add prototype.
* gdbtypes.h (create_array_type): Change prototype parameters.
* infrun.c (normal_stop): Remove unused local variables tem and c.
* infrun.c (hook_stop_stub): Return 0 rather than random value.
* language.c (unk_lang_print_type, unk_lang_val_print): Add
stub functions that call error if called.
* language.c (unknown_language_defn, auto_language_defn,
local_language_defn): Add initializers unk_lang_print_type and
unk_lang_val_print.
* language.h (struct language_defn): Reformat for larger
comments, add la_print_type and la_val_print members. Add
LA_PRINT_TYPE and LA_VAL_PRINT macros. Change local_printchar
to LA_PRINT_CHAR and local_printstr to LA_PRINT_STRING.
* m2-lang.c (m2_create_fundamental_type): Remove unused local
variable nbytes.
* m2-lang.c (m2_language_defn): Add initializers m2_print_type
and m2_val_print.
* m2-lang.h (m2_print_type, m2_val_print): Add prototypes.
* main.c (execute_command): Remove unused local variable cmdlines.
* main.c (echo_command), stabsread.c (read_type), printcmd.c
(clear_displays), symmisc.c (block_depth), values.c
(clear_value_history):
Make testing of truth value of assignment result explicit.
* mipsread.c (upgrade_type): Update FIXME to include future use
of create_range_type.
* printcmd.c (ptype_command, ptype_eval, whatis_command,
whatis_exp, maintenance_print_type): Move prototypes and functions
to new typeprint.c.
* printcmd.c (_initialize_printcmd): Move add_com calls for
ptype_command and whatis_command to new typeprint.c.
* ser-bsd.c (serial_open): Remove unused variable sgttyb.
* source.c (find_source_lines): Local variable c only used
when LSEEK_NOT_LINEAR is defined.
* stabsread.c (read_array_type): Use new create_range_type
function.
* stabsread.c (read_range_type): Add new index_type variable and
call new create_range_type function rather than handcrafting
range types.
* symmisc.c (type_print_1): Change usages to LA_PRINT_TYPE.
* symtab.c (typedef_print usages): Use c_typedef_print, renamed.
* symtab.c (type_print_base usages): Use c_type_print_base.
* symtab.c (type_print_varspec_prefix usages): Use
c_type_print_varspec_prefix.
* symtab.c (type_print_method_args usages): Use
cp_type_print_method_args.
* valprint.c: Completely ripped apart and the fragments used
to create c-valprint.c, cp-valprint.c, m2-valprint.c, and
valprint.h. Remaining stuff is language independent.
* value.h (struct fn_field): Forward declare for prototypes.
* value.h (type_print_1): Remove prototype.
* value.h (enum val_prettyprint): Moved to defs.h.
* value.h (typedef_print): Prototype renamed to c_typedef_print.
* value.h (baseclass_offset): Add prototype.
**** start-sanitize-chill ****
* Makefile.in (SFILES_MAINDIR): Add ch-typeprint.c, ch-valprint.c.
* Makefile.in (OBS): Add ch-typeprint.o, ch-valprint.o.
* ch-typeprint.c: New file for language dependent type printing.
* ch-valprint.c: New file for language dependent value printing.
* ch-exp.y (parse_number): Remove prototype and stub function.
* ch-exp.y (decode_integer_literal): Removed unused digits and
temp variables.
* ch-exp.y (convert_float): Completely ifdef out for now.
* ch-exp.y (tokentab2, tokentab3, tokentab4, tokentab5),
ch-lang.c (chill_op_print_tab):
Change from ANSI-obsolescent "const static" to ANSI-conformant
"static const".
* ch-exp.y (yylex): Add unhandled storage class enumeration
literals to switch statement for completeness.
* ch-lang.c (chill_create_fundamental_types): Remove unused
nbytes variable. Change dummy type to 2 bytes to match int.
Handle FT_VOID types gratuituously added to chill DWARF by
compiler. Change FT_CHAR case to generate an TYPE_CODE_CHAR
type rather than a one byte TYPE_CODE_INT type.
* ch-lang.c (chill_language_defn): Add chill_print_type and
chill_val_print.
* ch-lang.h (chill_print_type, chill_val_print): Add prototypes.
**** end-sanitize-chill ****
1992-12-18 20:21:32 +00:00
|
|
|
|
static const struct token tokentab3[] =
|
1991-09-19 10:31:00 +00:00
|
|
|
|
{
|
|
|
|
|
{">>=", ASSIGN_MODIFY, BINOP_RSH},
|
|
|
|
|
{"<<=", ASSIGN_MODIFY, BINOP_LSH}
|
|
|
|
|
};
|
|
|
|
|
|
* Makefile.in (VERSION): Bump to 4.7.4.
* Makefile.in (SFILES_MAINDIR): Add typeprint.c, c-typeprint.c,
m2-typeprint.c, c-valprint.c cp-valprint.c m2-valprint.c.
* Makefile.in (HFILES): Add valprint.h.
* Makefile.in (OBS): Add typeprint.o, c-typeprint.o,
m2-typeprint.o, c-valprint.o, cp-valprint.o m2-valprint.o.
* typeprint.c, typeprint.h: New files for language independent
type printing functions.
* c-typeprint.c, m2-typeprint.c: New files for language dependent
type printing functions and definitions.
* valprint.h: New include file for language independent value
printing definitions.
* c-valprint.c, cp-valprint.c, m2-valprint.c: New files for language
dependent value printing functions.
* c-exp.y (production ptype): Add range_type variable and use new
create_range_type function.
* c-exp.y (tokentab2, tokentab3), c-lang.c (c_op_print_tab),
infcmd.c (path_var_name), language.c (unk_op_print_tab),
m2-lang.c (m2_op_print_tab): Change from ANSI-obsolescent
"const static" to ANSI-conformant "static const".
* c-exp.y (c_create_fundamental_type): Remove unused nbytes.
* c-exp.y (c_language_defn, cplus_language_defn): Add c_print_type,
and c_val_print.
* c-lang.h (c_print_type, c_val_print): Add prototypes.
* coffread.c (decode_type): Add range_type variable and call to
new create_range_type function.
* complaints.c (complain): Remove unused val variable.
* complaints.c (_initialize_complaints): Make it void.
* convex-tdep.c (value_of_trapped_internalvar): Add range_type
variable and call new create_range_type function.
* defs.h (enum val_prettyprint): Move enum from value.h to here
so we can avoid having to include value.h just for prototypes that
need the enum (thanks ANSI).
* dwarfread.c (struct_type): Local anonymous_size variable is
only used if !BITS_BIG_ENDIAN.
* dwarfread.c (decode_subscript_data_item): Add rangetype
variable and call new create_range_type function.
* elfread.c (elf_symfile_read): Remove unused dbx and text_sect
variables.
* eval.c (evaluate_subexp): Remove unused local variable name
and the statement with no side effects that initializes it.
* expprint.c (print_subexp): Change local_printstr to
LA_PRINT_STRING.
* gdbtypes.c (create_range_type): New function that creates
a range type using code fragments from object file readers as
an example of what has to be initialized.
* gdbtypes.c (create_array_type): Removed index_type, low_bound,
and high_bound parameters, replaced with a single range_type
parameter. Change function body to use passed in range_type
rather than handcrafting one.
* gdbtypes.h (create_range_type): Add prototype.
* gdbtypes.h (create_array_type): Change prototype parameters.
* infrun.c (normal_stop): Remove unused local variables tem and c.
* infrun.c (hook_stop_stub): Return 0 rather than random value.
* language.c (unk_lang_print_type, unk_lang_val_print): Add
stub functions that call error if called.
* language.c (unknown_language_defn, auto_language_defn,
local_language_defn): Add initializers unk_lang_print_type and
unk_lang_val_print.
* language.h (struct language_defn): Reformat for larger
comments, add la_print_type and la_val_print members. Add
LA_PRINT_TYPE and LA_VAL_PRINT macros. Change local_printchar
to LA_PRINT_CHAR and local_printstr to LA_PRINT_STRING.
* m2-lang.c (m2_create_fundamental_type): Remove unused local
variable nbytes.
* m2-lang.c (m2_language_defn): Add initializers m2_print_type
and m2_val_print.
* m2-lang.h (m2_print_type, m2_val_print): Add prototypes.
* main.c (execute_command): Remove unused local variable cmdlines.
* main.c (echo_command), stabsread.c (read_type), printcmd.c
(clear_displays), symmisc.c (block_depth), values.c
(clear_value_history):
Make testing of truth value of assignment result explicit.
* mipsread.c (upgrade_type): Update FIXME to include future use
of create_range_type.
* printcmd.c (ptype_command, ptype_eval, whatis_command,
whatis_exp, maintenance_print_type): Move prototypes and functions
to new typeprint.c.
* printcmd.c (_initialize_printcmd): Move add_com calls for
ptype_command and whatis_command to new typeprint.c.
* ser-bsd.c (serial_open): Remove unused variable sgttyb.
* source.c (find_source_lines): Local variable c only used
when LSEEK_NOT_LINEAR is defined.
* stabsread.c (read_array_type): Use new create_range_type
function.
* stabsread.c (read_range_type): Add new index_type variable and
call new create_range_type function rather than handcrafting
range types.
* symmisc.c (type_print_1): Change usages to LA_PRINT_TYPE.
* symtab.c (typedef_print usages): Use c_typedef_print, renamed.
* symtab.c (type_print_base usages): Use c_type_print_base.
* symtab.c (type_print_varspec_prefix usages): Use
c_type_print_varspec_prefix.
* symtab.c (type_print_method_args usages): Use
cp_type_print_method_args.
* valprint.c: Completely ripped apart and the fragments used
to create c-valprint.c, cp-valprint.c, m2-valprint.c, and
valprint.h. Remaining stuff is language independent.
* value.h (struct fn_field): Forward declare for prototypes.
* value.h (type_print_1): Remove prototype.
* value.h (enum val_prettyprint): Moved to defs.h.
* value.h (typedef_print): Prototype renamed to c_typedef_print.
* value.h (baseclass_offset): Add prototype.
**** start-sanitize-chill ****
* Makefile.in (SFILES_MAINDIR): Add ch-typeprint.c, ch-valprint.c.
* Makefile.in (OBS): Add ch-typeprint.o, ch-valprint.o.
* ch-typeprint.c: New file for language dependent type printing.
* ch-valprint.c: New file for language dependent value printing.
* ch-exp.y (parse_number): Remove prototype and stub function.
* ch-exp.y (decode_integer_literal): Removed unused digits and
temp variables.
* ch-exp.y (convert_float): Completely ifdef out for now.
* ch-exp.y (tokentab2, tokentab3, tokentab4, tokentab5),
ch-lang.c (chill_op_print_tab):
Change from ANSI-obsolescent "const static" to ANSI-conformant
"static const".
* ch-exp.y (yylex): Add unhandled storage class enumeration
literals to switch statement for completeness.
* ch-lang.c (chill_create_fundamental_types): Remove unused
nbytes variable. Change dummy type to 2 bytes to match int.
Handle FT_VOID types gratuituously added to chill DWARF by
compiler. Change FT_CHAR case to generate an TYPE_CODE_CHAR
type rather than a one byte TYPE_CODE_INT type.
* ch-lang.c (chill_language_defn): Add chill_print_type and
chill_val_print.
* ch-lang.h (chill_print_type, chill_val_print): Add prototypes.
**** end-sanitize-chill ****
1992-12-18 20:21:32 +00:00
|
|
|
|
static const struct token tokentab2[] =
|
1991-09-19 10:31:00 +00:00
|
|
|
|
{
|
|
|
|
|
{"+=", ASSIGN_MODIFY, BINOP_ADD},
|
|
|
|
|
{"-=", ASSIGN_MODIFY, BINOP_SUB},
|
|
|
|
|
{"*=", ASSIGN_MODIFY, BINOP_MUL},
|
|
|
|
|
{"/=", ASSIGN_MODIFY, BINOP_DIV},
|
|
|
|
|
{"%=", ASSIGN_MODIFY, BINOP_REM},
|
* Makefile.in (SFILES_MAINDIR): Add ch-exp.y.
* Makefile.in (YYFILES): Add ch-exp.tab.c.
* Makefile.in (YYOBJ): Add ch-exp.tab.o.
* Makefile.in (saber_gdb): Add unload of ch-exp.y and load
of ch-exp.tab.c.
* Makefile.in (distclean): Add target ch-exp.tab.c.
* Makefile.in (realclean): Add rm of ch-exp.tab.c.
* Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on
Makefile since it contains sed patterns used in generation.
Add sed pattern to also delete #include of any malloc.h.
* Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets.
* ch-exp.y: New expression parser, for GNU-Chill.
* c-exp.y, expr.c, expression.h, language.c, m2-exp.y,
parser-defs.h, valarith.c, valops.c, value.h: Remap macros and
function names to conform to K&R terminology with respect to
logical and bitwise operators:
UNOP_ZEROP => UNOP_LOGICAL_NOT
UNOP_LOGNOT => UNOP_COMPLEMENT
BINOP_LOGAND => BINOP_BITWISE_AND
BINOP_LOGXOR => BINOP_BITWISE_XOR
BINOP_LOGIOR => BINOP_BITWISE_IOR
BINOP_AND => BINOP_LOGICAL_AND
BINOP_OR => BINOP_LOGICAL_OR
PREC_OR => PREC_LOGICAL_OR
PREC_AND => PREC_LOGICAL_AND
PREC_LOGIOR => PREC_BITWISE_IOR
PREC_LOGXOR => PREC_BITWISE_XOR
PREC_LOGAND => PREC_BITWISE_AND
value_zerop() => value_logical_not()
value_lognot() => value_complement()
* c-exp.y (c_op_print_tab): Add explicit empty terminator.
* m2-exp.y (m2_op_print_tab): Add explicit empty terminator.
* defs.h (enum language): Add language_chill.
* dwarfread.c (set_cu_language): Add LANG_CHILL case and make
LANG_MODULA2 a recognized language.
* eval.c (evaluate_subexp): Add OP_BOOL case.
* expprint.c (print_subexp): Add OP_BOOL case.
* gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for
Chill as well as Modula-2.
* gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long,
builtin_type_chill_ulong, builtin_type_chill_real): Add.
* i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary
and is nonexistant in some SVR4 based systems.
* language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4.
* language.c (set_language_command): Add chill.
* language.c (binop_result_type, integral_type, character_type,
boolean_type, structured_type, value_true, binop_type_check):
Add language_chill cases.
* language.h (_LANG_chill): Define.
* m2-exp.y (number_sign, modblock): Make static, #ifdef out
unused modblock.
* m2-exp.y (ANDAND): Rename to LOGICAL_AND.
* source.c (source_info): Fix minor nits, print "1 line" rather
than "1 lines", and "language is <lang>".
* symfile.c (deduce_language_from_filename): Recognize the
filename extensions ".chill", ".c186", and ".c286" for Chill.
* valarith.c (value_binop): Handle TYPE_CODE_BOOL as well
as TYPE_CODE_INT and TYPE_CODE_FLOAT.
* valprint.c (val_print): Print TYPE_CODE_BOOL type values as
"TRUE" or "FALSE".
* valprint.c (typedef_print): Add case for language_chill.
* values.c (value_from_longest): Handle TYPE_CODE_BOOL.
1992-11-15 17:28:02 +00:00
|
|
|
|
{"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR},
|
|
|
|
|
{"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND},
|
|
|
|
|
{"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR},
|
1991-09-19 10:31:00 +00:00
|
|
|
|
{"++", INCREMENT, BINOP_END},
|
|
|
|
|
{"--", DECREMENT, BINOP_END},
|
|
|
|
|
{"->", ARROW, BINOP_END},
|
1992-02-20 19:23:42 +00:00
|
|
|
|
{"&&", ANDAND, BINOP_END},
|
|
|
|
|
{"||", OROR, BINOP_END},
|
1991-09-19 10:31:00 +00:00
|
|
|
|
{"::", COLONCOLON, BINOP_END},
|
|
|
|
|
{"<<", LSH, BINOP_END},
|
|
|
|
|
{">>", RSH, BINOP_END},
|
|
|
|
|
{"==", EQUAL, BINOP_END},
|
|
|
|
|
{"!=", NOTEQUAL, BINOP_END},
|
|
|
|
|
{"<=", LEQ, BINOP_END},
|
|
|
|
|
{">=", GEQ, BINOP_END}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Read one token, getting characters through lexptr. */
|
|
|
|
|
|
1993-01-05 04:14:28 +00:00
|
|
|
|
static int
|
1991-09-19 10:31:00 +00:00
|
|
|
|
yylex ()
|
|
|
|
|
{
|
1992-11-24 03:02:10 +00:00
|
|
|
|
int c;
|
|
|
|
|
int namelen;
|
|
|
|
|
unsigned int i;
|
|
|
|
|
char *tokstart;
|
|
|
|
|
char *tokptr;
|
|
|
|
|
int tempbufindex;
|
|
|
|
|
static char *tempbuf;
|
|
|
|
|
static int tempbufsize;
|
|
|
|
|
|
1991-09-19 10:31:00 +00:00
|
|
|
|
retry:
|
|
|
|
|
|
|
|
|
|
tokstart = lexptr;
|
|
|
|
|
/* See if it is a special token of length 3. */
|
|
|
|
|
for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
|
* c-exp.y, m2-exp.y (yyreds, yytoks): Remap like other yy* names.
* c-exp.y, m2-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* c-exp.y (strncmp): Replace throughout with STREQN, missed
them during the previous replacements.
* printcmd.c (_initialize_printcmd): Update internal documentation
for "set" command to note that the assignment syntax is language
dependent.
**** start-sanitize-chill ****
* ch-exp.y (yyreds, yytoks): Remap like other yy* names.
* ch-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* ch-exp.y (GDB_REGNAME, GDB_LAST, GDB_VARIABLE, GDB_ASSIGNMENT,
single_assignment_action): New terminals and nonterminal for gdb
extensions to chill expression grammer.
* ch-exp.y (match_dollar_tokens): Lexer routine to match all
tokens that start with '$' (register names, convenience vars, etc).
* ch-exp.y (tokentab2): Add GDB_ASSIGNMENT.
* ch-exp.y (yylex): Call match_dollar_tokens.
**** end-sanitize-chill ****
1992-12-31 04:05:05 +00:00
|
|
|
|
if (STREQN (tokstart, tokentab3[i].operator, 3))
|
1991-09-19 10:31:00 +00:00
|
|
|
|
{
|
|
|
|
|
lexptr += 3;
|
|
|
|
|
yylval.opcode = tokentab3[i].opcode;
|
|
|
|
|
return tokentab3[i].token;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* See if it is a special token of length 2. */
|
|
|
|
|
for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
|
* c-exp.y, m2-exp.y (yyreds, yytoks): Remap like other yy* names.
* c-exp.y, m2-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* c-exp.y (strncmp): Replace throughout with STREQN, missed
them during the previous replacements.
* printcmd.c (_initialize_printcmd): Update internal documentation
for "set" command to note that the assignment syntax is language
dependent.
**** start-sanitize-chill ****
* ch-exp.y (yyreds, yytoks): Remap like other yy* names.
* ch-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* ch-exp.y (GDB_REGNAME, GDB_LAST, GDB_VARIABLE, GDB_ASSIGNMENT,
single_assignment_action): New terminals and nonterminal for gdb
extensions to chill expression grammer.
* ch-exp.y (match_dollar_tokens): Lexer routine to match all
tokens that start with '$' (register names, convenience vars, etc).
* ch-exp.y (tokentab2): Add GDB_ASSIGNMENT.
* ch-exp.y (yylex): Call match_dollar_tokens.
**** end-sanitize-chill ****
1992-12-31 04:05:05 +00:00
|
|
|
|
if (STREQN (tokstart, tokentab2[i].operator, 2))
|
1991-09-19 10:31:00 +00:00
|
|
|
|
{
|
|
|
|
|
lexptr += 2;
|
|
|
|
|
yylval.opcode = tokentab2[i].opcode;
|
|
|
|
|
return tokentab2[i].token;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (c = *tokstart)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
case ' ':
|
|
|
|
|
case '\t':
|
|
|
|
|
case '\n':
|
|
|
|
|
lexptr++;
|
|
|
|
|
goto retry;
|
|
|
|
|
|
|
|
|
|
case '\'':
|
1992-06-09 06:09:33 +00:00
|
|
|
|
/* We either have a character constant ('0' or '\177' for example)
|
|
|
|
|
or we have a quoted symbol reference ('foo(int,int)' in C++
|
|
|
|
|
for example). */
|
1991-09-19 10:31:00 +00:00
|
|
|
|
lexptr++;
|
|
|
|
|
c = *lexptr++;
|
|
|
|
|
if (c == '\\')
|
|
|
|
|
c = parse_escape (&lexptr);
|
1995-03-15 19:18:26 +00:00
|
|
|
|
else if (c == '\'')
|
|
|
|
|
error ("Empty character constant.");
|
1992-11-06 18:37:20 +00:00
|
|
|
|
|
* Add native support for long double data type.
* c-exp.y (%union): Change dval to typed_val_float. Use DOUBLEST
to store actual data. Change types of INT and FLOAT tokens to
typed_val_int and typed_val_float respectively. Create new token
DOUBLE_KEYWORD to specify the string `double'. Make production
for FLOAT use type determined by parse_number. Add production for
"long double" data type.
* (parse_number): Use sscanf to parse numbers as float, double or
long double depending upon the type of typed_val_float.dval. Also
allow user to specify `f' or `l' suffix to explicitly specify
float or long double constants. Change typed_val to
typed_val_int.
* (yylex): Change typed_val to typed_val_int. Also, scan for
"double" keyword.
* coffread.c (decode_base_type): Add support for T_LNGDBL basic
type.
* configure, configure.in: Add check for long double support in
the host compiler.
* defs.h: Define DOUBLEST appropriatly depending on whether
HAVE_LONG_DOUBLE (from autoconf) is defined. Also, fix prototypes
for functions that handle this type.
* expression.h (union exp_element): doubleconst is now type
DOUBLEST.
* m2-exp.y f-exp.y (%union): dval becomes type DOUBLEST.
* findvar.c (extract_floating): Make return value be DOUBLEST.
Also, add support for numbers with size of long double.
* (store_floating): Arg `val' is now type DOUBLEST. Handle all
floating types.
* parser-defs.h parse.c (write_exp_elt_dblcst): Arg expelt is now
DOUBLEST.
* valarith.c (value_binop): Change temp variables v1, v2 and v to
type DOUBLEST. Coerce type of result to long double if either op
was of that type.
* valops.c (value_arg_coerce): If argument type is bigger than
double, coerce to long double.
* (call_function_by_hand): If REG_STRUCT_HAS_ADDR is defined, and
arg type is float and > 8 bytes, then use pointer-to-object
calling conventions.
* valprint.c (print_floating): Arg doub is now type DOUBLEST.
Use appropriate format and precision to print out floating point
values.
* value.h: Fixup prototypes for value_as_double,
value_from_double, and unpack_double to use DOUBLEST.
* values.c (record_latest_value): Remove check for invalid
floats. Allow history to store them so that people may examine
them in hex if they want.
* (value_as_double unpack_double): Change return value to DOUBLEST.
* (value_from_double): Arg `num' is now DOUBLEST.
* (using_struct_return): Use RETURN_VALUE_ON_STACK macro (target
specific) to expect certain types to always be returned on the stack.
1996-02-17 00:07:35 +00:00
|
|
|
|
yylval.typed_val_int.val = c;
|
|
|
|
|
yylval.typed_val_int.type = builtin_type_char;
|
1992-11-06 18:37:20 +00:00
|
|
|
|
|
1991-09-19 10:31:00 +00:00
|
|
|
|
c = *lexptr++;
|
|
|
|
|
if (c != '\'')
|
1992-06-09 06:09:33 +00:00
|
|
|
|
{
|
|
|
|
|
namelen = skip_quoted (tokstart) - tokstart;
|
|
|
|
|
if (namelen > 2)
|
|
|
|
|
{
|
|
|
|
|
lexptr = tokstart + namelen;
|
1993-07-02 20:04:02 +00:00
|
|
|
|
if (lexptr[-1] != '\'')
|
|
|
|
|
error ("Unmatched single quote.");
|
1992-06-09 06:09:33 +00:00
|
|
|
|
namelen -= 2;
|
|
|
|
|
tokstart++;
|
|
|
|
|
goto tryname;
|
|
|
|
|
}
|
|
|
|
|
error ("Invalid character constant.");
|
|
|
|
|
}
|
1992-11-06 18:37:20 +00:00
|
|
|
|
return INT;
|
1991-09-19 10:31:00 +00:00
|
|
|
|
|
|
|
|
|
case '(':
|
|
|
|
|
paren_depth++;
|
|
|
|
|
lexptr++;
|
|
|
|
|
return c;
|
|
|
|
|
|
|
|
|
|
case ')':
|
|
|
|
|
if (paren_depth == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
paren_depth--;
|
|
|
|
|
lexptr++;
|
|
|
|
|
return c;
|
|
|
|
|
|
|
|
|
|
case ',':
|
|
|
|
|
if (comma_terminates && paren_depth == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
lexptr++;
|
|
|
|
|
return c;
|
|
|
|
|
|
|
|
|
|
case '.':
|
|
|
|
|
/* 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. */
|
|
|
|
|
|
|
|
|
|
case '0':
|
|
|
|
|
case '1':
|
|
|
|
|
case '2':
|
|
|
|
|
case '3':
|
|
|
|
|
case '4':
|
|
|
|
|
case '5':
|
|
|
|
|
case '6':
|
|
|
|
|
case '7':
|
|
|
|
|
case '8':
|
|
|
|
|
case '9':
|
|
|
|
|
{
|
|
|
|
|
/* It's a number. */
|
|
|
|
|
int got_dot = 0, got_e = 0, toktype;
|
|
|
|
|
register char *p = tokstart;
|
|
|
|
|
int hex = input_radix > 10;
|
|
|
|
|
|
|
|
|
|
if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
|
|
|
|
|
{
|
|
|
|
|
p += 2;
|
|
|
|
|
hex = 1;
|
|
|
|
|
}
|
|
|
|
|
else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
|
|
|
|
|
{
|
|
|
|
|
p += 2;
|
|
|
|
|
hex = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (;; ++p)
|
|
|
|
|
{
|
1993-06-12 22:03:27 +00:00
|
|
|
|
/* This test includes !hex because 'e' is a valid hex digit
|
|
|
|
|
and thus does not indicate a floating point number when
|
|
|
|
|
the radix is hex. */
|
1991-09-19 10:31:00 +00:00
|
|
|
|
if (!hex && !got_e && (*p == 'e' || *p == 'E'))
|
|
|
|
|
got_dot = got_e = 1;
|
1993-06-12 22:03:27 +00:00
|
|
|
|
/* This test does not include !hex, because a '.' always indicates
|
|
|
|
|
a decimal floating point number regardless of the radix. */
|
|
|
|
|
else if (!got_dot && *p == '.')
|
1991-09-19 10:31:00 +00:00
|
|
|
|
got_dot = 1;
|
|
|
|
|
else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
|
|
|
|
|
&& (*p == '-' || *p == '+'))
|
|
|
|
|
/* This is the sign of the exponent, not the end of the
|
|
|
|
|
number. */
|
|
|
|
|
continue;
|
|
|
|
|
/* We will take any letters or digits. parse_number will
|
|
|
|
|
complain if past the radix, or if L or U are not final. */
|
|
|
|
|
else if ((*p < '0' || *p > '9')
|
|
|
|
|
&& ((*p < 'a' || *p > 'z')
|
|
|
|
|
&& (*p < 'A' || *p > 'Z')))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
|
|
|
|
|
if (toktype == ERROR)
|
|
|
|
|
{
|
|
|
|
|
char *err_copy = (char *) alloca (p - tokstart + 1);
|
|
|
|
|
|
* breakpoint.c, buildsym.c, c-exp.y, coffread.c, command.c,
core.c, cplus-dem.c, dbxread.c, dwarfread.c, elfread.c, environ.c,
eval.c, findvar.c, gdbtypes.c, hppabsd-tdep.c, hppahpux-tdep.c,
i386-tdep.c, ieee-float.c, infcmd.c, inflow.c, infptrace.c,
infrun.c, m2-exp.y, mipsread.c, objfiles.c, parse.c, procfs.c,
putenv.c, remote-mm.c, remote-vx.c, solib.c, sparc-tdep.c,
sparc-xdep.c, stack.c, symfile.c, symtab.c, symtab.h, target.c,
tm-i386v.h, tm-sparc.h, utils.c, valarith.c, valops.c, valprint.c,
values.c, xcoffread.c:
Remove "(void)" casts from function calls where the return value
is ignored, in accordance with GNU coding standards.
1992-07-04 03:22:08 +00:00
|
|
|
|
memcpy (err_copy, tokstart, p - tokstart);
|
1991-09-19 10:31:00 +00:00
|
|
|
|
err_copy[p - tokstart] = 0;
|
|
|
|
|
error ("Invalid number \"%s\".", err_copy);
|
|
|
|
|
}
|
|
|
|
|
lexptr = p;
|
|
|
|
|
return toktype;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case '+':
|
|
|
|
|
case '-':
|
|
|
|
|
case '*':
|
|
|
|
|
case '/':
|
|
|
|
|
case '%':
|
|
|
|
|
case '|':
|
|
|
|
|
case '&':
|
|
|
|
|
case '^':
|
|
|
|
|
case '~':
|
|
|
|
|
case '!':
|
|
|
|
|
case '@':
|
|
|
|
|
case '<':
|
|
|
|
|
case '>':
|
|
|
|
|
case '[':
|
|
|
|
|
case ']':
|
|
|
|
|
case '?':
|
|
|
|
|
case ':':
|
|
|
|
|
case '=':
|
|
|
|
|
case '{':
|
|
|
|
|
case '}':
|
|
|
|
|
symbol:
|
|
|
|
|
lexptr++;
|
|
|
|
|
return c;
|
|
|
|
|
|
|
|
|
|
case '"':
|
1992-11-24 03:02:10 +00:00
|
|
|
|
|
|
|
|
|
/* Build the gdb internal form of the input string in tempbuf,
|
|
|
|
|
translating any standard C escape forms seen. Note that the
|
|
|
|
|
buffer is null byte terminated *only* for the convenience of
|
|
|
|
|
debugging gdb itself and printing the buffer contents when
|
|
|
|
|
the buffer contains no embedded nulls. Gdb does not depend
|
|
|
|
|
upon the buffer being null byte terminated, it uses the length
|
|
|
|
|
string instead. This allows gdb to handle C strings (as well
|
|
|
|
|
as strings in other languages) with embedded null bytes */
|
|
|
|
|
|
|
|
|
|
tokptr = ++tokstart;
|
|
|
|
|
tempbufindex = 0;
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
/* Grow the static temp buffer if necessary, including allocating
|
|
|
|
|
the first one on demand. */
|
|
|
|
|
if (tempbufindex + 1 >= tempbufsize)
|
1991-09-19 10:31:00 +00:00
|
|
|
|
{
|
1992-11-24 03:02:10 +00:00
|
|
|
|
tempbuf = (char *) realloc (tempbuf, tempbufsize += 64);
|
|
|
|
|
}
|
|
|
|
|
switch (*tokptr)
|
|
|
|
|
{
|
|
|
|
|
case '\0':
|
|
|
|
|
case '"':
|
|
|
|
|
/* Do nothing, loop will terminate. */
|
|
|
|
|
break;
|
|
|
|
|
case '\\':
|
|
|
|
|
tokptr++;
|
|
|
|
|
c = parse_escape (&tokptr);
|
|
|
|
|
if (c == -1)
|
1991-09-19 10:31:00 +00:00
|
|
|
|
{
|
1992-11-24 03:02:10 +00:00
|
|
|
|
continue;
|
1991-09-19 10:31:00 +00:00
|
|
|
|
}
|
1992-11-24 03:02:10 +00:00
|
|
|
|
tempbuf[tempbufindex++] = c;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
tempbuf[tempbufindex++] = *tokptr++;
|
|
|
|
|
break;
|
1991-09-19 10:31:00 +00:00
|
|
|
|
}
|
1992-11-24 03:02:10 +00:00
|
|
|
|
} while ((*tokptr != '"') && (*tokptr != '\0'));
|
|
|
|
|
if (*tokptr++ != '"')
|
|
|
|
|
{
|
|
|
|
|
error ("Unterminated string in expression.");
|
|
|
|
|
}
|
|
|
|
|
tempbuf[tempbufindex] = '\0'; /* See note above */
|
|
|
|
|
yylval.sval.ptr = tempbuf;
|
|
|
|
|
yylval.sval.length = tempbufindex;
|
|
|
|
|
lexptr = tokptr;
|
|
|
|
|
return (STRING);
|
1991-09-19 10:31:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!(c == '_' || c == '$'
|
|
|
|
|
|| (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
|
|
|
|
|
/* We must have come across a bad character (e.g. ';'). */
|
|
|
|
|
error ("Invalid character '%c' in expression.", c);
|
|
|
|
|
|
|
|
|
|
/* It's a name. See how long it is. */
|
|
|
|
|
namelen = 0;
|
|
|
|
|
for (c = tokstart[namelen];
|
|
|
|
|
(c == '_' || c == '$' || (c >= '0' && c <= '9')
|
1994-11-02 23:11:47 +00:00
|
|
|
|
|| (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');)
|
|
|
|
|
{
|
1997-03-22 10:50:18 +00:00
|
|
|
|
/* Template parameter lists are part of the name.
|
|
|
|
|
FIXME: This mishandles `print $a<4&&$a>3'. */
|
|
|
|
|
|
|
|
|
|
if (c == '<')
|
|
|
|
|
{
|
|
|
|
|
int i = namelen;
|
|
|
|
|
int nesting_level = 1;
|
|
|
|
|
while (tokstart[++i])
|
|
|
|
|
{
|
|
|
|
|
if (tokstart[i] == '<')
|
|
|
|
|
nesting_level++;
|
|
|
|
|
else if (tokstart[i] == '>')
|
|
|
|
|
{
|
|
|
|
|
if (--nesting_level == 0)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (tokstart[i] == '>')
|
|
|
|
|
namelen = i;
|
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
c = tokstart[++namelen];
|
|
|
|
|
}
|
1991-09-19 10:31:00 +00:00
|
|
|
|
|
|
|
|
|
/* The token "if" terminates the expression and is NOT
|
|
|
|
|
removed from the input stream. */
|
|
|
|
|
if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lexptr += namelen;
|
|
|
|
|
|
1992-06-09 06:09:33 +00:00
|
|
|
|
tryname:
|
1991-09-19 10:31:00 +00:00
|
|
|
|
|
|
|
|
|
/* Catch specific keywords. Should be done with a data structure. */
|
|
|
|
|
switch (namelen)
|
|
|
|
|
{
|
|
|
|
|
case 8:
|
* c-exp.y, m2-exp.y (yyreds, yytoks): Remap like other yy* names.
* c-exp.y, m2-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* c-exp.y (strncmp): Replace throughout with STREQN, missed
them during the previous replacements.
* printcmd.c (_initialize_printcmd): Update internal documentation
for "set" command to note that the assignment syntax is language
dependent.
**** start-sanitize-chill ****
* ch-exp.y (yyreds, yytoks): Remap like other yy* names.
* ch-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* ch-exp.y (GDB_REGNAME, GDB_LAST, GDB_VARIABLE, GDB_ASSIGNMENT,
single_assignment_action): New terminals and nonterminal for gdb
extensions to chill expression grammer.
* ch-exp.y (match_dollar_tokens): Lexer routine to match all
tokens that start with '$' (register names, convenience vars, etc).
* ch-exp.y (tokentab2): Add GDB_ASSIGNMENT.
* ch-exp.y (yylex): Call match_dollar_tokens.
**** end-sanitize-chill ****
1992-12-31 04:05:05 +00:00
|
|
|
|
if (STREQN (tokstart, "unsigned", 8))
|
1991-09-19 10:31:00 +00:00
|
|
|
|
return UNSIGNED;
|
1992-01-27 22:10:05 +00:00
|
|
|
|
if (current_language->la_language == language_cplus
|
* c-exp.y, m2-exp.y (yyreds, yytoks): Remap like other yy* names.
* c-exp.y, m2-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* c-exp.y (strncmp): Replace throughout with STREQN, missed
them during the previous replacements.
* printcmd.c (_initialize_printcmd): Update internal documentation
for "set" command to note that the assignment syntax is language
dependent.
**** start-sanitize-chill ****
* ch-exp.y (yyreds, yytoks): Remap like other yy* names.
* ch-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* ch-exp.y (GDB_REGNAME, GDB_LAST, GDB_VARIABLE, GDB_ASSIGNMENT,
single_assignment_action): New terminals and nonterminal for gdb
extensions to chill expression grammer.
* ch-exp.y (match_dollar_tokens): Lexer routine to match all
tokens that start with '$' (register names, convenience vars, etc).
* ch-exp.y (tokentab2): Add GDB_ASSIGNMENT.
* ch-exp.y (yylex): Call match_dollar_tokens.
**** end-sanitize-chill ****
1992-12-31 04:05:05 +00:00
|
|
|
|
&& STREQN (tokstart, "template", 8))
|
1991-11-15 23:16:29 +00:00
|
|
|
|
return TEMPLATE;
|
* c-exp.y, m2-exp.y (yyreds, yytoks): Remap like other yy* names.
* c-exp.y, m2-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* c-exp.y (strncmp): Replace throughout with STREQN, missed
them during the previous replacements.
* printcmd.c (_initialize_printcmd): Update internal documentation
for "set" command to note that the assignment syntax is language
dependent.
**** start-sanitize-chill ****
* ch-exp.y (yyreds, yytoks): Remap like other yy* names.
* ch-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* ch-exp.y (GDB_REGNAME, GDB_LAST, GDB_VARIABLE, GDB_ASSIGNMENT,
single_assignment_action): New terminals and nonterminal for gdb
extensions to chill expression grammer.
* ch-exp.y (match_dollar_tokens): Lexer routine to match all
tokens that start with '$' (register names, convenience vars, etc).
* ch-exp.y (tokentab2): Add GDB_ASSIGNMENT.
* ch-exp.y (yylex): Call match_dollar_tokens.
**** end-sanitize-chill ****
1992-12-31 04:05:05 +00:00
|
|
|
|
if (STREQN (tokstart, "volatile", 8))
|
1992-07-10 23:30:40 +00:00
|
|
|
|
return VOLATILE_KEYWORD;
|
1991-09-19 10:31:00 +00:00
|
|
|
|
break;
|
|
|
|
|
case 6:
|
* c-exp.y, m2-exp.y (yyreds, yytoks): Remap like other yy* names.
* c-exp.y, m2-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* c-exp.y (strncmp): Replace throughout with STREQN, missed
them during the previous replacements.
* printcmd.c (_initialize_printcmd): Update internal documentation
for "set" command to note that the assignment syntax is language
dependent.
**** start-sanitize-chill ****
* ch-exp.y (yyreds, yytoks): Remap like other yy* names.
* ch-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* ch-exp.y (GDB_REGNAME, GDB_LAST, GDB_VARIABLE, GDB_ASSIGNMENT,
single_assignment_action): New terminals and nonterminal for gdb
extensions to chill expression grammer.
* ch-exp.y (match_dollar_tokens): Lexer routine to match all
tokens that start with '$' (register names, convenience vars, etc).
* ch-exp.y (tokentab2): Add GDB_ASSIGNMENT.
* ch-exp.y (yylex): Call match_dollar_tokens.
**** end-sanitize-chill ****
1992-12-31 04:05:05 +00:00
|
|
|
|
if (STREQN (tokstart, "struct", 6))
|
1991-09-19 10:31:00 +00:00
|
|
|
|
return STRUCT;
|
* c-exp.y, m2-exp.y (yyreds, yytoks): Remap like other yy* names.
* c-exp.y, m2-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* c-exp.y (strncmp): Replace throughout with STREQN, missed
them during the previous replacements.
* printcmd.c (_initialize_printcmd): Update internal documentation
for "set" command to note that the assignment syntax is language
dependent.
**** start-sanitize-chill ****
* ch-exp.y (yyreds, yytoks): Remap like other yy* names.
* ch-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* ch-exp.y (GDB_REGNAME, GDB_LAST, GDB_VARIABLE, GDB_ASSIGNMENT,
single_assignment_action): New terminals and nonterminal for gdb
extensions to chill expression grammer.
* ch-exp.y (match_dollar_tokens): Lexer routine to match all
tokens that start with '$' (register names, convenience vars, etc).
* ch-exp.y (tokentab2): Add GDB_ASSIGNMENT.
* ch-exp.y (yylex): Call match_dollar_tokens.
**** end-sanitize-chill ****
1992-12-31 04:05:05 +00:00
|
|
|
|
if (STREQN (tokstart, "signed", 6))
|
1992-02-20 19:23:42 +00:00
|
|
|
|
return SIGNED_KEYWORD;
|
* c-exp.y, m2-exp.y (yyreds, yytoks): Remap like other yy* names.
* c-exp.y, m2-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* c-exp.y (strncmp): Replace throughout with STREQN, missed
them during the previous replacements.
* printcmd.c (_initialize_printcmd): Update internal documentation
for "set" command to note that the assignment syntax is language
dependent.
**** start-sanitize-chill ****
* ch-exp.y (yyreds, yytoks): Remap like other yy* names.
* ch-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* ch-exp.y (GDB_REGNAME, GDB_LAST, GDB_VARIABLE, GDB_ASSIGNMENT,
single_assignment_action): New terminals and nonterminal for gdb
extensions to chill expression grammer.
* ch-exp.y (match_dollar_tokens): Lexer routine to match all
tokens that start with '$' (register names, convenience vars, etc).
* ch-exp.y (tokentab2): Add GDB_ASSIGNMENT.
* ch-exp.y (yylex): Call match_dollar_tokens.
**** end-sanitize-chill ****
1992-12-31 04:05:05 +00:00
|
|
|
|
if (STREQN (tokstart, "sizeof", 6))
|
1991-09-19 10:31:00 +00:00
|
|
|
|
return SIZEOF;
|
* Add native support for long double data type.
* c-exp.y (%union): Change dval to typed_val_float. Use DOUBLEST
to store actual data. Change types of INT and FLOAT tokens to
typed_val_int and typed_val_float respectively. Create new token
DOUBLE_KEYWORD to specify the string `double'. Make production
for FLOAT use type determined by parse_number. Add production for
"long double" data type.
* (parse_number): Use sscanf to parse numbers as float, double or
long double depending upon the type of typed_val_float.dval. Also
allow user to specify `f' or `l' suffix to explicitly specify
float or long double constants. Change typed_val to
typed_val_int.
* (yylex): Change typed_val to typed_val_int. Also, scan for
"double" keyword.
* coffread.c (decode_base_type): Add support for T_LNGDBL basic
type.
* configure, configure.in: Add check for long double support in
the host compiler.
* defs.h: Define DOUBLEST appropriatly depending on whether
HAVE_LONG_DOUBLE (from autoconf) is defined. Also, fix prototypes
for functions that handle this type.
* expression.h (union exp_element): doubleconst is now type
DOUBLEST.
* m2-exp.y f-exp.y (%union): dval becomes type DOUBLEST.
* findvar.c (extract_floating): Make return value be DOUBLEST.
Also, add support for numbers with size of long double.
* (store_floating): Arg `val' is now type DOUBLEST. Handle all
floating types.
* parser-defs.h parse.c (write_exp_elt_dblcst): Arg expelt is now
DOUBLEST.
* valarith.c (value_binop): Change temp variables v1, v2 and v to
type DOUBLEST. Coerce type of result to long double if either op
was of that type.
* valops.c (value_arg_coerce): If argument type is bigger than
double, coerce to long double.
* (call_function_by_hand): If REG_STRUCT_HAS_ADDR is defined, and
arg type is float and > 8 bytes, then use pointer-to-object
calling conventions.
* valprint.c (print_floating): Arg doub is now type DOUBLEST.
Use appropriate format and precision to print out floating point
values.
* value.h: Fixup prototypes for value_as_double,
value_from_double, and unpack_double to use DOUBLEST.
* values.c (record_latest_value): Remove check for invalid
floats. Allow history to store them so that people may examine
them in hex if they want.
* (value_as_double unpack_double): Change return value to DOUBLEST.
* (value_from_double): Arg `num' is now DOUBLEST.
* (using_struct_return): Use RETURN_VALUE_ON_STACK macro (target
specific) to expect certain types to always be returned on the stack.
1996-02-17 00:07:35 +00:00
|
|
|
|
if (STREQN (tokstart, "double", 6))
|
|
|
|
|
return DOUBLE_KEYWORD;
|
1991-09-19 10:31:00 +00:00
|
|
|
|
break;
|
|
|
|
|
case 5:
|
1992-07-09 07:15:11 +00:00
|
|
|
|
if (current_language->la_language == language_cplus
|
* c-exp.y, m2-exp.y (yyreds, yytoks): Remap like other yy* names.
* c-exp.y, m2-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* c-exp.y (strncmp): Replace throughout with STREQN, missed
them during the previous replacements.
* printcmd.c (_initialize_printcmd): Update internal documentation
for "set" command to note that the assignment syntax is language
dependent.
**** start-sanitize-chill ****
* ch-exp.y (yyreds, yytoks): Remap like other yy* names.
* ch-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* ch-exp.y (GDB_REGNAME, GDB_LAST, GDB_VARIABLE, GDB_ASSIGNMENT,
single_assignment_action): New terminals and nonterminal for gdb
extensions to chill expression grammer.
* ch-exp.y (match_dollar_tokens): Lexer routine to match all
tokens that start with '$' (register names, convenience vars, etc).
* ch-exp.y (tokentab2): Add GDB_ASSIGNMENT.
* ch-exp.y (yylex): Call match_dollar_tokens.
**** end-sanitize-chill ****
1992-12-31 04:05:05 +00:00
|
|
|
|
&& STREQN (tokstart, "class", 5))
|
1992-07-09 04:40:39 +00:00
|
|
|
|
return CLASS;
|
* c-exp.y, m2-exp.y (yyreds, yytoks): Remap like other yy* names.
* c-exp.y, m2-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* c-exp.y (strncmp): Replace throughout with STREQN, missed
them during the previous replacements.
* printcmd.c (_initialize_printcmd): Update internal documentation
for "set" command to note that the assignment syntax is language
dependent.
**** start-sanitize-chill ****
* ch-exp.y (yyreds, yytoks): Remap like other yy* names.
* ch-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* ch-exp.y (GDB_REGNAME, GDB_LAST, GDB_VARIABLE, GDB_ASSIGNMENT,
single_assignment_action): New terminals and nonterminal for gdb
extensions to chill expression grammer.
* ch-exp.y (match_dollar_tokens): Lexer routine to match all
tokens that start with '$' (register names, convenience vars, etc).
* ch-exp.y (tokentab2): Add GDB_ASSIGNMENT.
* ch-exp.y (yylex): Call match_dollar_tokens.
**** end-sanitize-chill ****
1992-12-31 04:05:05 +00:00
|
|
|
|
if (STREQN (tokstart, "union", 5))
|
1991-09-19 10:31:00 +00:00
|
|
|
|
return UNION;
|
* c-exp.y, m2-exp.y (yyreds, yytoks): Remap like other yy* names.
* c-exp.y, m2-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* c-exp.y (strncmp): Replace throughout with STREQN, missed
them during the previous replacements.
* printcmd.c (_initialize_printcmd): Update internal documentation
for "set" command to note that the assignment syntax is language
dependent.
**** start-sanitize-chill ****
* ch-exp.y (yyreds, yytoks): Remap like other yy* names.
* ch-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* ch-exp.y (GDB_REGNAME, GDB_LAST, GDB_VARIABLE, GDB_ASSIGNMENT,
single_assignment_action): New terminals and nonterminal for gdb
extensions to chill expression grammer.
* ch-exp.y (match_dollar_tokens): Lexer routine to match all
tokens that start with '$' (register names, convenience vars, etc).
* ch-exp.y (tokentab2): Add GDB_ASSIGNMENT.
* ch-exp.y (yylex): Call match_dollar_tokens.
**** end-sanitize-chill ****
1992-12-31 04:05:05 +00:00
|
|
|
|
if (STREQN (tokstart, "short", 5))
|
1991-09-19 10:31:00 +00:00
|
|
|
|
return SHORT;
|
* c-exp.y, m2-exp.y (yyreds, yytoks): Remap like other yy* names.
* c-exp.y, m2-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* c-exp.y (strncmp): Replace throughout with STREQN, missed
them during the previous replacements.
* printcmd.c (_initialize_printcmd): Update internal documentation
for "set" command to note that the assignment syntax is language
dependent.
**** start-sanitize-chill ****
* ch-exp.y (yyreds, yytoks): Remap like other yy* names.
* ch-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* ch-exp.y (GDB_REGNAME, GDB_LAST, GDB_VARIABLE, GDB_ASSIGNMENT,
single_assignment_action): New terminals and nonterminal for gdb
extensions to chill expression grammer.
* ch-exp.y (match_dollar_tokens): Lexer routine to match all
tokens that start with '$' (register names, convenience vars, etc).
* ch-exp.y (tokentab2): Add GDB_ASSIGNMENT.
* ch-exp.y (yylex): Call match_dollar_tokens.
**** end-sanitize-chill ****
1992-12-31 04:05:05 +00:00
|
|
|
|
if (STREQN (tokstart, "const", 5))
|
1992-07-10 23:30:40 +00:00
|
|
|
|
return CONST_KEYWORD;
|
1991-09-19 10:31:00 +00:00
|
|
|
|
break;
|
|
|
|
|
case 4:
|
* c-exp.y, m2-exp.y (yyreds, yytoks): Remap like other yy* names.
* c-exp.y, m2-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* c-exp.y (strncmp): Replace throughout with STREQN, missed
them during the previous replacements.
* printcmd.c (_initialize_printcmd): Update internal documentation
for "set" command to note that the assignment syntax is language
dependent.
**** start-sanitize-chill ****
* ch-exp.y (yyreds, yytoks): Remap like other yy* names.
* ch-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* ch-exp.y (GDB_REGNAME, GDB_LAST, GDB_VARIABLE, GDB_ASSIGNMENT,
single_assignment_action): New terminals and nonterminal for gdb
extensions to chill expression grammer.
* ch-exp.y (match_dollar_tokens): Lexer routine to match all
tokens that start with '$' (register names, convenience vars, etc).
* ch-exp.y (tokentab2): Add GDB_ASSIGNMENT.
* ch-exp.y (yylex): Call match_dollar_tokens.
**** end-sanitize-chill ****
1992-12-31 04:05:05 +00:00
|
|
|
|
if (STREQN (tokstart, "enum", 4))
|
1991-09-19 10:31:00 +00:00
|
|
|
|
return ENUM;
|
* c-exp.y, m2-exp.y (yyreds, yytoks): Remap like other yy* names.
* c-exp.y, m2-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* c-exp.y (strncmp): Replace throughout with STREQN, missed
them during the previous replacements.
* printcmd.c (_initialize_printcmd): Update internal documentation
for "set" command to note that the assignment syntax is language
dependent.
**** start-sanitize-chill ****
* ch-exp.y (yyreds, yytoks): Remap like other yy* names.
* ch-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* ch-exp.y (GDB_REGNAME, GDB_LAST, GDB_VARIABLE, GDB_ASSIGNMENT,
single_assignment_action): New terminals and nonterminal for gdb
extensions to chill expression grammer.
* ch-exp.y (match_dollar_tokens): Lexer routine to match all
tokens that start with '$' (register names, convenience vars, etc).
* ch-exp.y (tokentab2): Add GDB_ASSIGNMENT.
* ch-exp.y (yylex): Call match_dollar_tokens.
**** end-sanitize-chill ****
1992-12-31 04:05:05 +00:00
|
|
|
|
if (STREQN (tokstart, "long", 4))
|
1991-09-19 10:31:00 +00:00
|
|
|
|
return LONG;
|
1992-01-27 22:10:05 +00:00
|
|
|
|
if (current_language->la_language == language_cplus
|
* c-exp.y, m2-exp.y (yyreds, yytoks): Remap like other yy* names.
* c-exp.y, m2-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* c-exp.y (strncmp): Replace throughout with STREQN, missed
them during the previous replacements.
* printcmd.c (_initialize_printcmd): Update internal documentation
for "set" command to note that the assignment syntax is language
dependent.
**** start-sanitize-chill ****
* ch-exp.y (yyreds, yytoks): Remap like other yy* names.
* ch-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* ch-exp.y (GDB_REGNAME, GDB_LAST, GDB_VARIABLE, GDB_ASSIGNMENT,
single_assignment_action): New terminals and nonterminal for gdb
extensions to chill expression grammer.
* ch-exp.y (match_dollar_tokens): Lexer routine to match all
tokens that start with '$' (register names, convenience vars, etc).
* ch-exp.y (tokentab2): Add GDB_ASSIGNMENT.
* ch-exp.y (yylex): Call match_dollar_tokens.
**** end-sanitize-chill ****
1992-12-31 04:05:05 +00:00
|
|
|
|
&& STREQN (tokstart, "this", 4))
|
1991-09-19 10:31:00 +00:00
|
|
|
|
{
|
|
|
|
|
static const char this_name[] =
|
|
|
|
|
{ CPLUS_MARKER, 't', 'h', 'i', 's', '\0' };
|
|
|
|
|
|
|
|
|
|
if (lookup_symbol (this_name, expression_context_block,
|
1993-07-30 21:20:56 +00:00
|
|
|
|
VAR_NAMESPACE, (int *) NULL,
|
|
|
|
|
(struct symtab **) NULL))
|
1991-09-19 10:31:00 +00:00
|
|
|
|
return THIS;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
* c-exp.y, m2-exp.y (yyreds, yytoks): Remap like other yy* names.
* c-exp.y, m2-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* c-exp.y (strncmp): Replace throughout with STREQN, missed
them during the previous replacements.
* printcmd.c (_initialize_printcmd): Update internal documentation
for "set" command to note that the assignment syntax is language
dependent.
**** start-sanitize-chill ****
* ch-exp.y (yyreds, yytoks): Remap like other yy* names.
* ch-exp.y (YYDEBUG): Define if MAINTENANCE_CMDS is defined
and YYDEBUG is not already defined.
* ch-exp.y (GDB_REGNAME, GDB_LAST, GDB_VARIABLE, GDB_ASSIGNMENT,
single_assignment_action): New terminals and nonterminal for gdb
extensions to chill expression grammer.
* ch-exp.y (match_dollar_tokens): Lexer routine to match all
tokens that start with '$' (register names, convenience vars, etc).
* ch-exp.y (tokentab2): Add GDB_ASSIGNMENT.
* ch-exp.y (yylex): Call match_dollar_tokens.
**** end-sanitize-chill ****
1992-12-31 04:05:05 +00:00
|
|
|
|
if (STREQN (tokstart, "int", 3))
|
1991-09-19 10:31:00 +00:00
|
|
|
|
return INT_KEYWORD;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
yylval.sval.ptr = tokstart;
|
|
|
|
|
yylval.sval.length = namelen;
|
|
|
|
|
|
|
|
|
|
if (*tokstart == '$')
|
|
|
|
|
{
|
1995-10-05 22:15:49 +00:00
|
|
|
|
write_dollar_variable (yylval.sval);
|
1991-09-19 10:31:00 +00:00
|
|
|
|
return VARIABLE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Use token-type BLOCKNAME for symbols that happen to be defined as
|
|
|
|
|
functions or symtabs. If this is not so, then ...
|
|
|
|
|
Use token-type TYPENAME for symbols that happen to be defined
|
|
|
|
|
currently as names of types; NAME for other symbols.
|
|
|
|
|
The caller is not constrained to care about the distinction. */
|
|
|
|
|
{
|
|
|
|
|
char *tmp = copy_name (yylval.sval);
|
|
|
|
|
struct symbol *sym;
|
|
|
|
|
int is_a_field_of_this = 0;
|
|
|
|
|
int hextype;
|
|
|
|
|
|
|
|
|
|
sym = lookup_symbol (tmp, expression_context_block,
|
1991-11-06 01:08:21 +00:00
|
|
|
|
VAR_NAMESPACE,
|
|
|
|
|
current_language->la_language == language_cplus
|
1993-07-30 21:20:56 +00:00
|
|
|
|
? &is_a_field_of_this : (int *) NULL,
|
|
|
|
|
(struct symtab **) NULL);
|
1993-11-13 00:06:49 +00:00
|
|
|
|
/* Call lookup_symtab, not lookup_partial_symtab, in case there are
|
|
|
|
|
no psymtabs (coff, xcoff, or some future change to blow away the
|
|
|
|
|
psymtabs once once symbols are read). */
|
1998-06-10 23:29:59 +00:00
|
|
|
|
if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
|
1991-09-19 10:31:00 +00:00
|
|
|
|
{
|
|
|
|
|
yylval.ssym.sym = sym;
|
|
|
|
|
yylval.ssym.is_a_field_of_this = is_a_field_of_this;
|
|
|
|
|
return BLOCKNAME;
|
|
|
|
|
}
|
1998-06-10 23:29:59 +00:00
|
|
|
|
else if (!sym)
|
|
|
|
|
{ /* See if it's a file name. */
|
|
|
|
|
struct symtab *symtab;
|
|
|
|
|
|
|
|
|
|
symtab = lookup_symtab (tmp);
|
|
|
|
|
|
|
|
|
|
if (symtab)
|
|
|
|
|
{
|
|
|
|
|
yylval.bval = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), STATIC_BLOCK);
|
|
|
|
|
return FILENAME;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1991-09-19 10:31:00 +00:00
|
|
|
|
if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
|
|
|
|
|
{
|
1994-01-29 00:59:50 +00:00
|
|
|
|
#if 1
|
|
|
|
|
/* Despite the following flaw, we need to keep this code enabled.
|
|
|
|
|
Because we can get called from check_stub_method, if we don't
|
|
|
|
|
handle nested types then it screws many operations in any
|
|
|
|
|
program which uses nested types. */
|
1993-12-27 17:27:45 +00:00
|
|
|
|
/* In "A::x", if x is a member function of A and there happens
|
|
|
|
|
to be a type (nested or not, since the stabs don't make that
|
|
|
|
|
distinction) named x, then this code incorrectly thinks we
|
|
|
|
|
are dealing with nested types rather than a member function. */
|
|
|
|
|
|
1993-07-30 19:50:29 +00:00
|
|
|
|
char *p;
|
|
|
|
|
char *namestart;
|
|
|
|
|
struct symbol *best_sym;
|
|
|
|
|
|
|
|
|
|
/* Look ahead to detect nested types. This probably should be
|
|
|
|
|
done in the grammar, but trying seemed to introduce a lot
|
|
|
|
|
of shift/reduce and reduce/reduce conflicts. It's possible
|
|
|
|
|
that it could be done, though. Or perhaps a non-grammar, but
|
|
|
|
|
less ad hoc, approach would work well. */
|
|
|
|
|
|
|
|
|
|
/* Since we do not currently have any way of distinguishing
|
|
|
|
|
a nested type from a non-nested one (the stabs don't tell
|
|
|
|
|
us whether a type is nested), we just ignore the
|
|
|
|
|
containing type. */
|
|
|
|
|
|
|
|
|
|
p = lexptr;
|
|
|
|
|
best_sym = sym;
|
|
|
|
|
while (1)
|
|
|
|
|
{
|
|
|
|
|
/* Skip whitespace. */
|
|
|
|
|
while (*p == ' ' || *p == '\t' || *p == '\n')
|
|
|
|
|
++p;
|
|
|
|
|
if (*p == ':' && p[1] == ':')
|
|
|
|
|
{
|
|
|
|
|
/* Skip the `::'. */
|
|
|
|
|
p += 2;
|
|
|
|
|
/* Skip whitespace. */
|
|
|
|
|
while (*p == ' ' || *p == '\t' || *p == '\n')
|
|
|
|
|
++p;
|
|
|
|
|
namestart = p;
|
|
|
|
|
while (*p == '_' || *p == '$' || (*p >= '0' && *p <= '9')
|
|
|
|
|
|| (*p >= 'a' && *p <= 'z')
|
|
|
|
|
|| (*p >= 'A' && *p <= 'Z'))
|
|
|
|
|
++p;
|
|
|
|
|
if (p != namestart)
|
|
|
|
|
{
|
|
|
|
|
struct symbol *cur_sym;
|
|
|
|
|
/* As big as the whole rest of the expression, which is
|
|
|
|
|
at least big enough. */
|
1994-11-02 23:11:47 +00:00
|
|
|
|
char *ncopy = alloca (strlen (tmp)+strlen (namestart)+3);
|
|
|
|
|
char *tmp1;
|
|
|
|
|
|
|
|
|
|
tmp1 = ncopy;
|
|
|
|
|
memcpy (tmp1, tmp, strlen (tmp));
|
|
|
|
|
tmp1 += strlen (tmp);
|
|
|
|
|
memcpy (tmp1, "::", 2);
|
|
|
|
|
tmp1 += 2;
|
|
|
|
|
memcpy (tmp1, namestart, p - namestart);
|
|
|
|
|
tmp1[p - namestart] = '\0';
|
|
|
|
|
cur_sym = lookup_symbol (ncopy, expression_context_block,
|
1993-07-30 21:20:56 +00:00
|
|
|
|
VAR_NAMESPACE, (int *) NULL,
|
|
|
|
|
(struct symtab **) NULL);
|
1993-07-30 19:50:29 +00:00
|
|
|
|
if (cur_sym)
|
|
|
|
|
{
|
|
|
|
|
if (SYMBOL_CLASS (cur_sym) == LOC_TYPEDEF)
|
|
|
|
|
{
|
|
|
|
|
best_sym = cur_sym;
|
|
|
|
|
lexptr = p;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
yylval.tsym.type = SYMBOL_TYPE (best_sym);
|
1993-12-27 17:27:45 +00:00
|
|
|
|
#else /* not 0 */
|
|
|
|
|
yylval.tsym.type = SYMBOL_TYPE (sym);
|
|
|
|
|
#endif /* not 0 */
|
1991-09-19 10:31:00 +00:00
|
|
|
|
return TYPENAME;
|
|
|
|
|
}
|
|
|
|
|
if ((yylval.tsym.type = lookup_primitive_typename (tmp)) != 0)
|
|
|
|
|
return TYPENAME;
|
|
|
|
|
|
|
|
|
|
/* Input names that aren't symbols but ARE valid hex numbers,
|
|
|
|
|
when the input radix permits them, can be names or numbers
|
|
|
|
|
depending on the parse. Note we support radixes > 16 here. */
|
|
|
|
|
if (!sym &&
|
|
|
|
|
((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) ||
|
|
|
|
|
(tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
|
|
|
|
|
{
|
|
|
|
|
YYSTYPE newlval; /* Its value is ignored. */
|
|
|
|
|
hextype = parse_number (tokstart, namelen, 0, &newlval);
|
|
|
|
|
if (hextype == INT)
|
|
|
|
|
{
|
|
|
|
|
yylval.ssym.sym = sym;
|
|
|
|
|
yylval.ssym.is_a_field_of_this = is_a_field_of_this;
|
|
|
|
|
return NAME_OR_INT;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Any other kind of symbol */
|
|
|
|
|
yylval.ssym.sym = sym;
|
|
|
|
|
yylval.ssym.is_a_field_of_this = is_a_field_of_this;
|
|
|
|
|
return NAME;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
yyerror (msg)
|
|
|
|
|
char *msg;
|
|
|
|
|
{
|
1994-05-12 03:21:48 +00:00
|
|
|
|
error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
|
1991-09-19 10:31:00 +00:00
|
|
|
|
}
|