This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ OpenACC routine directive testing: templated, and "auto", trailing return type syntax
- From: Thomas Schwinge <thomas at codesourcery dot com>
- To: Jakub Jelinek <jakub at redhat dot com>, <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 12 Jul 2016 15:50:14 +0200
- Subject: C++ OpenACC routine directive testing: templated, and "auto", trailing return type syntax
- Authentication-results: sourceware.org; auth=none
Hi!
Templated, and "auto", trailing return type syntax with the C++ OpenACC
routine directive all works, but doesn't have test coverage. OK for
trunk?
commit 7a387329674b07b8eb7e07cff665250284b4524b
Author: Thomas Schwinge <thomas@codesourcery.com>
Date: Thu Jul 7 16:12:15 2016 +0200
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.
---
libgomp/testsuite/libgomp.oacc-c++/routine-1-auto.C | 9 +++++++++
libgomp/testsuite/libgomp.oacc-c++/routine-1-template-auto.C | 8 ++++++++
.../routine-1-template-trailing-return-type.C | 8 ++++++++
libgomp/testsuite/libgomp.oacc-c++/routine-1-template.C | 8 ++++++++
.../libgomp.oacc-c++/routine-1-trailing-return-type.C | 9 +++++++++
libgomp/testsuite/libgomp.oacc-c-c++-common/routine-1.c | 12 ++++++++++--
6 files changed, 52 insertions(+), 2 deletions(-)
diff --git libgomp/testsuite/libgomp.oacc-c++/routine-1-auto.C libgomp/testsuite/libgomp.oacc-c++/routine-1-auto.C
new file mode 100644
index 0000000..f4b54e5
--- /dev/null
+++ 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 libgomp/testsuite/libgomp.oacc-c++/routine-1-template-auto.C libgomp/testsuite/libgomp.oacc-c++/routine-1-template-auto.C
new file mode 100644
index 0000000..444f1f3
--- /dev/null
+++ 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 libgomp/testsuite/libgomp.oacc-c++/routine-1-template-trailing-return-type.C libgomp/testsuite/libgomp.oacc-c++/routine-1-template-trailing-return-type.C
new file mode 100644
index 0000000..bfe2787
--- /dev/null
+++ 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 libgomp/testsuite/libgomp.oacc-c++/routine-1-template.C libgomp/testsuite/libgomp.oacc-c++/routine-1-template.C
new file mode 100644
index 0000000..a7e0323
--- /dev/null
+++ 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 libgomp/testsuite/libgomp.oacc-c++/routine-1-trailing-return-type.C libgomp/testsuite/libgomp.oacc-c++/routine-1-trailing-return-type.C
new file mode 100644
index 0000000..3074ba4
--- /dev/null
+++ 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 libgomp/testsuite/libgomp.oacc-c-c++-common/routine-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-1.c
index f112457..2a36b3b 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-1.c
+++ 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;
Grüße
Thomas