[compiler-rt] r209889 - [Sanitizers Win] Move duplicate Windows-specific compiler flags to a common CMake variable

Timur Iskhodzhanov timurrrr at google.com
Fri May 30 05:42:57 PDT 2014


Author: timurrrr
Date: Fri May 30 07:42:57 2014
New Revision: 209889

URL: http://llvm.org/viewvc/llvm-project?rev=209889&view=rev
Log:
[Sanitizers Win] Move duplicate Windows-specific compiler flags to a common CMake variable

Reviewed at http://reviews.llvm.org/D3952

Modified:
    compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
    compiler-rt/trunk/lib/asan/tests/CMakeLists.txt
    compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt

Modified: compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake?rev=209889&r1=209888&r2=209889&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake Fri May 30 07:42:57 2014
@@ -113,6 +113,8 @@ macro(add_compiler_rt_darwin_dynamic_run
     LIBRARY DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR})
 endmacro()
 
+set(COMPILER_RT_TEST_CFLAGS)
+
 # Unittests support.
 set(COMPILER_RT_GTEST_PATH ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest)
 set(COMPILER_RT_GTEST_SOURCE ${COMPILER_RT_GTEST_PATH}/src/gtest-all.cc)
@@ -124,8 +126,18 @@ set(COMPILER_RT_GTEST_CFLAGS
 )
 
 if(MSVC)
+  # clang doesn't support exceptions on Windows yet.
+  list(APPEND COMPILER_RT_TEST_CFLAGS
+       -D_HAS_EXCEPTIONS=0)
+
+  # We should teach clang to understand "#pragma intrinsic", see PR19898.
+  list(APPEND COMPILER_RT_TEST_CFLAGS -Wno-undefined-inline)
+
   # Clang doesn't support SEH on Windows yet.
   list(APPEND COMPILER_RT_GTEST_CFLAGS -DGTEST_HAS_SEH=0)
+
+  # gtest use a lot of stuff marked as deprecated on Windows.
+  list(APPEND COMPILER_RT_GTEST_CFLAGS -Wno-deprecated-declarations)
 endif()
 
 # Link objects into a single executable with COMPILER_RT_TEST_COMPILER,

Modified: compiler-rt/trunk/lib/asan/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/CMakeLists.txt?rev=209889&r1=209888&r2=209889&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/asan/tests/CMakeLists.txt Fri May 30 07:42:57 2014
@@ -21,6 +21,7 @@ set(ASAN_UNITTEST_HEADERS
   asan_test_utils.h)
 
 set(ASAN_UNITTEST_COMMON_CFLAGS
+  ${COMPILER_RT_TEST_CFLAGS}
   ${COMPILER_RT_GTEST_CFLAGS}
   -I${COMPILER_RT_SOURCE_DIR}/include
   -I${COMPILER_RT_SOURCE_DIR}/lib
@@ -39,21 +40,6 @@ else()
   list(APPEND ASAN_UNITTEST_COMMON_CFLAGS -g)
 endif()
 
-if(MSVC)
-  # MSVC system headers and gtest use a lot of deprecated stuff.
-  list(APPEND ASAN_UNITTEST_COMMON_CFLAGS
-       -Wno-deprecated-declarations)
-
-  # clang doesn't support exceptions on Windows yet.
-  list(APPEND ASAN_UNITTEST_COMMON_CFLAGS
-       -D_HAS_EXCEPTIONS=0)
-
-  # We should teach clang to understand more pragmas.
-  list(APPEND ASAN_UNITTEST_COMMON_CFLAGS
-       -Wno-unknown-pragmas
-       -Wno-undefined-inline)
-endif()
-
 # Use -D instead of definitions to please custom compile command.
 list(APPEND ASAN_UNITTEST_COMMON_CFLAGS
   -DASAN_HAS_BLACKLIST=1

Modified: compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt?rev=209889&r1=209888&r2=209889&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt Fri May 30 07:42:57 2014
@@ -34,6 +34,7 @@ foreach(header ${SANITIZER_HEADERS})
 endforeach()
 
 set(SANITIZER_TEST_CFLAGS_COMMON
+  ${COMPILER_RT_TEST_CFLAGS}
   ${COMPILER_RT_GTEST_CFLAGS}
   -I${COMPILER_RT_SOURCE_DIR}/include
   -I${COMPILER_RT_SOURCE_DIR}/lib
@@ -50,21 +51,6 @@ else()
   list(APPEND ASAN_UNITTEST_COMMON_CFLAGS -g)
 endif()
 
-if(MSVC)
-  # MSVC system headers and gtest use a lot of deprecated stuff.
-  list(APPEND SANITIZER_TEST_CFLAGS_COMMON
-       -Wno-deprecated-declarations)
-
-  # clang doesn't support exceptions on Windows yet.
-  list(APPEND SANITIZER_TEST_CFLAGS_COMMON
-       -D_HAS_EXCEPTIONS=0)
-
-  # We should teach clang to understand more pragmas.
-  list(APPEND SANITIZER_TEST_CFLAGS_COMMON
-       -Wno-unknown-pragmas
-       -Wno-undefined-inline)
-endif()
-
 if(NOT MSVC)
   list(APPEND SANITIZER_TEST_LINK_FLAGS_COMMON --driver-mode=g++)
 endif()





More information about the llvm-commits mailing list