From 44ef345c5093fd5f560594d7a2c5f8570b5749ec Mon Sep 17 00:00:00 2001 From: Jonas Hahnfeld Date: Thu, 1 Feb 2018 13:57:24 +0000 Subject: [PATCH] [CMake] Remove -stdlib= which is unused when passing -nostdinc++ This avoids the warnings when building with LLVM_ENABLE_LIBCXX which automatically adds -stdlib=libc++ to CMAKE_CXX_FLAGS. Differential Revision: https://reviews.llvm.org/D42238 llvm-svn: 323969 --- compiler-rt/lib/fuzzer/CMakeLists.txt | 2 ++ compiler-rt/lib/msan/tests/CMakeLists.txt | 3 +++ 2 files changed, 5 insertions(+) diff --git a/compiler-rt/lib/fuzzer/CMakeLists.txt b/compiler-rt/lib/fuzzer/CMakeLists.txt index 1815d7cc4a6b..3cc941be0f68 100644 --- a/compiler-rt/lib/fuzzer/CMakeLists.txt +++ b/compiler-rt/lib/fuzzer/CMakeLists.txt @@ -35,6 +35,8 @@ set(LIBFUZZER_CFLAGS ${SANITIZER_COMMON_CFLAGS}) if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND COMPILER_RT_LIBCXX_PATH) list(APPEND LIBFUZZER_CFLAGS -nostdinc++ -D_LIBCPP_ABI_VERSION=Fuzzer) + # Remove -stdlib= which is unused when passing -nostdinc++. + string(REGEX REPLACE "-stdlib=[a-zA-Z+]*" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) endif() append_list_if(COMPILER_RT_HAS_OMIT_FRAME_POINTER_FLAG -fno-omit-frame-pointer LIBFUZZER_CFLAGS) diff --git a/compiler-rt/lib/msan/tests/CMakeLists.txt b/compiler-rt/lib/msan/tests/CMakeLists.txt index fb7f563bcbfe..84e05a9c8948 100644 --- a/compiler-rt/lib/msan/tests/CMakeLists.txt +++ b/compiler-rt/lib/msan/tests/CMakeLists.txt @@ -37,6 +37,9 @@ set(MSAN_UNITTEST_COMMON_CFLAGS -Werror=sign-compare -Wno-gnu-zero-variadic-macro-arguments ) +# Remove -stdlib= which is unused when passing -nostdinc++. +string(REGEX REPLACE "-stdlib=[a-zA-Z+]*" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) + set(MSAN_UNITTEST_INSTRUMENTED_CFLAGS ${MSAN_UNITTEST_COMMON_CFLAGS} -fsanitize=memory