+2004-07-25 Daniel Jacobowitz <dan@debian.org>
+
+ * gcc.dg/pragma-align-2.c: New test.
+ * gcc.dg/pragma-init-fini.c: New test.
+ * gcc.dg/pragma-align.c: Change from compile to run. Run on Solaris
+ targets.
+
2004-07-25 Joseph S. Myers <jsm@polyomino.org.uk>
* gcc.dg/init-string-2.c: New test.
--- /dev/null
+/* { dg-do run { target *-*-solaris2.* } } */
+
+void abort (void);
+
+#pragma align 1(x1)
+#pragma align 2(x2)
+#pragma align 4(x4)
+#pragma align 8(x8,y8,z8)
+#pragma align 16(x16)
+#pragma align 32(x32)
+#pragma align 64(x64)
+#pragma align 128(x128)
+
+#pragma align 8(not_defined)
+
+#pragma align 9(odd_align) /* { dg-error "invalid alignment" } */
+#pragma align 256(high_align) /* { dg-error "invalid alignment" } */
+#pragma align -1(neg_align) /* { dg-error "malformed" } */
+#pragma align bad_align /* { dg-error "malformed" } */
+#pragma align 1(bad_align /* { dg-error "malformed" } */
+
+int x, x1, x2, x4, x8, y8, z8, x16, x32, x64, x128;
+
+#pragma align 16(x) /* { dg-error "must appear before" } */
+
+int
+main ()
+{
+ if (__alignof__ (x4) < 4)
+ abort ();
+
+ if (__alignof__ (x8) < 8)
+ abort ();
+
+ if (__alignof__ (y8) < 8)
+ abort ();
+
+ if (__alignof__ (z8) < 8)
+ abort ();
+
+ if (__alignof__ (x16) < 16)
+ abort ();
+
+ if (__alignof__ (x32) < 32)
+ abort ();
+
+ if (__alignof__ (x64) < 64)
+ abort ();
+
+ if (__alignof__ (x128) < 128)
+ abort ();
+
+ return 0;
+}
/* Prove that HANDLE_SYSTEMV_PRAGMA alignment handling works somewhat. */
-/* { dg-do compile { target i?86-*-linux* i?86-*-*bsd* i?86-*-sco3.2v5* } } */
+/* { dg-do run { target i?86-*-linux* i?86-*-*bsd* i?86-*-sco3.2v5* *-*-solaris2.* } } */
struct {
char one;
if(sizeof(resetalign) != sizeof(defaultalign)) abort();
return 0;
}
-
--- /dev/null
+/* Tests for #pragma init and #pragma fini. */
+
+/* { dg-do run { target *-*-solaris2.* } } */
+
+extern void abort ();
+
+#pragma init /* { dg-error "malformed" } */
+#pragma init () /* { dg-error "malformed" } */
+#pragma init init_func /* { dg-error "malformed" } */
+
+#pragma fini /* { dg-error "malformed" } */
+#pragma fini () /* { dg-error "malformed" } */
+#pragma fini fini_func /* { dg-error "malformed" } */
+
+#pragma init (init_func, init_static_func)
+
+int glob_1, glob_2;
+
+void init_func (void)
+{
+ glob_1 = 1;
+}
+
+static void init_static_func (void)
+{
+ glob_2 = 2;
+}
+
+#pragma fini (fini_func, fini_static_func)
+
+void fini_func (void)
+{
+
+}
+
+static void fini_static_func (void)
+{
+
+}
+
+int main()
+{
+ if (glob_1 != 1)
+ abort ();
+
+ if (glob_2 != 2)
+ abort ();
+
+ return 0;
+}