From b17f5cbcf84b32cc38b6c8ab3bdd0c4164b30a8f Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 10 Sep 2023 16:30:06 +0900 Subject: [PATCH] Suppress -Wundef warnings on arm64 macOS and Windows ``` In file included from ../../../../ext/fiddle/fiddle.h:46: /opt/local/include/ffi.h:477:5: warning: 'FFI_GO_CLOSURES' is not defined, evaluates to 0 [-Wundef] ^ ``` c.f. https://github.com/libffi/libffi/pull/796 --- ext/fiddle/extconf.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ext/fiddle/extconf.rb b/ext/fiddle/extconf.rb index cf8b5223..2d85b3ee 100644 --- a/ext/fiddle/extconf.rb +++ b/ext/fiddle/extconf.rb @@ -63,6 +63,11 @@ def enable_debug_build_flag(flags) end if have_ffi_header && (have_library('ffi') || have_library('libffi')) have_libffi = true + checking_for("undefined FFI_GO_CLOSURES is used") do + if egrep_cpp(/warning: 'FFI_GO_CLOSURES' is not defined/, cpp_include(ffi_header), "2>&1") + $defs.push('-DFFI_GO_CLOSURES=0') + end + end end end