From 0fce38ed5458b638eda5f3bb711903424a4366db Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Tue, 19 Mar 2024 16:23:33 +0100 Subject: [PATCH] Fix compilation on newer clang ``` posix-spawn.c:226:27: error: incompatible function pointer types passing 'int (VALUE, VALUE, posix_spawn_file_actions_t *)' (aka 'int (unsigned long, unsigned long, void **)') to parameter of type 'int (*)(VALUE, VALUE, VALUE)' (aka 'int (*)(unsigned long, unsigned long, unsigned long)') [-Wincompatible-function-pointer-types] rb_hash_foreach(options, posixspawn_file_actions_operations_iter, (VALUE)fops); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /opt/rubies/3.4-dev-03-19/include/ruby-3.4.0+0/ruby/internal/intern/hash.h:83:40: note: passing argument to parameter 'func' here void rb_hash_foreach(VALUE hash, int (*func)(VALUE key, VALUE val, VALUE arg), VALUE arg); ``` --- Rakefile | 2 +- ext/posix-spawn.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 4175983..941aca8 100644 --- a/Rakefile +++ b/Rakefile @@ -4,7 +4,7 @@ task :default => :test # Packaging # ========================================================== -GEMSPEC = eval(File.read('posix-spawn.gemspec')) +GEMSPEC = eval(File.read('posix-spawn.gemspec'), binding, __FILE__, __LINE__) require 'rubygems/package_task' Gem::PackageTask.new(GEMSPEC) do |pkg| diff --git a/ext/posix-spawn.c b/ext/posix-spawn.c index 7ff2464..cf1be2c 100644 --- a/ext/posix-spawn.c +++ b/ext/posix-spawn.c @@ -196,8 +196,9 @@ posixspawn_file_actions_addopen(VALUE key, VALUE val, posix_spawn_file_actions_t * if not. */ static int -posixspawn_file_actions_operations_iter(VALUE key, VALUE val, posix_spawn_file_actions_t *fops) +posixspawn_file_actions_operations_iter(VALUE key, VALUE val, VALUE fops_value) { + posix_spawn_file_actions_t *fops = (posix_spawn_file_actions_t *)fops_value; int act; act = posixspawn_file_actions_addclose(key, val, fops);