aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2011-02-22 10:06:20 +0100
committerJaroslav Kysela <perex@perex.cz>2011-02-22 12:15:44 +0100
commitdbefae52b07ce1b93af3a0e4ecbf25ca638e97eb (patch)
treedae38bdbd2fd4d9ce18afaec35bc636e00295192 /tests
parenta3ebdd0aeb834e3e7a644925ebb363d7b8064a52 (diff)
downloadtinycc-dbefae52b07ce1b93af3a0e4ecbf25ca638e97eb.tar.gz
tinycc-dbefae52b07ce1b93af3a0e4ecbf25ca638e97eb.tar.bz2
Fix complex static initializers (handle additional '}' and '{' brackets)
- added an example to test suite - the "warning: assignment discards qualifiers from pointer target type" is present but harmless
Diffstat (limited to 'tests')
-rw-r--r--tests/tcctest.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/tcctest.c b/tests/tcctest.c
index 87e7ad1..0d98dcc 100644
--- a/tests/tcctest.c
+++ b/tests/tcctest.c
@@ -827,6 +827,27 @@ struct aligntest4 {
double a[0];
};
+struct complexinit0 {
+ int a;
+ int b;
+};
+
+struct complexinit {
+ int a;
+ struct complexinit0 *b;
+};
+
+const static struct complexinit cix[] = {
+ [0] = {
+ .a = 0xfefa,
+ .b = (const struct complexinit0[]) {
+ { 0x80, 0x81 },
+ { 0x82, 0x83 },
+ {}
+ }
+ }
+};
+
void struct_test()
{
struct1 *s;
@@ -856,6 +877,11 @@ void struct_test()
printf("st2: %d %d %d\n",
s->f1, s->f2, s->f3);
printf("str_addr=%x\n", (int)st1.str - (int)&st1.f1);
+ printf("cix: %d %d %d %d %d %d %d\n",
+ cix[0].a,
+ cix[0].b[0].a, cix[0].b[0].b,
+ cix[0].b[1].a, cix[0].b[1].b,
+ cix[0].b[2].a, cix[0].b[2].b);
/* align / size tests */
printf("aligntest1 sizeof=%d alignof=%d\n",