This patch makes tcc ignore them. Normally (as per the C standard), They should be only applicable inside parameter arrays and affect (const/restrict) the pointer the array gets converted to. [matz: fix formatting, add volatile handling, add testcase, add comment about above deficiency]
Showing the changes to tests (2 of 3 files). Show all
Unified · Split
| @@ -0,0 +1,34 @@ | ||
| 1 | +void foo(int [5]); | |
| 2 | +void fooc(int x[const 5]); | |
| 3 | +void foos(int x[static 5]); | |
| 4 | +void foov(int x[volatile 5]); | |
| 5 | +void foor(int x[restrict 5]); | |
| 6 | +void fooc(int [const 5]); | |
| 7 | +void foos(int [static 5]); | |
| 8 | +void foov(int [volatile 5]); | |
| 9 | +void foor(int [restrict 5]); | |
| 10 | +void fooc(int (* const x)); | |
| 11 | +void foos(int *x); | |
| 12 | +void foov(int * volatile x); | |
| 13 | +void foor(int * restrict x); | |
| 14 | +void fooc(int x[volatile 5]) | |
| 15 | +{ | |
| 16 | + x[3] = 42; | |
| 17 | +#ifdef INVALID | |
| 18 | + x = 0; | |
| 19 | +#endif | |
| 20 | +} | |
| 21 | +void foovm(int x[const *]); | |
| 22 | +void foovm(int * const x); | |
| 23 | +#ifdef INVALID | |
| 24 | +void wrongc(int x[3][const 4]); | |
| 25 | +void wrongvm(int x[static *]); | |
| 26 | +void foovm(int x[const *]) | |
| 27 | +{ | |
| 28 | + x[2] = 1; | |
| 29 | +} | |
| 30 | +#endif | |
| 31 | +int main() | |
| 32 | +{ | |
| 33 | + return 0; | |
| 34 | +} | |
Empty file added.