more tests
authorMatthias Braun <matze@braunis.de>
Wed, 6 Aug 2008 10:45:00 +0000 (10:45 +0000)
committerMatthias Braun <matze@braunis.de>
Wed, 6 Aug 2008 10:45:00 +0000 (10:45 +0000)
[r21010]

parsetest/attributes.c [deleted file]
parsetest/constexpr2.c
parsetest/gnu99/attributes.c [new file with mode: 0644]
parsetest/gnu99/attributes2.c [new file with mode: 0644]
parsetest/gnu99/transparent_union.c [new file with mode: 0644]
parsetest/shouldfail/transparent_union2.c [new file with mode: 0644]

diff --git a/parsetest/attributes.c b/parsetest/attributes.c
deleted file mode 100644 (file)
index 0d9c84e..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-int test1(int a) __attribute__((noreturn));
-int test2(int a) __attribute__((const));
-/* empty args are allowed */
-int test3(int a) __attribute__((weak()));
-int test4(int a) __attribute__((unknown_error("bla", 3)));
-int test5(int a) __attribute__((alias("test2")));
-int test6(int a) __attribute__((section("extra")));
-int test7(int a, const char *fmt, ...) __attribute__((format(printf,2,3)));
-
-struct X {
-       char y;
-       int x __attribute__((aligned(4+4)));
-};
-
-int test2(int a) {
-       return a;
-}
-
-int main(void) {
-       return test5(0);
-}
index 7633e0a..35a66a6 100644 (file)
@@ -2,7 +2,7 @@ struct foo {
        int a;
        int b;
 };
-int glob = (int) &((struct foo*)0)->b;
+struct foo bar = { (int) &((struct foo*)0)->b, 0 };
 
 int main(void) {
        return 0;
diff --git a/parsetest/gnu99/attributes.c b/parsetest/gnu99/attributes.c
new file mode 100644 (file)
index 0000000..0d9c84e
--- /dev/null
@@ -0,0 +1,21 @@
+int test1(int a) __attribute__((noreturn));
+int test2(int a) __attribute__((const));
+/* empty args are allowed */
+int test3(int a) __attribute__((weak()));
+int test4(int a) __attribute__((unknown_error("bla", 3)));
+int test5(int a) __attribute__((alias("test2")));
+int test6(int a) __attribute__((section("extra")));
+int test7(int a, const char *fmt, ...) __attribute__((format(printf,2,3)));
+
+struct X {
+       char y;
+       int x __attribute__((aligned(4+4)));
+};
+
+int test2(int a) {
+       return a;
+}
+
+int main(void) {
+       return test5(0);
+}
diff --git a/parsetest/gnu99/attributes2.c b/parsetest/gnu99/attributes2.c
new file mode 100644 (file)
index 0000000..36a3c3b
--- /dev/null
@@ -0,0 +1,5 @@
+__attribute__((noreturn)) void d0(void), __attribute__((format(printf,1,2))) d1(const char*, ...), d2(void);
+
+int main(void) {
+       return 0;
+}
diff --git a/parsetest/gnu99/transparent_union.c b/parsetest/gnu99/transparent_union.c
new file mode 100644 (file)
index 0000000..cb4e15d
--- /dev/null
@@ -0,0 +1,22 @@
+struct sockaddr {
+       int bla;
+};
+
+struct sockaddr_at {
+       int blo, blup;
+};
+
+typedef union bla {
+       struct sockaddr *__restrict__     sockaddr_ptr;
+       struct sockaddr_at *__restrict__  sockaddr_at_ptr;
+} sockaddr_arg __attribute__((__transparent_union__));
+
+void *t_recvfrom(sockaddr_arg arg) {
+       return arg.sockaddr_at_ptr;
+}
+
+int main(void) {
+       struct sockaddr_at at;
+       int r = (t_recvfrom(&at) != &at);
+       return r;
+}
diff --git a/parsetest/shouldfail/transparent_union2.c b/parsetest/shouldfail/transparent_union2.c
new file mode 100644 (file)
index 0000000..a71b46b
--- /dev/null
@@ -0,0 +1,23 @@
+struct sockaddr {
+       int bla;
+};
+
+struct sockaddr_at {
+       int blo, blup;
+};
+
+typedef union bla {
+       struct sockaddr *__restrict__     sockaddr_ptr;
+       struct sockaddr_at *__restrict__  sockaddr_at_ptr;
+} sockaddr_arg __attribute__((__transparent_union__));
+
+void *t_recvfrom(sockaddr_arg arg) {
+       return arg.sockaddr_at_ptr;
+}
+
+int main(void) {
+       struct sockaddr at;
+       union bla bla = { &at };
+       int r = (t_recvfrom(bla) != &at);
+       return r;
+}