History

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

Jaroslav Kysela committed 15 years ago

Commit dbefae51 parent a3ebdd02 files · +34 −4Browse files

Showing the changes to tests (1 of 2 files). Show all

Unified · Split

tests/tcctest.c+26−0
@@ -827,6 +827,27 @@ struct aligntest4 { · 826 unmodified lines
827827 double a[0];
828828 };
829829
830+struct complexinit0 {
831+ int a;
832+ int b;
833+};
834+
835+struct complexinit {
836+ int a;
837+ struct complexinit0 *b;
838+};
839+
840+const static struct complexinit cix[] = {
841+ [0] = {
842+ .a = 0xfefa,
843+ .b = (const struct complexinit0[]) {
844+ { 0x80, 0x81 },
845+ { 0x82, 0x83 },
846+ {}
847+ }
848+ }
849+};
850+
830851 void struct_test()
831852 {
832853 struct1 *s;
@@ -856,6 +877,11 @@ void struct_test() · 23 unmodified lines
856877 printf("st2: %d %d %d\n",
857878 s->f1, s->f2, s->f3);
858879 printf("str_addr=%x\n", (int)st1.str - (int)&st1.f1);
880+ printf("cix: %d %d %d %d %d %d %d\n",
881+ cix[0].a,
882+ cix[0].b[0].a, cix[0].b[0].b,
883+ cix[0].b[1].a, cix[0].b[1].b,
884+ cix[0].b[2].a, cix[0].b[2].b);
859885
860886 /* align / size tests */
861887 printf("aligntest1 sizeof=%d alignof=%d\n",

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t