summaryrefslogtreecommitdiff
path: root/support/valdiag/tests/struct.c
diff options
context:
space:
mode:
authorXavier ASUS <xavi92psx@gmail.com>2019-10-18 00:31:54 +0200
committerXavier ASUS <xavi92psx@gmail.com>2019-10-18 00:31:54 +0200
commit268a53de823a6750d6256ee1fb1e7707b4b45740 (patch)
tree42c1799a9a82b2f7d9790ee9fe181d72a7274751 /support/valdiag/tests/struct.c
downloadsdcc-gas-268a53de823a6750d6256ee1fb1e7707b4b45740.tar.gz
sdcc-3.9.0 fork implementing GNU assembler syntax
This fork aims to provide better support for stm8-binutils
Diffstat (limited to 'support/valdiag/tests/struct.c')
-rw-r--r--support/valdiag/tests/struct.c115
1 files changed, 115 insertions, 0 deletions
diff --git a/support/valdiag/tests/struct.c b/support/valdiag/tests/struct.c
new file mode 100644
index 0000000..c7f4938
--- /dev/null
+++ b/support/valdiag/tests/struct.c
@@ -0,0 +1,115 @@
+
+#ifdef TEST1
+struct tag {
+ int good1;
+ register int bad; /* ERROR */
+ int good2;
+} badstruct; /* IGNORE */
+#endif
+
+#ifdef TEST2
+struct tag {
+ int good1;
+ int bad; /* IGNORE */
+ int bad; /* ERROR */
+ int good2;
+} badstruct;
+#endif
+
+#ifdef TEST3a
+struct tag {
+ int good1;
+ int bad:255; /* ERROR */
+ int good2;
+} badstruct;
+#endif
+
+#ifdef TEST3b
+struct tag {
+ int good1;
+ float badtype1 : 5; /* ERROR */
+ int good2;
+ _Bool badwidth2 : 2; /* ERROR */
+ int good3;
+ int badwidth2 : 17; /* ERROR */
+ int good4;
+} badstruct;
+#endif
+
+#ifdef TEST4
+struct tag {
+ int good1;
+ int good2;
+} goodstruct1;
+
+struct tag goodstruct2;
+#endif
+
+#ifdef TEST5a
+struct tag {
+ int good1;
+ int good2;
+} goodstruct1;
+
+union tag badunion; /* ERROR */
+#endif
+
+#ifdef TEST5b
+union tag {
+ int good1;
+ int good2;
+} goodunion1;
+
+struct tag badstruct; /* ERROR */
+#endif
+
+
+#ifdef TEST6
+struct linklist {
+ struct linklist *prev;
+ struct linklist *next;
+ int x;
+} ll;
+#endif
+
+#ifdef TEST7a
+union tag {
+ struct tag *next; /* ERROR */
+ int x;
+} ll;
+#endif
+
+#ifdef TEST7b
+struct tag {
+ union tag *next; /* ERROR */
+ int x;
+} ll;
+#endif
+
+#ifdef TEST8a
+struct tag {
+ int a; /* IGNORE */
+ struct {
+ int a; /* ERROR(SDCC) */ /* IGNORE(GCC) */
+ int b;
+ };
+} ll;
+#endif
+
+#ifdef TEST8b
+struct tag {
+ int a;
+ struct {
+ int b;
+ int c;
+ };
+} ll;
+
+void test(void)
+{
+ ll.a = 1;
+ ll.b = 2;
+ ll.c = 3;
+}
+
+#endif