diff options
Diffstat (limited to 'parse.c')
| -rw-r--r-- | parse.c | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -58,6 +58,7 @@ static declarator_t typedef_specifier, inline_specifier, auto_specifier, register_specifier, static_specifier, extern_specifier, thread_specifier, const_qualifier, volatile_qualifier; +static declarator_t restrict_qualifier; static struct token *parse_if_statement(struct token *token, struct statement *stmt); static struct token *parse_return_statement(struct token *token, struct statement *stmt); @@ -174,6 +175,7 @@ static struct symbol_op volatile_op = { static struct symbol_op restrict_op = { .type = KW_QUALIFIER, + .declarator = restrict_qualifier, }; static struct symbol_op typeof_op = { @@ -422,6 +424,9 @@ static struct init_keyword { { "volatile", NS_TYPEDEF, .op = &volatile_op }, { "__volatile", NS_TYPEDEF, .op = &volatile_op }, { "__volatile__", NS_TYPEDEF, .op = &volatile_op }, + { "restrict", NS_TYPEDEF, .op = &restrict_op}, + { "__restrict", NS_TYPEDEF, .op = &restrict_op}, + { "__restrict__", NS_TYPEDEF, .op = &restrict_op}, /* Typedef.. */ { "typedef", NS_TYPEDEF, .op = &typedef_op }, @@ -467,11 +472,6 @@ static struct init_keyword { { "_Alignas", NS_TYPEDEF, .op = &alignas_op }, - /* Ignored for now.. */ - { "restrict", NS_TYPEDEF, .op = &restrict_op}, - { "__restrict", NS_TYPEDEF, .op = &restrict_op}, - { "__restrict__", NS_TYPEDEF, .op = &restrict_op}, - /* Static assertion */ { "_Static_assert", NS_KEYWORD, .op = &static_assert_op }, @@ -1467,6 +1467,12 @@ static struct token *volatile_qualifier(struct token *next, struct decl_state *c return next; } +static struct token *restrict_qualifier(struct token *next, struct decl_state *ctx) +{ + apply_qualifier(&next->pos, &ctx->ctype, MOD_RESTRICT); + return next; +} + static void apply_ctype(struct position pos, struct ctype *thistype, struct ctype *ctype) { unsigned long mod = thistype->modifiers; |
