зеркало из https://github.com/github/ruby.git
eval_intern.h: VAR_INITIALIZED
* eval_intern.h (VAR_INITIALIZED): macro to suppress maybe-uninitialized warnings by gcc 4.7 and 4.8. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
9dd0113023
Коммит
e18259424e
4
cont.c
4
cont.c
|
@ -510,6 +510,7 @@ cont_capture(volatile int *stat)
|
||||||
if (ruby_setjmp(cont->jmpbuf)) {
|
if (ruby_setjmp(cont->jmpbuf)) {
|
||||||
volatile VALUE value;
|
volatile VALUE value;
|
||||||
|
|
||||||
|
VAR_INITIALIZED(cont);
|
||||||
value = cont->value;
|
value = cont->value;
|
||||||
if (cont->argc == -1) rb_exc_raise(value);
|
if (cont->argc == -1) rb_exc_raise(value);
|
||||||
cont->value = Qnil;
|
cont->value = Qnil;
|
||||||
|
@ -1271,15 +1272,14 @@ rb_fiber_start(void)
|
||||||
{
|
{
|
||||||
rb_thread_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
rb_fiber_t *fib;
|
rb_fiber_t *fib;
|
||||||
rb_context_t *cont;
|
|
||||||
rb_proc_t *proc;
|
rb_proc_t *proc;
|
||||||
int state;
|
int state;
|
||||||
|
|
||||||
GetFiberPtr(th->fiber, fib);
|
GetFiberPtr(th->fiber, fib);
|
||||||
cont = &fib->cont;
|
|
||||||
|
|
||||||
TH_PUSH_TAG(th);
|
TH_PUSH_TAG(th);
|
||||||
if ((state = EXEC_TAG()) == 0) {
|
if ((state = EXEC_TAG()) == 0) {
|
||||||
|
rb_context_t *cont = &VAR_FROM_MEMORY(fib)->cont;
|
||||||
int argc;
|
int argc;
|
||||||
const VALUE *argv, args = cont->value;
|
const VALUE *argv, args = cont->value;
|
||||||
GetProcPtr(cont->saved_thread.first_proc, proc);
|
GetProcPtr(cont->saved_thread.first_proc, proc);
|
||||||
|
|
|
@ -128,6 +128,14 @@ extern int select_large_fdset(int, fd_set *, fd_set *, fd_set *, struct timeval
|
||||||
#define PUSH_TAG() TH_PUSH_TAG(GET_THREAD())
|
#define PUSH_TAG() TH_PUSH_TAG(GET_THREAD())
|
||||||
#define POP_TAG() TH_POP_TAG()
|
#define POP_TAG() TH_POP_TAG()
|
||||||
|
|
||||||
|
#if defined __GNUC__ && __GNUC__ == 4 && (__GNUC_MINOR__ == 7 || __GNUC_MINOR__ == 8)
|
||||||
|
# define VAR_FROM_MEMORY(var) __extension__(*(__typeof__(var) volatile *)&(var))
|
||||||
|
# define VAR_INITIALIZED(var) ((var) = VAR_FROM_MEMORY(var))
|
||||||
|
#else
|
||||||
|
# define VAR_FROM_MEMORY(var) (var)
|
||||||
|
# define VAR_INITIALIZED(var) ((void)&(var))
|
||||||
|
#endif
|
||||||
|
|
||||||
/* clear th->state, and return the value */
|
/* clear th->state, and return the value */
|
||||||
static inline int
|
static inline int
|
||||||
rb_threadptr_tag_state(rb_thread_t *th)
|
rb_threadptr_tag_state(rb_thread_t *th)
|
||||||
|
@ -150,7 +158,7 @@ rb_threadptr_tag_jump(rb_thread_t *th, int st)
|
||||||
[ISO/IEC 9899:1999] 7.13.1.1
|
[ISO/IEC 9899:1999] 7.13.1.1
|
||||||
*/
|
*/
|
||||||
#define TH_EXEC_TAG() \
|
#define TH_EXEC_TAG() \
|
||||||
(ruby_setjmp(_tag.buf) ? rb_threadptr_tag_state(_th) : (TH_REPUSH_TAG(), 0))
|
(ruby_setjmp(_tag.buf) ? rb_threadptr_tag_state(VAR_FROM_MEMORY(_th)) : (TH_REPUSH_TAG(), 0))
|
||||||
|
|
||||||
#define EXEC_TAG() \
|
#define EXEC_TAG() \
|
||||||
TH_EXEC_TAG()
|
TH_EXEC_TAG()
|
||||||
|
|
|
@ -123,6 +123,7 @@ rb_exec_end_proc(void)
|
||||||
exec_end_procs_chain(&end_procs);
|
exec_end_procs_chain(&end_procs);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
VAR_INITIALIZED(th);
|
||||||
TH_TMPPOP_TAG();
|
TH_TMPPOP_TAG();
|
||||||
error_handle(status);
|
error_handle(status);
|
||||||
if (!NIL_P(th->errinfo)) errinfo = th->errinfo;
|
if (!NIL_P(th->errinfo)) errinfo = th->errinfo;
|
||||||
|
|
1
proc.c
1
proc.c
|
@ -1899,6 +1899,7 @@ rb_method_call_with_block(int argc, VALUE *argv, VALUE method, VALUE pass_procva
|
||||||
}
|
}
|
||||||
|
|
||||||
th->passed_block = block;
|
th->passed_block = block;
|
||||||
|
VAR_INITIALIZED(data);
|
||||||
result = rb_vm_call(th, data->recv, data->id, argc, argv, data->me, data->defined_class);
|
result = rb_vm_call(th, data->recv, data->id, argc, argv, data->me, data->defined_class);
|
||||||
}
|
}
|
||||||
POP_TAG();
|
POP_TAG();
|
||||||
|
|
|
@ -1060,6 +1060,8 @@ rb_iterate(VALUE (* it_proc) (VALUE), VALUE data1,
|
||||||
TH_PUSH_TAG(th);
|
TH_PUSH_TAG(th);
|
||||||
state = TH_EXEC_TAG();
|
state = TH_EXEC_TAG();
|
||||||
if (state == 0) {
|
if (state == 0) {
|
||||||
|
VAR_INITIALIZED(th);
|
||||||
|
VAR_INITIALIZED(node);
|
||||||
iter_retry:
|
iter_retry:
|
||||||
{
|
{
|
||||||
rb_block_t *blockptr;
|
rb_block_t *blockptr;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче