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 committed Nov 5, 2024
1 parent 882ebca commit d4af8a3
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 d4af8a3

Please sign in to comment.