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 | /* Initialization of a flex array member (warns in GCC) */ | 67 | /* Initialization of a flex array member (warns in GCC) */ |
| 68 | struct W gw = {{1,2,3,4}, {1,2,3,4,5}}; | 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 | #include <stdio.h> | 80 | #include <stdio.h> |
| 71 | void print_ (const char *name, const u8 *p, long size) | 81 | void print_ (const char *name, const u8 *p, long size) |
| 72 | { | 82 | { |
| @@ -133,6 +143,7 @@ int main() · 60 unmodified lines | |||
| 133 | print(gv3); | 143 | print(gv3); |
| 134 | print(sinit16); | 144 | print(sinit16); |
| 135 | print(gw); | 145 | print(gw); |
| 146 | print(gsu); | ||
| 136 | foo(&gw); | 147 | foo(&gw); |
| 137 | //printf("q: %s\n", q); | 148 | //printf("q: %s\n", q); |
| 138 | return 0; | 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 | gv3: 7 8 9 a 68 6f 68 6f 0 0 0 0 0 0 0 0 0 0 0 0 31 32 | 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 | sinit16: 1 0 0 0 2 0 0 0 | 13 | sinit16: 1 0 0 0 2 0 0 0 |
| 14 | gw: 1 2 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | 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 | ls: 1 2 3 4 | 16 | ls: 1 2 3 4 |
| 16 | ls2: 1 2 3 4 | 17 | ls2: 1 2 3 4 |
| 17 | lt: 68 65 6c 6c 6f 0 0 0 0 0 0 0 0 0 0 0 2a | 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 | @diff -Nbu $(SRC)/$*.expect $*.output && rm -f $*.output | 53 | @diff -Nbu $(SRC)/$*.expect $*.output && rm -f $*.output |
| 54 | 54 | ||
| 55 | # automatically generate .expect files with gcc: | 55 | # automatically generate .expect files with gcc: |
| 56 | %.expect : | 56 | %.expect : %.c |
| 57 | (gcc -w $*.c -o a.exe && ./a.exe $(ARGS)) >$*.expect 2>&1; rm -f a.exe | 57 | (gcc -w $*.c -o a.exe && ./a.exe $(ARGS)) >$*.expect 2>&1; rm -f a.exe |
| 58 | 58 | ||
| 59 | # tell make not to delete | 59 | # tell make not to delete |