Skip to content

Commit

Permalink
Restore wordsize logic as deprecated
Browse files Browse the repository at this point in the history
These were removed by CRuby but that breaks running older rubyspec
with new mspec. We restore them here while the change propagates
into rubyspec.
  • Loading branch information
headius authored and eregon committed Nov 5, 2024
1 parent dee6f2d commit c9cc4b4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/mspec/guards/platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ def self.wsl?
end
end

WORD_SIZE = 1.size * 8
deprecate_constant :WORD_SIZE

POINTER_SIZE = begin
require 'rbconfig/sizeof'
RbConfig::SIZEOF["void*"] * 8
Expand All @@ -66,6 +69,11 @@ def self.wsl?
[0].pack('l!').size
end

def self.wordsize?(size)
warn "#wordsize? is deprecated, use #c_long_size?"
size == WORD_SIZE
end

def self.pointer_size?(size)
size == POINTER_SIZE
end
Expand All @@ -91,6 +99,9 @@ def match?
match &&= PlatformGuard.os?(*value)
when :pointer_size
match &&= PlatformGuard.pointer_size? value
when :wordsize
warn ":wordsize is deprecated, use :c_long_size"
match &&= PlatformGuard.wordsize? value
when :c_long_size
match &&= PlatformGuard::c_long_size? value
end
Expand Down

0 comments on commit c9cc4b4

Please sign in to comment.