From f3c1570c1ffbe20e43896fbb779384fd7b21a0db Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Sat, 12 May 2018 14:55:39 -0400 Subject: [PATCH] support __alignof__ expressions like sizeof() --- src/parser/parser.l | 1 + src/parser/parser.yc | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/parser/parser.l b/src/parser/parser.l index f1748b7..d418bcc 100644 --- a/src/parser/parser.l +++ b/src/parser/parser.l @@ -121,6 +121,7 @@ break return BREAK; continue return CONTINUE; sizeof return SIZEOF; +__alignof__ return ALIGNOF; __attribute__ return ATTRIBUTE; __restrict return RESTRICT; diff --git a/src/parser/parser.yc b/src/parser/parser.yc index 47251c6..063c25b 100644 --- a/src/parser/parser.yc +++ b/src/parser/parser.yc @@ -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