* tm-rs6000.h (AIX_BUGGY_PTRACE_CALL): Zap, we think we fixed it.
[deliverable/binutils-gdb.git] / gdb / c-exp.y
index 20effd23a847e5cb0931205189af245d466c0eee..fa8ebb90b99fd64ad0bf9ef5c414a0795e32160c 100644 (file)
@@ -155,13 +155,13 @@ parse_number PARAMS ((char *, int, int, YYSTYPE *));
 
 %token <ssym> NAME_OR_INT NAME_OR_UINT
 
-%token STRUCT UNION ENUM SIZEOF UNSIGNED COLONCOLON
+%token STRUCT CLASS UNION ENUM SIZEOF UNSIGNED COLONCOLON
 %token TEMPLATE
 %token ERROR
 
 /* 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
 
@@ -193,9 +193,6 @@ parse_number PARAMS ((char *, int, int, YYSTYPE *));
 %type <bval> block
 %left COLONCOLON
 
-\f
-%%
-
 %{
 /* Ensure that if the generated parser contains any calls to malloc/realloc,
    that they get mapped to xmalloc/xrealloc.  We have to do this here
@@ -208,6 +205,9 @@ parse_number PARAMS ((char *, int, int, YYSTYPE *));
 #define realloc        xrealloc
 %}
 
+\f
+%%
+
 start   :      exp1
        |       type_exp
        ;
@@ -834,6 +834,9 @@ type        :       ptype
                        { $$ = 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
@@ -864,6 +867,9 @@ typebase
        |       STRUCT name
                        { $$ = lookup_struct (copy_name ($2),
                                              expression_context_block); }
+       |       CLASS name
+                       { $$ = lookup_struct (copy_name ($2),
+                                             expression_context_block); }
        |       UNION name
                        { $$ = lookup_union (copy_name ($2),
                                             expression_context_block); }
@@ -875,7 +881,7 @@ 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 '>'
@@ -1221,7 +1227,7 @@ yylex ()
          {
            char *err_copy = (char *) alloca (p - tokstart + 1);
 
-           (void) memcpy (err_copy, tokstart, p - tokstart);
+           memcpy (err_copy, tokstart, p - tokstart);
            err_copy[p - tokstart] = 0;
            error ("Invalid number \"%s\".", err_copy);
          }
@@ -1356,6 +1362,8 @@ yylex ()
       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))
@@ -1366,10 +1374,15 @@ yylex ()
        return SIZEOF;
       break;
     case 5:
+      if (current_language->la_language == language_cplus
+         && !strncmp (tokstart, "class", 5))
+       return CLASS;
       if (!strncmp (tokstart, "union", 5))
        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))
This page took 0.024827 seconds and 4 git commands to generate.