@@ -1,3 +1,11 @@
+2014-10-30 Thomas Schwinge <thomas@codesourcery.com>
+
+ * c-c++-common/goacc/acc_on_device-1.c: Move...
+ * gcc.dg/goacc/acc_on_device-1.c: ... here.
+ (dg-additional-options): Add -std=c89.
+ * c-c++-common/goacc/acc_on_device-2-off.c: Extend for C++.
+ * c-c++-common/goacc/acc_on_device-2.c: Likewise.
+
2014-10-20 Thomas Schwinge <thomas@codesourcery.com>
* gcc.dg/goacc/sb-1.c: Move file...
@@ -1,13 +1,21 @@
/* Have to enable optimizations, as otherwise builtins won't be expanded. */
/* { dg-additional-options "-O -fdump-rtl-expand -fno-openacc" } */
+#if __cplusplus
+extern "C" {
+#endif
+
typedef enum acc_device_t { acc_device_X = 123 } acc_device_t;
extern int acc_on_device (acc_device_t);
+#if __cplusplus
+}
+#endif
+
int
f (void)
{
- const int dev = acc_device_X;
+ const acc_device_t dev = acc_device_X;
return acc_on_device (dev);
}
@@ -1,17 +1,29 @@
/* Have to enable optimizations, as otherwise builtins won't be expanded. */
/* { dg-additional-options "-O -fdump-rtl-expand" } */
+#if __cplusplus
+extern "C" {
+#endif
+
typedef enum acc_device_t { acc_device_X = 123 } acc_device_t;
extern int acc_on_device (acc_device_t);
+#if __cplusplus
+}
+#endif
+
int
f (void)
{
- const int dev = acc_device_X;
+ const acc_device_t dev = acc_device_X;
return acc_on_device (dev);
}
/* With -fopenacc, we're expecting the builtin to be expanded, so no calls.
- { dg-final { scan-rtl-dump-times "\\\(call \[^\\n\]*\\\"acc_on_device" 0 "expand" } } */
+ TODO: in C++, even under extern "C", the use of enum for acc_device_t
+ perturbs expansion as a builtin, which expects an int parameter. It's fine
+ when changing acc_device_t to plain int, but that's not what we're doing in
+ <openacc.h>.
+ { dg-final { scan-rtl-dump-times "\\\(call \[^\\n\]*\\\"acc_on_device" 0 "expand" { xfail c++ } } } */
/* { dg-final { cleanup-rtl-dump "expand" } } */
similarity index 82%
rename from gcc/testsuite/c-c++-common/goacc/acc_on_device-1.c
rename to gcc/testsuite/gcc.dg/goacc/acc_on_device-1.c
@@ -1,5 +1,5 @@
/* Have to enable optimizations, as otherwise builtins won't be expanded. */
-/* { dg-additional-options "-O -fdump-rtl-expand -Wno-implicit-function-declaration" } */
+/* { dg-additional-options "-O -fdump-rtl-expand -std=c89 -Wno-implicit-function-declaration" } */
int
f (void)