@@ -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.
new file mode 100644
@@ -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"
new file mode 100644
@@ -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"
new file mode 100644
@@ -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"
new file mode 100644
@@ -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"
new file mode 100644
@@ -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"
@@ -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;
Backported to gomp-4_0-branch in r239130:
commit 13111b771ee2093a4dc0256ee31c4ea6648084c0
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Thu Aug 4 13:49:25 2016 +0000
C++ OpenACC routine directive testing: templated, and "auto", trailing return type syntax
Backport trunk r239126:
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@239130 138bc75d-0d04-0410-961f-82ee72b054a4
---
libgomp/ChangeLog.gomp | 10 ++++++++++
libgomp/testsuite/libgomp.oacc-c++/routine-1-auto.C | 7 +++++++
libgomp/testsuite/libgomp.oacc-c++/routine-1-template-auto.C | 6 ++++++
.../routine-1-template-trailing-return-type.C | 6 ++++++
libgomp/testsuite/libgomp.oacc-c++/routine-1-template.C | 6 ++++++
.../libgomp.oacc-c++/routine-1-trailing-return-type.C | 7 +++++++
libgomp/testsuite/libgomp.oacc-c-c++-common/routine-1.c | 12 ++++++++++--
7 files changed, 52 insertions(+), 2 deletions(-)
@@ -1,5 +1,15 @@
2016-08-04 Thomas Schwinge <thomas@codesourcery.com>
+ Backport trunk r239126:
+ * 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.
+
Backport trunk r239125:
* testsuite/libgomp.oacc-c-c++-common/crash-1.c: Make it a "link"
test, and don't hardcode -O0.
new file mode 100644
@@ -0,0 +1,7 @@
+// Routine with "auto" return type.
+
+#define TEMPLATE
+#define TYPE int
+#define RETURN_1 auto
+#define RETURN_2
+#include "../libgomp.oacc-c-c++-common/routine-1.c"
new file mode 100644
@@ -0,0 +1,6 @@
+// Templated routine with "auto" return type.
+
+#define TEMPLATE template<typename TYPE>
+#define RETURN_1 auto
+#define RETURN_2
+#include "../libgomp.oacc-c-c++-common/routine-1.c"
new file mode 100644
@@ -0,0 +1,6 @@
+// Templated routine using trailing return type syntax.
+
+#define TEMPLATE template<typename TYPE>
+#define RETURN_1 auto
+#define RETURN_2 -> TYPE
+#include "../libgomp.oacc-c-c++-common/routine-1.c"
new file mode 100644
@@ -0,0 +1,6 @@
+// Templated routine.
+
+#define TEMPLATE template<typename TYPE>
+#define RETURN_1 TYPE
+#define RETURN_2
+#include "../libgomp.oacc-c-c++-common/routine-1.c"
new file mode 100644
@@ -0,0 +1,7 @@
+// Routine using trailing return type syntax.
+
+#define TEMPLATE
+#define TYPE int
+#define RETURN_1 auto
+#define RETURN_2 -> TYPE
+#include "../libgomp.oacc-c-c++-common/routine-1.c"
@@ -1,8 +1,16 @@
-#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;