Skip to content

concurrent-ruby-ext: fix build on Darwin 32-bit #1064

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

barracuda156
Copy link

Fixes: #1063

@barracuda156
Copy link
Author

For the record, this works neatly with Ruby 3.3, while Ruby 3.2 also needs -Wno-incompatible-pointer-types to be passed, otherwise this fails:

atomic_reference.c: In function 'ir_compare_and_set':
atomic_reference.c:83:57: error: passing argument 3 of 'OSAtomicCompareAndSwap32' from incompatible pointer type [-Wincompatible-pointer-types]
   83 |   if (OSAtomicCompareAndSwap32(expect_value, new_value, &DATA_PTR(self))) {
In file included from atomic_reference.h:9,
                 from atomic_reference.c:20:
/usr/include/libkern/OSAtomic.h:132:93: note: expected 'volatile int32_t *' {aka 'volatile int *'} but argument is of type 'void **'
  132 | bool    OSAtomicCompareAndSwap32( int32_t __oldValue, int32_t __newValue, volatile int32_t *__theValue );
      |                                                                           ~~~~~~~~~~~~~~~~~~^~~~~~~~~~
make: *** [atomic_reference.o] Error 1

make failed, exit code 2

@eregon
Copy link
Collaborator

eregon commented Oct 7, 2024

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.

@barracuda156
Copy link
Author

@eregon If you suggest a better fix, I can test that locally both on ppc and i386.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

atomic_reference.c fails to compile on 32-bit due to unconditional usage of 64-bit atomics
2 participants