History

Don't fail on const/restrict/static/* inside []

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]

Petr Skocik committed 8 years ago

Commit ef668aa1 parent d6d3cf03 files · +51 −2Browse files

Showing the changes to tests (2 of 3 files). Show all

Unified · Split

2 files
  1. tests/tests2/100_c99array-decls.c +34 −0
  2. tests/tests2/100_c99array-decls.expect +0 −0
tests/tests2/100_c99array-decls.c+34−0
@@ -0,0 +1,34 @@
1void foo(int [5]);
2void fooc(int x[const 5]);
3void foos(int x[static 5]);
4void foov(int x[volatile 5]);
5void foor(int x[restrict 5]);
6void fooc(int [const 5]);
7void foos(int [static 5]);
8void foov(int [volatile 5]);
9void foor(int [restrict 5]);
10void fooc(int (* const x));
11void foos(int *x);
12void foov(int * volatile x);
13void foor(int * restrict x);
14void fooc(int x[volatile 5])
15{
16 x[3] = 42;
17#ifdef INVALID
18 x = 0;
19#endif
20}
21void foovm(int x[const *]);
22void foovm(int * const x);
23#ifdef INVALID
24void wrongc(int x[3][const 4]);
25void wrongvm(int x[static *]);
26void foovm(int x[const *])
27{
28 x[2] = 1;
29}
30#endif
31int main()
32{
33 return 0;
34}
tests/tests2/100_c99array-decls.expect+0−0

Empty file added.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t