File tree Expand file tree Collapse file tree 9 files changed +47
-15
lines changed Expand file tree Collapse file tree 9 files changed +47
-15
lines changed Original file line number Diff line number Diff line change @@ -1775,6 +1775,13 @@ rb_callcc(VALUE self)
1775
1775
return rb_yield (val );
1776
1776
}
1777
1777
}
1778
+ #ifdef RUBY_ASAN_ENABLED
1779
+ /* callcc can't possibly work with ASAN; see bug #20273. Also this function
1780
+ * definition below avoids a "defined and not used" warning. */
1781
+ MAYBE_UNUSED (static void notusing_callcc (void )) { rb_callcc (Qnil ); }
1782
+ # define rb_callcc rb_f_notimplement
1783
+ #endif
1784
+
1778
1785
1779
1786
static VALUE
1780
1787
make_passing_arg (int argc , const VALUE * argv )
Original file line number Diff line number Diff line change @@ -3561,6 +3561,7 @@ def need_continuation
3561
3561
unless respond_to? ( :callcc , true )
3562
3562
EnvUtil . suppress_warning { require 'continuation' }
3563
3563
end
3564
+ omit 'requires callcc support' unless respond_to? ( :callcc , true )
3564
3565
end
3565
3566
end
3566
3567
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: false
2
2
require 'test/unit'
3
+ EnvUtil . suppress_warning { require 'continuation' }
3
4
4
5
class TestBeginEndBlock < Test ::Unit ::TestCase
5
6
DIR = File . dirname ( File . expand_path ( __FILE__ ) )
@@ -131,6 +132,8 @@ def test_rescue_at_exit
131
132
end
132
133
133
134
def test_callcc_at_exit
135
+ omit 'requires callcc support' unless respond_to? ( :callcc )
136
+
134
137
bug9110 = '[ruby-core:58329][Bug #9110]'
135
138
assert_ruby_status ( [ ] , "#{ <<~"begin;" } \n #{ <<~'end;' } " , bug9110 )
136
139
begin;
Original file line number Diff line number Diff line change 4
4
require 'fiber'
5
5
6
6
class TestContinuation < Test ::Unit ::TestCase
7
+ def setup
8
+ omit 'requires callcc support' unless respond_to? ( :callcc )
9
+ end
10
+
7
11
def test_create
8
12
assert_equal ( :ok , callcc { :ok } )
9
13
assert_equal ( :ok , callcc { |c | c . call :ok } )
Original file line number Diff line number Diff line change @@ -843,6 +843,8 @@ def test_cycle
843
843
end
844
844
845
845
def test_callcc
846
+ omit 'requires callcc support' unless respond_to? ( :callcc )
847
+
846
848
assert_raise ( RuntimeError ) do
847
849
c = nil
848
850
@obj . sort_by { |x | callcc { |c2 | c ||= c2 } ; x }
Original file line number Diff line number Diff line change @@ -82,12 +82,14 @@ def test_error
82
82
f . resume
83
83
f . resume
84
84
}
85
- assert_raise ( RuntimeError ) {
86
- Fiber . new {
87
- @c = callcc { |c | @c = c }
88
- } . resume
89
- @c . call # cross fiber callcc
90
- }
85
+ if respond_to? ( :callcc )
86
+ assert_raise ( RuntimeError ) {
87
+ Fiber . new {
88
+ @c = callcc { |c | @c = c }
89
+ } . resume
90
+ @c . call # cross fiber callcc
91
+ }
92
+ end
91
93
assert_raise ( RuntimeError ) {
92
94
Fiber . new {
93
95
raise
Original file line number Diff line number Diff line change @@ -1359,6 +1359,8 @@ def test_flatten_arity
1359
1359
end
1360
1360
1361
1361
def test_callcc
1362
+ omit 'requires callcc support' unless respond_to? ( :callcc )
1363
+
1362
1364
h = @cls [ 1 => 2 ]
1363
1365
c = nil
1364
1366
f = false
@@ -1379,6 +1381,8 @@ def test_callcc
1379
1381
end
1380
1382
1381
1383
def test_callcc_iter_level
1384
+ omit 'requires callcc support' unless respond_to? ( :callcc )
1385
+
1382
1386
bug9105 = '[ruby-dev:47803] [Bug #9105]'
1383
1387
h = @cls [ 1 => 2 , 3 => 4 ]
1384
1388
c = nil
@@ -1397,6 +1401,8 @@ def test_callcc_iter_level
1397
1401
end
1398
1402
1399
1403
def test_callcc_escape
1404
+ omit 'requires callcc support' unless respond_to? ( :callcc )
1405
+
1400
1406
bug9105 = '[ruby-dev:47803] [Bug #9105]'
1401
1407
assert_nothing_raised ( RuntimeError , bug9105 ) do
1402
1408
h = @cls [ ]
@@ -1411,6 +1417,8 @@ def test_callcc_escape
1411
1417
end
1412
1418
1413
1419
def test_callcc_reenter
1420
+ omit 'requires callcc support' unless respond_to? ( :callcc )
1421
+
1414
1422
bug9105 = '[ruby-dev:47803] [Bug #9105]'
1415
1423
assert_nothing_raised ( RuntimeError , bug9105 ) do
1416
1424
h = @cls [ 1 => 2 , 3 => 4 ]
Original file line number Diff line number Diff line change @@ -609,6 +609,8 @@ def marshal_load(v)
609
609
610
610
def test_continuation
611
611
EnvUtil . suppress_warning { require "continuation" }
612
+ omit 'requires callcc support' unless respond_to? ( :callcc )
613
+
612
614
c = Bug9523 . new
613
615
assert_raise_with_message ( RuntimeError , /Marshal\. dump reentered at marshal_dump/ ) do
614
616
Marshal . dump ( c )
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: false
2
2
require 'test/unit'
3
+ EnvUtil . suppress_warning { require 'continuation' }
3
4
4
5
class TestSetTraceFunc < Test ::Unit ::TestCase
5
6
def setup
@@ -1258,15 +1259,17 @@ def each
1258
1259
end
1259
1260
}
1260
1261
assert_normal_exit src % %q{obj.zip({}) {}} , bug7774
1261
- assert_normal_exit src % %q{
1262
- require 'continuation'
1263
- begin
1264
- c = nil
1265
- obj.sort_by {|x| callcc {|c2| c ||= c2 }; x }
1266
- c.call
1267
- rescue RuntimeError
1268
- end
1269
- } , bug7774
1262
+ if respond_to? ( :callcc )
1263
+ assert_normal_exit src % %q{
1264
+ require 'continuation'
1265
+ begin
1266
+ c = nil
1267
+ obj.sort_by {|x| callcc {|c2| c ||= c2 }; x }
1268
+ c.call
1269
+ rescue RuntimeError
1270
+ end
1271
+ } , bug7774
1272
+ end
1270
1273
1271
1274
# TracePoint
1272
1275
tp_b = nil
You can’t perform that action at this time.
0 commit comments