|
1 | | -//==------ version.hpp --- SYCL compiler version macro ---------*- C++ -*---==// |
| 1 | +//==------- version.hpp --- SYCL library version macro ---------*- C++ -*---==// |
2 | 2 | // |
3 | 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | 4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | 6 | // |
7 | 7 | //===----------------------------------------------------------------------===// |
8 | 8 |
|
| 9 | +// __SYCL_COMPILER_VERSION is a legacy macro which does not represent a compiler |
| 10 | +// version, but instead only conveys a date when sycl library was built. |
| 11 | + |
| 12 | +#if /* defined(__GNUC__) || */ defined(__clang__) |
| 13 | +// clang supports GCC-style pragma messages, but GCC does not! |
| 14 | +// include/sycl/version.hpp error: missing binary operator before token "(" |
| 15 | +// 14 | #define __SYCL_COMPILER_VERSION _Pragma("GCC warning \"..\"") 20241120 |
| 16 | + |
| 17 | +#cmakedefine __SYCL_COMPILER_VERSION _Pragma( \ |
| 18 | + "GCC warning \"__SYCL_COMPILER_VERSION is deprecated, " \ |
| 19 | + "use __LIBSYCL_TIMESTAMP instead\"") ${__SYCL_COMPILER_VERSION} |
| 20 | +#elif defined(_MSC_VER) |
| 21 | +#cmakedefine __SYCL_COMPILER_VERSION ${__SYCL_COMPILER_VERSION} |
| 22 | +// It seems like MSVC ignores that pragma if its embedded into a macro |
| 23 | +// definition, so we have it on a standalone line |
| 24 | +_Pragma("deprecated(\"__SYCL_COMPILER_VERSION\")") |
| 25 | +#else |
| 26 | +// As a fallback, we still define the macro, but without a deprecation warning. |
| 27 | +// This path is only expected to be taken when 3rd-party host compiler is used |
| 28 | +// and that is not clang/msvc |
9 | 29 | #cmakedefine __SYCL_COMPILER_VERSION ${__SYCL_COMPILER_VERSION} |
| 30 | +#endif |
| 31 | + |
| 32 | +#cmakedefine __LIBSYCL_TIMESTAMP ${__LIBSYCL_TIMESTAMP} |
| 33 | + |
10 | 34 | #define __LIBSYCL_MAJOR_VERSION ${SYCL_MAJOR_VERSION} |
11 | 35 | #define __LIBSYCL_MINOR_VERSION ${SYCL_MINOR_VERSION} |
12 | 36 | #define __LIBSYCL_PATCH_VERSION ${SYCL_PATCH_VERSION} |
0 commit comments