From 336f480609bbd086ab08a8ea0cef33b39415fb0a Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Mon, 15 Jun 2026 20:47:54 +1200 Subject: [PATCH] Fix Windows extension feature detection --- .github/workflows/test.yaml | 1 + ext/extconf.rb | 2 +- ext/ruby/coverage/tracer.c | 6 +++--- releases.md | 4 ++++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e91d97c..eaf020f 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -16,6 +16,7 @@ jobs: os: - ubuntu - macos + - windows ruby: - "3.3" diff --git a/ext/extconf.rb b/ext/extconf.rb index 8bbc78b..4b52864 100644 --- a/ext/extconf.rb +++ b/ext/extconf.rb @@ -27,7 +27,7 @@ $LDFLAGS << " -fsanitize=address -fsanitize=undefined" end -have_func("rb_tracearg_instruction_sequence", "ruby/debug.h") +have_func("rb_tracearg_instruction_sequence((rb_trace_arg_t *)0)", "ruby/debug.h") create_header diff --git a/ext/ruby/coverage/tracer.c b/ext/ruby/coverage/tracer.c index 203f7f6..74b73af 100644 --- a/ext/ruby/coverage/tracer.c +++ b/ext/ruby/coverage/tracer.c @@ -291,9 +291,6 @@ static void Ruby_Coverage_Tracer_on_line(VALUE data, const rb_trace_arg_t *trace static VALUE Ruby_Coverage_Tracer_start(VALUE self) { - struct Ruby_Coverage_Tracer *tracer; - TypedData_Get_Struct(self, struct Ruby_Coverage_Tracer, &Ruby_Coverage_Tracer_type, tracer); - #ifdef HAVE_RB_TRACEARG_INSTRUCTION_SEQUENCE rb_add_event_hook2( (rb_event_hook_func_t)Ruby_Coverage_Tracer_on_script_compiled, @@ -302,6 +299,9 @@ static VALUE Ruby_Coverage_Tracer_start(VALUE self) RUBY_EVENT_HOOK_FLAG_SAFE | RUBY_EVENT_HOOK_FLAG_RAW_ARG ); #else + struct Ruby_Coverage_Tracer *tracer; + TypedData_Get_Struct(self, struct Ruby_Coverage_Tracer, &Ruby_Coverage_Tracer_type, tracer); + if (NIL_P(tracer->script_compiled_tracepoint)) { RB_OBJ_WRITE(self, &tracer->script_compiled_tracepoint, rb_tracepoint_new(Qnil, RUBY_EVENT_SCRIPT_COMPILED, diff --git a/releases.md b/releases.md index 2bb3b03..d8c8bb2 100644 --- a/releases.md +++ b/releases.md @@ -1,5 +1,9 @@ # Releases +## Unreleased + + - Fix native extension builds on Windows when `rb_tracearg_instruction_sequence` is not declared by Ruby's public headers, and avoid an unused variable compiler warning. + ## v0.1.1 - Fix an unused variable compiler warning in the native extension.