diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-02 06:41:56 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-02 06:41:56 +0000 |
commit | 5471bf9cc2ee4cab19f9f306aced64d0649fd672 (patch) | |
tree | 01ef4f1a10e7da2d773c1a07de3e9608da43f139 /variable.c | |
parent | 8dc0c7c035eb2ef22608968aeca63f24ade0eee0 (diff) | |
download | ruby-5471bf9cc2ee4cab19f9f306aced64d0649fd672.tar.gz |
offsetof(type, foo.bar) is (arguably) a GCCism
TL;DR see http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2031.htm
Suppose we have:
struct X {
struct Y {
z_t z;
} y;
} x;
then, you _cant_ infer offsetof(struct X, y.z). The ISO C99 section
7.17 says nothing about such situation. At least clang warns this
being an extension to the language (-Wextended-offsetof).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'variable.c')
-rw-r--r-- | variable.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/variable.c b/variable.c index 0047338cb5..5a0c45159e 100644 --- a/variable.c +++ b/variable.c @@ -1846,10 +1846,8 @@ struct autoload_state { VALUE result; ID id; VALUE thread; - union { - struct list_node node; - struct list_head head; - } waitq; + struct list_node node; + struct list_head head; }; struct autoload_data_i { @@ -2102,11 +2100,11 @@ autoload_reset(VALUE arg) if (need_wakeups) { struct autoload_state *cur = 0, *nxt; - list_for_each_safe(&state->waitq.head, cur, nxt, waitq.node) { + list_for_each_safe(&state->head, cur, nxt, node) { VALUE th = cur->thread; cur->thread = Qfalse; - list_del_init(&cur->waitq.node); /* idempotent */ + list_del_init(&cur->node); /* idempotent */ /* * cur is stored on the stack of cur->waiting_th, @@ -2141,7 +2139,7 @@ autoload_sleep_done(VALUE arg) struct autoload_state *state = (struct autoload_state *)arg; if (state->thread != Qfalse && rb_thread_to_be_killed(state->thread)) { - list_del(&state->waitq.node); /* idempotent after list_del_init */ + list_del(&state->node); /* idempotent after list_del_init */ } return Qfalse; @@ -2177,13 +2175,13 @@ rb_autoload_load(VALUE mod, ID id) * autoload_reset will wake up any threads added to this * iff the GVL is released during autoload_require */ - list_head_init(&state.waitq.head); + list_head_init(&state.head); } else if (state.thread == ele->state->thread) { return Qfalse; } else { - list_add_tail(&ele->state->waitq.head, &state.waitq.node); + list_add_tail(&ele->state->head, &state.node); rb_ensure(autoload_sleep, (VALUE)&state, autoload_sleep_done, (VALUE)&state); |