| 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 |
#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 |
| 25 |
|
| 26 |
#ifndef IMPLICIT_INCLUDE |
| 27 |
#include "extension-begin.h" |
| 28 |
#endif // IMPLICIT_INCLUDE |
| 29 |
#ifndef USE_PCH |
| 30 |
// [email protected]:4 {{expected 'disable' - ignoring}} |
| 31 |
// [email protected]:5 {{expected 'disable' - ignoring}} |
| 32 |
#endif // USE_PCH |
| 33 |
|
| 34 |
#if defined(IMPLICIT_INCLUDE) && defined(USE_PCH) |
| 35 |
//expected-no-diagnostics |
| 36 |
#endif |
| 37 |
|
| 38 |
// Tests that the pragmas are accepted for backward compatibility. |
| 39 |
#pragma OPENCL EXTENSION my_ext : enable |
| 40 |
#pragma OPENCL EXTENSION my_ext : disable |
| 41 |
|
| 42 |
#ifndef my_ext |
| 43 |
#error "Missing my_ext macro" |
| 44 |
#endif |
| 45 |
|
| 46 |
// When extension is supported its functionality can be used freely. |
| 47 |
void test(void) { |
| 48 |
struct A test_A1; |
| 49 |
f(); |
| 50 |
g(0); |
| 51 |
} |