Remove openacc.h include from goacc/kernels-acc-on-device.c
2015-10-12 Tom de Vries <tom@codesourcery.com>
* c-c++-common/goacc/kernels-acc-on-device.c: Remove openacc.h include.
(enum acc_device_t, acc_on_device): Declare.
(foo): Remove unused vars. Use acc_device_X.
---
.../c-c++-common/goacc/kernels-acc-on-device.c | 27 ++++++++++++++++------
1 file changed, 20 insertions(+), 7 deletions(-)
@@ -1,23 +1,36 @@
/* { dg-additional-options "-O2" } */
-#include <openacc.h>
+#if __cplusplus
+extern "C" {
+#endif
+
+#if __cplusplus >= 201103
+# define __GOACC_NOTHROW noexcept
+#elif __cplusplus
+# define __GOACC_NOTHROW throw ()
+#else /* Not C++ */
+# define __GOACC_NOTHROW __attribute__ ((__nothrow__))
+#endif
+
+typedef enum acc_device_t { acc_device_X = 123 } acc_device_t;
+int acc_on_device (int) __GOACC_NOTHROW;
+
+#if __cplusplus
+}
+#endif
#define N 32
void
foo (float *a, float *b)
{
- float exp;
- int i;
- int n;
-
#pragma acc kernels copyin(a[0:N]) copyout(b[0:N])
{
int ii;
for (ii = 0; ii < N; ii++)
{
- if (acc_on_device (acc_device_host))
+ if (acc_on_device (acc_device_X))
b[ii] = a[ii] + 1;
else
b[ii] = a[ii];
@@ -30,7 +43,7 @@ foo (float *a, float *b)
for (ii = 0; ii < N; ii++)
{
- if (acc_on_device (acc_device_host))
+ if (acc_on_device (acc_device_X))
b[ii] = a[ii] + 2;
else
b[ii] = a[ii];
--
1.9.1