ruby-changes:37912
From: nagachika <ko1@a...>
Date: Wed, 18 Mar 2015 01:57:11 +0900 (JST)
Subject: [ruby-changes:37912] nagachika:r49993 (ruby_2_1): merge revision(s) r49482, r49487: [Backport #10821]
nagachika 2015-03-18 01:56:55 +0900 (Wed, 18 Mar 2015) New Revision: 49993 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49993 Log: merge revision(s) r49482,r49487: [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] Modified directories: branches/ruby_2_1/ Modified files: branches/ruby_2_1/ChangeLog branches/ruby_2_1/lib/mkmf.rb branches/ruby_2_1/test/mkmf/base.rb branches/ruby_2_1/test/mkmf/test_flags.rb branches/ruby_2_1/version.h Index: ruby_2_1/ChangeLog =================================================================== --- ruby_2_1/ChangeLog (revision 49992) +++ ruby_2_1/ChangeLog (revision 49993) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1 +Wed Mar 18 01:45:12 2015 Nobuyoshi Nakada <nobu@r...> + + * 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 Mar 18 00:58:43 2015 Shugo Maeda <shugo@r...> * class.c (method_entry_i, class_instance_method_list, Index: ruby_2_1/lib/mkmf.rb =================================================================== --- ruby_2_1/lib/mkmf.rb (revision 49992) +++ ruby_2_1/lib/mkmf.rb (revision 49993) @@ -610,9 +610,7 @@ MSG https://github.com/ruby/ruby/blob/trunk/ruby_2_1/lib/mkmf.rb#L610 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) @@ -624,9 +622,7 @@ MSG https://github.com/ruby/ruby/blob/trunk/ruby_2_1/lib/mkmf.rb#L622 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) @@ -638,9 +634,7 @@ MSG https://github.com/ruby/ruby/blob/trunk/ruby_2_1/lib/mkmf.rb#L634 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) Index: ruby_2_1/version.h =================================================================== --- ruby_2_1/version.h (revision 49992) +++ ruby_2_1/version.h (revision 49993) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1 #define RUBY_VERSION "2.1.5" #define RUBY_RELEASE_DATE "2015-03-18" -#define RUBY_PATCHLEVEL 314 +#define RUBY_PATCHLEVEL 315 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 3 Index: ruby_2_1/test/mkmf/base.rb =================================================================== --- ruby_2_1/test/mkmf/base.rb (revision 49992) +++ ruby_2_1/test/mkmf/base.rb (revision 49993) @@ -3,6 +3,7 @@ $extmk = true https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/mkmf/base.rb#L3 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']) @@ -49,7 +50,9 @@ class TestMkmf < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/mkmf/base.rb#L50 @buffer << s if @out end end +end +module TestMkmf::Base attr_reader :stdout def mkmflog(msg) @@ -84,7 +87,7 @@ class TestMkmf < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/mkmf/base.rb#L87 @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 @@ -127,3 +130,11 @@ class TestMkmf < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/mkmf/base.rb#L130 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 Index: ruby_2_1/test/mkmf/test_flags.rb =================================================================== --- ruby_2_1/test/mkmf/test_flags.rb (revision 49992) +++ ruby_2_1/test/mkmf/test_flags.rb (revision 49993) @@ -31,5 +31,26 @@ class TestMkmf https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/mkmf/test_flags.rb#L31 $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 Property changes on: ruby_2_1 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r49482,49487 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/