Remove dead code and variables. Properly check for unions when skipping fields in initializers. Make tests2/*.expect depend on the .c files so they are automatically rebuilt when the latter change.
Showing the changes to tests (3 of 4 files). Show all
Unified · Split
| @@ -67,6 +67,16 @@ struct V gv3 = {((struct S){7,8,{9,10}}), {"hoho", 49}, 50}; · 66 unmodified lines | ||
| 67 | 67 | /* Initialization of a flex array member (warns in GCC) */ |
| 68 | 68 | struct W gw = {{1,2,3,4}, {1,2,3,4,5}}; |
| 69 | 69 | |
| 70 | +union UU { | |
| 71 | + u8 a; | |
| 72 | + u8 b; | |
| 73 | +}; | |
| 74 | +struct SU { | |
| 75 | + union UU u; | |
| 76 | + u8 c; | |
| 77 | +}; | |
| 78 | +struct SU gsu = {5,6}; | |
| 79 | + | |
| 70 | 80 | #include <stdio.h> |
| 71 | 81 | void print_ (const char *name, const u8 *p, long size) |
| 72 | 82 | { |
| @@ -133,6 +143,7 @@ int main() · 60 unmodified lines | ||
| 133 | 143 | print(gv3); |
| 134 | 144 | print(sinit16); |
| 135 | 145 | print(gw); |
| 146 | + print(gsu); | |
| 136 | 147 | foo(&gw); |
| 137 | 148 | //printf("q: %s\n", q); |
| 138 | 149 | return 0; |
| @@ -12,6 +12,7 @@ gv2: 7 8 9 a 68 69 68 69 0 0 0 0 0 0 0 0 0 0 0 0 2f 30 · 11 unmodified lines | ||
| 12 | 12 | gv3: 7 8 9 a 68 6f 68 6f 0 0 0 0 0 0 0 0 0 0 0 0 31 32 |
| 13 | 13 | sinit16: 1 0 0 0 2 0 0 0 |
| 14 | 14 | gw: 1 2 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 |
| 15 | +gsu: 5 6 | |
| 15 | 16 | ls: 1 2 3 4 |
| 16 | 17 | ls2: 1 2 3 4 |
| 17 | 18 | lt: 68 65 6c 6c 6f 0 0 0 0 0 0 0 0 0 0 0 2a |
| @@ -53,7 +53,7 @@ all test: $(filter-out $(SKIP),$(TESTS)) · 52 unmodified lines | ||
| 53 | 53 | @diff -Nbu $(SRC)/$*.expect $*.output && rm -f $*.output |
| 54 | 54 | |
| 55 | 55 | # automatically generate .expect files with gcc: |
| 56 | −%.expect : | |
| 56 | +%.expect : %.c | |
| 57 | 57 | (gcc -w $*.c -o a.exe && ./a.exe $(ARGS)) >$*.expect 2>&1; rm -f a.exe |
| 58 | 58 | |
| 59 | 59 | # tell make not to delete |