summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2014-02-26 21:54:39 +0000
committerReid Kleckner <reid@kleckner.net>2014-02-26 21:54:39 +0000
commit8cd8f51516c4635283a791bb1bcfbc289a3501fa (patch)
treefffe9655e9cb94dabeb79851056c311117de42ec /CMakeLists.txt
parent2fd71ac0233fb2ee70bd3f502a05da14b8d1c068 (diff)
Append -D__func__=__FUNCTION__ to SANITIZER_COMMON_CFLAGS
This way it gets picked up for all sanitizer libs, both sanitizer_common and asan. I believe those are the only libs that build with asan. There should be no need to set the __func__ definition inside clang_compile. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@202303 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt6
1 files changed, 6 insertions, 0 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)