1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Use RUBY_FUNCTION_NAME_STRING for old Visual C++

Probably `__func__` is supported since Visual C++ 2015 (= 14.0,
`_MSC_VER` = 1900).
This commit is contained in:
Nobuyoshi Nakada 2021-10-03 16:22:53 +09:00
parent 768ceb4ead
commit 0c15752556
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
2 changed files with 10 additions and 8 deletions

View file

@ -413,7 +413,7 @@ ractor_queue_enq(rb_ractor_t *r, struct rb_ractor_queue *rq, struct rb_ractor_ba
rq->size *= 2;
}
rq->baskets[(rq->start + rq->cnt++) % rq->size] = *basket;
// fprintf(stderr, "%s %p->cnt:%d\n", __func__, (void *)rq, rq->cnt);
// fprintf(stderr, "%s %p->cnt:%d\n", RUBY_FUNCTION_NAME_STRING, (void *)rq, rq->cnt);
}
static void
@ -502,7 +502,7 @@ ractor_wakeup(rb_ractor_t *r, enum ractor_wait_status wait_status, enum ractor_w
{
ASSERT_ractor_locking(r);
// fprintf(stderr, "%s r:%p status:%s/%s wakeup_status:%s/%s\n", __func__, (void *)r,
// fprintf(stderr, "%s r:%p status:%s/%s wakeup_status:%s/%s\n", RUBY_FUNCTION_NAME_STRING, (void *)r,
// wait_status_str(r->sync.wait.status), wait_status_str(wait_status),
// wakeup_status_str(r->sync.wait.wakeup_status), wakeup_status_str(wakeup_status));
@ -582,7 +582,7 @@ ractor_sleep(rb_execution_context_t *ec, rb_ractor_t *cr)
{
VM_ASSERT(GET_RACTOR() == cr);
VM_ASSERT(cr->sync.wait.status != wait_none);
// fprintf(stderr, "%s r:%p status:%s, wakeup_status:%s\n", __func__, (void *)cr,
// fprintf(stderr, "%s r:%p status:%s, wakeup_status:%s\n", RUBY_FUNCTION_NAME_STRING, (void *)cr,
// wait_status_str(cr->sync.wait.status), wakeup_status_str(cr->sync.wait.wakeup_status));
RACTOR_UNLOCK(cr);

View file

@ -94,18 +94,20 @@ bool ruby_debug_log_filter(const char *func_name);
// convenient macro to log even if the USE_RUBY_DEBUG_LOG macro is not specified.
// You can use this macro for temporary usage (you should not commit it).
#define _RUBY_DEBUG_LOG(...) ruby_debug_log(__FILE__, __LINE__, __func__, "" __VA_ARGS__)
#define _RUBY_DEBUG_LOG(...) ruby_debug_log(__FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING, "" __VA_ARGS__)
#if USE_RUBY_DEBUG_LOG
# define RUBY_DEBUG_LOG_ENABLED(func_name) \
(ruby_debug_log_mode && ruby_debug_log_filter(func_name))
#define RUBY_DEBUG_LOG(...) do { \
if (ruby_debug_log_mode && ruby_debug_log_filter(__func__)) \
ruby_debug_log(__FILE__, __LINE__, __func__, "" __VA_ARGS__); \
if (RUBY_DEBUG_LOG_ENABLED(RUBY_FUNCTION_NAME_STRING)) \
ruby_debug_log(__FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING, "" __VA_ARGS__); \
} while (0)
#define RUBY_DEBUG_LOG2(file, line, ...) do { \
if (ruby_debug_log_mode && ruby_debug_log_filter(__func__)) \
ruby_debug_log(file, line, __func__, "" __VA_ARGS__); \
if (RUBY_DEBUG_LOG_ENABLED(RUBY_FUNCTION_NAME_STRING)) \
ruby_debug_log(file, line, RUBY_FUNCTION_NAME_STRING, "" __VA_ARGS__); \
} while (0)
#else