summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt6
-rw-r--r--cmake/Modules/CompilerRTCompile.cmake3
2 files changed, 6 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 438a5bf04..a31c1c638 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -237,6 +237,12 @@ if(COMPILER_RT_ENABLE_WERROR)
add_definitions_if(COMPILER_RT_HAS_WX_FLAG /WX)
endif()
+# Emulate C99 and C++11's __func__ for MSVC prior to 2013 CTP.
+CHECK_SYMBOL_EXISTS(__func__ "" COMPILER_RT_HAS_FUNC)
+if(NOT COMPILER_RT_HAS_FUNC)
+ list(APPEND SANITIZER_COMMON_CFLAGS -D__func__=__FUNCTION__)
+endif()
+
# Provide some common commmandline flags for Sanitizer runtimes.
append_if(SANITIZER_COMMON_CFLAGS COMPILER_RT_HAS_FPIC_FLAG -fPIC)
append_if(SANITIZER_COMMON_CFLAGS COMPILER_RT_HAS_FNO_BUILTIN_FLAG -fno-builtin)
diff --git a/cmake/Modules/CompilerRTCompile.cmake b/cmake/Modules/CompilerRTCompile.cmake
index 909d7b90d..bb2d08018 100644
--- a/cmake/Modules/CompilerRTCompile.cmake
+++ b/cmake/Modules/CompilerRTCompile.cmake
@@ -11,9 +11,6 @@ macro(clang_compile object_file source)
if(NOT COMPILER_RT_STANDALONE_BUILD)
list(APPEND SOURCE_DEPS clang)
endif()
- if (MSVC)
- list(APPEND SOURCE_CFLAGS -D__func__=__FUNCTION__)
- endif()
add_custom_command(
OUTPUT ${object_file}
COMMAND ${COMPILER_RT_TEST_COMPILER} ${SOURCE_CFLAGS} -c -o "${object_file}"