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.

llvm-svn: 202303
This commit is contained in:
Reid Kleckner 2014-02-26 21:54:39 +00:00
parent 2869d85135
commit 0140ce483f
2 changed files with 6 additions and 3 deletions

View File

@ -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)

View File

@ -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}"