From ebac921a746de311fba53117a35840e757529706 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 22 Oct 2024 18:15:00 +0900 Subject: [PATCH 1/2] Suppress -Wundef warnings The GCC warning puts undefined macro names in double quotes while clang puts them in single quotes. --- ext/fiddle/extconf.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/fiddle/extconf.rb b/ext/fiddle/extconf.rb index 28999806..7b1e4a4d 100644 --- a/ext/fiddle/extconf.rb +++ b/ext/fiddle/extconf.rb @@ -69,7 +69,7 @@ def enable_debug_build_flag(flags) 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") + if egrep_cpp(/warning: \WFFI_GO_CLOSURES\W is not defined/, cpp_include(ffi_header), "2>&1") $defs.push('-DFFI_GO_CLOSURES=0') end end From 3a1a9a9b2df808409084ba90e7400853d555af51 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 22 Oct 2024 18:30:38 +0900 Subject: [PATCH 2/2] Define FFI_GO_CLOSURES always Anyway fiddle doesn't need Go closures, just define to 0. --- ext/fiddle/extconf.rb | 5 ----- ext/fiddle/fiddle.h | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/ext/fiddle/extconf.rb b/ext/fiddle/extconf.rb index 7b1e4a4d..63eacf2c 100644 --- a/ext/fiddle/extconf.rb +++ b/ext/fiddle/extconf.rb @@ -68,11 +68,6 @@ 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: \WFFI_GO_CLOSURES\W is not defined/, cpp_include(ffi_header), "2>&1") - $defs.push('-DFFI_GO_CLOSURES=0') - end - end end end diff --git a/ext/fiddle/fiddle.h b/ext/fiddle/fiddle.h index c0ab8a91..49cc6023 100644 --- a/ext/fiddle/fiddle.h +++ b/ext/fiddle/fiddle.h @@ -40,6 +40,7 @@ # endif #endif +#define FFI_GO_CLOSURES 0 /* fiddle does not use go closures */ #ifdef USE_HEADER_HACKS #include #else