mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
eval.c: suppress warnings
* eval.c (exc_setup_message): setup exception message as an exception instance, and a cause from a previous exception. split from setup_exception to suppress a warning when RUBY_USE_SETJMPEX is enabled. * eval.c (setup_exception): make state volatile to suppress a warning too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
71d16ad5aa
commit
5ba4d948ff
1 changed files with 16 additions and 9 deletions
25
eval.c
25
eval.c
|
@ -472,12 +472,9 @@ exc_setup_cause(VALUE exc, VALUE cause)
|
||||||
return exc;
|
return exc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static inline VALUE
|
||||||
setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg, VALUE cause)
|
exc_setup_message(rb_thread_t *th, VALUE mesg, VALUE *cause)
|
||||||
{
|
{
|
||||||
VALUE e;
|
|
||||||
const char *file = 0;
|
|
||||||
int line;
|
|
||||||
int nocause = 0;
|
int nocause = 0;
|
||||||
|
|
||||||
if (NIL_P(mesg)) {
|
if (NIL_P(mesg)) {
|
||||||
|
@ -489,18 +486,27 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg, VALUE cause)
|
||||||
mesg = rb_exc_new(rb_eRuntimeError, 0, 0);
|
mesg = rb_exc_new(rb_eRuntimeError, 0, 0);
|
||||||
nocause = 0;
|
nocause = 0;
|
||||||
}
|
}
|
||||||
if (cause == Qundef) {
|
if (*cause == Qundef) {
|
||||||
if (nocause) {
|
if (nocause) {
|
||||||
cause = Qnil;
|
*cause = Qnil;
|
||||||
}
|
}
|
||||||
else if (!rb_ivar_defined(mesg, id_cause)) {
|
else if (!rb_ivar_defined(mesg, id_cause)) {
|
||||||
cause = get_thread_errinfo(th);
|
*cause = get_thread_errinfo(th);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return mesg;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg, VALUE cause)
|
||||||
|
{
|
||||||
|
VALUE e;
|
||||||
|
const char *file = 0;
|
||||||
|
int line;
|
||||||
|
|
||||||
file = rb_source_loc(&line);
|
file = rb_source_loc(&line);
|
||||||
if ((file && !NIL_P(mesg)) || (cause != Qundef)) {
|
if ((file && !NIL_P(mesg)) || (cause != Qundef)) {
|
||||||
int state = 0;
|
volatile int state = 0;
|
||||||
|
|
||||||
TH_PUSH_TAG(th);
|
TH_PUSH_TAG(th);
|
||||||
if (EXEC_TAG() == TAG_NONE && !(state = rb_threadptr_set_raised(th))) {
|
if (EXEC_TAG() == TAG_NONE && !(state = rb_threadptr_set_raised(th))) {
|
||||||
|
@ -590,6 +596,7 @@ rb_threadptr_setup_exception(rb_thread_t *th, VALUE mesg, VALUE cause)
|
||||||
static void
|
static void
|
||||||
rb_longjmp(rb_thread_t *th, int tag, volatile VALUE mesg, VALUE cause)
|
rb_longjmp(rb_thread_t *th, int tag, volatile VALUE mesg, VALUE cause)
|
||||||
{
|
{
|
||||||
|
mesg = exc_setup_message(th, mesg, &cause);
|
||||||
setup_exception(th, tag, mesg, cause);
|
setup_exception(th, tag, mesg, cause);
|
||||||
rb_thread_raised_clear(th);
|
rb_thread_raised_clear(th);
|
||||||
TH_JUMP_TAG(th, tag);
|
TH_JUMP_TAG(th, tag);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue