summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-16 15:27:37 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-16 15:27:37 +0000
commitac84c2aee2c576247e7961491904f909e8b9ab66 (patch)
tree787b4abcbc340d18c24471455a2102c945c598ba /error.c
parent4237809aa3983fca36b520f95b48fdf9e7e88de2 (diff)
merge revision(s) 58471,58493: [Backport #13505]
load.c: backtrace of circular require * load.c (load_lock): print backtrace of circular require via `Warning.warn` [ruby-core:80850] [Bug #13505] Send the backtrace of the circular require warning as a single String to Warning.warn * load.c: send as a single string. * error.c: expose the string formatted by rb_warning as rb_warning_string(). * test/ruby/test_exception.rb: update tests. [ruby-core:80850] [Bug #13505] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r--error.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/error.c b/error.c
index b890be13a8..ee805d4cc1 100644
--- a/error.c
+++ b/error.c
@@ -162,10 +162,16 @@ rb_warning_s_warn(VALUE mod, VALUE str)
return Qnil;
}
+VALUE
+rb_warning_warn(VALUE mod, VALUE str)
+{
+ return rb_funcallv(mod, id_warn, 1, &str);
+}
+
static void
rb_write_warning_str(VALUE str)
{
- rb_funcall(rb_mWarning, id_warn, 1, str);
+ rb_warning_warn(rb_mWarning, str);
}
static VALUE
@@ -254,6 +260,14 @@ rb_warning(const char *fmt, ...)
}
}
+VALUE
+rb_warning_string(const char *fmt, ...)
+{
+ with_warning_string(mesg, 0, fmt) {
+ }
+ return mesg;
+}
+
#if 0
void
rb_enc_warning(rb_encoding *enc, const char *fmt, ...)