From 6412572e343117103748225e1152ddbe23437538 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Fri, 25 Sep 2026 04:48:21 +0000 Subject: [PATCH 1/2] Use _BitScanForward64 only on 64-bit MSVC _BitScanForward64 is not available for 32-bit x86, so the i386-mswin32 build failed at prism.c. Use the portable fallback there, as ntz_int64 in internal/bits.h does. This was fixed in ruby/ruby (https://github.com/ruby/ruby/commit/2a96d32a95363109c71e04649a103e0a9218a59c) but not here, so syncing from here reverts it. Co-Authored-By: Claude Opus 5.5 --- include/prism/internal/bit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/prism/internal/bit.h b/include/prism/internal/bit.h index b0111a4c2c..4f7b56090f 100644 --- a/include/prism/internal/bit.h +++ b/include/prism/internal/bit.h @@ -12,7 +12,7 @@ */ #if defined(__GNUC__) || defined(__clang__) #define pm_ctzll(v) ((unsigned) __builtin_ctzll(v)) -#elif defined(_MSC_VER) +#elif defined(_MSC_VER) && defined(_WIN64) #include #include From 2ef5e230e618a89135908df4995d5f1b14b170ae Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 24 Sep 2026 21:32:25 +0000 Subject: [PATCH 2/2] Remove unsupported platforms from host_os patterns Ruby 1.9.1 dropped DJGPP and Windows CE, and Ruby 2.3 dropped Borland C. This was changed in ruby/ruby (https://github.com/ruby/ruby/commit/7058490a7fb4ade0dfc972a5b2c9ad6862d5150e) but not here, so syncing from here reverts it. Co-Authored-By: Claude Opus 5.5 --- lib/prism/ffi.rb | 2 +- test/prism/test_helper.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/prism/ffi.rb b/lib/prism/ffi.rb index 192b7cb52e..6eb8231c2c 100644 --- a/lib/prism/ffi.rb +++ b/lib/prism/ffi.rb @@ -186,7 +186,7 @@ def self.with # pointer directly; for files it uses a pm_source_t under the hood. class PrismSource # :nodoc: PLATFORM_EXPECTS_UTF8 = - RbConfig::CONFIG["host_os"].match?(/bccwin|cygwin|djgpp|mingw|mswin|wince|darwin/i) + RbConfig::CONFIG["host_os"].match?(/cygwin|mingw|mswin|darwin/i) attr_reader :pointer, :length diff --git a/test/prism/test_helper.rb b/test/prism/test_helper.rb index 406582c0a5..9fea36476b 100644 --- a/test/prism/test_helper.rb +++ b/test/prism/test_helper.rb @@ -236,7 +236,7 @@ def self.each_encoding # True if the current platform is Windows. def self.windows? - RbConfig::CONFIG["host_os"].match?(/bccwin|cygwin|djgpp|mingw|mswin|wince/i) + RbConfig::CONFIG["host_os"].match?(/cygwin|mingw|mswin/i) end # All versions that prism can parse