function-target-disabled-check.cu 720 B

1234567891011121314151617181920212223242526
  1. // Test that we can disable cross-target call checks in Sema with the
  2. // -fcuda-disable-target-call-checks flag. Without this flag we'd get a bunch
  3. // of errors here, since there are invalid cross-target calls present.
  4. // RUN: %clang_cc1 -fsyntax-only -verify %s -fcuda-disable-target-call-checks
  5. // RUN: %clang_cc1 -fsyntax-only -fcuda-is-device -verify %s -fcuda-disable-target-call-checks
  6. // expected-no-diagnostics
  7. #define __device__ __attribute__((device))
  8. #define __global__ __attribute__((global))
  9. #define __host__ __attribute__((host))
  10. __attribute__((host)) void h1();
  11. __attribute__((device)) void d1() {
  12. h1();
  13. }
  14. __attribute__((host)) void h2() {
  15. d1();
  16. }
  17. __attribute__((global)) void g1() {
  18. h2();
  19. }