Skip to content

Commit db21f78

Browse files
cyyeverpytorchmergebot
authored andcommitted
Defaults to C++20 for torch targets
Signed-off-by: cyy <cyyever@outlook.com>
1 parent 5dddcd5 commit db21f78

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,6 +1027,8 @@ if(NOT MSVC)
10271027
append_cxx_flag_if_supported("-Wno-strict-overflow" CMAKE_CXX_FLAGS)
10281028
append_cxx_flag_if_supported("-Wno-strict-aliasing" CMAKE_CXX_FLAGS)
10291029
append_cxx_flag_if_supported("-Wno-stringop-overflow" CMAKE_CXX_FLAGS)
1030+
append_cxx_flag_if_supported("-Wno-deprecated-enum-enum-conversion" CMAKE_CXX_FLAGS)
1031+
append_cxx_flag_if_supported("-Wno-error=deprecated-enum-enum-conversion" CMAKE_CXX_FLAGS)
10301032
append_cxx_flag_if_supported("-Wvla-extension" CMAKE_CXX_FLAGS)
10311033
append_cxx_flag_if_supported("-Wsuggest-override" CMAKE_CXX_FLAGS)
10321034
append_cxx_flag_if_supported("-Wnewline-eof" CMAKE_CXX_FLAGS)

cmake/public/utils.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ endmacro()
337337
# Usage:
338338
# torch_compile_options(lib_name)
339339
function(torch_compile_options libname)
340-
set_property(TARGET ${libname} PROPERTY CXX_STANDARD 17)
340+
set_property(TARGET ${libname} PROPERTY CXX_STANDARD 20)
341341

342342
# until they can be unified, keep these lists synced with setup.py
343343
if(MSVC)
@@ -384,9 +384,12 @@ function(torch_compile_options libname)
384384
)
385385
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
386386
list(APPEND private_compile_options -Wredundant-move)
387+
list(APPEND private_compile_options -Wno-error=deprecated-declarations -Wno-error=redundant-move)
387388
endif()
388389
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
389390
list(APPEND private_compile_options -Wextra-semi -Wmove)
391+
list(APPEND private_compile_options -Wno-return-std-move)
392+
list(APPEND private_compile_options -Wno-deprecated-enum-enum-conversion -Wno-ambiguous-reversed-operator)
390393
else()
391394
list(APPEND private_compile_options
392395
# Considered to be flaky. See the discussion at

0 commit comments

Comments
 (0)