support __alignof__ expressions like sizeof()

This commit is contained in:
Josh Holtrop 2018-05-12 14:55:39 -04:00
parent db98fc1c7e
commit f3c1570c1f
2 changed files with 4 additions and 1 deletions

View File

@ -121,6 +121,7 @@ break return BREAK;
continue return CONTINUE;
sizeof return SIZEOF;
__alignof__ return ALIGNOF;
__attribute__ return ATTRIBUTE;
__restrict return RESTRICT;

View File

@ -103,7 +103,7 @@ int yylex(YYSTYPE *, YYLTYPE *);
%token CONTINUE;
%token SIZEOF;
%token ALIGNOF;
%token CHAR_CONST;
%token INT_CONST;
@ -162,6 +162,8 @@ unary_expression
| unary_operator cast_expression
| SIZEOF unary_expression
| SIZEOF LPAREN type_name RPAREN
| ALIGNOF unary_expression
| ALIGNOF LPAREN type_name RPAREN
;
unary_operator