Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions ext/fiddle/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,16 @@ def enable_debug_build_flag(flags)
$INCFLAGS << " -I" << libffi.include
end

unless macro_defined?("FFI_GO_CLOSURES", cpp_include(ffi_header || 'ffi.h'))
# ffi.h in libffi 3.4.4 or earlier and the macOS SDK uses
# `#if FFI_GO_CLOSURES`, which warns with -Wundef on targets whose
# ffitarget.h does not define it. Newer libffi defines it in
# ffitarget.h unconditionally, where defining it on our side would be
# a macro redefinition (e.g. warning C4005 with MSVC). Fiddle does
# not use Go closures.
$defs.push('-DFFI_GO_CLOSURES=0')
end

if libffi_version
# If libffi_version contains rc version, just ignored.
libffi_version = libffi_version.gsub(/-rc\d+/, '')
Expand Down
1 change: 0 additions & 1 deletion ext/fiddle/fiddle.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
# endif
#endif

#define FFI_GO_CLOSURES 0 /* fiddle does not use go closures */
#ifdef USE_HEADER_HACKS
#include <ffi/ffi.h>
#else
Expand Down