1 // Test this without pch.
2 // RUN
: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only
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
9 // RUN
: rm -rf %t.modules
10 // RUN
: mkdir -p %t.modules
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
14 // RUN
: rm -rf %t.modules
15 // RUN
: mkdir -p %t.modules
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
19 #pragma OPENCL EXTENSION my_ext
: enable
20 #ifndef IMPLICIT_INCLUDE
21 // expected-warning
@-
2 {{OpenCL extension
'my_ext
' unknown or does not require pragma - ignoring
}}
22 // expected-warning
@+2 {{OpenCL extension
'my_ext
' unknown or does not require pragma - ignoring
}}
23 #endif
// IMPLICIT_INCLUDE
24 #pragma OPENCL EXTENSION my_ext
: disable
26 #ifndef IMPLICIT_INCLUDE
27 #include
"extension-begin.h"
28 #endif
// IMPLICIT_INCLUDE
30 // expected-warning
@extension-begin.h
:4 {{expected
'disable
' - ignoring
}}
31 // expected-warning
@extension-begin.h
:5 {{expected
'disable
' - ignoring
}}
34 #if defined
(IMPLICIT_INCLUDE) && defined
(USE_PCH)
35 //expected-no-diagnostics
38 // Tests that the pragmas are accepted for backward compatibility.
39 #pragma OPENCL EXTENSION my_ext
: enable
40 #pragma OPENCL EXTENSION my_ext
: disable
43 #error
"Missing my_ext macro"
46 // When extension is supported its functionality can be used freely.