diff --git a/sycl/doc/PreprocessorMacros.md b/sycl/doc/PreprocessorMacros.md index 899897bd265af..a12d69e9187e4 100644 --- a/sycl/doc/PreprocessorMacros.md +++ b/sycl/doc/PreprocessorMacros.md @@ -34,10 +34,6 @@ This file describes macros that have effect on SYCL compiler and run-time. Disables all deprecation warnings in SYCL runtime headers, including SYCL 1.2.1 deprecations. -- **SYCL_DISABLE_CPP_VERSION_CHECK_WARNING** - - Disables a message which warns about unsupported C++ version. - - **SYCL_FALLBACK_ASSERT** Defining as non-zero enables the fallback assert feature even on devices diff --git a/sycl/include/sycl/detail/defines_elementary.hpp b/sycl/include/sycl/detail/defines_elementary.hpp index b1c78b9f6f93a..22bd168e9f21f 100644 --- a/sycl/include/sycl/detail/defines_elementary.hpp +++ b/sycl/include/sycl/detail/defines_elementary.hpp @@ -105,16 +105,5 @@ #define __SYCL_WARNING(msg) __pragma(message(msg)) #endif // __GNUC__ -#if !defined(SYCL_DISABLE_CPP_VERSION_CHECK_WARNING) && __cplusplus < 201703L - -#if defined(_MSC_VER) && !defined(__clang__) -__SYCL_WARNING("DPCPP does not support C++ version earlier than C++17. Some " - "features might not be available.") -#else -// This is the only way to emit a warning from system headers using clang, it -// cannot be wrapped by a macro(__pragma warning doesn't work in system -// headers). The solution is borrowed from libcxx. -#warning: DPCPP does not support C++ version earlier than C++17. Some features might not be available. -#endif - -#endif +static_assert(__cplusplus >= 201703L, + "DPCPP does not support C++ version earlier than C++17."); diff --git a/sycl/test/basic_tests/stdcpp_compat.cpp b/sycl/test/basic_tests/stdcpp_compat.cpp index d36ef476bc04b..914cfb64ab1e8 100644 --- a/sycl/test/basic_tests/stdcpp_compat.cpp +++ b/sycl/test/basic_tests/stdcpp_compat.cpp @@ -1,5 +1,4 @@ // RUN: %clangxx -std=c++14 -fsycl -Wall -pedantic -Wno-c99-extensions -Wno-deprecated -fsyntax-only -Xclang -verify=expected,cxx14 %s -c -o %t.out -// RUN: %clangxx -std=c++14 -fsycl -Wall -pedantic -Wno-c99-extensions -Wno-deprecated -fsyntax-only -Xclang -verify %s -c -o %t.out -DSYCL_DISABLE_CPP_VERSION_CHECK_WARNING=1 // RUN: %clangxx -std=c++14 -fsycl -Wall -pedantic -Wno-c99-extensions -Wno-deprecated -fsyntax-only -Xclang -verify=cxx14,warning_extension,expected %s -c -o %t.out // RUN: %clangxx -std=c++17 -fsycl -Wall -pedantic -Wno-c99-extensions -Wno-deprecated -fsyntax-only -Xclang -verify %s -c -o %t.out // RUN: %clangxx -std=c++20 -fsycl -Wall -pedantic -Wno-c99-extensions -Wno-deprecated -fsyntax-only -Xclang -verify %s -c -o %t.out @@ -10,13 +9,15 @@ #include -// cxx14-warning@* {{DPCPP does not support C++ version earlier than C++17. Some features might not be available.}} +// clang-format off +// cxx14-error@* {{static assertion failed due to requirement '201402L >= 201703L'}} // // The next warning is not emitted in device compilation for some reason // warning_extension-warning@* 0-1 {{#warning is a C++2b extension}} // // The next warning is emitted for windows only // expected-warning@* 0-1 {{Alignment of class vec is not in accordance with SYCL specification requirements, a limitation of the MSVC compiler(Error C2719).Requested alignment applied, limited at 64.}} +// clang-format on class KernelName1;