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> Tue Apr 26 23:42:30 2016 NAKAMURA Usaku <usa@ruby-lang.org>
* tool/redmine-backporter.rb (rel): should not raise exceptions even if * 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 void
rb_compile_error_with_enc(const char *file, int line, void *enc, const char *fmt, ...) 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 void
rb_compile_error(const char *file, int line, const char *fmt, ...) rb_compile_error(const char *file, int line, const char *fmt, ...)
{ {
ONLY_FOR_INTERNAL_USE("rb_compile_error()");
} }
void void
rb_compile_error_append(const char *fmt, ...) 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 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)) rb_exc_raise(rb_name_err_new(mesg, recv, name))
#define rb_name_err_raise(mesg, recv, name) \ #define rb_name_err_raise(mesg, recv, name) \
rb_name_err_raise_str(rb_fstring_cstr(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 */ /* eval.c */
VALUE rb_refinement_module_get_refined_class(VALUE module); VALUE rb_refinement_module_get_refined_class(VALUE module);

6
pack.c
View File

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

3
vm.c
View File

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

View File

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