[llvm] r369221 - [cmake] Move blocks out of redundant else( MSVC ); NFC
Hubert Tong via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 18 15:02:24 PDT 2019
Author: hubert.reinterpretcast
Date: Sun Aug 18 15:02:24 2019
New Revision: 369221
URL: http://llvm.org/viewvc/llvm-project?rev=369221&view=rev
Log:
[cmake] Move blocks out of redundant else( MSVC ); NFC
Address post-commit comment on D66256 regarding the `else( MSVC )` block
containing only blocks guarded with `LLVM_COMPILER_IS_GCC_COMPATIBLE`,
which would imply `NOT MSVC`.
Modified:
llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=369221&r1=369220&r2=369221&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Sun Aug 18 15:02:24 2019
@@ -431,71 +431,70 @@ if( MSVC )
endif()
endif()
endif()
+endif( MSVC )
-else( MSVC )
- # Warnings-as-errors handling for GCC-compatible compilers:
- if ( LLVM_COMPILER_IS_GCC_COMPATIBLE )
- append_if(LLVM_ENABLE_WERROR "-Werror" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
- append_if(LLVM_ENABLE_WERROR "-Wno-error" CMAKE_REQUIRED_FLAGS)
- endif( LLVM_COMPILER_IS_GCC_COMPATIBLE )
-
- # Specific default warnings-as-errors for compilers accepting GCC-compatible warning flags:
- if ( LLVM_COMPILER_IS_GCC_COMPATIBLE OR CMAKE_CXX_COMPILER_ID MATCHES "XL" )
- add_flag_if_supported("-Werror=date-time" WERROR_DATE_TIME)
- add_flag_if_supported("-Werror=unguarded-availability-new" WERROR_UNGUARDED_AVAILABILITY_NEW)
- endif( LLVM_COMPILER_IS_GCC_COMPATIBLE OR CMAKE_CXX_COMPILER_ID MATCHES "XL" )
-
- # C++ language standard selection for compilers accepting the GCC-style option:
- if ( LLVM_COMPILER_IS_GCC_COMPATIBLE OR CMAKE_CXX_COMPILER_ID MATCHES "XL" )
- check_cxx_compiler_flag("-std=${LLVM_CXX_STD}" CXX_SUPPORTS_CXX_STD)
- if (CXX_SUPPORTS_CXX_STD)
- if (CYGWIN OR MINGW)
- # MinGW and Cygwin are a bit stricter and lack things like
- # 'strdup', 'stricmp', etc in c++11 mode.
- string(REPLACE "c++" "gnu++" gnu_LLVM_CXX_STD "${LLVM_CXX_STD}")
- append("-std=${gnu_LLVM_CXX_STD}" CMAKE_CXX_FLAGS)
- else()
- append("-std=${LLVM_CXX_STD}" CMAKE_CXX_FLAGS)
- endif()
+# Warnings-as-errors handling for GCC-compatible compilers:
+if ( LLVM_COMPILER_IS_GCC_COMPATIBLE )
+ append_if(LLVM_ENABLE_WERROR "-Werror" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+ append_if(LLVM_ENABLE_WERROR "-Wno-error" CMAKE_REQUIRED_FLAGS)
+endif( LLVM_COMPILER_IS_GCC_COMPATIBLE )
+
+# Specific default warnings-as-errors for compilers accepting GCC-compatible warning flags:
+if ( LLVM_COMPILER_IS_GCC_COMPATIBLE OR CMAKE_CXX_COMPILER_ID MATCHES "XL" )
+ add_flag_if_supported("-Werror=date-time" WERROR_DATE_TIME)
+ add_flag_if_supported("-Werror=unguarded-availability-new" WERROR_UNGUARDED_AVAILABILITY_NEW)
+endif( LLVM_COMPILER_IS_GCC_COMPATIBLE OR CMAKE_CXX_COMPILER_ID MATCHES "XL" )
+
+# C++ language standard selection for compilers accepting the GCC-style option:
+if ( LLVM_COMPILER_IS_GCC_COMPATIBLE OR CMAKE_CXX_COMPILER_ID MATCHES "XL" )
+ check_cxx_compiler_flag("-std=${LLVM_CXX_STD}" CXX_SUPPORTS_CXX_STD)
+ if (CXX_SUPPORTS_CXX_STD)
+ if (CYGWIN OR MINGW)
+ # MinGW and Cygwin are a bit stricter and lack things like
+ # 'strdup', 'stricmp', etc in c++11 mode.
+ string(REPLACE "c++" "gnu++" gnu_LLVM_CXX_STD "${LLVM_CXX_STD}")
+ append("-std=${gnu_LLVM_CXX_STD}" CMAKE_CXX_FLAGS)
else()
- message(FATAL_ERROR "The host compiler does not support '-std=${LLVM_CXX_STD}'.")
+ append("-std=${LLVM_CXX_STD}" CMAKE_CXX_FLAGS)
endif()
- endif( LLVM_COMPILER_IS_GCC_COMPATIBLE OR CMAKE_CXX_COMPILER_ID MATCHES "XL" )
+ else()
+ message(FATAL_ERROR "The host compiler does not support '-std=${LLVM_CXX_STD}'.")
+ endif()
+endif( LLVM_COMPILER_IS_GCC_COMPATIBLE OR CMAKE_CXX_COMPILER_ID MATCHES "XL" )
- # Modules enablement for GCC-compatible compilers:
- if ( LLVM_COMPILER_IS_GCC_COMPATIBLE AND LLVM_ENABLE_MODULES )
- set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
- set(module_flags "-fmodules -fmodules-cache-path=${PROJECT_BINARY_DIR}/module.cache")
- if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
- # On Darwin -fmodules does not imply -fcxx-modules.
- set(module_flags "${module_flags} -fcxx-modules")
- endif()
- if (LLVM_ENABLE_LOCAL_SUBMODULE_VISIBILITY)
- set(module_flags "${module_flags} -Xclang -fmodules-local-submodule-visibility")
- endif()
- if (LLVM_ENABLE_MODULE_DEBUGGING AND
- ((uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG") OR
- (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")))
- set(module_flags "${module_flags} -gmodules")
- endif()
- set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${module_flags}")
+# Modules enablement for GCC-compatible compilers:
+if ( LLVM_COMPILER_IS_GCC_COMPATIBLE AND LLVM_ENABLE_MODULES )
+ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+ set(module_flags "-fmodules -fmodules-cache-path=${PROJECT_BINARY_DIR}/module.cache")
+ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ # On Darwin -fmodules does not imply -fcxx-modules.
+ set(module_flags "${module_flags} -fcxx-modules")
+ endif()
+ if (LLVM_ENABLE_LOCAL_SUBMODULE_VISIBILITY)
+ set(module_flags "${module_flags} -Xclang -fmodules-local-submodule-visibility")
+ endif()
+ if (LLVM_ENABLE_MODULE_DEBUGGING AND
+ ((uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG") OR
+ (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")))
+ set(module_flags "${module_flags} -gmodules")
+ endif()
+ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${module_flags}")
- # Check that we can build code with modules enabled, and that repeatedly
- # including <cassert> still manages to respect NDEBUG properly.
- CHECK_CXX_SOURCE_COMPILES("#undef NDEBUG
- #include <cassert>
- #define NDEBUG
- #include <cassert>
- int main() { assert(this code is not compiled); }"
- CXX_SUPPORTS_MODULES)
- set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
- if (CXX_SUPPORTS_MODULES)
- append("${module_flags}" CMAKE_CXX_FLAGS)
- else()
- message(FATAL_ERROR "LLVM_ENABLE_MODULES is not supported by this compiler")
- endif()
- endif( LLVM_COMPILER_IS_GCC_COMPATIBLE AND LLVM_ENABLE_MODULES )
-endif( MSVC )
+ # Check that we can build code with modules enabled, and that repeatedly
+ # including <cassert> still manages to respect NDEBUG properly.
+ CHECK_CXX_SOURCE_COMPILES("#undef NDEBUG
+ #include <cassert>
+ #define NDEBUG
+ #include <cassert>
+ int main() { assert(this code is not compiled); }"
+ CXX_SUPPORTS_MODULES)
+ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
+ if (CXX_SUPPORTS_MODULES)
+ append("${module_flags}" CMAKE_CXX_FLAGS)
+ else()
+ message(FATAL_ERROR "LLVM_ENABLE_MODULES is not supported by this compiler")
+ endif()
+endif( LLVM_COMPILER_IS_GCC_COMPATIBLE AND LLVM_ENABLE_MODULES )
if (MSVC)
if (NOT CLANG_CL)
More information about the llvm-commits
mailing list