[Lldb-commits] [lldb] cd676e5 - [lldb] Guard some GCC-style flags from MSVC

Vlad Serebrennikov via lldb-commits lldb-commits at lists.llvm.org
Sat Jun 1 02:48:19 PDT 2024


Author: Vlad Serebrennikov
Date: 2024-06-01T12:48:12+03:00
New Revision: cd676e5b27cb985697deac052c797057f5a33c06

URL: https://github.com/llvm/llvm-project/commit/cd676e5b27cb985697deac052c797057f5a33c06
DIFF: https://github.com/llvm/llvm-project/commit/cd676e5b27cb985697deac052c797057f5a33c06.diff

LOG: [lldb] Guard some GCC-style flags from MSVC

A follow up to #92953. Suggested in https://github.com/llvm/llvm-project/pull/92953#issuecomment-2143274065

Added: 
    

Modified: 
    lldb/cmake/modules/LLDBConfig.cmake

Removed: 
    


################################################################################
diff  --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index f2afced7403bd..a60921990cf77 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -186,13 +186,15 @@ include_directories("${CMAKE_CURRENT_BINARY_DIR}/../clang/include")
 # printed. Therefore, check for whether the compiler supports options in the
 # form -W<foo>, and if supported, add the corresponding -Wno-<foo> option.
 
-# Disable GCC warnings
-append("-Wno-deprecated-declarations" CMAKE_CXX_FLAGS)
-append("-Wno-unknown-pragmas" CMAKE_CXX_FLAGS)
-append("-Wno-strict-aliasing" CMAKE_CXX_FLAGS)
-
-check_cxx_compiler_flag("-Wstringop-truncation" CXX_SUPPORTS_STRINGOP_TRUNCATION)
-append_if(CXX_SUPPORTS_STRINGOP_TRUNCATION "-Wno-stringop-truncation" CMAKE_CXX_FLAGS)
+if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
+  # Disable GCC warnings
+  append("-Wno-deprecated-declarations" CMAKE_CXX_FLAGS)
+  append("-Wno-unknown-pragmas" CMAKE_CXX_FLAGS)
+  append("-Wno-strict-aliasing" CMAKE_CXX_FLAGS)
+
+  check_cxx_compiler_flag("-Wstringop-truncation" CXX_SUPPORTS_STRINGOP_TRUNCATION)
+  append_if(CXX_SUPPORTS_STRINGOP_TRUNCATION "-Wno-stringop-truncation" CMAKE_CXX_FLAGS)
+endif()
 
 # Disable Clang warnings
 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")


        


More information about the lldb-commits mailing list