diff options
Diffstat (limited to 'lib/mkmf.rb')
-rw-r--r-- | lib/mkmf.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb index d24c87f5cd..45346bfdbc 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -989,10 +989,14 @@ def check_sizeof(type, headers = nil, &b) x ? super : "failed" end checking_for checking_message("size of #{type}", headers), fmt do - if ((size = UNIVERSAL_INTS.find {|t| - try_static_assert("#{expr} == sizeof(#{t})", prelude, &b) - }) or - size = try_constant(expr, prelude, &b)) + 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) $defs.push(format("-DSIZEOF_%s=%s", type.tr_cpp, size)) size end |