[compiler-rt] r202303 - Append -D__func__=__FUNCTION__ to SANITIZER_COMMON_CFLAGS

Reid Kleckner reid at kleckner.net
Wed Feb 26 13:54:39 PST 2014


Author: rnk
Date: Wed Feb 26 15:54:39 2014
New Revision: 202303

URL: http://llvm.org/viewvc/llvm-project?rev=202303&view=rev
Log:
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.

Modified:
    compiler-rt/trunk/CMakeLists.txt
    compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake

Modified: compiler-rt/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=202303&r1=202302&r2=202303&view=diff
==============================================================================
--- compiler-rt/trunk/CMakeLists.txt (original)
+++ compiler-rt/trunk/CMakeLists.txt Wed Feb 26 15:54:39 2014
@@ -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)

Modified: compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake?rev=202303&r1=202302&r2=202303&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake Wed Feb 26 15:54:39 2014
@@ -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}"





More information about the llvm-commits mailing list