aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/pre_parser.mly
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@college-de-france.fr>2020-07-21 18:42:27 +0200
committerXavier Leroy <xavierleroy@users.noreply.github.com>2020-07-21 18:45:28 +0200
commita8ce85adbf2863e98e5c24e9cc6f82947d4b3a29 (patch)
treec289886f88b58716ecfe0f7261594a231a3b21be /cparser/pre_parser.mly
parent3a1b0e98a09dd9688e8f45f9677b7ea25f4720bf (diff)
downloadcompcert-kvx-a8ce85adbf2863e98e5c24e9cc6f82947d4b3a29.tar.gz
compcert-kvx-a8ce85adbf2863e98e5c24e9cc6f82947d4b3a29.zip
Support _Static_assert from C11
Diffstat (limited to 'cparser/pre_parser.mly')
-rw-r--r--cparser/pre_parser.mly8
1 files changed, 7 insertions, 1 deletions
diff --git a/cparser/pre_parser.mly b/cparser/pre_parser.mly
index 669ecf5e..6ba7ee39 100644
--- a/cparser/pre_parser.mly
+++ b/cparser/pre_parser.mly
@@ -57,7 +57,7 @@
AUTO REGISTER INLINE NORETURN CHAR SHORT INT LONG SIGNED UNSIGNED FLOAT DOUBLE
UNDERSCORE_BOOL CONST VOLATILE VOID STRUCT UNION ENUM CASE DEFAULT IF ELSE
SWITCH WHILE DO FOR GOTO CONTINUE BREAK RETURN BUILTIN_VA_ARG ALIGNOF
- ATTRIBUTE ALIGNAS PACKED ASM BUILTIN_OFFSETOF
+ ATTRIBUTE ALIGNAS PACKED ASM BUILTIN_OFFSETOF STATIC_ASSERT
%token EOF
@@ -404,6 +404,7 @@ expression:
declaration(phantom):
| declaration_specifiers(declaration(phantom)) init_declarator_list? SEMICOLON
| declaration_specifiers_typedef typedef_declarator_list? SEMICOLON
+| static_assert_declaration
{}
init_declarator_list:
@@ -518,6 +519,7 @@ struct_declaration_list:
struct_declaration:
| specifier_qualifier_list(struct_declaration) struct_declarator_list? SEMICOLON
+| static_assert_declaration
{}
(* As in the standard, except it also encodes the constraint described
@@ -607,6 +609,10 @@ gcc_attribute_word:
| PACKED
{}
+static_assert_declaration:
+| STATIC_ASSERT LPAREN constant_expression COMMA STRING_LITERAL RPAREN SEMICOLON
+ {}
+
function_specifier:
| INLINE
| NORETURN