1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
2 | |
3 | // Check the force_cuda_host_device pragma. |
4 | |
5 | #pragma clang force_cuda_host_device begin |
6 | void f(); |
7 | #pragma clang force_cuda_host_device begin |
8 | void g(); |
9 | #pragma clang force_cuda_host_device end |
10 | void h(); |
11 | #pragma clang force_cuda_host_device end |
12 | |
13 | void i(); // expected-note {{not viable}} |
14 | |
15 | void host() { |
16 | f(); |
17 | g(); |
18 | h(); |
19 | i(); |
20 | } |
21 | |
22 | __attribute__((device)) void device() { |
23 | f(); |
24 | g(); |
25 | h(); |
26 | i(); // expected-error {{no matching function}} |
27 | } |
28 | |
29 | #pragma clang force_cuda_host_device foo |
30 | // expected-warning@-1 {{incorrect use of #pragma clang force_cuda_host_device begin|end}} |
31 | |
32 | #pragma clang force_cuda_host_device |
33 | // expected-warning@-1 {{incorrect use of #pragma clang force_cuda_host_device begin|end}} |
34 | |
35 | #pragma clang force_cuda_host_device begin foo |
36 | // expected-warning@-1 {{incorrect use of #pragma clang force_cuda_host_device begin|end}} |
37 | |