summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorGreg Bedwell <greg_bedwell@sn.scee.net>2015-03-11 14:26:29 +0000
committerGreg Bedwell <greg_bedwell@sn.scee.net>2015-03-11 14:26:29 +0000
commit8b0d3f1ea4e0079f2efe4ba70e700af7eeebf989 (patch)
tree6f6badc8e97f8968d9f522d69b91ae37e55add22 /llvm
parent23445cadb2a2ed90ef9295055784fbac2eed5e8e (diff)
downloadbcm5719-llvm-8b0d3f1ea4e0079f2efe4ba70e700af7eeebf989.tar.gz
bcm5719-llvm-8b0d3f1ea4e0079f2efe4ba70e700af7eeebf989.zip
[CMake] Don't pass in MSVC warning flags as definitions
NFC currently but required as a prerequisite for using the Microsoft resource compiler in conjunction with CMake's ninja generator, which knows how to filter flags appropriately, but not definitions. Differential Revision: http://reviews.llvm.org/D8188 llvm-svn: 231924
Diffstat (limited to 'llvm')
-rw-r--r--llvm/cmake/modules/HandleLLVMOptions.cmake15
1 files changed, 11 insertions, 4 deletions
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 45b4d3278cb..30d0cd774f4 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -243,7 +243,7 @@ if( MSVC )
if( MSVC11 )
add_llvm_definitions(-D_VARIADIC_MAX=10)
endif()
-
+
# Add definitions that make MSVC much less annoying.
add_llvm_definitions(
# For some reason MS wants to deprecate a bunch of standard functions...
@@ -253,7 +253,9 @@ if( MSVC )
-D_CRT_NONSTDC_NO_WARNINGS
-D_SCL_SECURE_NO_DEPRECATE
-D_SCL_SECURE_NO_WARNINGS
+ )
+ set(msvc_warning_flags
# Disabled warnings.
-wd4146 # Suppress 'unary minus operator applied to unsigned type, result still unsigned'
-wd4180 # Suppress 'qualifier applied to function type has no meaning; ignored'
@@ -272,7 +274,7 @@ if( MSVC )
-wd4624 # Suppress ''derived class' : destructor could not be generated because a base class destructor is inaccessible'
-wd4722 # Suppress 'function' : destructor never returns, potential memory leak
-wd4800 # Suppress ''type' : forcing value to bool 'true' or 'false' (performance warning)'
-
+
# Promoted warnings.
-w14062 # Promote 'enumerator in switch of enum is not handled' to level 1 warning.
@@ -282,14 +284,19 @@ if( MSVC )
# Enable warnings
if (LLVM_ENABLE_WARNINGS)
- add_llvm_definitions( /W4 )
+ append("/W4" msvc_warning_flags)
if (LLVM_ENABLE_PEDANTIC)
# No MSVC equivalent available
endif (LLVM_ENABLE_PEDANTIC)
endif (LLVM_ENABLE_WARNINGS)
if (LLVM_ENABLE_WERROR)
- add_llvm_definitions( /WX )
+ append("/WX" msvc_warning_flags)
endif (LLVM_ENABLE_WERROR)
+
+ foreach(flag ${msvc_warning_flags})
+ append("${flag}" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+ endforeach(flag)
+
elseif( LLVM_COMPILER_IS_GCC_COMPATIBLE )
if (LLVM_ENABLE_WARNINGS)
append("-Wall -W -Wno-unused-parameter -Wwrite-strings" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
OpenPOWER on IntegriCloud