[PATCH] D42238: [CMake] Remove -stdlib= which is unused when passing -nostinc++

Jonas Hahnfeld via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 18 04:56:53 PST 2018


Hahnfeld created this revision.
Hahnfeld added reviewers: beanz, phosek, kcc, morehouse.
Herald added subscribers: Sanitizers, llvm-commits, mgorny.

This avoids the warnings when building with LLVM_ENABLE_LIBCXX
which automatically adds -stdlib=libc++ to CMAKE_CXX_FLAGS.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D42238

Files:
  lib/fuzzer/CMakeLists.txt
  lib/msan/tests/CMakeLists.txt


Index: lib/msan/tests/CMakeLists.txt
===================================================================
--- lib/msan/tests/CMakeLists.txt
+++ lib/msan/tests/CMakeLists.txt
@@ -37,6 +37,9 @@
   -Werror=sign-compare
   -Wno-gnu-zero-variadic-macro-arguments
 )
+# Remove -stdlib= which is unused when passing -nostinc++.
+string(REGEX REPLACE "-stdlib=[a-zA-Z+]*" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
+
 set(MSAN_UNITTEST_INSTRUMENTED_CFLAGS
   ${MSAN_UNITTEST_COMMON_CFLAGS}
   -fsanitize=memory
Index: lib/fuzzer/CMakeLists.txt
===================================================================
--- lib/fuzzer/CMakeLists.txt
+++ lib/fuzzer/CMakeLists.txt
@@ -35,6 +35,8 @@
 
 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 -nostinc++.
+  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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42238.130394.patch
Type: text/x-patch
Size: 1083 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180118/72a07d99/attachment.bin>


More information about the llvm-commits mailing list