mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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:
parent
aa25b1e740
commit
89b49d4598
2 changed files with 17 additions and 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
|
||||
|
|
18
lib/mkmf.rb
18
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
|
||||
|
||||
|
|
Loading…
Reference in a new issue