ruby-changes:42717
From: nobu <ko1@a...>
Date: Wed, 27 Apr 2016 13:33:12 +0900 (JST)
Subject: [ruby-changes:42717] nobu:r54791 (trunk): internal.h: ONLY_FOR_INTERNAL_USE
nobu 2016-04-27 14:29:49 +0900 (Wed, 27 Apr 2016) New Revision: 54791 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54791 Log: 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. Modified files: trunk/ChangeLog trunk/error.c trunk/internal.h trunk/pack.c trunk/vm.c trunk/vm_method.c Index: ChangeLog =================================================================== --- ChangeLog (revision 54790) +++ ChangeLog (revision 54791) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Apr 27 14:29:47 2016 Nobuyoshi Nakada <nobu@r...> + + * 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@r...> * tool/redmine-backporter.rb (rel): should not raise exceptions even if Index: error.c =================================================================== --- error.c (revision 54790) +++ error.c (revision 54791) @@ -124,16 +124,26 @@ rb_syntax_error_append(VALUE exc, VALUE https://github.com/ruby/ruby/blob/trunk/error.c#L124 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 Index: vm_method.c =================================================================== --- vm_method.c (revision 54790) +++ vm_method.c (revision 54791) @@ -83,9 +83,7 @@ rb_class_clear_method_cache(VALUE klass, https://github.com/ruby/ruby/blob/trunk/vm_method.c#L83 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 Index: internal.h =================================================================== --- internal.h (revision 54790) +++ internal.h (revision 54791) @@ -865,6 +865,8 @@ VALUE rb_name_err_new(VALUE mesg, VALUE https://github.com/ruby/ruby/blob/trunk/internal.h#L865 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); Index: pack.c =================================================================== --- pack.c (revision 54790) +++ pack.c (revision 54791) @@ -220,15 +220,13 @@ str_associated(VALUE str) https://github.com/ruby/ruby/blob/trunk/pack.c#L220 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()"); } /* Index: vm.c =================================================================== --- vm.c (revision 54790) +++ vm.c (revision 54791) @@ -459,8 +459,7 @@ rb_vm_rewind_cfp(rb_thread_t *th, rb_con https://github.com/ruby/ruby/blob/trunk/vm.c#L459 void rb_frame_pop(void) { - rb_thread_t *th = GET_THREAD(); - vm_pop_frame(th); + ONLY_FOR_INTERNAL_USE("rb_frame_pop()"); } /* at exit */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/