Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support C99 array declarator syntax involving static and * #539

Merged
merged 1 commit into from
Dec 2, 2024

Conversation

xavierleroy
Copy link
Contributor

E.g. int x[static 10] or int x [*]. Currently, treated like int x[10] and int x[] respectively.

Ref: https://en.cppreference.com/w/c/language/array ; C99 6.7.5.2, C11 6.7.6.2.

Fixes: #531

@monniaux
Copy link
Contributor

Fails line 7:

void foo(int [5]);
void fooc(int x[const 5]);
void foos(int x[static 5]);
void foov(int x[volatile 5]);
void foor(int x[restrict 5]);
void fooc(int [const 5]);
void foos(int [static 5]);
void foov(int [volatile 5]);
void foor(int [restrict 5]);
void fooc(int (* const x));
void foos(int *x);
void foov(int * volatile x);
void foor(int * restrict x);
void fooc(int x[volatile 5])

E.g. `int x[static 10]` or `int x [*]`.
Treated like `int x[10]` and `int x[]` respectively.

Fixes: #531
@xavierleroy
Copy link
Contributor Author

The parsers needed updating in two places, "direct declarators" and "direct abstract declarators", adding to the already terrible combinatorics of this part of the C grammar. Should be all right now.

@xavierleroy xavierleroy merged commit 8408602 into master Dec 2, 2024
6 of 7 checks passed
@xavierleroy xavierleroy deleted the c99-array-syntax branch December 6, 2024 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

static qualifier in array parameter declaration
2 participants