summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-25 12:04:53 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-25 12:04:53 +0000
commit237901a41b44dd86754b0a02979d03b56faeeb73 (patch)
tree0176ed42a448f71a9773913b785a04fe8a337ef1 /io.c
parentca9c9001dc19e41550086bc4da9fa57d65ff8890 (diff)
io.c: warn old write
* io.c (rb_io_puts): warn if write method accepts just one argument. [ruby-core:83529] [Feature #14042] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/io.c b/io.c
index 03cd40e7e8..5e44899b7a 100644
--- a/io.c
+++ b/io.c
@@ -1690,6 +1690,13 @@ static VALUE
rb_io_writev(VALUE io, int argc, VALUE *argv)
{
if (argc > 1 && rb_obj_method_arity(io, id_write) == 1) {
+ if (io != rb_stderr && RTEST(ruby_verbose)) {
+ VALUE klass = CLASS_OF(io);
+ char sep = FL_TEST(klass, FL_SINGLETON) ? (klass = io, '.') : '#';
+ rb_warning("%+"PRIsVALUE"%c""write is outdated interface"
+ " which accepts just one argument",
+ klass, sep);
+ }
do rb_io_write(io, *argv++); while (--argc);
return argv[0]; /* unused right now */
}