diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-03-26 21:39:50 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-03-26 21:39:50 +0000 |
commit | 89b49d45989845cb196a5b9ce4dc0147a867a4c6 (patch) | |
tree | 87423e3f575c86b922eb45dc59d9332c34a890fd | |
parent | aa25b1e7403840a4ac3bf1ee0e2318d8cb473260 (diff) | |
download | bundler-89b49d45989845cb196a5b9ce4dc0147a867a4c6.tar.gz |
mkmf.rb: force refererence in MAIN_DOES_NOTHING
* lib/mkmf.rb (MAIN_DOES_NOTHING): force to refer symbols for tests
to be preserved. [ruby-core:53745] [Bug #8169]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/mkmf.rb | 18 |
2 files changed, 17 insertions, 6 deletions
@@ -1,3 +1,8 @@ +Wed Mar 27 06:39:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * lib/mkmf.rb (MAIN_DOES_NOTHING): force to refer symbols for tests + to be preserved. [ruby-core:53745] [Bug #8169] + Wed Mar 27 05:15:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org> * configure.in (RUBY_REPLACE_TYPE): define SIGNEDNESS_OF_type same as diff --git a/lib/mkmf.rb b/lib/mkmf.rb index dbea04fd93..6f96f3ce1a 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -738,16 +738,16 @@ int main() {printf("%"PRI_CONFTEST_PREFIX"#{neg ? 'd' : 'u'}\\n", conftest_const decltype && try_link(<<"SRC", opt, &b) or #{headers} /*top*/ -#{MAIN_DOES_NOTHING} extern int t(void); int t(void) { #{decltype["volatile p"]}; p = (#{decltype[]})#{func}; return 0; } +#{MAIN_DOES_NOTHING "t"} SRC call && try_link(<<"SRC", opt, &b) #{headers} /*top*/ -#{MAIN_DOES_NOTHING} extern int t(void); int t(void) { #{call}; return 0; } +#{MAIN_DOES_NOTHING "t"} SRC end @@ -757,9 +757,9 @@ SRC try_compile(<<"SRC", opt, &b) #{headers} /*top*/ -#{MAIN_DOES_NOTHING} extern int t(void); int t(void) { const volatile void *volatile p; p = &(&#{var})[0]; return 0; } +#{MAIN_DOES_NOTHING "t"} SRC end @@ -1142,8 +1142,8 @@ SRC if try_compile(<<"SRC", opt, &b) #{cpp_include(headers)} /*top*/ -#{MAIN_DOES_NOTHING} int s = (char *)&((#{type}*)0)->#{member} - (char *)0; +#{MAIN_DOES_NOTHING "s"} SRC $defs.push(format("-DHAVE_%s_%s", type.tr_cpp, member.tr_cpp)) $defs.push(format("-DHAVE_ST_%s", member.tr_cpp)) # backward compatibility @@ -1396,9 +1396,9 @@ SRC #{cpp_include(headers)} /*top*/ volatile #{type} conftestval; -#{MAIN_DOES_NOTHING} extern int t(void); int t(void) {return (int)(1-*(conftestval#{member ? ".#{member}" : ""}));} +#{MAIN_DOES_NOTHING "t"} SRC end @@ -1409,9 +1409,9 @@ SRC #{cpp_include(headers)} /*top*/ volatile #{type} conftestval; -#{MAIN_DOES_NOTHING} extern int t(void); int t(void) {return (int)(1-(conftestval#{member ? ".#{member}" : ""}));} +#{MAIN_DOES_NOTHING "t"} SRC end @@ -2419,6 +2419,12 @@ MESSAGE @libdir_basename ||= config_string("libdir") {|name| name[/\A\$\(exec_prefix\)\/(.*)/, 1]} || "lib" end + def MAIN_DOES_NOTHING(*refs) + src = MAIN_DOES_NOTHING + src = src.sub(/\{/) {$&+refs.map {|n|"(void)#{n}; "}.join("")} + src + end + extend self init_mkmf |