ruby-changes:68221
From: Nobuyoshi <ko1@a...>
Date: Sun, 3 Oct 2021 18:30:59 +0900 (JST)
Subject: [ruby-changes:68221] ea64e742f5 (master): Revert "mkmf.rb: try linking at try_var" [Bug #18235]
https://git.ruby-lang.org/ruby.git/commit/?id=ea64e742f5 From ea64e742f5feddbdfb6526cd0a54a9986097a34d Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sun, 3 Oct 2021 16:35:10 +0900 Subject: Revert "mkmf.rb: try linking at try_var" [Bug #18235] This reverts commit 524513be399e81bb170ec88aa0d501f33cbde8c3, which can return false positive by existing but unusable symbol, including functions. --- lib/mkmf.rb | 10 +--------- test/mkmf/test_have_var.rb | 17 ----------------- 2 files changed, 1 insertion(+), 26 deletions(-) delete mode 100644 test/mkmf/test_have_var.rb diff --git a/lib/mkmf.rb b/lib/mkmf.rb index cab9a3f646..79dd3f7172 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -821,20 +821,12 @@ SRC https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L821 # You should use +have_var+ rather than +try_var+. def try_var(var, headers = nil, opt = "", &b) headers = cpp_include(headers) - try_compile(<<"SRC", opt, &b) or + try_compile(<<"SRC", opt, &b) #{headers} /*top*/ extern int t(void); #{MAIN_DOES_NOTHING 't'} int t(void) { const volatile void *volatile p; p = &(&#{var})[0]; return !p; } -SRC - try_link(<<"SRC", opt, &b) -#{headers} -/*top*/ -extern int t(void); -#{MAIN_DOES_NOTHING 't'} -extern int #{var}; -int t(void) { const volatile void *volatile p; p = &(&#{var})[0]; return !p; } SRC end diff --git a/test/mkmf/test_have_var.rb b/test/mkmf/test_have_var.rb deleted file mode 100644 index 5367ec2248..0000000000 --- a/test/mkmf/test_have_var.rb +++ /dev/null @@ -1,17 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L0 -# frozen_string_literal: false -require_relative 'base' -require 'tempfile' - -class TestMkmf - class TestHaveVar < TestMkmf - def test_have_var - assert_equal(true, have_var("ruby_version"), MKMFLOG) - assert_include($defs, '-DHAVE_RUBY_VERSION') - end - - def test_not_have_var - assert_equal(false, have_var("rb_vm_something_flag"), MKMFLOG) - assert_not_include($defs, '-DHAVE_RB_VM_SOMETHING_FLAG') - end - end -end -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/