diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-27 05:29:49 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-27 05:29:49 +0000 |
commit | d226ce8decef356c7447efb6b6b325bc8fc53dba (patch) | |
tree | fc6ee90568444f58aeea654c4f2326cb5b1f73ae | |
parent | f8fe5349802f2d73a70b0b7a190a3c7071efa0f4 (diff) |
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
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | error.c | 10 | ||||
-rw-r--r-- | internal.h | 2 | ||||
-rw-r--r-- | pack.c | 6 | ||||
-rw-r--r-- | vm.c | 3 | ||||
-rw-r--r-- | vm_method.c | 4 |
6 files changed, 22 insertions, 9 deletions
@@ -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 @@ -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 diff --git a/internal.h b/internal.h index 9ca1fb388c..b51a75113d 100644 --- a/internal.h +++ b/internal.h @@ -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); @@ -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()"); } /* @@ -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 */ diff --git a/vm_method.c b/vm_method.c index 2d3e78c303..90d543793a 100644 --- a/vm_method.c +++ b/vm_method.c @@ -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 |