Skip to content

Commit 172396b

Browse files
committed
Suppress -Wincompatible-pointer-types when needed
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
1 parent 7cfa8fd commit 172396b

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

ext/mini_racer_extension/extconf.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@
3232

3333
$CXXFLAGS += " -Wno-reserved-user-defined-literal" if IS_DARWIN
3434

35+
# LLVM Clang 22+ treats -Wincompatible-pointer-types as an error by default;
36+
# suppress it until the `unsigned long` vs `uint64_t` mismatch in the extension
37+
# is properly fixed.
38+
unless try_compile(<<~'C', '-Wincompatible-pointer-types')
39+
#include <stdint.h>
40+
void f(const uint64_t *p) { (void)p; }
41+
void g(void) { unsigned long a[1]; f(a); }
42+
C
43+
$CFLAGS += " -Wno-incompatible-pointer-types"
44+
end
45+
3546
if IS_DARWIN
3647
$LDFLAGS.insert(0, " -stdlib=libc++ ")
3748
else

0 commit comments

Comments
 (0)