+Fri Jul 10 13:58:34 1992 Per Bothner (bothner@rtl.cygnus.com)
+
+ * gdbtypes.c, gdbtypes.h: New function lookup_signed_typename.
+ * c-exp.y: Call lookup_signed_typename() after seeing
+ "signed". This handles "signed char" correctly.
+ * c-exp.y: Recognize (but ignore) 'const' and 'volatile'
+ keywords before a type specifier.
+
Fri Jul 10 10:19:52 1992 Fred Fish (fnf@cygnus.com)
* command.c (lookup_cmd_1): Clarify descriptive comments.
/* Special type cases, put in to allow the parser to distinguish different
legal basetypes. */
-%token SIGNED_KEYWORD LONG SHORT INT_KEYWORD
+%token SIGNED_KEYWORD LONG SHORT INT_KEYWORD CONST_KEYWORD VOLATILE_KEYWORD
%token <lval> LAST REGNAME
{ $$ = lookup_member_type
(lookup_function_type ($1), $3);
free ((PTR)$8); }
+ /* "const" and "volatile" are curently ignored. */
+ | CONST_KEYWORD type { $$ = $2; }
+ | VOLATILE_KEYWORD type { $$ = $2; }
;
typebase
| UNSIGNED
{ $$ = builtin_type_unsigned_int; }
| SIGNED_KEYWORD typename
- { $$ = $2.type; }
+ { $$ = lookup_signed_typename (TYPE_NAME($2.type)); }
| SIGNED_KEYWORD
{ $$ = builtin_type_int; }
| TEMPLATE name '<' type '>'
if (current_language->la_language == language_cplus
&& !strncmp (tokstart, "template", 8))
return TEMPLATE;
+ if (!strncmp (tokstart, "volatile", 8))
+ return VOLATILE_KEYWORD;
break;
case 6:
if (!strncmp (tokstart, "struct", 6))
return UNION;
if (!strncmp (tokstart, "short", 5))
return SHORT;
+ if (!strncmp (tokstart, "const", 5))
+ return CONST_KEYWORD;
break;
case 4:
if (!strncmp (tokstart, "enum", 4))
return (lookup_typename (uns, (struct block *) NULL, 0));
}
+struct type *
+lookup_signed_typename (name)
+ char *name;
+{
+ struct type *t;
+ char *uns = alloca (strlen (name) + 8);
+
+ strcpy (uns, "signed ");
+ strcpy (uns + 7, name);
+ t = lookup_typename (uns, (struct block *) NULL, 1);
+ /* If we don't find "signed FOO" just try again with plain "FOO". */
+ if (t != NULL)
+ return t;
+ return lookup_typename (name, (struct block *) NULL, 0);
+}
+
/* Lookup a structure type named "struct NAME",
visible in lexical block BLOCK. */