Handle alignof and _Alignof
[deliverable/binutils-gdb.git] / gdb / c-exp.y
index 9e2f80889f10d83cb3e77253ec1b698bf7d3f29a..3cee544106f6003037e8e3cd40ce13fa81280992 100644 (file)
@@ -173,7 +173,7 @@ static void c_print_token (FILE *file, int type, YYSTYPE value);
 %token <ssym> NAME_OR_INT
 
 %token OPERATOR
-%token STRUCT CLASS UNION ENUM SIZEOF UNSIGNED COLONCOLON
+%token STRUCT CLASS UNION ENUM SIZEOF ALIGNOF UNSIGNED COLONCOLON
 %token TEMPLATE
 %token ERROR
 %token NEW DELETE
@@ -307,6 +307,10 @@ exp        :       SIZEOF exp       %prec UNARY
                        { write_exp_elt_opcode (pstate, UNOP_SIZEOF); }
        ;
 
+exp    :       ALIGNOF '(' type_exp ')'        %prec UNARY
+                       { write_exp_elt_opcode (pstate, UNOP_ALIGNOF); }
+       ;
+
 exp    :       exp ARROW name
                        { write_exp_elt_opcode (pstate, STRUCTOP_PTR);
                          write_exp_string (pstate, $3);
@@ -2329,6 +2333,8 @@ static const struct token ident_tokens[] =
     {"struct", STRUCT, OP_NULL, 0},
     {"signed", SIGNED_KEYWORD, OP_NULL, 0},
     {"sizeof", SIZEOF, OP_NULL, 0},
+    {"_Alignof", ALIGNOF, OP_NULL, 0},
+    {"alignof", ALIGNOF, OP_NULL, FLAG_CXX},
     {"double", DOUBLE_KEYWORD, OP_NULL, 0},
     {"false", FALSEKEYWORD, OP_NULL, FLAG_CXX},
     {"class", CLASS, OP_NULL, FLAG_CXX},
This page took 0.024152 seconds and 4 git commands to generate.