ruby-changes:38134
From: nobu <ko1@a...>
Date: Fri, 10 Apr 2015 22:29:41 +0900 (JST)
Subject: [ruby-changes:38134] nobu:r50215 (trunk): mkmf.rb: fix werror option
nobu 2015-04-10 22:29:23 +0900 (Fri, 10 Apr 2015) New Revision: 50215 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50215 Log: mkmf.rb: fix werror option * lib/mkmf.rb (try_compile): pass the given werror flag to try_do to check if stderr is empty. * lib/mkmf.rb (try_cflags, try_ldflags): default werror to true. * win32/Makefile.sub (WERRORFLAG): remove useless option. VC does not make warnings of unknown command option an error. Modified files: trunk/ChangeLog trunk/ext/date/extconf.rb trunk/lib/mkmf.rb trunk/win32/Makefile.sub Index: ChangeLog =================================================================== --- ChangeLog (revision 50214) +++ ChangeLog (revision 50215) @@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Apr 10 22:29:21 2015 Nobuyoshi Nakada <nobu@r...> + + * lib/mkmf.rb (try_compile): pass the given werror flag to try_do + to check if stderr is empty. + + * lib/mkmf.rb (try_cflags, try_ldflags): default werror to true. + + * win32/Makefile.sub (WERRORFLAG): remove useless option. VC does + not make warnings of unknown command option an error. + Fri Apr 10 19:34:24 2015 Tanaka Akira <akr@f...> * test/ruby/test_file_exhaustive.rb: Test socket. Index: lib/mkmf.rb =================================================================== --- lib/mkmf.rb (revision 50214) +++ lib/mkmf.rb (revision 50215) @@ -568,7 +568,7 @@ MSG https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L568 # [+src+] a String which contains a C source # [+opt+] a String which contains compiler options def try_compile(src, opt="", *opts, &b) - with_werror(opt, *opts) {|_opt, *_opts| try_do(src, cc_command(_opt), *_opts, &b)} and + with_werror(opt, *opts) {|_opt, *| try_do(src, cc_command(_opt), *opts, &b)} and File.file?("#{CONFTEST}.#{$OBJEXT}") ensure MakeMakefile.rm_f "#{CONFTEST}*" @@ -621,8 +621,8 @@ MSG https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L621 $CFLAGS = cflags unless ret end - def try_cflags(flags, *opts) - try_compile(MAIN_DOES_NOTHING, flags, *opts) + def try_cflags(flags, opts = {}) + try_compile(MAIN_DOES_NOTHING, flags, {:werror => true}.update(opts)) end def with_ldflags(flags) @@ -633,8 +633,8 @@ MSG https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L633 $LDFLAGS = ldflags unless ret end - def try_ldflags(flags) - try_link(MAIN_DOES_NOTHING, flags) + def try_ldflags(flags, opts = {}) + try_link(MAIN_DOES_NOTHING, flags, {:werror => true}.update(opts)) end def try_static_assert(expr, headers = nil, opt = "", &b) Index: win32/Makefile.sub =================================================================== --- win32/Makefile.sub (revision 50214) +++ win32/Makefile.sub (revision 50215) @@ -208,7 +208,7 @@ WARNFLAGS = -W2 -wd4996 -we4028 -we4142 https://github.com/ruby/ruby/blob/trunk/win32/Makefile.sub#L208 WARNFLAGS = -W2 !endif !endif -WERRORFLAG = -WX -we9002 +WERRORFLAG = -WX !if !defined(CFLAGS) CFLAGS = $(RUNTIMEFLAG) $(DEBUGFLAGS) $(WARNFLAGS) $(OPTFLAGS) $(PROCESSOR_FLAG) $(COMPILERFLAG) !endif Index: ext/date/extconf.rb =================================================================== --- ext/date/extconf.rb (revision 50214) +++ ext/date/extconf.rb (revision 50215) @@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/ext/date/extconf.rb#L1 require 'mkmf' -if try_cflags("-std=iso9899:1999", :werror => true) +if try_cflags("-std=iso9899:1999") $CFLAGS += " " << "-std=iso9899:1999" end create_makefile('date_core') -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/