From 5c8433e823395fb104a3f525dabcd6e6901443cc Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Mon, 22 Sep 2025 18:33:55 +0200 Subject: [PATCH 1/2] [SYCL] Reduce scope of `SYCL2020_DISABLE_DEPRECATION_WARNINGS` macro We have two kinds of deprecations in our implementation: 1. Functionality that is deprecated by the SYCL 2020 specification. It must still be supported and will only be removed in the future version of the standard. We can only remove it once we drop support for the SYCL 2020 standard all together; 2. Functionality that is deprecated by us (some non-standard API accidentally made public for whichever reason, changes to extensions, etc.). Such functionality can be removed by us way quicker and it isn't tied to the SYCL 2020 standard; By some reason, the macro which is intended to control warnings about the group (1) also controlled warnings about the group (2) and this patch fixes that. `SYCL2020_DISABLE_DEPRECATION_WARNINGS` changed it so that it **only** control warnings from the group (1). Warnings from the group (2) can only be disabled with a newly introduced internal macro `__SYCL_DISABLE_DEPRECATION_WARNINGS` which we need to reduce the noise from building `libsycl.so` and unit-tests for it which still can reference deprecated functionality from the group (2). There is no user-visible macro provided for disabling warnings from the group (2). Anyone who wants to silence those warnings should use regular `-Wno-deprecated-declarations`. --- sycl/include/sycl/detail/defines_elementary.hpp | 2 +- sycl/source/CMakeLists.txt | 1 + sycl/unittests/CMakeLists.txt | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sycl/include/sycl/detail/defines_elementary.hpp b/sycl/include/sycl/detail/defines_elementary.hpp index f340f1018a257..c2d81d124abd7 100644 --- a/sycl/include/sycl/detail/defines_elementary.hpp +++ b/sycl/include/sycl/detail/defines_elementary.hpp @@ -58,7 +58,7 @@ #endif #ifndef __SYCL_DEPRECATED -#if !defined(SYCL2020_DISABLE_DEPRECATION_WARNINGS) +#if !defined(__SYCL_DISABLE_DEPRECATION_WARNINGS) #define __SYCL_DEPRECATED(message) [[deprecated(message)]] #else // SYCL_DISABLE_DEPRECATION_WARNINGS #define __SYCL_DEPRECATED(message) diff --git a/sycl/source/CMakeLists.txt b/sycl/source/CMakeLists.txt index 6a38cf3fc35ed..6035cbe030fa2 100644 --- a/sycl/source/CMakeLists.txt +++ b/sycl/source/CMakeLists.txt @@ -53,6 +53,7 @@ function(add_sycl_rt_library LIB_NAME LIB_OBJ_NAME) __DPCPP_ENABLE_UNFINISHED_KHR_EXTENSIONS __SYCL_INTERNAL_API SYCL2020_DISABLE_DEPRECATION_WARNINGS + __SYCL_DISABLE_DEPRECATION_WARNINGS $<$:__SYCL_BUILD_SYCL_DLL> ) diff --git a/sycl/unittests/CMakeLists.txt b/sycl/unittests/CMakeLists.txt index 62af3d0074cac..9e9614f94183d 100644 --- a/sycl/unittests/CMakeLists.txt +++ b/sycl/unittests/CMakeLists.txt @@ -7,7 +7,10 @@ foreach(flag_var string(REGEX REPLACE "/MT" "/MD" ${flag_var} "${${flag_var}}") endforeach() -add_compile_definitions(SYCL2020_DISABLE_DEPRECATION_WARNINGS SYCL_DISABLE_FSYCL_SYCLHPP_WARNING) +add_compile_definitions( + __SYCL_DISABLE_DEPRECATION_WARNINGS + SYCL2020_DISABLE_DEPRECATION_WARNINGS + SYCL_DISABLE_FSYCL_SYCLHPP_WARNING) # suppress warnings which came from Google Test sources if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG) From a370dba29fe6f30e9cb42e2bae13c56a61661085 Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Tue, 23 Sep 2025 12:21:12 +0200 Subject: [PATCH 2/2] Disable warnings when building sycl-ls --- sycl/tools/sycl-ls/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sycl/tools/sycl-ls/CMakeLists.txt b/sycl/tools/sycl-ls/CMakeLists.txt index aa0d8851cf0ac..a1cb33c6553b2 100644 --- a/sycl/tools/sycl-ls/CMakeLists.txt +++ b/sycl/tools/sycl-ls/CMakeLists.txt @@ -9,7 +9,12 @@ if (WIN32 AND "${build_type_lower}" MATCHES "debug") endif() # Disable aspect::image & deprecation warnings. -target_compile_definitions(sycl-ls PRIVATE SYCL_DISABLE_IMAGE_ASPECT_WARNING SYCL2020_DISABLE_DEPRECATION_WARNINGS SYCL_DISABLE_FSYCL_SYCLHPP_WARNING) +target_compile_definitions(sycl-ls + PRIVATE + __SYCL_DISABLE_DEPRECATION_WARNINGS + SYCL_DISABLE_IMAGE_ASPECT_WARNING + SYCL2020_DISABLE_DEPRECATION_WARNINGS + SYCL_DISABLE_FSYCL_SYCLHPP_WARNING) target_link_libraries(sycl-ls PRIVATE