summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg
diff options
context:
space:
mode:
authorYamaArashi <shadow962@live.com>2016-01-06 01:47:28 -0800
committerYamaArashi <shadow962@live.com>2016-01-06 01:47:28 -0800
commitbe8b04496302184c6e8f04d6179f9c3afc50aeb6 (patch)
tree726e2468c0c07add773c0dbd86ab6386844259ae /gcc/testsuite/g++.dg
initial commit
Diffstat (limited to 'gcc/testsuite/g++.dg')
-rwxr-xr-xgcc/testsuite/g++.dg/special/conpr-1.C18
-rwxr-xr-xgcc/testsuite/g++.dg/special/conpr-2.C20
-rwxr-xr-xgcc/testsuite/g++.dg/special/conpr-2a.C12
-rwxr-xr-xgcc/testsuite/g++.dg/special/conpr-3.C20
-rwxr-xr-xgcc/testsuite/g++.dg/special/conpr-3a.C11
-rwxr-xr-xgcc/testsuite/g++.dg/special/conpr-3b.C11
-rwxr-xr-xgcc/testsuite/g++.dg/special/ecos.exp75
7 files changed, 167 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/special/conpr-1.C b/gcc/testsuite/g++.dg/special/conpr-1.C
new file mode 100755
index 0000000..8ab6bfe
--- /dev/null
+++ b/gcc/testsuite/g++.dg/special/conpr-1.C
@@ -0,0 +1,18 @@
+/* { dg-do run } */
+
+class foo_t {
+ int x;
+public:
+ foo_t(void) { x=1; }
+ int get(void) { return x; }
+};
+
+static foo_t foo __attribute__((init_priority(5000)));
+
+int main(void) {
+
+ if (foo.get())
+ exit(0);
+ else
+ abort();
+}
diff --git a/gcc/testsuite/g++.dg/special/conpr-2.C b/gcc/testsuite/g++.dg/special/conpr-2.C
new file mode 100755
index 0000000..07ba8ab
--- /dev/null
+++ b/gcc/testsuite/g++.dg/special/conpr-2.C
@@ -0,0 +1,20 @@
+/* { dg-do run } */
+
+class foo_t {
+ int x;
+ static int count;
+public:
+ foo_t(void) { x=++count; }
+ int get(void) { return x; }
+};
+
+int foo_t::count;
+
+extern foo_t foo1, foo2;
+
+int main(void) {
+
+ if ( (foo1.get() != 2) || (foo2.get() != 1) )
+ abort();
+ exit(0);
+}
diff --git a/gcc/testsuite/g++.dg/special/conpr-2a.C b/gcc/testsuite/g++.dg/special/conpr-2a.C
new file mode 100755
index 0000000..69fb7d6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/special/conpr-2a.C
@@ -0,0 +1,12 @@
+/* { dg-do run } */
+
+class foo_t {
+ int x;
+ static int count;
+public:
+ foo_t(void) { x=++count; }
+ int get(void) { return x; }
+};
+
+foo_t foo1 __attribute__((init_priority(6000)));
+foo_t foo2 __attribute__((init_priority(5000)));
diff --git a/gcc/testsuite/g++.dg/special/conpr-3.C b/gcc/testsuite/g++.dg/special/conpr-3.C
new file mode 100755
index 0000000..07ba8ab
--- /dev/null
+++ b/gcc/testsuite/g++.dg/special/conpr-3.C
@@ -0,0 +1,20 @@
+/* { dg-do run } */
+
+class foo_t {
+ int x;
+ static int count;
+public:
+ foo_t(void) { x=++count; }
+ int get(void) { return x; }
+};
+
+int foo_t::count;
+
+extern foo_t foo1, foo2;
+
+int main(void) {
+
+ if ( (foo1.get() != 2) || (foo2.get() != 1) )
+ abort();
+ exit(0);
+}
diff --git a/gcc/testsuite/g++.dg/special/conpr-3a.C b/gcc/testsuite/g++.dg/special/conpr-3a.C
new file mode 100755
index 0000000..b237bb5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/special/conpr-3a.C
@@ -0,0 +1,11 @@
+/* { dg-do run } */
+
+class foo_t {
+ int x;
+ static int count;
+public:
+ foo_t(void) { x=++count; }
+ int get(void) { return x; }
+};
+
+foo_t foo1 __attribute__((init_priority(6000)));
diff --git a/gcc/testsuite/g++.dg/special/conpr-3b.C b/gcc/testsuite/g++.dg/special/conpr-3b.C
new file mode 100755
index 0000000..b5efa0c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/special/conpr-3b.C
@@ -0,0 +1,11 @@
+/* { dg-do run } */
+
+class foo_t {
+ int x;
+ static int count;
+public:
+ foo_t(void) { x=++count; }
+ int get(void) { return x; }
+};
+
+foo_t foo2 __attribute__((init_priority(5000)));
diff --git a/gcc/testsuite/g++.dg/special/ecos.exp b/gcc/testsuite/g++.dg/special/ecos.exp
new file mode 100755
index 0000000..34a54b7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/special/ecos.exp
@@ -0,0 +1,75 @@
+# Copyright (C) 1999 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# jlarmour@cygnus.co.uk
+
+# This file was written by Jonathan Larmour (jlarmour@cygnus.co.uk).
+
+# G++ testsuite that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib g++-dg.exp
+
+###########
+# conpr-1.C
+###########
+
+dg-init
+dg-runtest "$srcdir/$subdir/conpr-1.C" "-finit-priority" ""
+dg-finish
+
+
+###########
+# conpr-2.C
+###########
+
+dg-init
+
+set lines [g++_target_compile "$srcdir/$subdir/conpr-2a.C" "conpr-2a.o" object "additional_flags=-finit-priority"]
+if ![string match "" $lines] then {
+ fail "conpr-2a.o"
+} else {
+ dg-runtest "$srcdir/$subdir/conpr-2.C" "conpr-2a.o" "-finit-priority"
+ file delete conpr-2a.o
+}
+dg-finish
+
+
+###########
+# conpr-3.C
+###########
+
+dg-init
+
+set lines [g++_target_compile "$srcdir/$subdir/conpr-3a.C" "conpr-3a.o" object "additional_flags=-finit-priority"]
+if ![string match "" $lines] then {
+ fail "conpr-3a.o"
+} else {
+ set lines [g++_target_compile "$srcdir/$subdir/conpr-3b.C" "conpr-3b.o" object "additional_flags=-finit-priority"]
+ if ![string match "" $lines] then {
+ fail "conpr-3b.o"
+ } else {
+ # run it with objects both ways around!
+ dg-runtest "$srcdir/$subdir/conpr-3.C" "conpr-3a.o conpr-3b.o" "-finit-priority"
+ dg-runtest "$srcdir/$subdir/conpr-3.C" "conpr-3b.o conpr-3a.o" "-finit-priority"
+ file delete conpr-3a.o conpr-3b.o
+ }
+}
+dg-finish
+
+
+### EOF ecos.exp