mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-25 06:40:18 +00:00
Fix some warnings in the MSVC build
- Fixes warnings about the ignored -fms-compatibility-version flag. - Fixes warnings about overriding /W4 with /W3 and back. - Fixes a warning where PREFETCH() expanded to nothing in a braceless if block. llvm-svn: 273021
This commit is contained in:
parent
3370c20c7e
commit
d0680ad717
@ -135,7 +135,14 @@ pythonize_bool(COMPILER_RT_DEBUG)
|
||||
include(config-ix)
|
||||
|
||||
if(MSVC)
|
||||
append_string_if(COMPILER_RT_HAS_W3_FLAG /W3 CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
|
||||
# Override any existing /W flags with /W4. This is what LLVM does. Failing to
|
||||
# remove other /W[0-4] flags will result in a warning about overriding a
|
||||
# previous flag.
|
||||
if (COMPILER_RT_HAS_W4_FLAG)
|
||||
string(REGEX REPLACE " /W[0-4]" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
string(REGEX REPLACE " /W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
append_string_if(COMPILER_RT_HAS_W4_FLAG /W4 CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
|
||||
endif()
|
||||
else()
|
||||
append_string_if(COMPILER_RT_HAS_WALL_FLAG -Wall CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
|
||||
endif()
|
||||
|
@ -106,6 +106,10 @@ macro(test_targets)
|
||||
# Add this flag into the host build if this is clang-cl.
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
append("${MSVC_VERSION_FLAG}" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
|
||||
elseif (COMPILER_RT_TEST_COMPILER_ID MATCHES "Clang")
|
||||
# Add this flag to test compiles to suppress clang's auto-detection
|
||||
# logic.
|
||||
append("${MSVC_VERSION_FLAG}" COMPILER_RT_TEST_COMPILER_CFLAGS)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@ -126,9 +130,9 @@ macro(test_targets)
|
||||
test_target_arch(i386 __i386__ "-m32")
|
||||
else()
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
test_target_arch(i386 "" "${MSVC_VERSION_FLAG}")
|
||||
test_target_arch(i386 "" "")
|
||||
else()
|
||||
test_target_arch(x86_64 "" "${MSVC_VERSION_FLAG}")
|
||||
test_target_arch(x86_64 "" "")
|
||||
endif()
|
||||
endif()
|
||||
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "powerpc")
|
||||
|
@ -56,7 +56,7 @@ check_cxx_compiler_flag("-Werror -Wgnu" COMPILER_RT_HAS_WGNU_FLAG
|
||||
check_cxx_compiler_flag("-Werror -Wnon-virtual-dtor" COMPILER_RT_HAS_WNON_VIRTUAL_DTOR_FLAG)
|
||||
check_cxx_compiler_flag("-Werror -Wvariadic-macros" COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG)
|
||||
|
||||
check_cxx_compiler_flag(/W3 COMPILER_RT_HAS_W3_FLAG)
|
||||
check_cxx_compiler_flag(/W4 COMPILER_RT_HAS_W4_FLAG)
|
||||
check_cxx_compiler_flag(/WX COMPILER_RT_HAS_WX_FLAG)
|
||||
check_cxx_compiler_flag(/wd4146 COMPILER_RT_HAS_WD4146_FLAG)
|
||||
check_cxx_compiler_flag(/wd4291 COMPILER_RT_HAS_WD4291_FLAG)
|
||||
|
@ -138,7 +138,7 @@ typedef u32 operator_new_size_type;
|
||||
# define THREADLOCAL __declspec(thread)
|
||||
# define LIKELY(x) (x)
|
||||
# define UNLIKELY(x) (x)
|
||||
# define PREFETCH(x) /* _mm_prefetch(x, _MM_HINT_NTA) */
|
||||
# define PREFETCH(x) /* _mm_prefetch(x, _MM_HINT_NTA) */ (void)0
|
||||
#else // _MSC_VER
|
||||
# define ALWAYS_INLINE inline __attribute__((always_inline))
|
||||
# define ALIAS(x) __attribute__((alias(x)))
|
||||
|
Loading…
Reference in New Issue
Block a user