[compiler-rt] r201910 - Replace __FUNCTION__ with __func__, the latter being standard C99/C++11.

Reid Kleckner rnk at google.com
Fri Feb 21 16:44:25 PST 2014


Reverted in r201916, since __func__ isn't available in versions of MSVC
that we support.


On Fri, Feb 21, 2014 at 3:55 PM, Joerg Sonnenberger <joerg at bec.de> wrote:

> Author: joerg
> Date: Fri Feb 21 17:55:15 2014
> New Revision: 201910
>
> URL: http://llvm.org/viewvc/llvm-project?rev=201910&view=rev
> Log:
> Replace __FUNCTION__ with __func__, the latter being standard C99/C++11.
>
> Modified:
>     compiler-rt/trunk/lib/asan/asan_report.cc
>     compiler-rt/trunk/lib/asan/asan_thread.cc
>     compiler-rt/trunk/lib/asan/tests/asan_racy_double_free_test.cc
>     compiler-rt/trunk/lib/builtins/int_util.h
>     compiler-rt/trunk/lib/msan/msan_interceptors.cc
>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.cc
>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_bitvector.h
>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc
>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc
>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc
>     compiler-rt/trunk/lib/tsan/rtl/tsan_interface_ann.cc
>     compiler-rt/trunk/lib/tsan/rtl/tsan_interface_atomic.cc
>
> Modified: compiler-rt/trunk/lib/asan/asan_report.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_report.cc?rev=201910&r1=201909&r2=201910&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/asan/asan_report.cc (original)
> +++ compiler-rt/trunk/lib/asan/asan_report.cc Fri Feb 21 17:55:15 2014
> @@ -835,7 +835,7 @@ void NOINLINE __asan_set_error_report_ca
>    if (callback) {
>      error_message_buffer_size = 1 << 16;
>      error_message_buffer =
> -        (char*)MmapOrDie(error_message_buffer_size, __FUNCTION__);
> +        (char*)MmapOrDie(error_message_buffer_size, __func__);
>      error_message_buffer_pos = 0;
>    }
>  }
>
> Modified: compiler-rt/trunk/lib/asan/asan_thread.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_thread.cc?rev=201910&r1=201909&r2=201910&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/asan/asan_thread.cc (original)
> +++ compiler-rt/trunk/lib/asan/asan_thread.cc Fri Feb 21 17:55:15 2014
> @@ -79,7 +79,7 @@ AsanThread *AsanThread::Create(thread_ca
>                                 void *arg) {
>    uptr PageSize = GetPageSizeCached();
>    uptr size = RoundUpTo(sizeof(AsanThread), PageSize);
> -  AsanThread *thread = (AsanThread*)MmapOrDie(size, __FUNCTION__);
> +  AsanThread *thread = (AsanThread*)MmapOrDie(size, __func__);
>    thread->start_routine_ = start_routine;
>    thread->arg_ = arg;
>
>
> Modified: compiler-rt/trunk/lib/asan/tests/asan_racy_double_free_test.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_racy_double_free_test.cc?rev=201910&r1=201909&r2=201910&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/asan/tests/asan_racy_double_free_test.cc
> (original)
> +++ compiler-rt/trunk/lib/asan/tests/asan_racy_double_free_test.cc Fri Feb
> 21 17:55:15 2014
> @@ -7,7 +7,7 @@ void *x[N];
>
>  void *Thread1(void *unused) {
>    for (int i = 0; i < N; i++) {
> -    fprintf(stderr, "%s %d\n", __FUNCTION__, i);
> +    fprintf(stderr, "%s %d\n", __func__, i);
>      free(x[i]);
>    }
>    return NULL;
> @@ -15,7 +15,7 @@ void *Thread1(void *unused) {
>
>  void *Thread2(void *unused) {
>    for (int i = 0; i < N; i++) {
> -    fprintf(stderr, "%s %d\n", __FUNCTION__, i);
> +    fprintf(stderr, "%s %d\n", __func__, i);
>      free(x[i]);
>    }
>    return NULL;
>
> Modified: compiler-rt/trunk/lib/builtins/int_util.h
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/int_util.h?rev=201910&r1=201909&r2=201910&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/builtins/int_util.h (original)
> +++ compiler-rt/trunk/lib/builtins/int_util.h Fri Feb 21 17:55:15 2014
> @@ -21,7 +21,7 @@
>
>  /** \brief Trigger a program abort (or panic for kernel code). */
>  #define compilerrt_abort() compilerrt_abort_impl(__FILE__, __LINE__, \
> -                                                 __FUNCTION__)
> +                                                 __func__)
>
>  void compilerrt_abort_impl(const char *file, int line,
>                             const char *function)
> __attribute__((noreturn));
>
> Modified: compiler-rt/trunk/lib/msan/msan_interceptors.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_interceptors.cc?rev=201910&r1=201909&r2=201910&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/msan/msan_interceptors.cc (original)
> +++ compiler-rt/trunk/lib/msan/msan_interceptors.cc Fri Feb 21 17:55:15
> 2014
> @@ -68,7 +68,7 @@ bool IsInInterceptorScope() {
>      if (offset >= 0 && __msan::flags()->report_umrs) {
>     \
>        GET_CALLER_PC_BP_SP;
>     \
>        (void) sp;
>     \
> -      Printf("UMR in %s at offset %d inside [%p, +%d) \n", __FUNCTION__,
>     \
> +      Printf("UMR in %s at offset %d inside [%p, +%d) \n", __func__,
>     \
>               offset, x, n);
>    \
>        __msan::PrintWarningWithOrigin(pc, bp,
>     \
>                                       __msan_get_origin((char *)x +
> offset)); \
>
> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.cc?rev=201910&r1=201909&r2=201910&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.cc
> (original)
> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.cc Fri Feb
> 21 17:55:15 2014
> @@ -117,7 +117,7 @@ void *LowLevelAllocator::Allocate(uptr s
>    if (allocated_end_ - allocated_current_ < (sptr)size) {
>      uptr size_to_allocate = Max(size, GetPageSizeCached());
>      allocated_current_ =
> -        (char*)MmapOrDie(size_to_allocate, __FUNCTION__);
> +        (char*)MmapOrDie(size_to_allocate, __func__);
>      allocated_end_ = allocated_current_ + size_to_allocate;
>      if (low_level_alloc_callback) {
>        low_level_alloc_callback((uptr)allocated_current_,
>
> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_bitvector.h
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_bitvector.h?rev=201910&r1=201909&r2=201910&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_bitvector.h (original)
> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_bitvector.h Fri Feb
> 21 17:55:15 2014
> @@ -149,7 +149,7 @@ class TwoLevelBitVector {
>        l2_[i0][i1].clear();
>      }
>      bool res = l2_[i0][i1].setBit(i2);
> -    // Printf("%s: %zd => %zd %zd %zd; %d\n", __FUNCTION__,
> +    // Printf("%s: %zd => %zd %zd %zd; %d\n", __func__,
>      // idx, i0, i1, i2, res);
>      return res;
>    }
> @@ -173,7 +173,7 @@ class TwoLevelBitVector {
>      uptr i0 = idx0(idx);
>      uptr i1 = idx1(idx);
>      uptr i2 = idx2(idx);
> -    // Printf("%s: %zd => %zd %zd %zd\n", __FUNCTION__, idx, i0, i1, i2);
> +    // Printf("%s: %zd => %zd %zd %zd\n", __func__, idx, i0, i1, i2);
>      return l1_[i0].getBit(i1) && l2_[i0][i1].getBit(i2);
>    }
>
>
> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc?rev=201910&r1=201909&r2=201910&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc (original)
> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc Fri Feb 21
> 17:55:15 2014
> @@ -93,7 +93,7 @@ uptr ReadFileToBuffer(const char *file_n
>      if (internal_iserror(openrv)) return 0;
>      fd_t fd = openrv;
>      UnmapOrDie(*buff, *buff_size);
> -    *buff = (char*)MmapOrDie(size, __FUNCTION__);
> +    *buff = (char*)MmapOrDie(size, __func__);
>      *buff_size = size;
>      // Read up to one page at a time.
>      read_len = 0;
>
> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc?rev=201910&r1=201909&r2=201910&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc (original)
> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc Fri Feb 21
> 17:55:15 2014
> @@ -178,7 +178,7 @@ void DumpProcessMap() {
>    MemoryMappingLayout proc_maps(/*cache_enabled*/true);
>    uptr start, end;
>    const sptr kBufSize = 4095;
> -  char *filename = (char*)MmapOrDie(kBufSize, __FUNCTION__);
> +  char *filename = (char*)MmapOrDie(kBufSize, __func__);
>    Report("Process memory map follows:\n");
>    while (proc_maps.Next(&start, &end, /* file_offset */0,
>                          filename, kBufSize, /* protection */0)) {
>
> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc?rev=201910&r1=201909&r2=201910&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc
> (original)
> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc Fri
> Feb 21 17:55:15 2014
> @@ -105,7 +105,7 @@ void SetAlternateSignalStack() {
>    // TODO(glider): the mapped stack should have the MAP_STACK flag in the
>    // future. It is not required by man 2 sigaltstack now (they're using
>    // malloc()).
> -  void* base = MmapOrDie(kAltStackSize, __FUNCTION__);
> +  void* base = MmapOrDie(kAltStackSize, __func__);
>    altstack.ss_sp = base;
>    altstack.ss_flags = 0;
>    altstack.ss_size = kAltStackSize;
>
> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_interface_ann.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interface_ann.cc?rev=201910&r1=201909&r2=201910&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/rtl/tsan_interface_ann.cc (original)
> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_interface_ann.cc Fri Feb 21
> 17:55:15 2014
> @@ -52,7 +52,7 @@ class ScopedAnnotation {
>      const uptr caller_pc = (uptr)__builtin_return_address(0); \
>      StatInc(thr, StatAnnotation); \
>      StatInc(thr, Stat##typ); \
> -    ScopedAnnotation sa(thr, __FUNCTION__, f, l, caller_pc); \
> +    ScopedAnnotation sa(thr, __func__, f, l, caller_pc); \
>      const uptr pc = __sanitizer::StackTrace::GetCurrentPc(); \
>      (void)pc; \
>  /**/
>
> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_interface_atomic.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interface_atomic.cc?rev=201910&r1=201909&r2=201910&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/rtl/tsan_interface_atomic.cc (original)
> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_interface_atomic.cc Fri Feb 21
> 17:55:15 2014
> @@ -35,7 +35,7 @@ using namespace __tsan;  // NOLINT
>      if (thr->ignore_interceptors) \
>        return NoTsanAtomic##func(__VA_ARGS__); \
>      AtomicStatInc(thr, sizeof(*a), mo, StatAtomic##func); \
> -    ScopedAtomic sa(thr, callpc, a, mo, __FUNCTION__); \
> +    ScopedAtomic sa(thr, callpc, a, mo, __func__); \
>      return Atomic##func(thr, pc, __VA_ARGS__); \
>  /**/
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140221/74cb4ab2/attachment.html>


More information about the llvm-commits mailing list