diff options
| author | Michael Matz <matz@suse.de> | 2016-07-31 06:18:45 +0200 |
|---|---|---|
| committer | Michael Matz <matz@suse.de> | 2016-12-15 17:47:09 +0100 |
| commit | 7bf323843ee2f59bcbdaa8e5dd7b060a2df4ea4d (patch) | |
| tree | 9be1e61872b69e254171f92c358a6bc7fbe33cc0 /tests | |
| parent | ed7d54651d2ef33dd6f644f23ba2fa64706e84db (diff) | |
| download | tinycc-7bf323843ee2f59bcbdaa8e5dd7b060a2df4ea4d.tar.gz tinycc-7bf323843ee2f59bcbdaa8e5dd7b060a2df4ea4d.tar.bz2 | |
struct-init: Cleanup
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.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/tests2/86-struct-init.c | 11 | ||||
| -rw-r--r-- | tests/tests2/86-struct-init.expect | 1 | ||||
| -rw-r--r-- | tests/tests2/Makefile | 2 |
3 files changed, 13 insertions, 1 deletions
diff --git a/tests/tests2/86-struct-init.c b/tests/tests2/86-struct-init.c index 71a2810..fa0d967 100644 --- a/tests/tests2/86-struct-init.c +++ b/tests/tests2/86-struct-init.c @@ -67,6 +67,16 @@ struct V gv3 = {((struct S){7,8,{9,10}}), {"hoho", 49}, 50}; /* Initialization of a flex array member (warns in GCC) */ struct W gw = {{1,2,3,4}, {1,2,3,4,5}}; +union UU { + u8 a; + u8 b; +}; +struct SU { + union UU u; + u8 c; +}; +struct SU gsu = {5,6}; + #include <stdio.h> void print_ (const char *name, const u8 *p, long size) { @@ -133,6 +143,7 @@ int main() print(gv3); print(sinit16); print(gw); + print(gsu); foo(&gw); //printf("q: %s\n", q); return 0; diff --git a/tests/tests2/86-struct-init.expect b/tests/tests2/86-struct-init.expect index 221048f..6ae60e0 100644 --- a/tests/tests2/86-struct-init.expect +++ b/tests/tests2/86-struct-init.expect @@ -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 gv3: 7 8 9 a 68 6f 68 6f 0 0 0 0 0 0 0 0 0 0 0 0 31 32 sinit16: 1 0 0 0 2 0 0 0 gw: 1 2 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +gsu: 5 6 ls: 1 2 3 4 ls2: 1 2 3 4 lt: 68 65 6c 6c 6f 0 0 0 0 0 0 0 0 0 0 0 2a diff --git a/tests/tests2/Makefile b/tests/tests2/Makefile index 50cff85..2434215 100644 --- a/tests/tests2/Makefile +++ b/tests/tests2/Makefile @@ -53,7 +53,7 @@ all test: $(filter-out $(SKIP),$(TESTS)) @diff -Nbu $(SRC)/$*.expect $*.output && rm -f $*.output # automatically generate .expect files with gcc: -%.expect : +%.expect : %.c (gcc -w $*.c -o a.exe && ./a.exe $(ARGS)) >$*.expect 2>&1; rm -f a.exe # tell make not to delete |
