summaryrefslogtreecommitdiff
path: root/tests/tests2/90_struct-init.c
diff options
context:
space:
mode:
authorThomas Preud'homme <robotux@celest.fr>2020-08-14 23:04:13 +0100
committerThomas Preud'homme <robotux@celest.fr>2020-08-14 23:04:13 +0100
commitafd09586d7ead4f146ad7a7a471be34196b3c6bc (patch)
tree87854be29fb4264b979b700fa45445f58faa4c26 /tests/tests2/90_struct-init.c
parente2ccf3981d78dfeb390d22c74625b60310100abb (diff)
New upstream version 0.9.27+git20200814.62c30a4a
Diffstat (limited to 'tests/tests2/90_struct-init.c')
-rw-r--r--tests/tests2/90_struct-init.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/tests2/90_struct-init.c b/tests/tests2/90_struct-init.c
index d931e23..ade7fad 100644
--- a/tests/tests2/90_struct-init.c
+++ b/tests/tests2/90_struct-init.c
@@ -87,6 +87,13 @@ union UV guv = {{6,5}};
union UV guv2 = {{.b = 7, .a = 8}};
union UV guv3 = {.b = 8, .a = 7};
+struct SSU {
+ int y;
+ struct { int x; };
+};
+struct SSU gssu1 = { .y = 5, .x = 3 };
+struct SSU gssu2 = { 5, 3 };
+
/* Under -fms-extensions also the following is valid:
union UV2 {
struct Anon {u8 a,b;}; // unnamed member, but tagged struct, ...
@@ -166,6 +173,14 @@ void foo (struct W *w, struct pkthdr *phdr_)
int elt = 0x42;
/* Range init, overlapping */
struct T lt2 = { { [1 ... 5] = 9, [6 ... 10] = elt, [4 ... 7] = elt+1 }, 1 };
+ struct SSU lssu1 = { 5, 3 };
+ struct SSU lssu2 = { .y = 5, .x = 3 };
+ /* designated initializers in GNU form */
+#if defined(__GNUC__) || defined(__TINYC__)
+ struct S ls4 = {a: 1, b: 2, c: {3, 4}};
+#else
+ struct S ls4 = {.a = 1, .b = 2, .c = {3, 4}};
+#endif
print(ls);
print(ls2);
print(lt);
@@ -182,7 +197,10 @@ void foo (struct W *w, struct pkthdr *phdr_)
print(lv2);
print(lv3);
print(lt2);
+ print(lssu1);
+ print(lssu2);
print(flow);
+ print(ls4);
}
#endif
@@ -272,6 +290,8 @@ int main()
print(guv.b);
print(guv2);
print(guv3);
+ print(gssu1);
+ print(gssu2);
print(phdr);
foo(&gw, &phdr);
//printf("q: %s\n", q);