Feature #12944 » 0001-Change-Kernel-warn-to-call-Warning.warn.patch
| error.c | ||
|---|---|---|
|
VALUE rb_iseqw_local_variables(VALUE iseqval);
|
||
|
VALUE rb_iseqw_new(const rb_iseq_t *);
|
||
|
int str_end_with_asciichar(VALUE str, int c);
|
||
|
VALUE rb_eEAGAIN;
|
||
|
VALUE rb_eEWOULDBLOCK;
|
||
| ... | ... | |
|
* call-seq:
|
||
|
* warn(msg, ...) -> nil
|
||
|
*
|
||
|
* Displays each of the given messages followed by a record separator on
|
||
|
* STDERR unless warnings have been disabled (for example with the
|
||
|
* <code>-W0</code> flag).
|
||
|
*
|
||
|
* If warnings have been disabled (for example with the
|
||
|
* <code>-W0</code> flag), does nothing. Otherwise,
|
||
|
* joins all strings with a newline, makes sure
|
||
|
* the resulting string ends with a newline, and calls
|
||
|
* <code>Warning.warn</code> with the string.
|
||
|
*
|
||
|
* warn("warning 1", "warning 2")
|
||
|
*
|
||
|
* <em>produces:</em>
|
||
| ... | ... | |
|
rb_warn_m(int argc, VALUE *argv, VALUE exc)
|
||
|
{
|
||
|
if (!NIL_P(ruby_verbose) && argc > 0) {
|
||
|
rb_io_puts(argc, argv, rb_stderr);
|
||
|
VALUE str;
|
||
|
str = rb_ary_new_from_values(argc, argv);
|
||
|
str = rb_ary_join(str, rb_str_new("\n", 1));
|
||
|
if (RSTRING_LEN(str) == 0 || !str_end_with_asciichar(str, '\n')) {
|
||
|
rb_str_cat(str, "\n", 1);
|
||
|
}
|
||
|
rb_write_warning_str(str);
|
||
|
}
|
||
|
return Qnil;
|
||
|
}
|
||
| io.c | ||
|---|---|---|
|
}
|
||
|
static int
|
||
|
int
|
||
|
str_end_with_asciichar(VALUE str, int c)
|
||
|
{
|
||
|
long len = RSTRING_LEN(str);
|
||