Bug #17388 ยป experimental.diff
error.c | ||
---|---|---|
rb_write_warning_str(str);
|
||
}
|
||
void
|
||
rb_category_compile_warn(const char* category, const char *file, int line, const char *fmt, ...)
|
||
{
|
||
VALUE str;
|
||
va_list args;
|
||
if (NIL_P(ruby_verbose)) return;
|
||
va_start(args, fmt);
|
||
str = warn_vsprintf(NULL, file, line, fmt, args);
|
||
va_end(args);
|
||
rb_warn_category(str, ID2SYM(rb_intern(category)));
|
||
}
|
||
static VALUE
|
||
warning_string(rb_encoding *enc, const char *fmt, va_list args)
|
||
{
|
||
... | ... | |
warning_categories = rb_hash_new();
|
||
rb_gc_register_mark_object(warning_categories);
|
||
rb_hash_aset(warning_categories, ID2SYM(rb_intern_const("deprecated")), Qtrue);
|
||
rb_hash_aset(warning_categories, ID2SYM(rb_intern_const("experimental")), Qtrue);
|
||
rb_obj_freeze(warning_categories);
|
||
}
|
||
include/ruby/internal/error.h | ||
---|---|---|
PRINTF_ARGS(void rb_warning(const char*, ...), 1, 2);
|
||
PRINTF_ARGS(void rb_category_warning(const char*, const char*, ...), 2, 3);
|
||
PRINTF_ARGS(void rb_compile_warning(const char *, int, const char*, ...), 3, 4);
|
||
PRINTF_ARGS(void rb_category_compile_warn(const char *, const char *, int, const char*, ...), 4, 5);
|
||
PRINTF_ARGS(void rb_sys_warning(const char*, ...), 1, 2);
|
||
/* reports always */
|
||
COLDFUNC PRINTF_ARGS(void rb_warn(const char*, ...), 1, 2);
|
parse.y | ||
---|---|---|
# define rb_warning4L(l,fmt,a,b,c,d) WARNING_CALL(WARNING_ARGS_L(l, fmt, 5), (a), (b), (c), (d))
|
||
#ifdef RIPPER
|
||
static ID id_warn, id_warning, id_gets, id_assoc;
|
||
static VALUE experimental_category_kw;
|
||
static VALUE
|
||
warn0L_experimental(VALUE p_value, VALUE mesg)
|
||
{
|
||
VALUE args[2];
|
||
args[0] = mesg;
|
||
args[1] = experimental_category_kw;
|
||
rb_p(p_value);
|
||
rb_p(mesg);
|
||
rb_p(experimental_category_kw);
|
||
return rb_funcallv_kw(p_value, id_warn, 2, args, RB_PASS_KEYWORDS);
|
||
}
|
||
# define rb_warn0L_experimental(l, fmt) warn0L_experimental(p->value, rb_usascii_str_new_lit(fmt))
|
||
# define WARN_S_L(s,l) STR_NEW(s,l)
|
||
# define WARN_S(s) STR_NEW2(s)
|
||
# define WARN_I(i) INT2NUM(i)
|
||
... | ... | |
# define WARN_ARGS(fmt,n) WARN_ARGS_L(p->ruby_sourceline,fmt,n)
|
||
# define WARN_ARGS_L(l,fmt,n) p->ruby_sourcefile, (l), (fmt)
|
||
# define WARN_CALL rb_compile_warn
|
||
# define rb_warn0L_experimental(l,fmt) rb_category_compile_warn("experimental", WARN_ARGS_L(l, fmt, 1))
|
||
# define WARNING_ARGS(fmt,n) WARN_ARGS(fmt,n)
|
||
# define WARNING_ARGS_L(l,fmt,n) WARN_ARGS_L(l,fmt,n)
|
||
# define WARNING_CALL rb_compile_warning
|
||
... | ... | |
$$ = new_find_pattern_tail(p, $1, $3, $5, &@$);
|
||
if (rb_warning_category_enabled_p(RB_WARN_CATEGORY_EXPERIMENTAL))
|
||
rb_warn0L(nd_line($$), "Find pattern is experimental, and the behavior may change in future versions of Ruby!");
|
||
rb_warn0L_experimental(nd_line($$), "Find pattern is experimental, and the behavior may change in future versions of Ruby!");
|
||
}
|
||
;
|
||
... | ... | |
if (rb_warning_category_enabled_p(RB_WARN_CATEGORY_EXPERIMENTAL) &&
|
||
!(right_assign && (type == NODE_LASGN || type == NODE_DASGN || type == NODE_DASGN_CURR)))
|
||
rb_warn0L(nd_line(node), "One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!");
|
||
rb_warn0L_experimental(nd_line(node), "One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!");
|
||
}
|
||
static NODE*
|
||
... | ... | |
id_gets = rb_intern_const("gets");
|
||
id_assoc = rb_intern_const("=>");
|
||
experimental_category_kw = rb_hash_new();
|
||
rb_gc_register_mark_object(experimental_category_kw);
|
||
rb_hash_aset(experimental_category_kw,
|
||
ID2SYM(rb_intern_const("category")),
|
||
ID2SYM(rb_intern_const("experimental")));
|
||
rb_obj_freeze(experimental_category_kw);
|
||
(void)yystpcpy; /* may not used in newer bison */
|
||
InitVM(ripper);
|
ractor.c | ||
---|---|---|
rb_transient_heap_evacuate();
|
||
if (rb_warning_category_enabled_p(RB_WARN_CATEGORY_EXPERIMENTAL)) {
|
||
rb_warn("Ractor is experimental, and the behavior may change in future versions of Ruby! "
|
||
"Also there are many implementation issues.");
|
||
rb_category_warn("experimental",
|
||
"Ractor is experimental, and the behavior may change in future versions of Ruby! "
|
||
"Also there are many implementation issues.");
|
||
}
|
||
ruby_single_main_ractor = NULL;
|