summaryrefslogtreecommitdiff
path: root/vm_debug.h
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-10-03 16:22:53 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-10-20 11:22:33 +0900
commit0c15752556513f99c5275c8ca05808221eb56248 (patch)
treed1e7af1ddba2822cfd78fbdef6e13129a1e2d494 /vm_debug.h
parent768ceb4ead2c1a78b2af047e8f54f2472b34e849 (diff)
Use `RUBY_FUNCTION_NAME_STRING` for old Visual C++
Probably `__func__` is supported since Visual C++ 2015 (= 14.0, `_MSC_VER` = 1900).
Diffstat (limited to 'vm_debug.h')
-rw-r--r--vm_debug.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/vm_debug.h b/vm_debug.h
index a2647273a0..d8f4fcbe24 100644
--- a/vm_debug.h
+++ b/vm_debug.h
@@ -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