From bbc79c0e9ee0f8a3e6a2e0a4ec104d2b86e093b9 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Thu, 4 Aug 2016 15:35:10 +0200 Subject: [PATCH] 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 --- libgomp/ChangeLog | 9 +++++++++ libgomp/testsuite/libgomp.oacc-c++/routine-1-auto.C | 9 +++++++++ .../libgomp.oacc-c++/routine-1-template-auto.C | 8 ++++++++ .../routine-1-template-trailing-return-type.C | 8 ++++++++ .../testsuite/libgomp.oacc-c++/routine-1-template.C | 8 ++++++++ .../routine-1-trailing-return-type.C | 9 +++++++++ .../testsuite/libgomp.oacc-c-c++-common/routine-1.c | 12 ++++++++++-- 7 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 libgomp/testsuite/libgomp.oacc-c++/routine-1-auto.C create mode 100644 libgomp/testsuite/libgomp.oacc-c++/routine-1-template-auto.C create mode 100644 libgomp/testsuite/libgomp.oacc-c++/routine-1-template-trailing-return-type.C create mode 100644 libgomp/testsuite/libgomp.oacc-c++/routine-1-template.C create mode 100644 libgomp/testsuite/libgomp.oacc-c++/routine-1-trailing-return-type.C diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index cc76b7b5fe2..70e765ef33a 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,5 +1,14 @@ 2016-08-04 Thomas Schwinge + * 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 00000000000..f4b54e55fa7 --- /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 00000000000..444f1f32a76 --- /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 +#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 00000000000..bfe2787d931 --- /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 +#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 00000000000..a7e0323d44f --- /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 +#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 00000000000..3074ba47c2a --- /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 f112457c168..2a36b3b1fac 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 +// 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 #pragma acc routine -int fact(int n) +TEMPLATE +RETURN_1 fact(TYPE n) RETURN_2 { if (n == 0 || n == 1) return 1; -- 2.30.2