1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

internal.h: ONLY_FOR_INTERNAL_USE

* error.c (ruby_only_for_internal_use): raise fatal error when
  deprecated function only for internal use is called, not just a
  warning.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-04-27 05:29:49 +00:00
parent f8fe534980
commit d226ce8dec
6 changed files with 22 additions and 9 deletions

View file

@ -1,3 +1,9 @@
Wed Apr 27 14:29:47 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* error.c (ruby_only_for_internal_use): raise fatal error when
deprecated function only for internal use is called, not just a
warning.
Tue Apr 26 23:42:30 2016 NAKAMURA Usaku <usa@ruby-lang.org>
* tool/redmine-backporter.rb (rel): should not raise exceptions even if

10
error.c
View file

@ -124,16 +124,26 @@ rb_syntax_error_append(VALUE exc, VALUE file, int line, int column,
void
rb_compile_error_with_enc(const char *file, int line, void *enc, const char *fmt, ...)
{
ONLY_FOR_INTERNAL_USE("rb_compile_error_with_enc()");
}
void
rb_compile_error(const char *file, int line, const char *fmt, ...)
{
ONLY_FOR_INTERNAL_USE("rb_compile_error()");
}
void
rb_compile_error_append(const char *fmt, ...)
{
ONLY_FOR_INTERNAL_USE("rb_compile_error_append()");
}
void
ruby_only_for_internal_use(const char *func)
{
rb_print_backtrace();
rb_fatal("%s is only for internal use and deprecated; do not use", func);
}
static VALUE

View file

@ -865,6 +865,8 @@ VALUE rb_name_err_new(VALUE mesg, VALUE recv, VALUE method);
rb_exc_raise(rb_name_err_new(mesg, recv, name))
#define rb_name_err_raise(mesg, recv, name) \
rb_name_err_raise_str(rb_fstring_cstr(mesg), (recv), (name))
NORETURN(void ruby_only_for_internal_use(const char *));
#define ONLY_FOR_INTERNAL_USE(func) ruby_only_for_internal_use(func)
/* eval.c */
VALUE rb_refinement_module_get_refined_class(VALUE module);

6
pack.c
View file

@ -220,15 +220,13 @@ str_associated(VALUE str)
void
rb_str_associate(VALUE str, VALUE add)
{
rb_warn("rb_str_associate() is only for internal use and deprecated; do not use");
str_associate(str, add);
ONLY_FOR_INTERNAL_USE("rb_str_associate()");
}
VALUE
rb_str_associated(VALUE str)
{
rb_warn("rb_str_associated() is only for internal use and deprecated; do not use");
return str_associated(str);
ONLY_FOR_INTERNAL_USE("rb_str_associated()");
}
/*

3
vm.c
View file

@ -459,8 +459,7 @@ rb_vm_rewind_cfp(rb_thread_t *th, rb_control_frame_t *cfp)
void
rb_frame_pop(void)
{
rb_thread_t *th = GET_THREAD();
vm_pop_frame(th);
ONLY_FOR_INTERNAL_USE("rb_frame_pop()");
}
/* at exit */

View file

@ -83,9 +83,7 @@ rb_class_clear_method_cache(VALUE klass, VALUE arg)
void
rb_clear_cache(void)
{
rb_warning("rb_clear_cache() is deprecated.");
INC_GLOBAL_METHOD_STATE();
INC_GLOBAL_CONSTANT_STATE();
ONLY_FOR_INTERNAL_USE("rb_clear_cache()");
}
void