summaryrefslogtreecommitdiff
path: root/error.c
AgeCommit message (Collapse)Author
2018-01-18merge extern declarations into internal.hshyouhei
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09internal.h: remove dependecy on ruby/encoding.hnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-31error.c: limit depthnobu
* error.c (rb_warn_m): limit backtrace depth to reduce objects to be created but not used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-31error.c: negative uplevelnobu
* error.c (rb_warn_m): negative uplevel is not allowed. [ruby-core:84568] [Bug #14262] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-19error.c: KeyError docs [ci skip]nobu
* error.c (key_err_receiver, key_err_key): [DOC] documents of KeyError methods. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12error.c(rb_error_write): Remove ec_ from its namesorah
It's unrelated to rb_execution_context_t during writing the patch r61154 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12hotfix implicit-function-declarationsorah
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12Add uplevel keyword to Kernel#warn and use itshyouhei
If uplevel keyword is given, the warning message is prepended with caller file and line information and the string "warning: ". The use of the uplevel keyword makes Kernel#warn format output similar to how rb_warn formats output. This patch modifies net/ftp and net/imap to use Kernel#warn instead of $stderr.puts or $stderr.printf, since they are used for printing warnings. This makes lib/cgi/core and tempfile use $stderr.puts instead of warn for debug logging, since they are used for debug printing and not for warning. This does not modify bundler, rubygems, or rdoc, as those are maintained outside of ruby and probably wish to remain backwards compatible with older ruby versions. rb_warn_m code is originally from nobu, but I've changed it so that it only includes the path and lineno from uplevel (not the method), and also prepends the string "warning: ", to make it more similar to rb_warn. From: Jeremy Evans code@jeremyevans.net Signed-off-by: Urabe Shyouhei shyouhei@ruby-lang.org git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12error.c(exc_full_message): Exception#full_messagesorah
Add a method to retrieve a String expression of an exception, formatted in the same way that Ruby prints an uncaught exception out. [Feature #14141] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12Add FrozenError as a subclass of RuntimeErrorshyouhei
FrozenError will be used instead of RuntimeError for exceptions raised when there is an attempt to modify a frozen object. The reason for this change is to differentiate exceptions related to frozen objects from generic exceptions such as those generated by Kernel#raise without an exception class. From: Jeremy Evans <code@jeremyevans.net> Signed-off-by: Urabe Shyouhei <shyouhei@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16fix r60792.ko1
* error.c (warning_string): `file` is already cstr. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16`rb_source_loc` -> `rb_source_location_cstr`ko1
* vm.c (rb_source_loc): rename to rb_source_location_cstr() to make behavior clear compare with rb_source_location(). * error.c (warning_string): use rb_source_location_cstr() directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-29EXEC_EVENT_HOOK(ec, ...)ko1
* vm_core.h (EXEC_EVENT_HOOK): accepts `ec` instead of `th`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-28check `ec` instead of `th`.ko1
* error.c (rb_bug): check `ec` instead of `th`. * error.c (rb_bug_context): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-27Remove duplicated includekazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-26some functions accept `ec` instead of `th`.ko1
* vm.c (vm_make_env_object): accepts `ec`. * vm.c (rb_vm_get_ruby_level_next_cfp): ditto. * vm.c (rb_vm_make_proc): ditto. * vm.c (rb_vm_make_proc_lambda): ditto. * vm_core.h: some macros accept ec instead of th (and make them inline functions): * RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW * RUBY_VM_END_CONTROL_FRAME * RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P * eval.c (frame_func_id): constify for the first parameter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-26Use rb_execution_context_t instead of rb_thread_tko1
to represent execution context [Feature #14038] * vm_core.h (rb_thread_t): rb_thread_t::ec is now a pointer. There are many code using `th` to represent execution context (such as cfp, VM stack and so on). To access `ec`, they need to use `th->ec->...` (adding one indirection) so that we need to replace them by passing `ec` instead of `th`. * vm_core.h (GET_EC()): introduced to access current ec. Also remove `ruby_current_thread` global variable. * cont.c (rb_context_t): introduce rb_context_t::thread_ptr instead of rb_context_t::thread_value. * cont.c (ec_set_vm_stack): added to update vm_stack explicitly. * cont.c (ec_switch): added to switch ec explicitly. * cont.c (rb_fiber_close): added to terminate fibers explicitly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-23error.c: warning to write multiple argumentsnobu
* error.c (warning_write): accepts multiple arguments to merge multiple warning messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-15error.c: [DOC] fix typo [ci skip]nobu
* error.c (RuntimeError): example code uses Kernel#raise instance method, not Kernel.raise singleton method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-13error.c: infinite recursion at Warning#warnnobu
* error.c (rb_warn_m): write the message to rb_stderr directly, to get rid of infinite recursion when called on Warning module itself, by super in redefined Warning#warn. [ruby-dev:50293] [Bug #14006] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-18error.c: KeyError#receiver and KeyError#keynobu
* error.c: new method KeyError#receiver and KeyError#key. [Feature #12063] * hash.c: make KeyError object with receiver and key. * sprintf.c: ditto. Author: ksss <co000ri@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-22Add Doxygen commentsyugui
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-23use "enum ruby_tag_type" and TAG_NONE.ko1
Return value of EXEC_TAG() is saved by "int state". Instead of "int", use "enum ruby_tag_type". First EXEC_TAG() value should be 0, so that define TAG_NONE (= 0) and use it. Some code used "status" instead of "state". To make them clear, rename them to state. We can change variable name from "state" to "tag_state", but this ticket doesn't contain it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-09rb_execution_context_t: move stack, stack_size and cfp from rb_thread_tnormal
The goal is to reduce rb_context_t and rb_fiber_t size by removing the need to store the entire rb_thread_t in there. [ruby-core:81045] Work-in-progress: soon, we will move more fields here. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-27Send the backtrace of the circular require warning as a single String to ↵eregon
Warning.warn * load.c: send as a single string. * error.c: expose the string formatted by rb_warning as rb_warning_string(). * test/ruby/test_exception.rb: update tests. [ruby-core:80850] [Bug #13505] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-26error.c: send as a single stringnobu
* error.c (rb_warn_m): send the arguments as a single string concatenated with a newline, so it can be filtered easily. [ruby-core:80875] [Feature #12944] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-26error.c: improve docsstomar
* error.c: [DOC] fix rdoc formatting (make sure `Warning.warn' is displayed verbatim; rdoc would render it as a link named `#warn'), use capitalized "Ruby", fix a typo. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-26error.c: splat warn argumentsnobu
* error.c (rb_warn_m): print array arguments with splatting. it is often used with `caller`. [ruby-core:80849] [Feature #12944] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-25Document the Warning module and warn methoderegon
* error.c (Warning): add documentation. [Feature #13504] Author: Jeremy Evans <code@jeremyevans.net> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-25load.c: backtrace of circular requirenobu
* load.c (load_lock): print backtrace of circular require via `Warning.warn` [ruby-core:80850] [Bug #13505] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-15ruby.h: check argc to rb_funcallnobu
* include/ruby/ruby.h (rb_funcall): check if argc matches the number of variadic arguments, and replace with rb_funcallv. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-27dir.c: err at glob failurenobu
* dir.c (glob_helper): raise a SystemCallError exception when opendir() failed, except for ENOENT, ENOTDIR, and EACCES. this behavior predates 1.0; the comments in glob.c claimed that glob() returned -1 on error but actualy the pointer to a global variable, then dir_glob() did check only -1 as the comments, and ignored actual errors. [ruby-core:80226] [Bug #13276] dir.c: ruby_glob_funcs_t git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-27error.c: warning functionsnobu
* error.c: define warning functions in all combinations of * no errno, system errno, argument * without/with encoding * enabled/disabled by default git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-27error.c: refactor warning messagesnobu
* error.c (with_warning_string): extract building warning message string from variadic arguments. * error.c (syserr_warning): write warning message with the system error message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-21error.c: remove deprecated internal featuresnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-17DEPRECATED_INTERNAL_FEATUREnobu
* error.c (ruby_deprecated_internal_feature): renamed, to explicitly represent deprecation. * internal.h (DEPRECATED_INTERNAL_FEATURE): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-23error.c: fixed doc [ci skip]nobu
* error.c (exc_message): fixed doc regarding the presence of to_str. [Fix GH-1517] Author: Marc Gauthier <marcg.gauthier@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-20error.c: print default RSnobu
* error.c (rb_warn_m): print the default RS instead of an empty string with a newline. [Feature #12944] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-19Change Kernel#warn to call Warning.warnnobu
This allows Warning.warn to filter/process warning messages generated by Kernel#warn. Currently, Warning.warn can only handle messages generated by the rb_warn/rb_warning C functions. The Kernel#warn API is different than the Warning.warn API, this tries to get similar behavior, but there are probably corner cases where the behavior is different. This makes str_end_with_asciichar in io.c no longer static so it can be called from error.c. [Feature #12944] Author: Jeremy Evans <code@jeremyevans.net> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-13error.c: movednobu
* error.c (preface_dump, postscript_dump): CrashReporter directory was used before Mac OS X 10.6. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-13error.c: movednobu
* error.c (preface_dump, postscript_dump): moved from rb_vm_bugreport to place the last important message at the very last after [NOTE]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-13error.c: redefined backtracenobu
* error.c (rb_get_backtrace): honor redefined Exception#backtrace method. [ruby-core:78097] [Bug #12925] * eval.c (setup_exception): rescue exceptions during backtrace setup. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-13error.c: rb_get_backtracenobu
* error.c (rb_get_backtrace): move from eval_error.c to call exc_backtrace directly. [ruby-core:78097] [Bug #12925] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-26[DOC] replace Fixnum with Integer [ci skip]nobu
* numeric.c: [DOC] update document for Integer class. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-27error.c: check argument of Warning.warnnobu
* error.c (rb_warning_s_warn): the argument must be an ASCII-compatible string. [ruby-core:77430] [Bug #12793] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-27 * error.c: This makes all warnings raised call Warning.warn, whichshyouhei
by default does the same thing it does currently (rb_write_error_str). You can override Warning.warn to change the behavior. [ruby-core:75016] [Feature #12299] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-08replace fixnum by integer in documents.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-12error.c: fix newline in syntax errornobu
* error.c (rb_syntax_error_append): fix newline in syntax error message to the beginning, not after file name and line number. [Feature #11951] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-23internal.h: inline Check_Typenobu
* internal.h (Check_Type): inline check for the object type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-17[Feature #12005] Unify Fixnum and Bignum into Integerakr
* [Feature #12005] Unify Fixnum and Bignum into Integer * include/ruby/ruby.h (rb_class_of): Return rb_cInteger for fixnums. * insns.def (INTEGER_REDEFINED_OP_FLAG): Unified from FIXNUM_REDEFINED_OP_FLAG and BIGNUM_REDEFINED_OP_FLAG. * vm_core.h: Ditto. * vm_insnhelper.c (opt_eq_func): Use INTEGER_REDEFINED_OP_FLAG instead of FIXNUM_REDEFINED_OP_FLAG. * vm.c (vm_redefinition_check_flag): Use rb_cInteger instead of rb_cFixnum and rb_cBignum. (C): Use Integer instead of Fixnum and Bignum. * numeric.c (fix_succ): Removed. (Init_Numeric): Define Fixnum as Integer. * bignum.c (bignew): Use rb_cInteger instead of Rb_cBignum. (rb_int_coerce): replaced from rb_big_coerce and return fixnums as-is. (Init_Bignum): Define Bignum as Integer. Don't define ===. * error.c (builtin_class_name): Return "Integer" for fixnums. * sprintf.c (ruby__sfvextra): Use rb_cInteger instead of rb_cFixnum. * ext/-test-/testutil: New directory to test. Currently it provides utilities for fixnum and bignum. * ext/json/generator/generator.c: Define mInteger_to_json. * lib/mathn.rb (Fixnum#/): Redefinition removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e