diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-07-19 18:34:25 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-07-23 23:29:45 +0200 |
| commit | 7cdd65dd26cc523b3ff6d4acfc19488a47be8d7b (patch) | |
| tree | 168929153c01e6181f66df77a6f396b62680ac55 /parse.c | |
| parent | 0de9fc21de2cc26038b9b07d3b80e9c5cd84ec30 (diff) | |
| download | sparse-dev-7cdd65dd26cc523b3ff6d4acfc19488a47be8d7b.tar.gz | |
allow [*] in array declarators
Since C99, a '*' is allowed in an abstract array declarator to
specify that the array is a VLA with a yet-to-be-determined size.
So, accept this construction (but still ignore it for now).
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'parse.c')
| -rw-r--r-- | parse.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1717,7 +1717,12 @@ static struct token *abstract_array_declarator(struct token *token, struct symbo has_static |= (sym->op->type & KW_STATIC); token = token->next; } - token = assignment_expression(token, &expr); + if (match_op(token, '*') && match_op(token->next, ']')) { + // FIXME: '[*]' is treated like '[]' + token = token->next; + } else { + token = assignment_expression(token, &expr); + } sym->array_size = expr; return token; } |
