diff mbox

C++ OpenACC routine directive testing: templated, and "auto", trailing return type syntax

Message ID 87invg8wp8.fsf@kepler.schwinge.homeip.net
State New
Headers show

Commit Message

Thomas Schwinge Aug. 4, 2016, 1:56 p.m. UTC
Hi!

On Tue, 12 Jul 2016 15:55:37 +0200, Jakub Jelinek <jakub@redhat.com> wrote:
> On Tue, Jul 12, 2016 at 03:50:14PM +0200, Thomas Schwinge wrote:
> > Templated, and "auto", trailing return type syntax with the C++ OpenACC
> > routine directive all works, but doesn't have test coverage.  OK for
> > trunk?

> >     C++ OpenACC routine directive testing: templated, and "auto", trailing return type syntax

> Ok.

Committed to trunk in r239126:

commit ae6f822e37f1ab662ae467abcb5719c4cbf2d230
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Thu Aug 4 13:35:10 2016 +0000

    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.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239126 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog                                            |  9 +++++++++
 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 ++++++++++--
 7 files changed, 61 insertions(+), 2 deletions(-)



Grüße
 Thomas
diff mbox

Patch

diff --git libgomp/ChangeLog libgomp/ChangeLog
index cc76b7b..70e765e 100644
--- libgomp/ChangeLog
+++ 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 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;

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(-)

diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index 4320237..9ef3d5f 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -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.
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..771a273
--- /dev/null
+++ libgomp/testsuite/libgomp.oacc-c++/routine-1-auto.C
@@ -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"
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..17bdaa0
--- /dev/null
+++ libgomp/testsuite/libgomp.oacc-c++/routine-1-template-auto.C
@@ -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"
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..99faa86
--- /dev/null
+++ libgomp/testsuite/libgomp.oacc-c++/routine-1-template-trailing-return-type.C
@@ -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"
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..89defb1
--- /dev/null
+++ libgomp/testsuite/libgomp.oacc-c++/routine-1-template.C
@@ -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"
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..767e0ce
--- /dev/null
+++ libgomp/testsuite/libgomp.oacc-c++/routine-1-trailing-return-type.C
@@ -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"
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-1.c
index f2ebaf1..0f70e26 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-1.c
+++ libgomp/testsuite/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;