2007-06-24 20:45:48 -04:00
|
|
|
/* -*-c-*- */
|
2006-12-31 10:02:22 -05:00
|
|
|
/*
|
|
|
|
* included by eval.c
|
|
|
|
*/
|
|
|
|
|
2016-05-12 14:12:46 -04:00
|
|
|
#ifdef HAVE_BUILTIN___BUILTIN_CONSTANT_P
|
Use RB_GNUC_EXTENSION_BLOCK instead of __extension__
* include/ruby/defines.h (RB_GNUC_EXTENSION, RB_GNUC_EXTENSION_BLOCK):
macros for skipping __extension__ on non-GCC compilers.
* eval_error.c (warn_print): use RB_GNUC_EXTENSION_BLOCK instead of
__extension__ because __extension__ is a GNU extension.
Fix compile error on Solaris 10 with Oracle Solaris Studio 12.x.
[Bug #12397] [ruby-dev:49629].
* internal.h (rb_fstring_cstr, rb_fstring_enc_cstr): ditto
* include/ruby/encoding.h (rb_enc_str_new, rb_enc_str_new_cstr): ditto
* include/ruby/intern.h (rb_str_new, rb_str_new_cstr,
rb_usascii_str_new, rb_utf8_str_new, rb_tainted_str_new_cstr,
rb_usascii_str_new_cstr, rb_utf8_str_new_cstr,
rb_external_str_new_cstr, rb_locale_str_new_cstr,
rb_str_buf_new_cstr, rb_str_cat_cstr, rb_exc_new_cstr): ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-20 08:29:06 -04:00
|
|
|
#define warn_print(x) RB_GNUC_EXTENSION_BLOCK( \
|
2016-03-06 03:34:50 -05:00
|
|
|
(__builtin_constant_p(x)) ? \
|
|
|
|
rb_write_error2((x), (long)strlen(x)) : \
|
Use RB_GNUC_EXTENSION_BLOCK instead of __extension__
* include/ruby/defines.h (RB_GNUC_EXTENSION, RB_GNUC_EXTENSION_BLOCK):
macros for skipping __extension__ on non-GCC compilers.
* eval_error.c (warn_print): use RB_GNUC_EXTENSION_BLOCK instead of
__extension__ because __extension__ is a GNU extension.
Fix compile error on Solaris 10 with Oracle Solaris Studio 12.x.
[Bug #12397] [ruby-dev:49629].
* internal.h (rb_fstring_cstr, rb_fstring_enc_cstr): ditto
* include/ruby/encoding.h (rb_enc_str_new, rb_enc_str_new_cstr): ditto
* include/ruby/intern.h (rb_str_new, rb_str_new_cstr,
rb_usascii_str_new, rb_utf8_str_new, rb_tainted_str_new_cstr,
rb_usascii_str_new_cstr, rb_utf8_str_new_cstr,
rb_external_str_new_cstr, rb_locale_str_new_cstr,
rb_str_buf_new_cstr, rb_str_cat_cstr, rb_exc_new_cstr): ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-20 08:29:06 -04:00
|
|
|
rb_write_error(x) \
|
|
|
|
)
|
2016-03-06 03:34:50 -05:00
|
|
|
#else
|
2006-12-31 10:02:22 -05:00
|
|
|
#define warn_print(x) rb_write_error(x)
|
2016-03-06 03:34:50 -05:00
|
|
|
#endif
|
2010-12-11 23:28:29 -05:00
|
|
|
#define warn_print2(x,l) rb_write_error2((x),(l))
|
2013-06-24 09:03:35 -04:00
|
|
|
#define warn_print_str(x) rb_write_error_str(x)
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2016-02-25 07:36:24 -05:00
|
|
|
static VALUE error_pos_str(void);
|
|
|
|
|
2006-12-31 10:02:22 -05:00
|
|
|
static void
|
|
|
|
error_pos(void)
|
2016-02-25 07:36:24 -05:00
|
|
|
{
|
|
|
|
VALUE str = error_pos_str();
|
|
|
|
if (!NIL_P(str)) {
|
|
|
|
warn_print_str(str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static VALUE
|
|
|
|
error_pos_str(void)
|
2006-12-31 10:02:22 -05:00
|
|
|
{
|
2015-10-30 21:02:26 -04:00
|
|
|
int sourceline;
|
|
|
|
VALUE sourcefile = rb_source_location(&sourceline);
|
2007-06-24 16:33:04 -04:00
|
|
|
|
2017-11-16 00:35:58 -05:00
|
|
|
if (!NIL_P(sourcefile)) {
|
2013-05-24 18:03:41 -04:00
|
|
|
ID caller_name;
|
2007-06-24 16:33:04 -04:00
|
|
|
if (sourceline == 0) {
|
2016-02-25 07:36:24 -05:00
|
|
|
return rb_sprintf("%"PRIsVALUE": ", sourcefile);
|
2006-12-31 10:02:22 -05:00
|
|
|
}
|
2013-05-24 18:03:41 -04:00
|
|
|
else if ((caller_name = rb_frame_callee()) != 0) {
|
2016-02-25 07:36:24 -05:00
|
|
|
return rb_sprintf("%"PRIsVALUE":%d:in `%"PRIsVALUE"': ",
|
|
|
|
sourcefile, sourceline,
|
|
|
|
rb_id2str(caller_name));
|
2006-12-31 10:02:22 -05:00
|
|
|
}
|
|
|
|
else {
|
2016-02-25 07:36:24 -05:00
|
|
|
return rb_sprintf("%"PRIsVALUE":%d: ", sourcefile, sourceline);
|
2006-12-31 10:02:22 -05:00
|
|
|
}
|
|
|
|
}
|
2016-02-25 07:36:24 -05:00
|
|
|
return Qnil;
|
2006-12-31 10:02:22 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
set_backtrace(VALUE info, VALUE bt)
|
|
|
|
{
|
2012-05-24 02:09:23 -04:00
|
|
|
ID set_backtrace = rb_intern("set_backtrace");
|
|
|
|
|
|
|
|
if (rb_backtrace_p(bt)) {
|
2012-05-24 02:36:44 -04:00
|
|
|
if (rb_method_basic_definition_p(CLASS_OF(info), set_backtrace)) {
|
2012-05-24 02:09:23 -04:00
|
|
|
rb_exc_set_backtrace(info, bt);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
bt = rb_backtrace_to_str_ary(bt);
|
|
|
|
}
|
|
|
|
}
|
2016-11-13 00:25:53 -05:00
|
|
|
rb_check_funcall(info, set_backtrace, 1, &bt);
|
2006-12-31 10:02:22 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-10-29 10:06:58 -04:00
|
|
|
error_print(rb_execution_context_t *ec)
|
2016-06-05 20:25:38 -04:00
|
|
|
{
|
2017-10-29 10:06:58 -04:00
|
|
|
rb_ec_error_print(ec, ec->errinfo);
|
2016-06-05 20:25:38 -04:00
|
|
|
}
|
|
|
|
|
2017-02-22 03:50:25 -05:00
|
|
|
static void
|
|
|
|
print_errinfo(const VALUE eclass, const VALUE errat, const VALUE emesg)
|
2006-12-31 10:02:22 -05:00
|
|
|
{
|
2017-02-22 03:50:25 -05:00
|
|
|
const char *einfo = "";
|
|
|
|
long elen = 0;
|
2016-02-25 02:22:01 -05:00
|
|
|
VALUE mesg;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2017-02-22 03:50:25 -05:00
|
|
|
if (emesg != Qundef) {
|
|
|
|
if (NIL_P(errat) || RARRAY_LEN(errat) == 0 ||
|
|
|
|
NIL_P(mesg = RARRAY_AREF(errat, 0))) {
|
|
|
|
error_pos();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
warn_print_str(mesg);
|
|
|
|
warn_print(": ");
|
|
|
|
}
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2017-02-22 03:50:25 -05:00
|
|
|
if (!NIL_P(emesg)) {
|
|
|
|
einfo = RSTRING_PTR(emesg);
|
|
|
|
elen = RSTRING_LEN(emesg);
|
|
|
|
}
|
2006-12-31 10:02:22 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (eclass == rb_eRuntimeError && elen == 0) {
|
2016-02-24 23:42:16 -05:00
|
|
|
warn_print("unhandled exception\n");
|
2006-12-31 10:02:22 -05:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
VALUE epath;
|
|
|
|
|
|
|
|
epath = rb_class_name(eclass);
|
|
|
|
if (elen == 0) {
|
2013-06-24 09:03:35 -04:00
|
|
|
warn_print_str(epath);
|
2006-12-31 10:02:22 -05:00
|
|
|
warn_print("\n");
|
|
|
|
}
|
|
|
|
else {
|
2016-02-25 07:36:25 -05:00
|
|
|
const char *tail = 0;
|
2006-12-31 10:02:22 -05:00
|
|
|
long len = elen;
|
|
|
|
|
|
|
|
if (RSTRING_PTR(epath)[0] == '#')
|
|
|
|
epath = 0;
|
2007-08-18 03:44:51 -04:00
|
|
|
if ((tail = memchr(einfo, '\n', elen)) != 0) {
|
2006-12-31 10:02:22 -05:00
|
|
|
len = tail - einfo;
|
|
|
|
tail++; /* skip newline */
|
|
|
|
}
|
2017-02-22 03:50:25 -05:00
|
|
|
warn_print_str(tail ? rb_str_subseq(emesg, 0, len) : emesg);
|
2006-12-31 10:02:22 -05:00
|
|
|
if (epath) {
|
|
|
|
warn_print(" (");
|
2013-06-24 09:03:35 -04:00
|
|
|
warn_print_str(epath);
|
2006-12-31 10:02:22 -05:00
|
|
|
warn_print(")\n");
|
|
|
|
}
|
|
|
|
if (tail) {
|
2017-02-22 03:50:25 -05:00
|
|
|
warn_print_str(rb_str_subseq(emesg, tail - einfo, elen - len - 1));
|
2006-12-31 10:02:22 -05:00
|
|
|
}
|
2014-06-25 13:45:10 -04:00
|
|
|
if (tail ? einfo[elen-1] != '\n' : !epath) warn_print2("\n", 1);
|
2006-12-31 10:02:22 -05:00
|
|
|
}
|
|
|
|
}
|
2017-02-22 03:50:25 -05:00
|
|
|
}
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2017-02-22 03:50:25 -05:00
|
|
|
static void
|
|
|
|
print_backtrace(const VALUE eclass, const VALUE errat, int reverse)
|
|
|
|
{
|
2006-12-31 10:02:22 -05:00
|
|
|
if (!NIL_P(errat)) {
|
|
|
|
long i;
|
|
|
|
long len = RARRAY_LEN(errat);
|
2007-06-19 19:27:47 -04:00
|
|
|
int skip = eclass == rb_eSysStackError;
|
2017-05-19 03:12:45 -04:00
|
|
|
const int threshold = 1000000000;
|
|
|
|
int width = ((int)log10((double)(len > threshold ?
|
|
|
|
((len - 1) / threshold) :
|
|
|
|
len - 1)) +
|
2017-05-19 03:34:05 -04:00
|
|
|
(len < threshold ? 0 : 9) + 1);
|
2009-02-22 09:23:33 -05:00
|
|
|
|
2006-12-31 10:02:22 -05:00
|
|
|
#define TRACE_MAX (TRACE_HEAD+TRACE_TAIL+5)
|
|
|
|
#define TRACE_HEAD 8
|
|
|
|
#define TRACE_TAIL 5
|
|
|
|
|
|
|
|
for (i = 1; i < len; i++) {
|
2017-02-22 03:50:25 -05:00
|
|
|
VALUE line = RARRAY_AREF(errat, reverse ? len - i : i);
|
2013-06-11 02:57:04 -04:00
|
|
|
if (RB_TYPE_P(line, T_STRING)) {
|
2017-05-19 03:12:45 -04:00
|
|
|
VALUE str = rb_str_new_cstr("\t");
|
|
|
|
if (reverse) rb_str_catf(str, "%*ld: ", width, len - i);
|
|
|
|
warn_print_str(rb_str_catf(str, "from %"PRIsVALUE"\n", line));
|
2006-12-31 10:02:22 -05:00
|
|
|
}
|
2007-06-19 19:27:47 -04:00
|
|
|
if (skip && i == TRACE_HEAD && len > TRACE_MAX) {
|
2016-02-25 07:36:24 -05:00
|
|
|
warn_print_str(rb_sprintf("\t ... %ld levels...\n",
|
|
|
|
len - TRACE_HEAD - TRACE_TAIL));
|
2006-12-31 10:02:22 -05:00
|
|
|
i = len - TRACE_TAIL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-02-22 03:50:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-10-29 10:06:58 -04:00
|
|
|
rb_ec_error_print(rb_execution_context_t * volatile ec, volatile VALUE errinfo)
|
2017-02-22 03:50:25 -05:00
|
|
|
{
|
|
|
|
volatile VALUE errat = Qundef;
|
2017-10-29 10:06:58 -04:00
|
|
|
volatile int raised_flag = ec->raised_flag;
|
2017-02-22 03:50:25 -05:00
|
|
|
volatile VALUE eclass = Qundef, emesg = Qundef;
|
|
|
|
|
|
|
|
if (NIL_P(errinfo))
|
|
|
|
return;
|
2017-11-07 00:22:09 -05:00
|
|
|
rb_ec_raised_clear(ec);
|
2017-02-22 03:50:25 -05:00
|
|
|
|
2017-10-29 10:06:58 -04:00
|
|
|
EC_PUSH_TAG(ec);
|
2017-10-26 07:02:13 -04:00
|
|
|
if (EC_EXEC_TAG() == TAG_NONE) {
|
2017-02-22 03:50:25 -05:00
|
|
|
errat = rb_get_backtrace(errinfo);
|
|
|
|
}
|
|
|
|
else if (errat == Qundef) {
|
|
|
|
errat = Qnil;
|
|
|
|
}
|
|
|
|
else if (eclass == Qundef || emesg != Qundef) {
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
if ((eclass = CLASS_OF(errinfo)) != Qundef) {
|
|
|
|
VALUE e = rb_check_funcall(errinfo, rb_intern("message"), 0, 0);
|
|
|
|
if (e != Qundef) {
|
|
|
|
if (!RB_TYPE_P(e, T_STRING)) e = rb_check_string_type(e);
|
|
|
|
emesg = e;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (rb_stderr_tty_p()) {
|
2017-05-19 03:12:45 -04:00
|
|
|
warn_print("Traceback (most recent call last):\n");
|
2017-02-22 03:50:25 -05:00
|
|
|
print_backtrace(eclass, errat, TRUE);
|
|
|
|
print_errinfo(eclass, errat, emesg);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
print_errinfo(eclass, errat, emesg);
|
|
|
|
print_backtrace(eclass, errat, FALSE);
|
|
|
|
}
|
2006-12-31 10:02:22 -05:00
|
|
|
error:
|
2017-10-26 07:02:13 -04:00
|
|
|
EC_POP_TAG();
|
2017-10-29 10:06:58 -04:00
|
|
|
ec->errinfo = errinfo;
|
2017-11-07 00:22:09 -05:00
|
|
|
rb_ec_raised_set(ec, raised_flag);
|
2006-12-31 10:02:22 -05:00
|
|
|
}
|
|
|
|
|
2015-10-30 21:22:51 -04:00
|
|
|
#define undef_mesg_for(v, k) rb_fstring_cstr("undefined"v" method `%1$s' for "k" `%2$s'")
|
2015-10-28 02:24:12 -04:00
|
|
|
#define undef_mesg(v) ( \
|
|
|
|
is_mod ? \
|
|
|
|
undef_mesg_for(v, "module") : \
|
|
|
|
undef_mesg_for(v, "class"))
|
2014-07-26 12:13:21 -04:00
|
|
|
|
|
|
|
void
|
2016-01-02 23:59:54 -05:00
|
|
|
rb_print_undef(VALUE klass, ID id, rb_method_visibility_t visi)
|
2014-07-26 12:13:21 -04:00
|
|
|
{
|
2015-10-28 02:24:12 -04:00
|
|
|
const int is_mod = RB_TYPE_P(klass, T_MODULE);
|
|
|
|
VALUE mesg;
|
|
|
|
switch (visi & METHOD_VISI_MASK) {
|
|
|
|
case METHOD_VISI_UNDEF:
|
|
|
|
case METHOD_VISI_PUBLIC: mesg = undef_mesg(""); break;
|
|
|
|
case METHOD_VISI_PRIVATE: mesg = undef_mesg(" private"); break;
|
|
|
|
case METHOD_VISI_PROTECTED: mesg = undef_mesg(" protected"); break;
|
|
|
|
default: UNREACHABLE;
|
|
|
|
}
|
|
|
|
rb_name_err_raise_str(mesg, klass, ID2SYM(id));
|
2006-12-31 10:02:22 -05:00
|
|
|
}
|
|
|
|
|
2011-07-26 12:05:35 -04:00
|
|
|
void
|
|
|
|
rb_print_undef_str(VALUE klass, VALUE name)
|
|
|
|
{
|
2015-10-28 02:24:12 -04:00
|
|
|
const int is_mod = RB_TYPE_P(klass, T_MODULE);
|
|
|
|
rb_name_err_raise_str(undef_mesg(""), klass, name);
|
2011-07-26 12:05:35 -04:00
|
|
|
}
|
|
|
|
|
2015-10-28 02:24:12 -04:00
|
|
|
#define inaccessible_mesg_for(v, k) rb_fstring_cstr("method `%1$s' for "k" `%2$s' is "v)
|
|
|
|
#define inaccessible_mesg(v) ( \
|
|
|
|
is_mod ? \
|
|
|
|
inaccessible_mesg_for(v, "module") : \
|
|
|
|
inaccessible_mesg_for(v, "class"))
|
|
|
|
|
2014-07-26 12:13:21 -04:00
|
|
|
void
|
2015-06-02 21:39:16 -04:00
|
|
|
rb_print_inaccessible(VALUE klass, ID id, rb_method_visibility_t visi)
|
2014-07-26 12:13:21 -04:00
|
|
|
{
|
2015-10-28 02:24:12 -04:00
|
|
|
const int is_mod = RB_TYPE_P(klass, T_MODULE);
|
|
|
|
VALUE mesg;
|
|
|
|
switch (visi & METHOD_VISI_MASK) {
|
|
|
|
case METHOD_VISI_UNDEF:
|
|
|
|
case METHOD_VISI_PUBLIC: mesg = inaccessible_mesg(""); break;
|
|
|
|
case METHOD_VISI_PRIVATE: mesg = inaccessible_mesg(" private"); break;
|
|
|
|
case METHOD_VISI_PROTECTED: mesg = inaccessible_mesg(" protected"); break;
|
|
|
|
default: UNREACHABLE;
|
|
|
|
}
|
|
|
|
rb_name_err_raise_str(mesg, klass, ID2SYM(id));
|
2014-07-26 12:13:21 -04:00
|
|
|
}
|
|
|
|
|
2006-12-31 10:02:22 -05:00
|
|
|
static int
|
|
|
|
sysexit_status(VALUE err)
|
|
|
|
{
|
2015-02-23 02:05:30 -05:00
|
|
|
VALUE st = rb_ivar_get(err, id_status);
|
2006-12-31 10:02:22 -05:00
|
|
|
return NUM2INT(st);
|
|
|
|
}
|
|
|
|
|
2015-07-18 20:25:45 -04:00
|
|
|
#define unknown_longjmp_status(status) \
|
|
|
|
rb_bug("Unknown longjmp status %d", status)
|
|
|
|
|
2006-12-31 10:02:22 -05:00
|
|
|
static int
|
|
|
|
error_handle(int ex)
|
|
|
|
{
|
|
|
|
int status = EXIT_FAILURE;
|
2017-10-29 10:06:58 -04:00
|
|
|
rb_execution_context_t *ec = GET_EC();
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2017-11-07 00:12:39 -05:00
|
|
|
if (rb_ec_set_raised(ec))
|
2006-12-31 10:02:22 -05:00
|
|
|
return EXIT_FAILURE;
|
|
|
|
switch (ex & TAG_MASK) {
|
* call_cfunc.ci, compile.c, compile.h, debug.h, eval.c,
eval_error.h, eval_jump.h, eval_load.c, eval_thread.c, gc.c,
insnhelper.h, insns.def, iseq.c, main.c, numeric.c, parse.y,
range.c, regenc.h, ruby.h, signal.c, thread.c, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
fixed indents and non-C90 comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-02 11:26:04 -05:00
|
|
|
case 0:
|
2006-12-31 10:02:22 -05:00
|
|
|
status = EXIT_SUCCESS;
|
|
|
|
break;
|
|
|
|
|
* call_cfunc.ci, compile.c, compile.h, debug.h, eval.c,
eval_error.h, eval_jump.h, eval_load.c, eval_thread.c, gc.c,
insnhelper.h, insns.def, iseq.c, main.c, numeric.c, parse.y,
range.c, regenc.h, ruby.h, signal.c, thread.c, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
fixed indents and non-C90 comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-02 11:26:04 -05:00
|
|
|
case TAG_RETURN:
|
2006-12-31 10:02:22 -05:00
|
|
|
error_pos();
|
2016-02-24 23:42:16 -05:00
|
|
|
warn_print("unexpected return\n");
|
2006-12-31 10:02:22 -05:00
|
|
|
break;
|
* call_cfunc.ci, compile.c, compile.h, debug.h, eval.c,
eval_error.h, eval_jump.h, eval_load.c, eval_thread.c, gc.c,
insnhelper.h, insns.def, iseq.c, main.c, numeric.c, parse.y,
range.c, regenc.h, ruby.h, signal.c, thread.c, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
fixed indents and non-C90 comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-02 11:26:04 -05:00
|
|
|
case TAG_NEXT:
|
2006-12-31 10:02:22 -05:00
|
|
|
error_pos();
|
2016-02-24 23:42:16 -05:00
|
|
|
warn_print("unexpected next\n");
|
2006-12-31 10:02:22 -05:00
|
|
|
break;
|
* call_cfunc.ci, compile.c, compile.h, debug.h, eval.c,
eval_error.h, eval_jump.h, eval_load.c, eval_thread.c, gc.c,
insnhelper.h, insns.def, iseq.c, main.c, numeric.c, parse.y,
range.c, regenc.h, ruby.h, signal.c, thread.c, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
fixed indents and non-C90 comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-02 11:26:04 -05:00
|
|
|
case TAG_BREAK:
|
2006-12-31 10:02:22 -05:00
|
|
|
error_pos();
|
2016-02-24 23:42:16 -05:00
|
|
|
warn_print("unexpected break\n");
|
2006-12-31 10:02:22 -05:00
|
|
|
break;
|
* call_cfunc.ci, compile.c, compile.h, debug.h, eval.c,
eval_error.h, eval_jump.h, eval_load.c, eval_thread.c, gc.c,
insnhelper.h, insns.def, iseq.c, main.c, numeric.c, parse.y,
range.c, regenc.h, ruby.h, signal.c, thread.c, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
fixed indents and non-C90 comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-02 11:26:04 -05:00
|
|
|
case TAG_REDO:
|
2006-12-31 10:02:22 -05:00
|
|
|
error_pos();
|
2016-02-24 23:42:16 -05:00
|
|
|
warn_print("unexpected redo\n");
|
2006-12-31 10:02:22 -05:00
|
|
|
break;
|
* call_cfunc.ci, compile.c, compile.h, debug.h, eval.c,
eval_error.h, eval_jump.h, eval_load.c, eval_thread.c, gc.c,
insnhelper.h, insns.def, iseq.c, main.c, numeric.c, parse.y,
range.c, regenc.h, ruby.h, signal.c, thread.c, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
fixed indents and non-C90 comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-02 11:26:04 -05:00
|
|
|
case TAG_RETRY:
|
2006-12-31 10:02:22 -05:00
|
|
|
error_pos();
|
2016-02-24 23:42:16 -05:00
|
|
|
warn_print("retry outside of rescue clause\n");
|
2006-12-31 10:02:22 -05:00
|
|
|
break;
|
* call_cfunc.ci, compile.c, compile.h, debug.h, eval.c,
eval_error.h, eval_jump.h, eval_load.c, eval_thread.c, gc.c,
insnhelper.h, insns.def, iseq.c, main.c, numeric.c, parse.y,
range.c, regenc.h, ruby.h, signal.c, thread.c, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
fixed indents and non-C90 comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-02 11:26:04 -05:00
|
|
|
case TAG_THROW:
|
|
|
|
/* TODO: fix me */
|
2006-12-31 10:02:22 -05:00
|
|
|
error_pos();
|
2016-02-24 23:42:16 -05:00
|
|
|
warn_print("unexpected throw\n");
|
2006-12-31 10:02:22 -05:00
|
|
|
break;
|
2008-05-27 09:10:46 -04:00
|
|
|
case TAG_RAISE: {
|
2017-10-29 10:06:58 -04:00
|
|
|
VALUE errinfo = ec->errinfo;
|
2007-04-19 13:37:03 -04:00
|
|
|
if (rb_obj_is_kind_of(errinfo, rb_eSystemExit)) {
|
|
|
|
status = sysexit_status(errinfo);
|
|
|
|
}
|
2014-05-18 04:47:41 -04:00
|
|
|
else if (rb_obj_is_instance_of(errinfo, rb_eSignal) &&
|
2015-02-23 02:05:30 -05:00
|
|
|
rb_ivar_get(errinfo, id_signo) != INT2FIX(SIGSEGV)) {
|
2007-04-19 13:37:03 -04:00
|
|
|
/* no message when exiting by signal */
|
2006-12-31 10:02:22 -05:00
|
|
|
}
|
|
|
|
else {
|
2017-10-29 10:06:58 -04:00
|
|
|
rb_ec_error_print(ec, errinfo);
|
2006-12-31 10:02:22 -05:00
|
|
|
}
|
|
|
|
break;
|
2007-04-19 13:37:03 -04:00
|
|
|
}
|
2008-05-27 09:10:46 -04:00
|
|
|
case TAG_FATAL:
|
2017-10-29 10:06:58 -04:00
|
|
|
error_print(ec);
|
2008-05-27 09:10:46 -04:00
|
|
|
break;
|
* call_cfunc.ci, compile.c, compile.h, debug.h, eval.c,
eval_error.h, eval_jump.h, eval_load.c, eval_thread.c, gc.c,
insnhelper.h, insns.def, iseq.c, main.c, numeric.c, parse.y,
range.c, regenc.h, ruby.h, signal.c, thread.c, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
fixed indents and non-C90 comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-02 11:26:04 -05:00
|
|
|
default:
|
2015-07-18 20:25:45 -04:00
|
|
|
unknown_longjmp_status(ex);
|
2006-12-31 10:02:22 -05:00
|
|
|
break;
|
|
|
|
}
|
2017-11-06 23:01:13 -05:00
|
|
|
rb_ec_reset_raised(ec);
|
2006-12-31 10:02:22 -05:00
|
|
|
return status;
|
|
|
|
}
|