aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2016-08-04 15:35:10 +0200
committerThomas Schwinge <tschwinge@gcc.gnu.org>2016-08-04 15:35:10 +0200
commitbbc79c0e9ee0f8a3e6a2e0a4ec104d2b86e093b9 (patch)
tree5ae825923aba6b78ae3122230826bfa9e15fd4fd
parent9ef64248fe2c609a7018dcd9ce436467991bd483 (diff)
downloadgcc-bbc79c0e9ee0f8a3e6a2e0a4ec104d2b86e093b9.zip
gcc-bbc79c0e9ee0f8a3e6a2e0a4ec104d2b86e093b9.tar.gz
gcc-bbc79c0e9ee0f8a3e6a2e0a4ec104d2b86e093b9.tar.bz2
C++ OpenACC routine directive testing: templated, and "auto", trailing return type syntax
libgomp/ * testsuite/libgomp.oacc-c++/routine-1-auto.C: New file. * testsuite/libgomp.oacc-c++/routine-1-template-auto.C: Likewise. * testsuite/libgomp.oacc-c++/routine-1-template-trailing-return-type.C: Likewise. * testsuite/libgomp.oacc-c++/routine-1-template.C: Likewise. * testsuite/libgomp.oacc-c++/routine-1-trailing-return-type.C: Likewise. * testsuite/libgomp.oacc-c-c++-common/routine-1.c: Adjust. From-SVN: r239126
-rw-r--r--libgomp/ChangeLog9
-rw-r--r--libgomp/testsuite/libgomp.oacc-c++/routine-1-auto.C9
-rw-r--r--libgomp/testsuite/libgomp.oacc-c++/routine-1-template-auto.C8
-rw-r--r--libgomp/testsuite/libgomp.oacc-c++/routine-1-template-trailing-return-type.C8
-rw-r--r--libgomp/testsuite/libgomp.oacc-c++/routine-1-template.C8
-rw-r--r--libgomp/testsuite/libgomp.oacc-c++/routine-1-trailing-return-type.C9
-rw-r--r--libgomp/testsuite/libgomp.oacc-c-c++-common/routine-1.c12
7 files changed, 61 insertions, 2 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index cc76b7b..70e765e 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,5 +1,14 @@
2016-08-04 Thomas Schwinge <thomas@codesourcery.com>
+ * testsuite/libgomp.oacc-c++/routine-1-auto.C: New file.
+ * testsuite/libgomp.oacc-c++/routine-1-template-auto.C: Likewise.
+ * testsuite/libgomp.oacc-c++/routine-1-template-trailing-return-type.C:
+ Likewise.
+ * testsuite/libgomp.oacc-c++/routine-1-template.C: Likewise.
+ * testsuite/libgomp.oacc-c++/routine-1-trailing-return-type.C:
+ Likewise.
+ * testsuite/libgomp.oacc-c-c++-common/routine-1.c: Adjust.
+
* testsuite/libgomp.oacc-c-c++-common/crash-1.c: Make it a "link"
test, and don't hardcode -O0.
diff --git a/libgomp/testsuite/libgomp.oacc-c++/routine-1-auto.C b/libgomp/testsuite/libgomp.oacc-c++/routine-1-auto.C
new file mode 100644
index 0000000..f4b54e5
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c++/routine-1-auto.C
@@ -0,0 +1,9 @@
+// Routine with "auto" return type.
+
+// { dg-additional-options "-fno-exceptions" }
+
+#define TEMPLATE
+#define TYPE int
+#define RETURN_1 auto
+#define RETURN_2
+#include "../libgomp.oacc-c-c++-common/routine-1.c"
diff --git a/libgomp/testsuite/libgomp.oacc-c++/routine-1-template-auto.C b/libgomp/testsuite/libgomp.oacc-c++/routine-1-template-auto.C
new file mode 100644
index 0000000..444f1f3
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c++/routine-1-template-auto.C
@@ -0,0 +1,8 @@
+// Templated routine with "auto" return type.
+
+// { dg-additional-options "-fno-exceptions" }
+
+#define TEMPLATE template<typename TYPE>
+#define RETURN_1 auto
+#define RETURN_2
+#include "../libgomp.oacc-c-c++-common/routine-1.c"
diff --git a/libgomp/testsuite/libgomp.oacc-c++/routine-1-template-trailing-return-type.C b/libgomp/testsuite/libgomp.oacc-c++/routine-1-template-trailing-return-type.C
new file mode 100644
index 0000000..bfe2787
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c++/routine-1-template-trailing-return-type.C
@@ -0,0 +1,8 @@
+// Templated routine using trailing return type syntax.
+
+// { dg-additional-options "-fno-exceptions" }
+
+#define TEMPLATE template<typename TYPE>
+#define RETURN_1 auto
+#define RETURN_2 -> TYPE
+#include "../libgomp.oacc-c-c++-common/routine-1.c"
diff --git a/libgomp/testsuite/libgomp.oacc-c++/routine-1-template.C b/libgomp/testsuite/libgomp.oacc-c++/routine-1-template.C
new file mode 100644
index 0000000..a7e0323
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c++/routine-1-template.C
@@ -0,0 +1,8 @@
+// Templated routine.
+
+// { dg-additional-options "-fno-exceptions" }
+
+#define TEMPLATE template<typename TYPE>
+#define RETURN_1 TYPE
+#define RETURN_2
+#include "../libgomp.oacc-c-c++-common/routine-1.c"
diff --git a/libgomp/testsuite/libgomp.oacc-c++/routine-1-trailing-return-type.C b/libgomp/testsuite/libgomp.oacc-c++/routine-1-trailing-return-type.C
new file mode 100644
index 0000000..3074ba4
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c++/routine-1-trailing-return-type.C
@@ -0,0 +1,9 @@
+// Routine using trailing return type syntax.
+
+// { dg-additional-options "-fno-exceptions" }
+
+#define TEMPLATE
+#define TYPE int
+#define RETURN_1 auto
+#define RETURN_2 -> TYPE
+#include "../libgomp.oacc-c-c++-common/routine-1.c"
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/routine-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/routine-1.c
index f112457..2a36b3b 100644
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/routine-1.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/routine-1.c
@@ -1,10 +1,18 @@
// { dg-additional-options "-fno-exceptions" }
-#include <stdio.h>
+// Defaults, if not "#include"d from ../libgomp.oacc-c++/routine-1-*.C.
+#ifndef TEMPLATE
+# define TEMPLATE
+# define TYPE int
+# define RETURN_1 TYPE
+# define RETURN_2
+#endif
+
#include <stdlib.h>
#pragma acc routine
-int fact(int n)
+TEMPLATE
+RETURN_1 fact(TYPE n) RETURN_2
{
if (n == 0 || n == 1)
return 1;