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
This commit is contained in:
nobu 2013-03-26 21:39:50 +00:00
Родитель aa25b1e740
Коммит 89b49d4598
2 изменённых файлов: 17 добавлений и 6 удалений

Просмотреть файл

@ -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> Wed Mar 27 05:15:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (RUBY_REPLACE_TYPE): define SIGNEDNESS_OF_type same as * configure.in (RUBY_REPLACE_TYPE): define SIGNEDNESS_OF_type same as

Просмотреть файл

@ -738,16 +738,16 @@ int main() {printf("%"PRI_CONFTEST_PREFIX"#{neg ? 'd' : 'u'}\\n", conftest_const
decltype && try_link(<<"SRC", opt, &b) or decltype && try_link(<<"SRC", opt, &b) or
#{headers} #{headers}
/*top*/ /*top*/
#{MAIN_DOES_NOTHING}
extern int t(void); extern int t(void);
int t(void) { #{decltype["volatile p"]}; p = (#{decltype[]})#{func}; return 0; } int t(void) { #{decltype["volatile p"]}; p = (#{decltype[]})#{func}; return 0; }
#{MAIN_DOES_NOTHING "t"}
SRC SRC
call && try_link(<<"SRC", opt, &b) call && try_link(<<"SRC", opt, &b)
#{headers} #{headers}
/*top*/ /*top*/
#{MAIN_DOES_NOTHING}
extern int t(void); extern int t(void);
int t(void) { #{call}; return 0; } int t(void) { #{call}; return 0; }
#{MAIN_DOES_NOTHING "t"}
SRC SRC
end end
@ -757,9 +757,9 @@ SRC
try_compile(<<"SRC", opt, &b) try_compile(<<"SRC", opt, &b)
#{headers} #{headers}
/*top*/ /*top*/
#{MAIN_DOES_NOTHING}
extern int t(void); extern int t(void);
int t(void) { const volatile void *volatile p; p = &(&#{var})[0]; return 0; } int t(void) { const volatile void *volatile p; p = &(&#{var})[0]; return 0; }
#{MAIN_DOES_NOTHING "t"}
SRC SRC
end end
@ -1142,8 +1142,8 @@ SRC
if try_compile(<<"SRC", opt, &b) if try_compile(<<"SRC", opt, &b)
#{cpp_include(headers)} #{cpp_include(headers)}
/*top*/ /*top*/
#{MAIN_DOES_NOTHING}
int s = (char *)&((#{type}*)0)->#{member} - (char *)0; int s = (char *)&((#{type}*)0)->#{member} - (char *)0;
#{MAIN_DOES_NOTHING "s"}
SRC SRC
$defs.push(format("-DHAVE_%s_%s", type.tr_cpp, member.tr_cpp)) $defs.push(format("-DHAVE_%s_%s", type.tr_cpp, member.tr_cpp))
$defs.push(format("-DHAVE_ST_%s", member.tr_cpp)) # backward compatibility $defs.push(format("-DHAVE_ST_%s", member.tr_cpp)) # backward compatibility
@ -1396,9 +1396,9 @@ SRC
#{cpp_include(headers)} #{cpp_include(headers)}
/*top*/ /*top*/
volatile #{type} conftestval; volatile #{type} conftestval;
#{MAIN_DOES_NOTHING}
extern int t(void); extern int t(void);
int t(void) {return (int)(1-*(conftestval#{member ? ".#{member}" : ""}));} int t(void) {return (int)(1-*(conftestval#{member ? ".#{member}" : ""}));}
#{MAIN_DOES_NOTHING "t"}
SRC SRC
end end
@ -1409,9 +1409,9 @@ SRC
#{cpp_include(headers)} #{cpp_include(headers)}
/*top*/ /*top*/
volatile #{type} conftestval; volatile #{type} conftestval;
#{MAIN_DOES_NOTHING}
extern int t(void); extern int t(void);
int t(void) {return (int)(1-(conftestval#{member ? ".#{member}" : ""}));} int t(void) {return (int)(1-(conftestval#{member ? ".#{member}" : ""}));}
#{MAIN_DOES_NOTHING "t"}
SRC SRC
end end
@ -2419,6 +2419,12 @@ MESSAGE
@libdir_basename ||= config_string("libdir") {|name| name[/\A\$\(exec_prefix\)\/(.*)/, 1]} || "lib" @libdir_basename ||= config_string("libdir") {|name| name[/\A\$\(exec_prefix\)\/(.*)/, 1]} || "lib"
end end
def MAIN_DOES_NOTHING(*refs)
src = MAIN_DOES_NOTHING
src = src.sub(/\{/) {$&+refs.map {|n|"(void)#{n}; "}.join("")}
src
end
extend self extend self
init_mkmf init_mkmf