Skip to content

Commit 5d0fb7c

Browse files
committed
* lib/mkmf.rb (configuration): fixing gsub when multiple error flags
are passed to GCC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 5631792 commit 5d0fb7c

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Thu Jan 6 09:12:31 2011 Aaron Patterson <[email protected]>
2+
3+
* lib/mkmf.rb (configuration): fixing gsub when multiple error flags
4+
are passed to GCC.
5+
16
Thu Jan 6 05:25:49 2011 Nobuyoshi Nakada <[email protected]>
27

38
* array.c (rb_ary_modify): export.

lib/mkmf.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1660,7 +1660,9 @@ def configuration(srcdir)
16601660
extconf_h = $extconf_h ? "-DRUBY_EXTCONF_H=\\\"$(RUBY_EXTCONF_H)\\\" " : $defs.join(" ") << " "
16611661
if warnflags = CONFIG['warnflags'] and CONFIG['GCC'] == 'yes' and !$extmk
16621662
# turn warnings into errors only for bundled extensions.
1663-
warnflags = warnflags.gsub(/(?:\A|\s)-Werror=/, '\1-W')
1663+
warnflags = warnflags.split.map { |flag|
1664+
flag.gsub(/(?:\A|\s)-Werror=/, '\1-W')
1665+
}.join ' '
16641666
end
16651667
mk << %{
16661668
CC = #{CONFIG['CC']}

test/mkmf/test_find_executable.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22

33
class TestMkmf
44
class TestFindExecutable < TestMkmf
5+
def test_valid_warnflags
6+
val = $extmk
7+
begin
8+
makefile = mkmf do
9+
$extmk = false
10+
self.class::CONFIG['warnflags'] = "-Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=shorten-64-to-32"
11+
self.class::CONFIG['GCC'] = 'yes'
12+
configuration '.'
13+
end
14+
generated_flags = makefile.grep(/warnflags/).first[/^warnflags = .*$/]
15+
assert_equal "warnflags = -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32", generated_flags
16+
ensure
17+
$extmk = val
18+
end
19+
end
20+
521
def test_find_executable
622
bug2669 = '[ruby-core:27912]'
723
path, ENV["PATH"] = ENV["PATH"], path

0 commit comments

Comments
 (0)