merge revision(s) 49482,49487: [Backport #10821]

* lib/mkmf.rb (try_cppflags, try_cflags, try_ldflags): get rid of
	  interference by modifying global variables in have_devel? method.
	  [ruby-core:67962] [Bug #10821]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@49735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2015-02-25 05:26:38 +00:00
parent 12ba294b8d
commit 5b37cb25ec
5 changed files with 43 additions and 11 deletions

View file

@ -1,3 +1,9 @@
Wed Feb 25 14:22:57 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/mkmf.rb (try_cppflags, try_cflags, try_ldflags): get rid of
interference by modifying global variables in have_devel? method.
[ruby-core:67962] [Bug #10821]
Wed Feb 25 14:19:35 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
* thread.c: Improve documentation for Thread#value

View file

@ -588,9 +588,7 @@ MSG
end
def try_cppflags(flags)
with_cppflags(flags) do
try_header("int main() {return 0;}")
end
try_header(MAIN_DOES_NOTHING, flags)
end
def with_cflags(flags)
@ -602,9 +600,7 @@ MSG
end
def try_cflags(flags)
with_cflags(flags) do
try_compile("int main() {return 0;}")
end
try_compile(MAIN_DOES_NOTHING, flags)
end
def with_ldflags(flags)
@ -616,9 +612,7 @@ MSG
end
def try_ldflags(flags)
with_ldflags(flags) do
try_link("int main() {return 0;}")
end
try_link(MAIN_DOES_NOTHING, flags)
end
def try_static_assert(expr, headers = nil, opt = "", &b)

View file

@ -1,6 +1,7 @@
require 'test/unit'
require 'mkmf'
require 'tmpdir'
require_relative '../ruby/envutil'
$extout = '$(topdir)/'+RbConfig::CONFIG["EXTOUT"]
RbConfig::CONFIG['topdir'] = CONFIG['topdir'] = File.expand_path(CONFIG['topdir'])
@ -50,7 +51,9 @@ class TestMkmf < Test::Unit::TestCase
@buffer << s if @out
end
end
end
module TestMkmf::Base
attr_reader :stdout
def mkmflog(msg)
@ -89,7 +92,7 @@ class TestMkmf < Test::Unit::TestCase
@tmpdir = Dir.mktmpdir
@curdir = Dir.pwd
@mkmfobj = Object.new
@stdout = Capture.new
@stdout = TestMkmf::Capture.new
Dir.chdir(@tmpdir)
@quiet, Logging.quiet = Logging.quiet, true
init_mkmf
@ -132,3 +135,11 @@ class TestMkmf < Test::Unit::TestCase
nil
end
end
class TestMkmf
include TestMkmf::Base
def assert_separately(args, src, *rest)
super(args + ["-r#{__FILE__}"], "extend TestMkmf::Base; setup\n#{src}", *rest)
end
end

View file

@ -31,5 +31,26 @@ class TestMkmf
$warnflags = warnflags
$extmk = val
end
def test_try_ldflag_invalid_opt
assert_separately([], <<-'end;') #do
assert(!try_ldflags("nosuch.c"), TestMkmf::MKMFLOG)
assert(have_devel?, TestMkmf::MKMFLOG)
end;
end
def test_try_cflag_invalid_opt
assert_separately([], <<-'end;') #do
assert(!try_cflags("nosuch.c"), TestMkmf::MKMFLOG)
assert(have_devel?, TestMkmf::MKMFLOG)
end;
end
def test_try_cppflag_invalid_opt
assert_separately([], <<-'end;') #do
assert(!try_cppflags("nosuch.c"), TestMkmf::MKMFLOG)
assert(have_devel?, TestMkmf::MKMFLOG)
end;
end
end
end

View file

@ -1,6 +1,6 @@
#define RUBY_VERSION "2.0.0"
#define RUBY_RELEASE_DATE "2015-02-25"
#define RUBY_PATCHLEVEL 637
#define RUBY_PATCHLEVEL 638
#define RUBY_RELEASE_YEAR 2015
#define RUBY_RELEASE_MONTH 2