Suppress -Wincompatible-pointer-types when needed#397
Suppress -Wincompatible-pointer-types when needed#397knu wants to merge 1 commit intorubyjs:mainfrom
Conversation
|
Hey! I added macOS 26 (both on arm and x86) to the CI matrix: #398. It seems to compile just fine, even without your change… 🤔 The images use clang 17, according to https://github.com/actions/runner-images/blob/main/images/macos/macos-15-arm64-Readme.md. Maybe there is another cause for the compilation issues? EDIT: The referenced issues mention this problem also happening on older macOS versions, not only macOS 26. |
LLVM Clang 22+ treats -Wincompatible-pointer-types as an error by default, which breaks compilation of mini_racer_extension.c due to the unsigned long vs uint64_t mismatch in the bigint serialization code. Add -Wno-incompatible-pointer-types to CFLAGS when the compiler rejects an unsigned long to uint64_t pointer conversion, as a workaround until the type mismatch is properly fixed in the extension source. Ref: rubyjs#359 Ref: rubyjs#361
|
@tisba Sorry, the build process picked Clang 22 installed via Homebrew, which was the cause. I've updated the fix. |
|
Thank you. This greatly exceeds my level of expertise though 😅 Maybe @SamSaffron @bnoordhuis can take a look? |
|
The added conditional basically checks if the compiler accepts |
|
Wouldn't this also solve the issue? diff --git a/ext/mini_racer_extension/serde.c b/ext/mini_racer_extension/serde.c
index 7d5d51f..3a3d8eb 100644
--- a/ext/mini_racer_extension/serde.c
+++ b/ext/mini_racer_extension/serde.c
@@ -244,7 +244,7 @@ static void ser_num(Ser *s, double v)
}
// ser_bigint: |n| is in bytes, not quadwords
-static void ser_bigint(Ser *s, const uint64_t *p, size_t n, int sign)
+static void ser_bigint(Ser *s, const unsigned long *p, size_t n, int sign)
{
if (*s->err)
return; |
LLVM Clang 22+ treats -Wincompatible-pointer-types as an error by default, which breaks compilation of mini_racer_extension.c due to the unsigned long vs uint64_t mismatch in the bigint serialization code.
Add -Wno-incompatible-pointer-types to CFLAGS when the compiler rejects an unsigned long to uint64_t pointer conversion, as a workaround until the type mismatch is properly fixed in the extension source.
Ref: #359
Ref: #361