concurrent-ruby-ext: fix build on Darwin 32-bit#1064
concurrent-ruby-ext: fix build on Darwin 32-bit#1064eregon merged 1 commit intoruby-concurrency:masterfrom
Conversation
|
For the record, this works neatly with Ruby 3.3, while Ruby 3.2 also needs |
|
Arguments should be explicitly casted to avoid the warning/error. One problem though is we have no way to test macOS 32-bit, so it should be considered basically unsupported. |
|
@eregon If you suggest a better fix, I can test that locally both on ppc and i386. |
| VALUE ir_compare_and_set(volatile VALUE self, VALUE expect_value, VALUE new_value) { | ||
| #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 | ||
| #if defined(__i386__) || defined(__ppc__) | ||
| if (OSAtomicCompareAndSwap32(expect_value, new_value, &DATA_PTR(self))) { |
There was a problem hiding this comment.
| if (OSAtomicCompareAndSwap32(expect_value, new_value, &DATA_PTR(self))) { | |
| if (OSAtomicCompareAndSwap32(expect_value, new_value, (VALUE*) &DATA_PTR(self))) { |
Can you try this?
I think it should solve your warning on Ruby 3.2
There was a problem hiding this comment.
Sure, I will try that, thank you.
There was a problem hiding this comment.
Upd. No, it still fails if the error is not downgraded to warning with a flag.
There was a problem hiding this comment.
I have still added (VALUE*) there and rebased to master.
There was a problem hiding this comment.
Upd. No, it still fails if the error is not downgraded to warning with a flag.
Could you share the error output?
Does it work fine with the current state of this PR?
There was a problem hiding this comment.
If it's still an error then probably we need to match the signature exactly:
(from the PR description)
132 | bool OSAtomicCompareAndSwap32( int32_t __oldValue, int32_t __newValue, volatile int32_t *__theValue );
So
if (OSAtomicCompareAndSwap32((int32_t) expect_value, (int32_t) new_value, (int32_t*) &DATA_PTR(self))) {There was a problem hiding this comment.
Sorry, I did not notice this. I will try it.
|
I'll merge this, even though that platform is not really supported since we can't test it in CI. |
|
@eregon It does work with a flag passed to downgrade error to a warning: https://github.com/macos-powerpc/powerpc-ports/blob/419651175e26d038a2c29040f1cae484426aeda0/ruby/rb-concurrent-ruby-ext/Portfile#L28-L30 |
|
Mmh, that's still not right then, could you try #1064 (comment) ? |
|
@eregon Yeah, that works now without adding a flag. |
|
Great, could you update the PR to use that? |
|
@eregon Updated |
Fixes: #1063