* parse.c (parse_exp_in_context): Initialize it.
* parser-def.h (parse_gdbarch, parse_language): New macros.
* ada-exp.y (parse_type): New macro.
Replace builtin_type_ macros by using parse_type.
Replace current_language by parse_language.
* ada-lex.l (processInt): Replace current_gdbarch by parse_gdbarch.
Replace builtin_type_ macros.
* c-exp.y (parse_type): New macro.
Replace builtin_type_ macros by using parse_type.
(parse_number): Replace current_gdbarch by parse_gdbarch.
(yylex): Replace current_language by parse_language.
* f-exp.y (parse_type, parse_f_type): New macros.
Replace builtin_type_ macros by using parse_{f_,}type.
(parse_number): Replace current_gdbarch by parse_gdbarch.
(yylex): Replace current_language by parse_language.
* jv-exp.y (parse_type): New macro.
(parse_number): Replace builtin_type_ macros by using parse_type.
* m2-exp.y (parse_type, parse_m2_type): New macros.
Replace builtin_type_ macros by using parse_{m2_,}type.
* objc-exp.y (parse_type): New macro.
Replace builtin_type_ macros by using parse_type.
(parse_number): Replace current_gdbarch by parse_gdbarch.
(yylex): Replace current_language by parse_language.
* p-exp.y (parse_type): New macro.
Replace builtin_type_ macros by using parse_type.
(parse_number): Replace current_gdbarch by parse_gdbarch.
(yylex): Replace current_language by parse_language.
+2008-09-11 Ulrich Weigand <uweigand@de.ibm.com>
+
+ * expression.h (struct expression): New member GDBARCH.
+ * parse.c (parse_exp_in_context): Initialize it.
+ * parser-def.h (parse_gdbarch, parse_language): New macros.
+
+ * ada-exp.y (parse_type): New macro.
+ Replace builtin_type_ macros by using parse_type.
+ Replace current_language by parse_language.
+ * ada-lex.l (processInt): Replace current_gdbarch by parse_gdbarch.
+ Replace builtin_type_ macros.
+
+ * c-exp.y (parse_type): New macro.
+ Replace builtin_type_ macros by using parse_type.
+ (parse_number): Replace current_gdbarch by parse_gdbarch.
+ (yylex): Replace current_language by parse_language.
+
+ * f-exp.y (parse_type, parse_f_type): New macros.
+ Replace builtin_type_ macros by using parse_{f_,}type.
+ (parse_number): Replace current_gdbarch by parse_gdbarch.
+ (yylex): Replace current_language by parse_language.
+
+ * jv-exp.y (parse_type): New macro.
+ (parse_number): Replace builtin_type_ macros by using parse_type.
+
+ * m2-exp.y (parse_type, parse_m2_type): New macros.
+ Replace builtin_type_ macros by using parse_{m2_,}type.
+
+ * objc-exp.y (parse_type): New macro.
+ Replace builtin_type_ macros by using parse_type.
+ (parse_number): Replace current_gdbarch by parse_gdbarch.
+ (yylex): Replace current_language by parse_language.
+
+ * p-exp.y (parse_type): New macro.
+ Replace builtin_type_ macros by using parse_type.
+ (parse_number): Replace current_gdbarch by parse_gdbarch.
+ (yylex): Replace current_language by parse_language.
+
2008-09-11 Ulrich Weigand <uweigand@de.ibm.com>
* parser-defs.h (write_exp_msymbol): Remove TEXT_SYMBOL_TYPE
#include "frame.h"
#include "block.h"
+#define parse_type builtin_type (parse_gdbarch)
+
/* 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. These are only the variables
type_prefix
| /* EMPTY */
{ write_exp_elt_opcode (OP_TYPE);
- write_exp_elt_type (builtin_type_void);
+ write_exp_elt_type (parse_type->builtin_void);
write_exp_elt_opcode (OP_TYPE); }
;
find_primitive_type (char *name)
{
struct type *type;
- type = language_lookup_primitive_type_by_name (current_language,
- current_gdbarch,
+ type = language_lookup_primitive_type_by_name (parse_language,
+ parse_gdbarch,
name);
if (type == NULL && strcmp ("system__address", name) == 0)
type = type_system_address ();
static struct type *
type_int (void)
{
- return builtin_type_int;
+ return parse_type->builtin_int;
}
static struct type *
type_long (void)
{
- return builtin_type_long;
+ return parse_type->builtin_long;
}
static struct type *
type_long_long (void)
{
- return builtin_type_long_long;
+ return parse_type->builtin_long_long;
}
static struct type *
type_float (void)
{
- return builtin_type_float;
+ return parse_type->builtin_float;
}
static struct type *
type_double (void)
{
- return builtin_type_double;
+ return parse_type->builtin_double;
}
static struct type *
type_long_double (void)
{
- return builtin_type_long_double;
+ return parse_type->builtin_long_double;
}
static struct type *
type_char (void)
{
- return language_string_char_type (current_language, current_gdbarch);
+ return language_string_char_type (parse_language, parse_gdbarch);
}
static struct type *
type_boolean (void)
{
- return builtin_type_bool;
+ return parse_type->builtin_bool;
}
static struct type *
type_system_address (void)
{
struct type *type
- = language_lookup_primitive_type_by_name (current_language,
- current_gdbarch,
+ = language_lookup_primitive_type_by_name (parse_language,
+ parse_gdbarch,
"system__address");
- return type != NULL ? type : lookup_pointer_type (builtin_type_void);
+ return type != NULL ? type : parse_type->builtin_data_ptr;
}
void
exp -= 1;
}
- if ((result >> (gdbarch_int_bit (current_gdbarch)-1)) == 0)
+ if ((result >> (gdbarch_int_bit (parse_gdbarch)-1)) == 0)
yylval.typed_val.type = type_int ();
- else if ((result >> (gdbarch_long_bit (current_gdbarch)-1)) == 0)
+ else if ((result >> (gdbarch_long_bit (parse_gdbarch)-1)) == 0)
yylval.typed_val.type = type_long ();
- else if (((result >> (gdbarch_long_bit (current_gdbarch)-1)) >> 1) == 0)
+ else if (((result >> (gdbarch_long_bit (parse_gdbarch)-1)) >> 1) == 0)
{
/* We have a number representable as an unsigned integer quantity.
For consistency with the C treatment, we will treat it as an
for the mess, but C doesn't officially guarantee that a simple
assignment does the trick (no, it doesn't; read the reference manual).
*/
- yylval.typed_val.type = builtin_type_unsigned_long;
+ yylval.typed_val.type
+ = builtin_type (parse_gdbarch)->builtin_unsigned_long;
if (result & LONGEST_SIGN)
yylval.typed_val.val =
(LONGEST) (result & ~LONGEST_SIGN)
sscanf (num0, "%" DOUBLEST_SCAN_FORMAT, &yylval.typed_val_float.dval);
yylval.typed_val_float.type = type_float ();
- if (sizeof(DOUBLEST) >= gdbarch_double_bit (current_gdbarch)
+ if (sizeof(DOUBLEST) >= gdbarch_double_bit (parse_gdbarch)
/ TARGET_CHAR_BIT)
yylval.typed_val_float.type = type_double ();
- if (sizeof(DOUBLEST) >= gdbarch_long_double_bit (current_gdbarch)
+ if (sizeof(DOUBLEST) >= gdbarch_long_double_bit (parse_gdbarch)
/ TARGET_CHAR_BIT)
yylval.typed_val_float.type = type_long_double ();
#include "cp-support.h"
#include "dfp.h"
+#define parse_type builtin_type (parse_gdbarch)
+
/* 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
exp : SIZEOF '(' type ')' %prec UNARY
{ write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type (current_gdbarch)->builtin_int);
+ write_exp_elt_type (parse_type->builtin_int);
CHECK_TYPEDEF ($3);
write_exp_elt_longcst ((LONGEST) TYPE_LENGTH ($3));
write_exp_elt_opcode (OP_LONG); }
while (count-- > 0)
{
write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type (current_gdbarch)->builtin_char);
+ write_exp_elt_type (parse_type->builtin_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 (current_gdbarch)->builtin_char);
+ write_exp_elt_type (parse_type->builtin_char);
write_exp_elt_longcst ((LONGEST)'\0');
write_exp_elt_opcode (OP_LONG);
write_exp_elt_opcode (OP_ARRAY);
/* C++. */
exp : TRUEKEYWORD
{ write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type (current_gdbarch)->builtin_bool);
+ write_exp_elt_type (parse_type->builtin_bool);
write_exp_elt_longcst ((LONGEST) 1);
write_exp_elt_opcode (OP_LONG); }
;
exp : FALSEKEYWORD
{ write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type (current_gdbarch)->builtin_bool);
+ write_exp_elt_type (parse_type->builtin_bool);
write_exp_elt_longcst ((LONGEST) 0);
write_exp_elt_opcode (OP_LONG); }
;
: TYPENAME
{ $$ = $1.type; }
| INT_KEYWORD
- { $$ = builtin_type (current_gdbarch)->builtin_int; }
+ { $$ = parse_type->builtin_int; }
| LONG
- { $$ = builtin_type (current_gdbarch)->builtin_long; }
+ { $$ = parse_type->builtin_long; }
| SHORT
- { $$ = builtin_type (current_gdbarch)->builtin_short; }
+ { $$ = parse_type->builtin_short; }
| LONG INT_KEYWORD
- { $$ = builtin_type (current_gdbarch)->builtin_long; }
+ { $$ = parse_type->builtin_long; }
| LONG SIGNED_KEYWORD INT_KEYWORD
- { $$ = builtin_type (current_gdbarch)->builtin_long; }
+ { $$ = parse_type->builtin_long; }
| LONG SIGNED_KEYWORD
- { $$ = builtin_type (current_gdbarch)->builtin_long; }
+ { $$ = parse_type->builtin_long; }
| SIGNED_KEYWORD LONG INT_KEYWORD
- { $$ = builtin_type (current_gdbarch)->builtin_long; }
+ { $$ = parse_type->builtin_long; }
| UNSIGNED LONG INT_KEYWORD
- { $$ = builtin_type (current_gdbarch)->builtin_unsigned_long; }
+ { $$ = parse_type->builtin_unsigned_long; }
| LONG UNSIGNED INT_KEYWORD
- { $$ = builtin_type (current_gdbarch)->builtin_unsigned_long; }
+ { $$ = parse_type->builtin_unsigned_long; }
| LONG UNSIGNED
- { $$ = builtin_type (current_gdbarch)->builtin_unsigned_long; }
+ { $$ = parse_type->builtin_unsigned_long; }
| LONG LONG
- { $$ = builtin_type (current_gdbarch)->builtin_long_long; }
+ { $$ = parse_type->builtin_long_long; }
| LONG LONG INT_KEYWORD
- { $$ = builtin_type (current_gdbarch)->builtin_long_long; }
+ { $$ = parse_type->builtin_long_long; }
| LONG LONG SIGNED_KEYWORD INT_KEYWORD
- { $$ = builtin_type (current_gdbarch)->builtin_long_long; }
+ { $$ = parse_type->builtin_long_long; }
| LONG LONG SIGNED_KEYWORD
- { $$ = builtin_type (current_gdbarch)->builtin_long_long; }
+ { $$ = parse_type->builtin_long_long; }
| SIGNED_KEYWORD LONG LONG
- { $$ = builtin_type (current_gdbarch)->builtin_long_long; }
+ { $$ = parse_type->builtin_long_long; }
| SIGNED_KEYWORD LONG LONG INT_KEYWORD
- { $$ = builtin_type (current_gdbarch)->builtin_long_long; }
+ { $$ = parse_type->builtin_long_long; }
| UNSIGNED LONG LONG
- { $$ = builtin_type (current_gdbarch)->builtin_unsigned_long_long; }
+ { $$ = parse_type->builtin_unsigned_long_long; }
| UNSIGNED LONG LONG INT_KEYWORD
- { $$ = builtin_type (current_gdbarch)->builtin_unsigned_long_long; }
+ { $$ = parse_type->builtin_unsigned_long_long; }
| LONG LONG UNSIGNED
- { $$ = builtin_type (current_gdbarch)->builtin_unsigned_long_long; }
+ { $$ = parse_type->builtin_unsigned_long_long; }
| LONG LONG UNSIGNED INT_KEYWORD
- { $$ = builtin_type (current_gdbarch)->builtin_unsigned_long_long; }
+ { $$ = parse_type->builtin_unsigned_long_long; }
| SHORT INT_KEYWORD
- { $$ = builtin_type (current_gdbarch)->builtin_short; }
+ { $$ = parse_type->builtin_short; }
| SHORT SIGNED_KEYWORD INT_KEYWORD
- { $$ = builtin_type (current_gdbarch)->builtin_short; }
+ { $$ = parse_type->builtin_short; }
| SHORT SIGNED_KEYWORD
- { $$ = builtin_type (current_gdbarch)->builtin_short; }
+ { $$ = parse_type->builtin_short; }
| UNSIGNED SHORT INT_KEYWORD
- { $$ = builtin_type (current_gdbarch)->builtin_unsigned_short; }
+ { $$ = parse_type->builtin_unsigned_short; }
| SHORT UNSIGNED
- { $$ = builtin_type (current_gdbarch)->builtin_unsigned_short; }
+ { $$ = parse_type->builtin_unsigned_short; }
| SHORT UNSIGNED INT_KEYWORD
- { $$ = builtin_type (current_gdbarch)->builtin_unsigned_short; }
+ { $$ = parse_type->builtin_unsigned_short; }
| DOUBLE_KEYWORD
- { $$ = builtin_type (current_gdbarch)->builtin_double; }
+ { $$ = parse_type->builtin_double; }
| LONG DOUBLE_KEYWORD
- { $$ = builtin_type (current_gdbarch)->builtin_long_double; }
+ { $$ = parse_type->builtin_long_double; }
| STRUCT name
{ $$ = lookup_struct (copy_name ($2),
expression_context_block); }
| UNSIGNED typename
{ $$ = lookup_unsigned_typename (TYPE_NAME($2.type)); }
| UNSIGNED
- { $$ = builtin_type (current_gdbarch)->builtin_unsigned_int; }
+ { $$ = parse_type->builtin_unsigned_int; }
| SIGNED_KEYWORD typename
{ $$ = lookup_signed_typename (TYPE_NAME($2.type)); }
| SIGNED_KEYWORD
- { $$ = builtin_type (current_gdbarch)->builtin_int; }
+ { $$ = parse_type->builtin_int; }
/* It appears that this rule for templates is never
reduced; template recognition happens by lookahead
in the token processing code in yylex. */
{
$$.stoken.ptr = "int";
$$.stoken.length = 3;
- $$.type = builtin_type (current_gdbarch)->builtin_int;
+ $$.type = parse_type->builtin_int;
}
| LONG
{
$$.stoken.ptr = "long";
$$.stoken.length = 4;
- $$.type = builtin_type (current_gdbarch)->builtin_long;
+ $$.type = parse_type->builtin_long;
}
| SHORT
{
$$.stoken.ptr = "short";
$$.stoken.length = 5;
- $$.type = builtin_type (current_gdbarch)->builtin_short;
+ $$.type = parse_type->builtin_short;
}
;
{
p[len - 2] = '\0';
putithere->typed_val_decfloat.type
- = builtin_type (current_gdbarch)->builtin_decfloat;
+ = parse_type->builtin_decfloat;
decimal_from_string (putithere->typed_val_decfloat.val, 4, p);
p[len - 2] = 'd';
return DECFLOAT;
{
p[len - 2] = '\0';
putithere->typed_val_decfloat.type
- = builtin_type (current_gdbarch)->builtin_decdouble;
+ = parse_type->builtin_decdouble;
decimal_from_string (putithere->typed_val_decfloat.val, 8, p);
p[len - 2] = 'd';
return DECFLOAT;
{
p[len - 2] = '\0';
putithere->typed_val_decfloat.type
- = builtin_type (current_gdbarch)->builtin_declong;
+ = parse_type->builtin_declong;
decimal_from_string (putithere->typed_val_decfloat.val, 16, p);
p[len - 2] = 'd';
return DECFLOAT;
if (num == 1)
putithere->typed_val_float.type =
- builtin_type (current_gdbarch)->builtin_double;
+ parse_type->builtin_double;
if (num == 2 )
{
double. */
if (!strcasecmp (s, "f"))
putithere->typed_val_float.type =
- builtin_type (current_gdbarch)->builtin_float;
+ parse_type->builtin_float;
else if (!strcasecmp (s, "l"))
putithere->typed_val_float.type =
- builtin_type (current_gdbarch)->builtin_long_double;
+ parse_type->builtin_long_double;
else
{
free (s);
un = (ULONGEST)n >> 2;
if (long_p == 0
- && (un >> (gdbarch_int_bit (current_gdbarch) - 2)) == 0)
+ && (un >> (gdbarch_int_bit (parse_gdbarch) - 2)) == 0)
{
- high_bit = ((ULONGEST)1) << (gdbarch_int_bit (current_gdbarch) - 1);
+ high_bit = ((ULONGEST)1) << (gdbarch_int_bit (parse_gdbarch) - 1);
/* A large decimal (not hex or octal) constant (between INT_MAX
and UINT_MAX) is a long or unsigned long, according to ANSI,
int. This probably should be fixed. GCC gives a warning on
such constants. */
- unsigned_type = builtin_type (current_gdbarch)->builtin_unsigned_int;
- signed_type = builtin_type (current_gdbarch)->builtin_int;
+ unsigned_type = parse_type->builtin_unsigned_int;
+ signed_type = parse_type->builtin_int;
}
else if (long_p <= 1
- && (un >> (gdbarch_long_bit (current_gdbarch) - 2)) == 0)
+ && (un >> (gdbarch_long_bit (parse_gdbarch) - 2)) == 0)
{
- high_bit = ((ULONGEST)1) << (gdbarch_long_bit (current_gdbarch) - 1);
- unsigned_type = builtin_type (current_gdbarch)->builtin_unsigned_long;
- signed_type = builtin_type (current_gdbarch)->builtin_long;
+ high_bit = ((ULONGEST)1) << (gdbarch_long_bit (parse_gdbarch) - 1);
+ unsigned_type = parse_type->builtin_unsigned_long;
+ signed_type = parse_type->builtin_long;
}
else
{
int shift;
if (sizeof (ULONGEST) * HOST_CHAR_BIT
- < gdbarch_long_long_bit (current_gdbarch))
+ < gdbarch_long_long_bit (parse_gdbarch))
/* A long long does not fit in a LONGEST. */
shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1);
else
- shift = (gdbarch_long_long_bit (current_gdbarch) - 1);
+ shift = (gdbarch_long_long_bit (parse_gdbarch) - 1);
high_bit = (ULONGEST) 1 << shift;
- unsigned_type = builtin_type (current_gdbarch)->builtin_unsigned_long_long;
- signed_type = builtin_type (current_gdbarch)->builtin_long_long;
+ unsigned_type = parse_type->builtin_unsigned_long_long;
+ signed_type = parse_type->builtin_long_long;
}
putithere->typed_val_int.val = n;
}
yylval.typed_val_int.val = c;
- yylval.typed_val_int.type = builtin_type (current_gdbarch)->builtin_char;
+ yylval.typed_val_int.type = parse_type->builtin_char;
c = *lexptr++;
if (c != '\'')
case 8:
if (strncmp (tokstart, "unsigned", 8) == 0)
return UNSIGNED;
- if (current_language->la_language == language_cplus
+ if (parse_language->la_language == language_cplus
&& strncmp (tokstart, "template", 8) == 0)
return TEMPLATE;
if (strncmp (tokstart, "volatile", 8) == 0)
return DOUBLE_KEYWORD;
break;
case 5:
- if (current_language->la_language == language_cplus)
+ if (parse_language->la_language == language_cplus)
{
if (strncmp (tokstart, "false", 5) == 0)
return FALSEKEYWORD;
return ENUM;
if (strncmp (tokstart, "long", 4) == 0)
return LONG;
- if (current_language->la_language == language_cplus)
+ if (parse_language->la_language == language_cplus)
{
if (strncmp (tokstart, "true", 4) == 0)
return TRUEKEYWORD;
sym = lookup_symbol (tmp, expression_context_block,
VAR_DOMAIN,
- current_language->la_language == language_cplus
+ parse_language->la_language == language_cplus
? &is_a_field_of_this : (int *) NULL);
/* Call lookup_symtab, not lookup_partial_symtab, in case there are
no psymtabs (coff, xcoff, or some future change to blow away the
return TYPENAME;
}
yylval.tsym.type
- = language_lookup_primitive_type_by_name (current_language,
- current_gdbarch, tmp);
+ = language_lookup_primitive_type_by_name (parse_language,
+ parse_gdbarch, tmp);
if (yylval.tsym.type != NULL)
return TYPENAME;
struct expression
{
const struct language_defn *language_defn; /* language it was entered in */
+ struct gdbarch *gdbarch; /* architecture it was parsed in */
int nelts;
union exp_element elts[1];
};
#include "block.h"
#include <ctype.h>
+#define parse_type builtin_type (parse_gdbarch)
+#define parse_f_type builtin_f_type (parse_gdbarch)
+
/* 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
exp : FLOAT
{ write_exp_elt_opcode (OP_DOUBLE);
- write_exp_elt_type (builtin_type_f_real_s8);
+ write_exp_elt_type (parse_f_type->builtin_real_s8);
write_exp_elt_dblcst ($1);
write_exp_elt_opcode (OP_DOUBLE); }
;
exp : SIZEOF '(' type ')' %prec UNARY
{ write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type_f_integer);
+ write_exp_elt_type (parse_f_type->builtin_integer);
CHECK_TYPEDEF ($3);
write_exp_elt_longcst ((LONGEST) TYPE_LENGTH ($3));
write_exp_elt_opcode (OP_LONG); }
{
range_type =
create_range_type ((struct type *) NULL,
- builtin_type_f_integer, 0,
- array_size - 1);
+ parse_f_type->builtin_integer,
+ 0, array_size - 1);
follow_type =
create_array_type ((struct type *) NULL,
follow_type, range_type);
: TYPENAME
{ $$ = $1.type; }
| INT_KEYWORD
- { $$ = builtin_type_f_integer; }
+ { $$ = parse_f_type->builtin_integer; }
| INT_S2_KEYWORD
- { $$ = builtin_type_f_integer_s2; }
+ { $$ = parse_f_type->builtin_integer_s2; }
| CHARACTER
- { $$ = builtin_type_f_character; }
+ { $$ = parse_f_type->builtin_character; }
| LOGICAL_KEYWORD
- { $$ = builtin_type_f_logical;}
+ { $$ = parse_f_type->builtin_logical; }
| LOGICAL_S2_KEYWORD
- { $$ = builtin_type_f_logical_s2;}
+ { $$ = parse_f_type->builtin_logical_s2; }
| LOGICAL_S1_KEYWORD
- { $$ = builtin_type_f_logical_s1;}
+ { $$ = parse_f_type->builtin_logical_s1; }
| REAL_KEYWORD
- { $$ = builtin_type_f_real;}
+ { $$ = parse_f_type->builtin_real; }
| REAL_S8_KEYWORD
- { $$ = builtin_type_f_real_s8;}
+ { $$ = parse_f_type->builtin_real_s8; }
| REAL_S16_KEYWORD
- { $$ = builtin_type_f_real_s16;}
+ { $$ = parse_f_type->builtin_real_s16; }
| COMPLEX_S8_KEYWORD
- { $$ = builtin_type_f_complex_s8;}
+ { $$ = parse_f_type->builtin_complex_s8; }
| COMPLEX_S16_KEYWORD
- { $$ = builtin_type_f_complex_s16;}
+ { $$ = parse_f_type->builtin_complex_s16; }
| COMPLEX_S32_KEYWORD
- { $$ = builtin_type_f_complex_s32;}
+ { $$ = parse_f_type->builtin_complex_s32; }
;
nonempty_typelist
target int size is different to the target long size.
In the expression below, we could have tested
- (n >> gdbarch_int_bit (current_gdbarch))
+ (n >> gdbarch_int_bit (parse_gdbarch))
to see if it was zero,
but too many compilers warn about that, when ints and longs
are the same size. So we shift it twice, with fewer bits
each time, for the same result. */
- if ((gdbarch_int_bit (current_gdbarch) != gdbarch_long_bit (current_gdbarch)
+ if ((gdbarch_int_bit (parse_gdbarch) != gdbarch_long_bit (parse_gdbarch)
&& ((n >> 2)
- >> (gdbarch_int_bit (current_gdbarch)-2))) /* Avoid shift warning */
+ >> (gdbarch_int_bit (parse_gdbarch)-2))) /* Avoid shift warning */
|| long_p)
{
- high_bit = ((ULONGEST)1) << (gdbarch_long_bit (current_gdbarch)-1);
- unsigned_type = builtin_type_unsigned_long;
- signed_type = builtin_type_long;
+ high_bit = ((ULONGEST)1) << (gdbarch_long_bit (parse_gdbarch)-1);
+ unsigned_type = parse_type->builtin_unsigned_long;
+ signed_type = parse_type->builtin_long;
}
else
{
- high_bit = ((ULONGEST)1) << (gdbarch_int_bit (current_gdbarch)-1);
- unsigned_type = builtin_type_unsigned_int;
- signed_type = builtin_type_int;
+ high_bit = ((ULONGEST)1) << (gdbarch_int_bit (parse_gdbarch)-1);
+ unsigned_type = parse_type->builtin_unsigned_int;
+ signed_type = parse_type->builtin_int;
}
putithere->typed_val.val = n;
sym = lookup_symbol (tmp, expression_context_block,
VAR_DOMAIN,
- current_language->la_language == language_cplus
+ parse_language->la_language == language_cplus
? &is_a_field_of_this : NULL);
if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
{
return TYPENAME;
}
yylval.tsym.type
- = language_lookup_primitive_type_by_name (current_language,
- current_gdbarch, tmp);
+ = language_lookup_primitive_type_by_name (parse_language,
+ parse_gdbarch, tmp);
if (yylval.tsym.type != NULL)
return TYPENAME;
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
#include "block.h"
+#define parse_type builtin_type (parse_gdbarch)
+
/* 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
c = tolower (p[len - 1]);
if (c == 'f' || c == 'F')
- putithere->typed_val_float.type = builtin_type_float;
+ putithere->typed_val_float.type = parse_type->builtin_float;
else if (isdigit (c) || c == '.' || c == 'd' || c == 'D')
- putithere->typed_val_float.type = builtin_type_double;
+ putithere->typed_val_float.type = parse_type->builtin_double;
else
return ERROR;
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
#include "block.h"
+#define parse_type builtin_type (parse_gdbarch)
+#define parse_m2_type builtin_m2_type (parse_gdbarch)
+
/* 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
exp : INT
{ write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type_m2_int);
+ write_exp_elt_type (parse_m2_type->builtin_int);
write_exp_elt_longcst ((LONGEST) $1);
write_exp_elt_opcode (OP_LONG); }
;
exp : UINT
{
write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type_m2_card);
+ write_exp_elt_type (parse_m2_type->builtin_card);
write_exp_elt_longcst ((LONGEST) $1);
write_exp_elt_opcode (OP_LONG);
}
exp : CHAR
{ write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type_m2_char);
+ write_exp_elt_type (parse_m2_type->builtin_char);
write_exp_elt_longcst ((LONGEST) $1);
write_exp_elt_opcode (OP_LONG); }
;
exp : FLOAT
{ write_exp_elt_opcode (OP_DOUBLE);
- write_exp_elt_type (builtin_type_m2_real);
+ write_exp_elt_type (parse_m2_type->builtin_real);
write_exp_elt_dblcst ($1);
write_exp_elt_opcode (OP_DOUBLE); }
;
exp : SIZE '(' type ')' %prec UNARY
{ write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type_int);
+ write_exp_elt_type (parse_type->builtin_int);
write_exp_elt_longcst ((LONGEST) TYPE_LENGTH ($3));
write_exp_elt_opcode (OP_LONG); }
;
overflow(a,b)
long a,b;
{
- return (MAX_OF_TYPE(builtin_type_m2_int) - b) < a;
+ return (MAX_OF_TYPE(parse_m2_type->builtin_int) - b) < a;
}
int
uoverflow(a,b)
unsigned long a,b;
{
- return (MAX_OF_TYPE(builtin_type_m2_card) - b) < a;
+ return (MAX_OF_TYPE(parse_m2_type->builtin_card) - b) < a;
}
#endif /* FIXME */
#include "completer.h" /* For skip_quoted(). */
#include "block.h"
+#define parse_type builtin_type (parse_gdbarch)
+
/* 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
error ("%s is not an ObjC Class",
copy_name ($2.stoken));
write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type_int);
+ write_exp_elt_type (parse_type->builtin_int);
write_exp_elt_longcst ((LONGEST) class);
write_exp_elt_opcode (OP_LONG);
start_msglist();
exp : '[' CLASSNAME
{
write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type_int);
+ write_exp_elt_type (parse_type->builtin_int);
write_exp_elt_longcst ((LONGEST) $2.class);
write_exp_elt_opcode (OP_LONG);
start_msglist();
exp : SIZEOF '(' type ')' %prec UNARY
{ write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type_int);
+ write_exp_elt_type (parse_type->builtin_int);
CHECK_TYPEDEF ($3);
write_exp_elt_longcst ((LONGEST) TYPE_LENGTH ($3));
write_exp_elt_opcode (OP_LONG); }
while (count-- > 0)
{
write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type_char);
+ write_exp_elt_type (parse_type->builtin_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_type (parse_type->builtin_char);
write_exp_elt_longcst ((LONGEST)'\0');
write_exp_elt_opcode (OP_LONG);
write_exp_elt_opcode (OP_ARRAY);
$$ = $1.type;
}
| INT_KEYWORD
- { $$ = builtin_type_int; }
+ { $$ = parse_type->builtin_int; }
| LONG
- { $$ = builtin_type_long; }
+ { $$ = parse_type->builtin_long; }
| SHORT
- { $$ = builtin_type_short; }
+ { $$ = parse_type->builtin_short; }
| LONG INT_KEYWORD
- { $$ = builtin_type_long; }
+ { $$ = parse_type->builtin_long; }
| UNSIGNED LONG INT_KEYWORD
- { $$ = builtin_type_unsigned_long; }
+ { $$ = parse_type->builtin_unsigned_long; }
| LONG LONG
- { $$ = builtin_type_long_long; }
+ { $$ = parse_type->builtin_long_long; }
| LONG LONG INT_KEYWORD
- { $$ = builtin_type_long_long; }
+ { $$ = parse_type->builtin_long_long; }
| UNSIGNED LONG LONG
- { $$ = builtin_type_unsigned_long_long; }
+ { $$ = parse_type->builtin_unsigned_long_long; }
| UNSIGNED LONG LONG INT_KEYWORD
- { $$ = builtin_type_unsigned_long_long; }
+ { $$ = parse_type->builtin_unsigned_long_long; }
| SHORT INT_KEYWORD
- { $$ = builtin_type_short; }
+ { $$ = parse_type->builtin_short; }
| UNSIGNED SHORT INT_KEYWORD
- { $$ = builtin_type_unsigned_short; }
+ { $$ = parse_type->builtin_unsigned_short; }
| DOUBLE_KEYWORD
- { $$ = builtin_type_double; }
+ { $$ = parse_type->builtin_double; }
| LONG DOUBLE_KEYWORD
- { $$ = builtin_type_long_double; }
+ { $$ = parse_type->builtin_long_double; }
| STRUCT name
{ $$ = lookup_struct (copy_name ($2),
expression_context_block); }
| UNSIGNED typename
{ $$ = lookup_unsigned_typename (TYPE_NAME($2.type)); }
| UNSIGNED
- { $$ = builtin_type_unsigned_int; }
+ { $$ = parse_type->builtin_unsigned_int; }
| SIGNED_KEYWORD typename
{ $$ = lookup_signed_typename (TYPE_NAME($2.type)); }
| SIGNED_KEYWORD
- { $$ = builtin_type_int; }
+ { $$ = parse_type->builtin_int; }
| TEMPLATE name '<' type '>'
{ $$ = lookup_template_type(copy_name($2), $4,
expression_context_block);
{
$$.stoken.ptr = "int";
$$.stoken.length = 3;
- $$.type = builtin_type_int;
+ $$.type = parse_type->builtin_int;
}
| LONG
{
$$.stoken.ptr = "long";
$$.stoken.length = 4;
- $$.type = builtin_type_long;
+ $$.type = parse_type->builtin_long;
}
| SHORT
{
$$.stoken.ptr = "short";
$$.stoken.length = 5;
- $$.type = builtin_type_short;
+ $$.type = parse_type->builtin_short;
}
;
c = tolower (p[len - 1]);
if (c == 'f')
- putithere->typed_val_float.type = builtin_type_float;
+ putithere->typed_val_float.type = parse_type->builtin_float;
else if (c == 'l')
- putithere->typed_val_float.type = builtin_type_long_double;
+ putithere->typed_val_float.type = parse_type->builtin_long_double;
else if (isdigit (c) || c == '.')
- putithere->typed_val_float.type = builtin_type_double;
+ putithere->typed_val_float.type = parse_type->builtin_double;
else
return ERROR;
un = (unsigned LONGEST)n >> 2;
if (long_p == 0
- && (un >> (gdbarch_int_bit (current_gdbarch) - 2)) == 0)
+ && (un >> (gdbarch_int_bit (parse_gdbarch) - 2)) == 0)
{
- high_bit = ((unsigned LONGEST)1) << (gdbarch_int_bit (current_gdbarch) - 1);
+ high_bit = ((unsigned LONGEST)1) << (gdbarch_int_bit (parse_gdbarch) - 1);
/* A large decimal (not hex or octal) constant (between INT_MAX
and UINT_MAX) is a long or unsigned long, according to ANSI,
int. This probably should be fixed. GCC gives a warning on
such constants. */
- unsigned_type = builtin_type_unsigned_int;
- signed_type = builtin_type_int;
+ unsigned_type = parse_type->builtin_unsigned_int;
+ signed_type = parse_type->builtin_int;
}
else if (long_p <= 1
- && (un >> (gdbarch_long_bit (current_gdbarch) - 2)) == 0)
+ && (un >> (gdbarch_long_bit (parse_gdbarch) - 2)) == 0)
{
- high_bit = ((unsigned LONGEST)1) << (gdbarch_long_bit (current_gdbarch) - 1);
- unsigned_type = builtin_type_unsigned_long;
- signed_type = builtin_type_long;
+ high_bit = ((unsigned LONGEST)1) << (gdbarch_long_bit (parse_gdbarch) - 1);
+ unsigned_type = parse_type->builtin_unsigned_long;
+ signed_type = parse_type->builtin_long;
}
else
{
high_bit = (((unsigned LONGEST)1)
- << (gdbarch_long_long_bit (current_gdbarch) - 32 - 1)
+ << (gdbarch_long_long_bit (parse_gdbarch) - 32 - 1)
<< 16
<< 16);
if (high_bit == 0)
/* A long long does not fit in a LONGEST. */
high_bit =
(unsigned LONGEST)1 << (sizeof (LONGEST) * HOST_CHAR_BIT - 1);
- unsigned_type = builtin_type_unsigned_long_long;
- signed_type = builtin_type_long_long;
+ unsigned_type = parse_type->builtin_unsigned_long_long;
+ signed_type = parse_type->builtin_long_long;
}
putithere->typed_val_int.val = n;
error ("Empty character constant.");
yylval.typed_val_int.val = c;
- yylval.typed_val_int.type = builtin_type_char;
+ yylval.typed_val_int.type = parse_type->builtin_char;
c = *lexptr++;
if (c != '\'')
case 8:
if (strncmp (tokstart, "unsigned", 8) == 0)
return UNSIGNED;
- if (current_language->la_language == language_cplus
+ if (parse_language->la_language == language_cplus
&& strncmp (tokstart, "template", 8) == 0)
return TEMPLATE;
if (strncmp (tokstart, "volatile", 8) == 0)
return DOUBLE_KEYWORD;
break;
case 5:
- if ((current_language->la_language == language_cplus)
+ if ((parse_language->la_language == language_cplus)
&& strncmp (tokstart, "class", 5) == 0)
return CLASS;
if (strncmp (tokstart, "union", 5) == 0)
int is_a_field_of_this = 0, *need_this;
int hextype;
- if (current_language->la_language == language_cplus ||
- current_language->la_language == language_objc)
+ if (parse_language->la_language == language_cplus ||
+ parse_language->la_language == language_objc)
need_this = &is_a_field_of_this;
else
need_this = (int *) NULL;
return TYPENAME;
}
yylval.tsym.type
- = language_lookup_primitive_type_by_name (current_language,
- current_gdbarch, tmp);
+ = language_lookup_primitive_type_by_name (parse_language,
+ parse_gdbarch, tmp);
if (yylval.tsym.type != NULL)
return TYPENAME;
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
#include "block.h"
+#define parse_type builtin_type (parse_gdbarch)
+
/* 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
&& is_integral_type (current_type))
{
write_exp_elt_opcode (UNOP_CAST);
- write_exp_elt_type (builtin_type_long_double);
- current_type = builtin_type_long_double;
+ write_exp_elt_type (parse_type->builtin_long_double);
+ current_type = parse_type->builtin_long_double;
write_exp_elt_opcode (UNOP_CAST);
leftdiv_is_integer = 0;
}
exp : exp '=' exp
{ write_exp_elt_opcode (BINOP_EQUAL);
- current_type = builtin_type_bool;
+ current_type = parse_type->builtin_bool;
}
;
exp : exp NOTEQUAL exp
{ write_exp_elt_opcode (BINOP_NOTEQUAL);
- current_type = builtin_type_bool;
+ current_type = parse_type->builtin_bool;
}
;
exp : exp LEQ exp
{ write_exp_elt_opcode (BINOP_LEQ);
- current_type = builtin_type_bool;
+ current_type = parse_type->builtin_bool;
}
;
exp : exp GEQ exp
{ write_exp_elt_opcode (BINOP_GEQ);
- current_type = builtin_type_bool;
+ current_type = parse_type->builtin_bool;
}
;
exp : exp '<' exp
{ write_exp_elt_opcode (BINOP_LESS);
- current_type = builtin_type_bool;
+ current_type = parse_type->builtin_bool;
}
;
exp : exp '>' exp
{ write_exp_elt_opcode (BINOP_GTR);
- current_type = builtin_type_bool;
+ current_type = parse_type->builtin_bool;
}
;
exp : TRUEKEYWORD
{ write_exp_elt_opcode (OP_BOOL);
write_exp_elt_longcst ((LONGEST) $1);
- current_type = builtin_type_bool;
+ current_type = parse_type->builtin_bool;
write_exp_elt_opcode (OP_BOOL); }
;
exp : FALSEKEYWORD
{ write_exp_elt_opcode (OP_BOOL);
write_exp_elt_longcst ((LONGEST) $1);
- current_type = builtin_type_bool;
+ current_type = parse_type->builtin_bool;
write_exp_elt_opcode (OP_BOOL); }
;
exp : SIZEOF '(' type ')' %prec UNARY
{ write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type_int);
+ write_exp_elt_type (parse_type->builtin_int);
CHECK_TYPEDEF ($3);
write_exp_elt_longcst ((LONGEST) TYPE_LENGTH ($3));
write_exp_elt_opcode (OP_LONG); }
while (count-- > 0)
{
write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type_char);
+ write_exp_elt_type (parse_type->builtin_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_type (parse_type->builtin_char);
write_exp_elt_longcst ((LONGEST)'\0');
write_exp_elt_opcode (OP_LONG);
write_exp_elt_opcode (OP_ARRAY);
c = tolower (p[len - 1]);
if (c == 'f')
- putithere->typed_val_float.type = builtin_type_float;
+ putithere->typed_val_float.type = parse_type->builtin_float;
else if (c == 'l')
- putithere->typed_val_float.type = builtin_type_long_double;
+ putithere->typed_val_float.type = parse_type->builtin_long_double;
else if (isdigit (c) || c == '.')
- putithere->typed_val_float.type = builtin_type_double;
+ putithere->typed_val_float.type = parse_type->builtin_double;
else
return ERROR;
un = (ULONGEST)n >> 2;
if (long_p == 0
- && (un >> (gdbarch_int_bit (current_gdbarch) - 2)) == 0)
+ && (un >> (gdbarch_int_bit (parse_gdbarch) - 2)) == 0)
{
- high_bit = ((ULONGEST)1) << (gdbarch_int_bit (current_gdbarch) - 1);
+ high_bit = ((ULONGEST)1) << (gdbarch_int_bit (parse_gdbarch) - 1);
/* A large decimal (not hex or octal) constant (between INT_MAX
and UINT_MAX) is a long or unsigned long, according to ANSI,
int. This probably should be fixed. GCC gives a warning on
such constants. */
- unsigned_type = builtin_type_unsigned_int;
- signed_type = builtin_type_int;
+ unsigned_type = parse_type->builtin_unsigned_int;
+ signed_type = parse_type->builtin_int;
}
else if (long_p <= 1
- && (un >> (gdbarch_long_bit (current_gdbarch) - 2)) == 0)
+ && (un >> (gdbarch_long_bit (parse_gdbarch) - 2)) == 0)
{
- high_bit = ((ULONGEST)1) << (gdbarch_long_bit (current_gdbarch) - 1);
- unsigned_type = builtin_type_unsigned_long;
- signed_type = builtin_type_long;
+ high_bit = ((ULONGEST)1) << (gdbarch_long_bit (parse_gdbarch) - 1);
+ unsigned_type = parse_type->builtin_unsigned_long;
+ signed_type = parse_type->builtin_long;
}
else
{
int shift;
if (sizeof (ULONGEST) * HOST_CHAR_BIT
- < gdbarch_long_long_bit (current_gdbarch))
+ < gdbarch_long_long_bit (parse_gdbarch))
/* A long long does not fit in a LONGEST. */
shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1);
else
- shift = (gdbarch_long_long_bit (current_gdbarch) - 1);
+ shift = (gdbarch_long_long_bit (parse_gdbarch) - 1);
high_bit = (ULONGEST) 1 << shift;
- unsigned_type = builtin_type_unsigned_long_long;
- signed_type = builtin_type_long_long;
+ unsigned_type = parse_type->builtin_unsigned_long_long;
+ signed_type = parse_type->builtin_long_long;
}
putithere->typed_val_int.val = n;
error ("Empty character constant.");
yylval.typed_val_int.val = c;
- yylval.typed_val_int.type = builtin_type_char;
+ yylval.typed_val_int.type = parse_type->builtin_char;
c = *lexptr++;
if (c != '\'')
return TYPENAME;
}
yylval.tsym.type
- = language_lookup_primitive_type_by_name (current_language,
- current_gdbarch, tmp);
+ = language_lookup_primitive_type_by_name (parse_language,
+ parse_gdbarch, tmp);
if (yylval.tsym.type != NULL)
{
free (uptokstart);
expout = (struct expression *)
xmalloc (sizeof (struct expression) + EXP_ELEM_TO_BYTES (expout_size));
expout->language_defn = current_language;
+ expout->gdbarch = current_gdbarch;
TRY_CATCH (except, RETURN_MASK_ALL)
{
extern int expout_size;
extern int expout_ptr;
+#define parse_gdbarch (expout->gdbarch)
+#define parse_language (expout->language_defn)
+
/* If this is nonzero, this block is used as the lexical context
for symbol names. */