similarity index 68%
rename from gcc/testsuite/gcc.dg/initpri1.c
rename to gcc/testsuite/c-c++-common/initpri1.c
@@ -1,6 +1,5 @@
/* { dg-do run { target init_priority } } */
-
-extern void abort (void);
+/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */
int i;
int j;
@@ -11,17 +10,17 @@ void c3() __attribute__((constructor (600)));
void c1() {
if (i++ != 0)
- abort ();
+ __builtin_abort ();
}
void c2() {
if (i++ != 2)
- abort ();
+ __builtin_abort ();
}
void c3() {
if (i++ != 1)
- abort ();
+ __builtin_abort ();
}
void d1() __attribute__((destructor (500)));
@@ -30,26 +29,26 @@ void d3() __attribute__((destructor (600)));
void d1() {
if (--i != 0)
- abort ();
+ __builtin_abort ();
}
void d2() {
if (--i != 2)
- abort ();
+ __builtin_abort ();
}
void d3() {
if (j != 2)
- abort ();
+ __builtin_abort ();
if (--i != 1)
- abort ();
+ __builtin_abort ();
}
void cd4() __attribute__((constructor (800), destructor (800)));
void cd4() {
if (i != 3)
- abort ();
+ __builtin_abort ();
++j;
}
@@ -57,6 +56,6 @@ int main () {
if (i != 3)
return 1;
if (j != 1)
- abort ();
+ __builtin_abort ();
return 0;
}
similarity index 92%
rename from gcc/testsuite/gcc.dg/initpri2.c
rename to gcc/testsuite/c-c++-common/initpri2.c
@@ -1,4 +1,5 @@
/* { dg-do compile { target init_priority } } */
+/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */
/* Priorities must be in the range [0, 65535]. */
void c1()
deleted file mode 100644
@@ -1,62 +0,0 @@
-/* { dg-do run { target init_priority } } */
-
-extern "C" void abort ();
-
-int i;
-int j;
-
-void c1() __attribute__((constructor (500)));
-void c2() __attribute__((constructor (700)));
-void c3() __attribute__((constructor (600)));
-
-void c1() {
- if (i++ != 0)
- abort ();
-}
-
-void c2() {
- if (i++ != 2)
- abort ();
-}
-
-void c3() {
- if (i++ != 1)
- abort ();
-}
-
-void d1() __attribute__((destructor (500)));
-void d2() __attribute__((destructor (700)));
-void d3() __attribute__((destructor (600)));
-
-void d1() {
- if (--i != 0)
- abort ();
-}
-
-void d2() {
- if (--i != 2)
- abort ();
-}
-
-void d3() {
- if (j != 2)
- abort ();
- if (--i != 1)
- abort ();
-}
-
-void cd4() __attribute__((constructor (800), destructor (800)));
-
-void cd4() {
- if (i != 3)
- abort ();
- ++j;
-}
-
-int main () {
- if (i != 3)
- return 1;
- if (j != 1)
- abort ();
- return 0;
-}
deleted file mode 100644
@@ -1,39 +0,0 @@
-/* { dg-do compile { target init_priority } } */
-
-/* Priorities must be in the range [0, 65535]. */
-void c1()
- __attribute__((constructor (-1))); /* { dg-error "priorities" } */
-void c2()
- __attribute__((constructor (65536))); /* { dg-error "priorities" } */
-void d1()
- __attribute__((destructor (-1))); /* { dg-error "priorities" } */
-void d2()
- __attribute__((destructor (65536))); /* { dg-error "priorities" } */
-
-/* Priorities 0-100 are reserved for system libraries. */
-void c3()
- __attribute__((constructor (50))); /* { dg-warning "reserved" } */
-void d3()
- __attribute__((constructor (50))); /* { dg-warning "reserved" } */
-
-/* Priorities must be integral constants. */
-
-/* Pointers, even with constant values, are not allowed. */
-void c4()
- __attribute__((constructor ((void*) 500))); /* { dg-error "priorities" } */
-void d4()
- __attribute__((destructor ((void*) 500))); /* { dg-error "priorities" } */
-
-/* Integer variables are not allowed. */
-int i;
-void c5()
- __attribute__((constructor ((i)))); /* { dg-error "priorities" } */
-void d5()
- __attribute__((destructor ((i)))); /* { dg-error "priorities" } */
-
-/* Enumeration constants are allowed. */
-enum E { e = 500 };
-void c6()
- __attribute__((constructor ((e))));
-void d6()
- __attribute__((destructor ((e))));
@@ -2,4 +2,4 @@
/* { dg-require-effective-target lto } */
/* { dg-options "-flto -O3" } */
-#include "initpri1.c"
+#include "../c-c++-common/initpri1.c"