From 93c852631d7d98acd44f5c516d4ea13ceb8f8e5a Mon Sep 17 00:00:00 2001 From: Pavel V Chupin Date: Thu, 15 Dec 2022 15:29:32 -0800 Subject: [PATCH 1/2] [SYCL] sycl_special_class is avaialble in SYCL device compilation only Fixes unrecognized attribute warning when code is compiled in C++ mode. Discovered at #7672. --- sycl/include/sycl/detail/defines.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/include/sycl/detail/defines.hpp b/sycl/include/sycl/detail/defines.hpp index 23df19ce4b284..e1031aaec9f53 100644 --- a/sycl/include/sycl/detail/defines.hpp +++ b/sycl/include/sycl/detail/defines.hpp @@ -21,7 +21,7 @@ #endif #endif -#if __has_attribute(sycl_special_class) +#if __has_attribute(sycl_special_class) && defined(SYCL_DEVICE_ONLY) #define __SYCL_SPECIAL_CLASS __attribute__((sycl_special_class)) #else #define __SYCL_SPECIAL_CLASS From 990943d78a04d8f0c8c3b1a9ed061def2a2603c2 Mon Sep 17 00:00:00 2001 From: Pavel Chupin Date: Thu, 15 Dec 2022 15:35:52 -0800 Subject: [PATCH 2/2] Update sycl/include/sycl/detail/defines.hpp Co-authored-by: Alexey Bader --- sycl/include/sycl/detail/defines.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/include/sycl/detail/defines.hpp b/sycl/include/sycl/detail/defines.hpp index e1031aaec9f53..951d098cceb74 100644 --- a/sycl/include/sycl/detail/defines.hpp +++ b/sycl/include/sycl/detail/defines.hpp @@ -21,7 +21,7 @@ #endif #endif -#if __has_attribute(sycl_special_class) && defined(SYCL_DEVICE_ONLY) +#if __has_attribute(sycl_special_class) && defined(__SYCL_DEVICE_ONLY__) #define __SYCL_SPECIAL_CLASS __attribute__((sycl_special_class)) #else #define __SYCL_SPECIAL_CLASS