C++ OpenACC routine directive testing: templated, and "auto", trailing return type...
authorThomas Schwinge <thomas@codesourcery.com>
Thu, 4 Aug 2016 13:35:10 +0000 (15:35 +0200)
committerThomas Schwinge <tschwinge@gcc.gnu.org>
Thu, 4 Aug 2016 13:35:10 +0000 (15:35 +0200)
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

libgomp/ChangeLog
libgomp/testsuite/libgomp.oacc-c++/routine-1-auto.C [new file with mode: 0644]
libgomp/testsuite/libgomp.oacc-c++/routine-1-template-auto.C [new file with mode: 0644]
libgomp/testsuite/libgomp.oacc-c++/routine-1-template-trailing-return-type.C [new file with mode: 0644]
libgomp/testsuite/libgomp.oacc-c++/routine-1-template.C [new file with mode: 0644]
libgomp/testsuite/libgomp.oacc-c++/routine-1-trailing-return-type.C [new file with mode: 0644]
libgomp/testsuite/libgomp.oacc-c-c++-common/routine-1.c

index cc76b7b5fe2ad60942c361df61c9be83fe393f48..70e765ef33a756cf471666d205b2223c9c85984c 100644 (file)
@@ -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 (file)
index 0000000..f4b54e5
--- /dev/null
@@ -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 (file)
index 0000000..444f1f3
--- /dev/null
@@ -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 (file)
index 0000000..bfe2787
--- /dev/null
@@ -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 (file)
index 0000000..a7e0323
--- /dev/null
@@ -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 (file)
index 0000000..3074ba4
--- /dev/null
@@ -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"
index f112457c168ec72f494879ae4df095da534c8b0a..2a36b3b1fac6b1b7661b33d7dafeceb11902534e 100644 (file)
@@ -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;