/* YACC parser for C expressions, for GDB.
- Copyright 1986, 1989, 1990, 1991, 1993, 1994, 2002 Free Software
- Foundation, Inc.
+ Copyright (C) 1986, 1989, 1990, 1991, 1993, 1994, 2002, 2006, 2007
+ Free Software Foundation, Inc.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
/* Parse a C expression from text in a string, and return the result
as a struct expression pointer. That structure contains arithmetic
error ("`%s' is not defined as an aggregate type.",
TYPE_NAME (type));
- if (!STREQ (type_name_no_tag (type), $4.ptr))
+ if (!DEPRECATED_STREQ (type_name_no_tag (type), $4.ptr))
error ("invalid destructor `%s::~%s'",
type_name_no_tag (type), $4.ptr);
is a pointer to member type. Stroustrup loses again! */
type : ptype
- | typebase COLONCOLON '*'
- { $$ = lookup_member_type (builtin_type_int, $1); }
;
typebase /* Implements (approximately): (type-qualifier)* type-specifier. */
/* It's a float since it contains a point or an exponent. */
- if (sizeof (putithere->typed_val_float.dval) <= sizeof (float))
- sscanf (p, "%g", (float *)&putithere->typed_val_float.dval);
- else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double))
- sscanf (p, "%lg", (double *)&putithere->typed_val_float.dval);
- else
- {
-#ifdef PRINTF_HAS_LONG_DOUBLE
- sscanf (p, "%Lg", &putithere->typed_val_float.dval);
-#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;
- sscanf (p, "%lg", &temp);
- putithere->typed_val_float.dval = temp;
-#endif
- }
+ sscanf (p, DOUBLEST_SCAN_FORMAT "%c",
+ &putithere->typed_val_float.dval, &c);
/* See if it has `f' or `l' suffix (float or long double). */
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
+ (which always produces a zero result). Sometimes gdbarch_int_bit
+ or gdbarch_long_int 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. */
un = (unsigned LONGEST)n >> 2;
if (long_p == 0
- && (un >> (TARGET_INT_BIT - 2)) == 0)
+ && (un >> (gdbarch_int_bit (current_gdbarch) - 2)) == 0)
{
- high_bit = ((unsigned LONGEST)1) << (TARGET_INT_BIT-1);
+ high_bit = ((unsigned LONGEST)1) << (gdbarch_int_bit (current_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,
signed_type = builtin_type_int;
}
else if (long_p <= 1
- && (un >> (TARGET_LONG_BIT - 2)) == 0)
+ && (un >> (gdbarch_long_bit (current_gdbarch) - 2)) == 0)
{
- high_bit = ((unsigned LONGEST)1) << (TARGET_LONG_BIT-1);
+ high_bit = ((unsigned LONGEST)1) << (gdbarch_long_bit (current_gdbarch) - 1);
unsigned_type = builtin_type_unsigned_long;
signed_type = builtin_type_long;
}
else
{
high_bit = (((unsigned LONGEST)1)
- << (TARGET_LONG_LONG_BIT - 32 - 1)
+ << (gdbarch_long_long_bit (current_gdbarch) - 32 - 1)
<< 16
<< 16);
if (high_bit == 0)
tokstart = lexptr;
/* See if it is a special token of length 3. */
for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
- if (STREQN (tokstart, tokentab3[i].operator, 3))
+ if (DEPRECATED_STREQN (tokstart, tokentab3[i].operator, 3))
{
lexptr += 3;
yylval.opcode = tokentab3[i].opcode;
/* See if it is a special token of length 2. */
for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
- if (STREQN (tokstart, tokentab2[i].operator, 2))
+ if (DEPRECATED_STREQN (tokstart, tokentab2[i].operator, 2))
{
lexptr += 2;
yylval.opcode = tokentab2[i].opcode;
switch (namelen)
{
case 8:
- if (STREQN (tokstart, "unsigned", 8))
+ if (DEPRECATED_STREQN (tokstart, "unsigned", 8))
return UNSIGNED;
if (current_language->la_language == language_cplus
&& strncmp (tokstart, "template", 8) == 0)
return TEMPLATE;
- if (STREQN (tokstart, "volatile", 8))
+ if (DEPRECATED_STREQN (tokstart, "volatile", 8))
return VOLATILE_KEYWORD;
break;
case 6:
- if (STREQN (tokstart, "struct", 6))
+ if (DEPRECATED_STREQN (tokstart, "struct", 6))
return STRUCT;
- if (STREQN (tokstart, "signed", 6))
+ if (DEPRECATED_STREQN (tokstart, "signed", 6))
return SIGNED_KEYWORD;
- if (STREQN (tokstart, "sizeof", 6))
+ if (DEPRECATED_STREQN (tokstart, "sizeof", 6))
return SIZEOF;
- if (STREQN (tokstart, "double", 6))
+ if (DEPRECATED_STREQN (tokstart, "double", 6))
return DOUBLE_KEYWORD;
break;
case 5:
if ((current_language->la_language == language_cplus)
&& strncmp (tokstart, "class", 5) == 0)
return CLASS;
- if (STREQN (tokstart, "union", 5))
+ if (DEPRECATED_STREQN (tokstart, "union", 5))
return UNION;
- if (STREQN (tokstart, "short", 5))
+ if (DEPRECATED_STREQN (tokstart, "short", 5))
return SHORT;
- if (STREQN (tokstart, "const", 5))
+ if (DEPRECATED_STREQN (tokstart, "const", 5))
return CONST_KEYWORD;
break;
case 4:
- if (STREQN (tokstart, "enum", 4))
+ if (DEPRECATED_STREQN (tokstart, "enum", 4))
return ENUM;
- if (STREQN (tokstart, "long", 4))
+ if (DEPRECATED_STREQN (tokstart, "long", 4))
return LONG;
break;
case 3:
- if (STREQN (tokstart, "int", 3))
+ if (DEPRECATED_STREQN (tokstart, "int", 3))
return INT_KEYWORD;
break;
default:
#endif /* not 0 */
return TYPENAME;
}
- if ((yylval.tsym.type = lookup_primitive_typename (tmp)) != 0)
- return TYPENAME;
+ yylval.tsym.type
+ = language_lookup_primitive_type_by_name (current_language,
+ current_gdbarch, tmp);
+ if (yylval.tsym.type != NULL)
+ return TYPENAME;
/* See if it's an ObjC classname. */
if (!sym)