DPC++ Runtime
Runtime libraries for oneAPI DPC++
defines_elementary.hpp
Go to the documentation of this file.
1 //==--- defines_elementary.hpp ---- Preprocessor directives (simplified) ---==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #pragma once
10 
11 #define __SYCL_INLINE_VER_NAMESPACE(X) inline namespace X
12 
13 #ifndef __has_attribute
14 #define __has_attribute(x) 0
15 #endif
16 
17 #ifndef __has_builtin
18 #define __has_builtin(x) 0
19 #endif // __has_builtin
20 
21 #ifndef __SYCL_ALWAYS_INLINE
22 #if __has_attribute(always_inline)
23 #define __SYCL_ALWAYS_INLINE __attribute__((always_inline))
24 #else
25 #define __SYCL_ALWAYS_INLINE
26 #endif
27 #endif // __SYCL_ALWAYS_INLINE
28 
29 #ifdef SYCL_EXTERNAL
30 #define __DPCPP_SYCL_EXTERNAL SYCL_EXTERNAL
31 #else
32 #ifdef __SYCL_DEVICE_ONLY__
33 #define __DPCPP_SYCL_EXTERNAL __attribute__((sycl_device))
34 #else
35 #define __DPCPP_SYCL_EXTERNAL
36 #define SYCL_EXTERNAL
37 #endif
38 #endif
39 
40 #ifndef __SYCL_ID_QUERIES_FIT_IN_INT__
41 #define __SYCL_ID_QUERIES_FIT_IN_INT__ 0
42 #endif
43 
44 #ifndef __SYCL_DEPRECATED
45 #if !defined(SYCL2020_DISABLE_DEPRECATION_WARNINGS)
46 #define __SYCL_DEPRECATED(message) [[deprecated(message)]]
47 #else // SYCL_DISABLE_DEPRECATION_WARNINGS
48 #define __SYCL_DEPRECATED(message)
49 #endif // SYCL_DISABLE_DEPRECATION_WARNINGS
50 #endif // __SYCL_DEPRECATED
51 
52 #ifndef __SYCL2020_DEPRECATED
53 #if SYCL_LANGUAGE_VERSION >= 202001 && \
54  !defined(SYCL2020_DISABLE_DEPRECATION_WARNINGS)
55 #define __SYCL2020_DEPRECATED(message) __SYCL_DEPRECATED(message)
56 #else
57 #define __SYCL2020_DEPRECATED(message)
58 #endif
59 #endif // __SYCL2020_DEPRECATED
60 
61 #ifndef __SYCL_HAS_CPP_ATTRIBUTE
62 #if defined(__cplusplus) && defined(__has_cpp_attribute)
63 #define __SYCL_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
64 #else
65 #define __SYCL_HAS_CPP_ATTRIBUTE(x) 0
66 #endif
67 #endif
68 
69 // Stringify an argument to pass it in _Pragma directive below.
70 #ifndef __SYCL_STRINGIFY
71 #define __SYCL_STRINGIFY(x) #x
72 #endif // __SYCL_STRINGIFY
73 
74 static_assert(__cplusplus >= 201703L,
75  "DPCPP does not support C++ version earlier than C++17.");