mirror of https://github.com/rui314/chibicc
Ignore "static" and "const" in array-dimensions
This commit is contained in:
parent
b773554275
commit
93d12771d0
5
parse.c
5
parse.c
|
@ -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);
|
||||||
|
|
|
@ -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; }
|
||||||
|
|
Loading…
Reference in New Issue