Ignore "static" and "const" in array-dimensions

This commit is contained in:
Rui Ueyama 2020-08-31 09:58:42 +09:00
parent b773554275
commit 93d12771d0
2 changed files with 6 additions and 1 deletions

View File

@ -575,8 +575,11 @@ static Type *func_params(Token **rest, Token *tok, Type *ty) {
return ty; return ty;
} }
// array-dimensions = const-expr? "]" type-suffix // array-dimensions = ("static" | "restrict")* const-expr? "]" type-suffix
static Type *array_dimensions(Token **rest, Token *tok, Type *ty) { static Type *array_dimensions(Token **rest, Token *tok, Type *ty) {
while (equal(tok, "static") || equal(tok, "restrict"))
tok = tok->next;
if (equal(tok, "]")) { if (equal(tok, "]")) {
ty = type_suffix(rest, tok->next, ty); ty = type_suffix(rest, tok->next, ty);
return array_of(ty, -1); return array_of(ty, -1);

View File

@ -4,6 +4,8 @@ _Noreturn noreturn_fn(int restrict x) {
exit(0); exit(0);
} }
void funcy_type(int arg[restrict static 3]) {}
int main() { int main() {
{ volatile x; } { volatile x; }
{ int volatile x; } { int volatile x; }