[PATCH] D66256: [AIX] For XL, pick GCC-compatible std & default warning options
Hubert Tong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 15 15:25:20 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369058: [AIX] For XL, pick GCC-compatible std & default warning options (authored by hubert.reinterpretcast, committed by ).
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66256/new/
https://reviews.llvm.org/D66256
Files:
llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
Index: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
@@ -432,25 +432,38 @@
endif()
endif()
-elseif( 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)
- add_flag_if_supported("-Werror=date-time" WERROR_DATE_TIME)
- add_flag_if_supported("-Werror=unguarded-availability-new" WERROR_UNGUARDED_AVAILABILITY_NEW)
- 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( 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()
else()
- append("-std=${LLVM_CXX_STD}" CMAKE_CXX_FLAGS)
+ message(FATAL_ERROR "The host compiler does not support '-std=${LLVM_CXX_STD}'.")
endif()
- else()
- message(FATAL_ERROR "The host compiler does not support '-std=${LLVM_CXX_STD}'.")
- endif()
- if (LLVM_ENABLE_MODULES)
+ 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")
@@ -481,7 +494,7 @@
else()
message(FATAL_ERROR "LLVM_ENABLE_MODULES is not supported by this compiler")
endif()
- endif(LLVM_ENABLE_MODULES)
+ endif( LLVM_COMPILER_IS_GCC_COMPATIBLE AND LLVM_ENABLE_MODULES )
endif( MSVC )
if (MSVC)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66256.215482.patch
Type: text/x-patch
Size: 3318 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190815/3bd68f58/attachment.bin>
More information about the llvm-commits
mailing list