Skip to content

Commit

Permalink
Fix -Wclobbered warning from gcc 12
Browse files Browse the repository at this point in the history
A variable modified in `EXEC_TAG` block should be `volatile`.

```
ractor.c: In function 'ractor_try_yield':
ractor.c:1251:97: warning: argument 'obj' might be clobbered by 'longjmp' or 'vfork' [-Wclobbered]
 1251 | ractor_try_yield(rb_execution_context_t *ec, rb_ractor_t *cr, struct rb_ractor_queue *ts, VALUE obj, VALUE move, bool exc, bool is_will)
      |                                                                                           ~~~~~~^~~
```
  • Loading branch information
nobu committed Mar 19, 2023
1 parent e7342e7 commit bcd0aa8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ractor.c
Expand Up @@ -887,7 +887,7 @@ static VALUE ractor_move(VALUE obj); // in this file
static VALUE ractor_copy(VALUE obj); // in this file

static void
ractor_basket_prepare_contents(VALUE obj, VALUE move, VALUE *pobj, enum rb_ractor_basket_type *ptype)
ractor_basket_prepare_contents(VALUE obj, VALUE move, volatile VALUE *pobj, enum rb_ractor_basket_type *ptype)
{
VALUE v;
enum rb_ractor_basket_type type;
Expand Down Expand Up @@ -1248,7 +1248,7 @@ ractor_deq_take_basket(rb_ractor_t *cr, struct rb_ractor_queue *rs, struct rb_ra
}

static bool
ractor_try_yield(rb_execution_context_t *ec, rb_ractor_t *cr, struct rb_ractor_queue *ts, VALUE obj, VALUE move, bool exc, bool is_will)
ractor_try_yield(rb_execution_context_t *ec, rb_ractor_t *cr, struct rb_ractor_queue *ts, volatile VALUE obj, VALUE move, bool exc, bool is_will)
{
ASSERT_ractor_unlocking(cr);

Expand Down

0 comments on commit bcd0aa8

Please sign in to comment.