From 4f7f0587b228c77083166c0aab0725e620b9ac3d Mon Sep 17 00:00:00 2001 From: Eidolon Date: Mon, 25 Aug 2025 21:28:53 -0500 Subject: [PATCH] Adjust compiler warnings for upcoming clang-cl --- src/CMakeLists.txt | 53 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 104824c3d..6f17d49ce 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -539,13 +539,21 @@ target_compile_options(SRB2SDL2 PRIVATE # C, Clang and Apple Clang $<$,$,$>>: - -Wall - -Wno-absolute-value - -Wno-trigraphs - -Wno-error=non-literal-null-conversion - -Wno-error=constant-conversion - -Wno-unused-but-set-variable - -Wno-error=unused-but-set-variable + #-Wall + -Werror=microsoft + -Wreturn-type # Missing returns in non-void function + -Wduplicate-decl-specifier + -Wsometimes-uninitialized + -Wno-trigraphs # Trigraphs are disabled + -Wc11-extensions # Don't use C11 language extensions not part of baseline + -Wno-unused-but-set-variable # Setting unread variables is fine + -Wno-misleading-indentation # Some cases in code currently + -Wno-deprecated-non-prototype # We have no intention of using C23 yet. + -Wno-parentheses-equality + -Wno-unsafe-buffer-usage # Very common in this codebase + -Wno-unused-const-variable + -Wno-unused-variable + -Wno-unused-function > # C, MSVC @@ -555,16 +563,35 @@ target_compile_options(SRB2SDL2 PRIVATE /Wv:19.20.27004.0 > - # C++, GNU, Clang and Apple Clang - $<$,$,$,$>>: + # C++, GNU + $<$,$>: -Wall + > + + # C++, GNU, Clang and Apple Clang + $<$,$,$>>: + #-Wall + -Werror=microsoft + -Wdelete-abstract-non-virtual-dtor + -Wreturn-type # Missing returns in non-void function + -Wduplicate-decl-specifier + -Wsometimes-uninitialized + -Wno-trigraphs # Trigraphs are disabled + -Wno-c++98-compat + -Wno-c++11-compat + -Wno-c++14-compat # No C++14 compat needed + -Wno-unused-but-set-variable # Setting unread variables is fine (nontrivial C++ types issue) + -Wno-misleading-indentation # Some cases in code currently + -Wno-deprecated-non-prototype # We have no intention of using C23 yet. + -Wno-parentheses-equality + -Wno-unsafe-buffer-usage # Very common in this codebase + -Wno-unused-const-variable + -Wno-unused-variable -Wno-unused-function - -Wno-unused-but-set-variable - -Wno-unused-private-field > # C++, MSVC - $<$,$>: + $<$,$>: /Wv:19.20.27004.0 > @@ -645,7 +672,7 @@ add_subdirectory(modp_b64) # strip debug symbols into separate file when using gcc or clang. # to be consistent with Makefile, don't generate for OS X. -if((CMAKE_COMPILER_IS_GNUCC OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND NOT ("${CMAKE_SYSTEM_NAME}" MATCHES Darwin)) +if((CMAKE_COMPILER_IS_GNUCC) AND NOT ("${CMAKE_SYSTEM_NAME}" MATCHES Darwin)) if(${CMAKE_BUILD_TYPE} MATCHES RelWithDebInfo OR SRB2_CONFIG_ALWAYS_MAKE_DEBUGLINK) message(STATUS "Will make separate debug symbols in *.debug") add_custom_command(TARGET SRB2SDL2 POST_BUILD