Revert "Replace __FUNCTION__ with __func__, the latter being standard C99/C++11."

This reverts commit r201910.

While __func__ may be standard in C++11, it was only recently added to
MSVC in 2013 CTP, and LLVM supports MSVC 2012.  __FUNCTION__ may not be
standard, but it's *very* portable.

llvm-svn: 201916
This commit is contained in:
Reid Kleckner 2014-02-22 00:37:45 +00:00
parent dec8d55b1d
commit 324eee45a7
12 changed files with 14 additions and 14 deletions

View File

@ -835,7 +835,7 @@ void NOINLINE __asan_set_error_report_callback(void (*callback)(const char*)) {
if (callback) {
error_message_buffer_size = 1 << 16;
error_message_buffer =
(char*)MmapOrDie(error_message_buffer_size, __func__);
(char*)MmapOrDie(error_message_buffer_size, __FUNCTION__);
error_message_buffer_pos = 0;
}
}

View File

@ -79,7 +79,7 @@ AsanThread *AsanThread::Create(thread_callback_t start_routine,
void *arg) {
uptr PageSize = GetPageSizeCached();
uptr size = RoundUpTo(sizeof(AsanThread), PageSize);
AsanThread *thread = (AsanThread*)MmapOrDie(size, __func__);
AsanThread *thread = (AsanThread*)MmapOrDie(size, __FUNCTION__);
thread->start_routine_ = start_routine;
thread->arg_ = arg;

View File

@ -7,7 +7,7 @@ void *x[N];
void *Thread1(void *unused) {
for (int i = 0; i < N; i++) {
fprintf(stderr, "%s %d\n", __func__, i);
fprintf(stderr, "%s %d\n", __FUNCTION__, 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", __func__, i);
fprintf(stderr, "%s %d\n", __FUNCTION__, i);
free(x[i]);
}
return NULL;

View File

@ -21,7 +21,7 @@
/** \brief Trigger a program abort (or panic for kernel code). */
#define compilerrt_abort() compilerrt_abort_impl(__FILE__, __LINE__, \
__func__)
__FUNCTION__)
void compilerrt_abort_impl(const char *file, int line,
const char *function) __attribute__((noreturn));

View File

@ -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", __func__, \
Printf("UMR in %s at offset %d inside [%p, +%d) \n", __FUNCTION__, \
offset, x, n); \
__msan::PrintWarningWithOrigin(pc, bp, \
__msan_get_origin((char *)x + offset)); \

View File

@ -117,7 +117,7 @@ void *LowLevelAllocator::Allocate(uptr size) {
if (allocated_end_ - allocated_current_ < (sptr)size) {
uptr size_to_allocate = Max(size, GetPageSizeCached());
allocated_current_ =
(char*)MmapOrDie(size_to_allocate, __func__);
(char*)MmapOrDie(size_to_allocate, __FUNCTION__);
allocated_end_ = allocated_current_ + size_to_allocate;
if (low_level_alloc_callback) {
low_level_alloc_callback((uptr)allocated_current_,

View File

@ -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", __func__,
// Printf("%s: %zd => %zd %zd %zd; %d\n", __FUNCTION__,
// 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", __func__, idx, i0, i1, i2);
// Printf("%s: %zd => %zd %zd %zd\n", __FUNCTION__, idx, i0, i1, i2);
return l1_[i0].getBit(i1) && l2_[i0][i1].getBit(i2);
}

View File

@ -93,7 +93,7 @@ uptr ReadFileToBuffer(const char *file_name, char **buff,
if (internal_iserror(openrv)) return 0;
fd_t fd = openrv;
UnmapOrDie(*buff, *buff_size);
*buff = (char*)MmapOrDie(size, __func__);
*buff = (char*)MmapOrDie(size, __FUNCTION__);
*buff_size = size;
// Read up to one page at a time.
read_len = 0;

View File

@ -178,7 +178,7 @@ void DumpProcessMap() {
MemoryMappingLayout proc_maps(/*cache_enabled*/true);
uptr start, end;
const sptr kBufSize = 4095;
char *filename = (char*)MmapOrDie(kBufSize, __func__);
char *filename = (char*)MmapOrDie(kBufSize, __FUNCTION__);
Report("Process memory map follows:\n");
while (proc_maps.Next(&start, &end, /* file_offset */0,
filename, kBufSize, /* protection */0)) {

View File

@ -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, __func__);
void* base = MmapOrDie(kAltStackSize, __FUNCTION__);
altstack.ss_sp = base;
altstack.ss_flags = 0;
altstack.ss_size = kAltStackSize;

View File

@ -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, __func__, f, l, caller_pc); \
ScopedAnnotation sa(thr, __FUNCTION__, f, l, caller_pc); \
const uptr pc = __sanitizer::StackTrace::GetCurrentPc(); \
(void)pc; \
/**/

View File

@ -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, __func__); \
ScopedAtomic sa(thr, callpc, a, mo, __FUNCTION__); \
return Atomic##func(thr, pc, __VA_ARGS__); \
/**/