1 | // Test this without pch. |
2 | // RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only |
3 | |
4 | // Test with pch. |
5 | // RUN: %clang_cc1 -x cl %S/extension-begin.h -triple spir-unknown-unknown -emit-pch -o %t.pch -pedantic |
6 | // RUN: %clang_cc1 %s -triple spir-unknown-unknown -include-pch %t.pch -DIMPLICIT_INCLUDE -DUSE_PCH -fsyntax-only -verify -pedantic |
7 | |
8 | // Test with modules |
9 | // RUN: rm -rf %t.modules |
10 | // RUN: mkdir -p %t.modules |
11 | // |
12 | // RUN: %clang_cc1 -cl-std=CL1.2 -DIMPLICIT_INCLUDE -include %S/extension-begin.h -triple spir-unknown-unknown -O0 -emit-llvm -o - -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.modules %s -verify -pedantic |
13 | // |
14 | // RUN: rm -rf %t.modules |
15 | // RUN: mkdir -p %t.modules |
16 | // |
17 | // RUN: %clang_cc1 -cl-std=CL2.0 -DIMPLICIT_INCLUDE -include %S/extension-begin.h -triple spir-unknown-unknown -O0 -emit-llvm -o - -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.modules %s -verify -pedantic |
18 | |
19 | #ifndef IMPLICIT_INCLUDE |
20 | #include "extension-begin.h" |
21 | #endif // IMPLICIT_INCLUDE |
22 | #ifndef USE_PCH |
23 | // expected-warning@extension-begin.h:4 {{expected 'disable' - ignoring}} |
24 | // expected-warning@extension-begin.h:5 {{expected 'disable' - ignoring}} |
25 | // expected-warning@extension-begin.h:21 {{OpenCL extension end directive mismatches begin directive - ignoring}} |
26 | #endif // USE_PCH |
27 | |
28 | #pragma OPENCL EXTENSION my_ext : enable |
29 | void test_f1(void) { |
30 | struct A test_A1; |
31 | f(); |
32 | g(0); |
33 | } |
34 | |
35 | #pragma OPENCL EXTENSION my_ext : disable |
36 | void test_f2(void) { |
37 | struct A test_A2; // expected-error {{use of type 'struct A' requires my_ext extension to be enabled}} |
38 | const struct A test_A_local; // expected-error {{use of type 'struct A' requires my_ext extension to be enabled}} |
39 | TypedefOfA test_typedef_A; // expected-error {{use of type 'TypedefOfA' (aka 'struct A') requires my_ext extension to be enabled}} |
40 | PointerOfA test_A_pointer; // expected-error {{use of type 'PointerOfA' (aka 'const struct A *') requires my_ext extension to be enabled}} |
41 | f(); // expected-error {{use of declaration 'f' requires my_ext extension to be enabled}} |
42 | g(0); // expected-error {{no matching function for call to 'g'}} |
43 | // expected-note@extension-begin.h:18 {{candidate unavailable as it requires OpenCL extension 'my_ext' to be enabled}} |
44 | // expected-note@extension-begin.h:23 {{candidate function not viable: requires 0 arguments, but 1 was provided}} |
45 | } |
46 | |
47 | |