1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-04-10 13:29:23 +00:00
parent 6f636adad0
commit aceb11dff4
4 changed files with 17 additions and 7 deletions

View file

@ -1,3 +1,13 @@
Fri Apr 10 22:29:21 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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@fsij.org>
* test/ruby/test_file_exhaustive.rb: Test socket.

View file

@ -1,5 +1,5 @@
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')

View file

@ -568,7 +568,7 @@ MSG
# [+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
$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
$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)

View file

@ -208,7 +208,7 @@ WARNFLAGS = -W2 -wd4996 -we4028 -we4142
WARNFLAGS = -W2
!endif
!endif
WERRORFLAG = -WX -we9002
WERRORFLAG = -WX
!if !defined(CFLAGS)
CFLAGS = $(RUNTIMEFLAG) $(DEBUGFLAGS) $(WARNFLAGS) $(OPTFLAGS) $(PROCESSOR_FLAG) $(COMPILERFLAG)
!endif