зеркало из https://github.com/github/ruby.git
Disable callcc when ASAN is enabled
callcc's implementation is fundamentally incompatible with ASAN. Since callcc is deprecated and almost never used, it's probably OK to disable callcc when ruby is compiled with ASAN. [Bug #20273]
This commit is contained in:
Родитель
0d9a681eff
Коммит
5621d794a2
7
cont.c
7
cont.c
|
@ -1775,6 +1775,13 @@ rb_callcc(VALUE self)
|
|||
return rb_yield(val);
|
||||
}
|
||||
}
|
||||
#ifdef RUBY_ASAN_ENABLED
|
||||
/* callcc can't possibly work with ASAN; see bug #20273. Also this function
|
||||
* definition below avoids a "defined and not used" warning. */
|
||||
MAYBE_UNUSED(static void notusing_callcc(void)) { rb_callcc(Qnil); }
|
||||
# define rb_callcc rb_f_notimplement
|
||||
#endif
|
||||
|
||||
|
||||
static VALUE
|
||||
make_passing_arg(int argc, const VALUE *argv)
|
||||
|
|
|
@ -3561,6 +3561,7 @@ class TestArray < Test::Unit::TestCase
|
|||
unless respond_to?(:callcc, true)
|
||||
EnvUtil.suppress_warning {require 'continuation'}
|
||||
end
|
||||
omit 'requires callcc support' unless respond_to?(:callcc, true)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# frozen_string_literal: false
|
||||
require 'test/unit'
|
||||
EnvUtil.suppress_warning {require 'continuation'}
|
||||
|
||||
class TestBeginEndBlock < Test::Unit::TestCase
|
||||
DIR = File.dirname(File.expand_path(__FILE__))
|
||||
|
@ -131,6 +132,8 @@ class TestBeginEndBlock < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_callcc_at_exit
|
||||
omit 'requires callcc support' unless respond_to?(:callcc)
|
||||
|
||||
bug9110 = '[ruby-core:58329][Bug #9110]'
|
||||
assert_ruby_status([], "#{<<~"begin;"}\n#{<<~'end;'}", bug9110)
|
||||
begin;
|
||||
|
|
|
@ -4,6 +4,10 @@ EnvUtil.suppress_warning {require 'continuation'}
|
|||
require 'fiber'
|
||||
|
||||
class TestContinuation < Test::Unit::TestCase
|
||||
def setup
|
||||
omit 'requires callcc support' unless respond_to?(:callcc)
|
||||
end
|
||||
|
||||
def test_create
|
||||
assert_equal(:ok, callcc{:ok})
|
||||
assert_equal(:ok, callcc{|c| c.call :ok})
|
||||
|
|
|
@ -843,6 +843,8 @@ class TestEnumerable < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_callcc
|
||||
omit 'requires callcc support' unless respond_to?(:callcc)
|
||||
|
||||
assert_raise(RuntimeError) do
|
||||
c = nil
|
||||
@obj.sort_by {|x| callcc {|c2| c ||= c2 }; x }
|
||||
|
|
|
@ -82,12 +82,14 @@ class TestFiber < Test::Unit::TestCase
|
|||
f.resume
|
||||
f.resume
|
||||
}
|
||||
assert_raise(RuntimeError){
|
||||
Fiber.new{
|
||||
@c = callcc{|c| @c = c}
|
||||
}.resume
|
||||
@c.call # cross fiber callcc
|
||||
}
|
||||
if respond_to?(:callcc)
|
||||
assert_raise(RuntimeError){
|
||||
Fiber.new{
|
||||
@c = callcc{|c| @c = c}
|
||||
}.resume
|
||||
@c.call # cross fiber callcc
|
||||
}
|
||||
end
|
||||
assert_raise(RuntimeError){
|
||||
Fiber.new{
|
||||
raise
|
||||
|
|
|
@ -1359,6 +1359,8 @@ class TestHash < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_callcc
|
||||
omit 'requires callcc support' unless respond_to?(:callcc)
|
||||
|
||||
h = @cls[1=>2]
|
||||
c = nil
|
||||
f = false
|
||||
|
@ -1379,6 +1381,8 @@ class TestHash < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_callcc_iter_level
|
||||
omit 'requires callcc support' unless respond_to?(:callcc)
|
||||
|
||||
bug9105 = '[ruby-dev:47803] [Bug #9105]'
|
||||
h = @cls[1=>2, 3=>4]
|
||||
c = nil
|
||||
|
@ -1397,6 +1401,8 @@ class TestHash < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_callcc_escape
|
||||
omit 'requires callcc support' unless respond_to?(:callcc)
|
||||
|
||||
bug9105 = '[ruby-dev:47803] [Bug #9105]'
|
||||
assert_nothing_raised(RuntimeError, bug9105) do
|
||||
h=@cls[]
|
||||
|
@ -1411,6 +1417,8 @@ class TestHash < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_callcc_reenter
|
||||
omit 'requires callcc support' unless respond_to?(:callcc)
|
||||
|
||||
bug9105 = '[ruby-dev:47803] [Bug #9105]'
|
||||
assert_nothing_raised(RuntimeError, bug9105) do
|
||||
h = @cls[1=>2,3=>4]
|
||||
|
|
|
@ -609,6 +609,8 @@ class TestMarshal < Test::Unit::TestCase
|
|||
|
||||
def test_continuation
|
||||
EnvUtil.suppress_warning {require "continuation"}
|
||||
omit 'requires callcc support' unless respond_to?(:callcc)
|
||||
|
||||
c = Bug9523.new
|
||||
assert_raise_with_message(RuntimeError, /Marshal\.dump reentered at marshal_dump/) do
|
||||
Marshal.dump(c)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# frozen_string_literal: false
|
||||
require 'test/unit'
|
||||
EnvUtil.suppress_warning {require 'continuation'}
|
||||
|
||||
class TestSetTraceFunc < Test::Unit::TestCase
|
||||
def setup
|
||||
|
@ -1258,15 +1259,17 @@ CODE
|
|||
end
|
||||
}
|
||||
assert_normal_exit src % %q{obj.zip({}) {}}, bug7774
|
||||
assert_normal_exit src % %q{
|
||||
require 'continuation'
|
||||
begin
|
||||
c = nil
|
||||
obj.sort_by {|x| callcc {|c2| c ||= c2 }; x }
|
||||
c.call
|
||||
rescue RuntimeError
|
||||
end
|
||||
}, bug7774
|
||||
if respond_to?(:callcc)
|
||||
assert_normal_exit src % %q{
|
||||
require 'continuation'
|
||||
begin
|
||||
c = nil
|
||||
obj.sort_by {|x| callcc {|c2| c ||= c2 }; x }
|
||||
c.call
|
||||
rescue RuntimeError
|
||||
end
|
||||
}, bug7774
|
||||
end
|
||||
|
||||
# TracePoint
|
||||
tp_b = nil
|
||||
|
|
Загрузка…
Ссылка в новой задаче