mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/mkmf.rb (check_sizeof): should return integer always.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e18e1314a9
commit
7031b99bca
3 changed files with 12 additions and 9 deletions
|
@ -1,3 +1,7 @@
|
|||
Fri Dec 3 19:48:11 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* lib/mkmf.rb (check_sizeof): should return integer always.
|
||||
|
||||
Fri Dec 3 12:54:48 2010 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* win32/Makefile.sub (RCFLAGS): VC10 and after only. fixed the problem
|
||||
|
|
|
@ -1105,14 +1105,7 @@ def check_sizeof(type, headers = nil, opts = "", &b)
|
|||
expr = "sizeof((*rbcv_ptr_)#{"." << member if member})"
|
||||
fmt = STRING_OR_FAILED_FORMAT
|
||||
checking_for checking_message("size of #{type}", headers), fmt do
|
||||
if UNIVERSAL_INTS.include?(type)
|
||||
type
|
||||
elsif size = UNIVERSAL_INTS.find {|t|
|
||||
try_static_assert("#{expr} == sizeof(#{t})", prelude, opts, &b)
|
||||
}
|
||||
$defs.push(format("-DSIZEOF_%s=SIZEOF_%s", type.tr_cpp, size.tr_cpp))
|
||||
size
|
||||
elsif size = try_constant(expr, prelude, opts, &b)
|
||||
if size = try_constant(expr, prelude, opts, &b)
|
||||
$defs.push(format("-DSIZEOF_%s=%s", type.tr_cpp, size))
|
||||
size
|
||||
end
|
||||
|
|
|
@ -2,7 +2,13 @@ require_relative 'base'
|
|||
|
||||
class TestMkmf
|
||||
class TestSizeof < TestMkmf
|
||||
def test_sizeof
|
||||
def test_sizeof_builtin
|
||||
%w[char short int long float double void*].each do |type|
|
||||
assert_kind_of(Integer, mkmf {check_sizeof(type)})
|
||||
end
|
||||
end
|
||||
|
||||
def test_sizeof_struct
|
||||
open("confdefs.h", "w") {|f|
|
||||
f.puts "typedef struct {char x;} test1_t;"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue