summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib/mkmf.rb4
-rw-r--r--test/mkmf/test_find_executable.rb16
3 files changed, 24 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 97e8e79..e23b87c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Jan 6 09:12:31 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * lib/mkmf.rb (configuration): fixing gsub when multiple error flags
+ are passed to GCC.
+
Thu Jan 6 05:25:49 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* array.c (rb_ary_modify): export.
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index d7964d6..a438886 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -1660,7 +1660,9 @@ VPATH = #{vpath.join(CONFIG['PATH_SEPARATOR'])}
extconf_h = $extconf_h ? "-DRUBY_EXTCONF_H=\\\"$(RUBY_EXTCONF_H)\\\" " : $defs.join(" ") << " "
if warnflags = CONFIG['warnflags'] and CONFIG['GCC'] == 'yes' and !$extmk
# turn warnings into errors only for bundled extensions.
- warnflags = warnflags.gsub(/(?:\A|\s)-Werror=/, '\1-W')
+ warnflags = warnflags.split.map { |flag|
+ flag.gsub(/(?:\A|\s)-Werror=/, '\1-W')
+ }.join ' '
end
mk << %{
CC = #{CONFIG['CC']}
diff --git a/test/mkmf/test_find_executable.rb b/test/mkmf/test_find_executable.rb
index 5ccec88..132330b 100644
--- a/test/mkmf/test_find_executable.rb
+++ b/test/mkmf/test_find_executable.rb
@@ -2,6 +2,22 @@ require_relative 'base'
class TestMkmf
class TestFindExecutable < TestMkmf
+ def test_valid_warnflags
+ val = $extmk
+ begin
+ makefile = mkmf do
+ $extmk = false
+ 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"
+ self.class::CONFIG['GCC'] = 'yes'
+ configuration '.'
+ end
+ generated_flags = makefile.grep(/warnflags/).first[/^warnflags = .*$/]
+ 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
+ ensure
+ $extmk = val
+ end
+ end
+
def test_find_executable
bug2669 = '[ruby-core:27912]'
path, ENV["PATH"] = ENV["PATH"], path