ruby-changes:57682
From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Mon, 9 Sep 2019 21:28:00 +0900 (JST)
Subject: [ruby-changes:57682] 92a8726994 (master): Revert "save committers' weekend from CI failures"
https://git.ruby-lang.org/ruby.git/commit/?id=92a8726994 From 92a87269945154344ba3fc96c0de63493e2fe6a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= <shyouhei@r...> Date: Sat, 7 Sep 2019 17:48:02 +0900 Subject: Revert "save committers' weekend from CI failures" This reverts commit 53d21087da078cf999cc4757b03b2ff0fab4c2cf. diff --git a/ext/-test-/cxxanyargs/cxxanyargs.cpp b/ext/-test-/cxxanyargs/cxxanyargs.cpp new file mode 100644 index 0000000..51be7ca --- /dev/null +++ b/ext/-test-/cxxanyargs/cxxanyargs.cpp @@ -0,0 +1,362 @@ https://github.com/ruby/ruby/blob/trunk/ext/-test-/cxxanyargs/cxxanyargs.cpp#L1 +#include <ruby/ruby.h> + +#if 0 // Warnings expected, should just suppress them + +#elif defined(_MSC_VER) +#pragma warning(disable : 4996) + +#elif defined(__clang__) +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + +#elif defined(__GNUC__) +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#else +// :FIXME: improve here for your compiler. + +#endif + +namespace test_rb_define_virtual_variable { + VALUE + getter(ID, VALUE *data) + { + return *data; + } + + void + setter(VALUE val, ID, VALUE *data) + { + *data = val; + } + + VALUE + test(VALUE self) + { + rb_define_virtual_variable("test", + RUBY_METHOD_FUNC(getter), + reinterpret_cast<void(*)(ANYARGS)>(setter)); // old + rb_define_virtual_variable("test", getter, setter); // new + return self; + } +} + +struct test_rb_define_hooked_variable { + static VALUE v; + + static VALUE + getter(ID, VALUE *data) + { + return *data; + } + + static void + setter(VALUE val, ID, VALUE *data) + { + *data = val; + } + + static VALUE + test(VALUE self) + { + rb_define_hooked_variable("test", &v, + RUBY_METHOD_FUNC(getter), + reinterpret_cast<void(*)(ANYARGS)>(setter)); // old + rb_define_hooked_variable("test", &v, getter, setter); // new + return self; + } +}; + +namespace test_rb_iterate { + VALUE + iter(VALUE self) + { + return rb_funcall(self, rb_intern("yield"), 0); + } + + VALUE + block(RB_BLOCK_CALL_FUNC_ARGLIST(arg, param)) + { + return rb_funcall(arg, rb_intern("=="), 1, param); + } + + VALUE + test(VALUE self) + { + rb_iterate(iter, self, RUBY_METHOD_FUNC(block), self); // old + return rb_iterate(iter, self, block, self); // new + } +} + +namespace test_rb_block_call { + VALUE + block(RB_BLOCK_CALL_FUNC_ARGLIST(arg, param)) + { + return rb_funcall(arg, rb_intern("=="), 1, param); + } + + VALUE + test(VALUE self) + { + const ID mid = rb_intern("each"); + const VALUE argv[] = { Qundef }; + rb_block_call(self, mid, 0, argv, RUBY_METHOD_FUNC(block), self); // old + return rb_block_call(self, mid, 0, argv, block, self); // new + } +} + +namespace test_rb_rescue { + VALUE + begin(VALUE arg) + { + return arg; + } + + VALUE + rescue(VALUE arg, VALUE exc) + { + return exc; + } + + VALUE + test(VALUE self) + { + rb_rescue(RUBY_METHOD_FUNC(begin), self, RUBY_METHOD_FUNC(rescue), self); // old + return rb_rescue(begin, self, rescue, self); // new + } +} + +namespace test_rb_rescue2 { + VALUE + begin(VALUE arg) + { + return arg; + } + + VALUE + rescue(VALUE arg, VALUE exc) + { + return exc; + } + + VALUE + test(VALUE self) + { + rb_rescue2(RUBY_METHOD_FUNC(begin), self, RUBY_METHOD_FUNC(rescue), self, + rb_eStandardError, rb_eFatal, 0); // old + return rb_rescue2(begin, self, rescue, self, rb_eStandardError, rb_eFatal, 0); // new + } +} + +namespace test_rb_ensure { + VALUE + begin(VALUE arg) + { + return arg; + } + + VALUE + ensure(VALUE arg) + { + return arg; + } + + VALUE + test(VALUE self) + { + rb_ensure(RUBY_METHOD_FUNC(begin), self, RUBY_METHOD_FUNC(ensure), self); // old + return rb_ensure(begin, self, ensure, self); // new + } +} + +namespace test_rb_catch { + VALUE + catcher(RB_BLOCK_CALL_FUNC_ARGLIST(arg, param)) + { + return arg; + } + + VALUE + test(VALUE self) + { + static const char *zero = 0; + rb_catch(zero, RUBY_METHOD_FUNC(catcher), self); // old + return rb_catch(zero, catcher, self); // new + } +} + +namespace test_rb_catch_obj { + VALUE + catcher(RB_BLOCK_CALL_FUNC_ARGLIST(arg, param)) + { + return arg; + } + + VALUE + test(VALUE self) + { + rb_catch_obj(self, RUBY_METHOD_FUNC(catcher), self); // old + return rb_catch_obj(self, catcher, self); // new + } +} + +namespace test_rb_fiber_new { + VALUE + fiber(RB_BLOCK_CALL_FUNC_ARGLIST(arg, param)) + { + return arg; + } + + VALUE + test(VALUE self) + { + rb_fiber_new(RUBY_METHOD_FUNC(fiber), self); // old + return rb_fiber_new(fiber, self); // new + } +} + +namespace test_rb_proc_new { + VALUE + proc(RB_BLOCK_CALL_FUNC_ARGLIST(arg, param)) + { + return arg; + } + + VALUE + test(VALUE self) + { + rb_fiber_new(RUBY_METHOD_FUNC(proc), self); // old + return rb_fiber_new(proc, self); // new + } +} + +struct test_rb_thread_create { + static VALUE v; + + static VALUE + thread(void *ptr) + { + const VALUE *w = reinterpret_cast<const VALUE*>(ptr); + return *w; + } + + static VALUE + test(VALUE self) + { + v = self; + rb_thread_create(RUBY_METHOD_FUNC(thread), &v); // old + return rb_thread_create(thread, &v); // new + } +}; + +namespace test_st_foreach { + static int + iter(st_data_t, st_data_t, st_data_t) + { + return ST_CONTINUE; + } + + VALUE + test(VALUE self) + { + st_data_t data = 0; + st_table *st = st_init_numtable(); + st_foreach(st, reinterpret_cast<int(*)(ANYARGS)>(iter), data); // old + st_foreach(st, iter, data); // new + return self; + } +} + +namespace test_st_foreach_check { + static int + iter(st_data_t, st_data_t, st_data_t, int x) + { + return x ? ST_STOP : ST_CONTINUE; + } + + VALUE + test(VALUE self) + { + st_data_t data = 0; + st_table *st = st_init_numtable(); + st_foreach_check(st, reinterpret_cast<int(*)(ANYARGS)>(iter), data, data); // old + st_foreach_check(st, iter, data, data); // new + return self; + } +} + +namespace test_st_foreach_safe { + static int + iter(st_data_t, st_data_t, st_data_t) + { + return ST_CONTINUE; + } + + VALUE + test(VALUE self) + { + st_data_t data = 0; + st_table *st = st_init_numtable(); + st_foreach_safe(st, reinterpret_cast<int(*)(ANYARGS)>(iter), data); // old + st_foreach_safe(st, iter, data); // new + return self; + } +} + +namespace test_rb_hash_foreach { + static int + iter(VALUE, VALUE, VALUE) + { + return ST_CONTINUE; + } + + VALUE + test(VALUE self) + { + VALUE h = rb_hash_new(); + rb_hash_foreach(h, reinterpret_cast<int(*)(ANYARGS)>(iter), self); // old + rb_hash_foreach(h, iter, self); // new + return self; + } +} + +namespace test_rb_ivar_foreach { + static int + iter(VALUE, VALUE, VALUE) + { + return ST_CONTINUE; + } + + VALUE + test(VALUE self) + { + rb_ivar_foreach(self, reinterpret_cast<int(*)(ANYARGS)>(iter), self); // old + rb_ivar_foreach(self, iter, self); // new + return self; + } +} + +extern "C" void +Init_cxxanyargs(void) +{ + VALUE b = rb_define_module("Bug"); +#define test(sym) \ + rb_define_module_function(b, #sym, RUBY_METHOD_FUNC(test_ ## sym::test), 0) + + test(rb_define_virtual_variable); + test(rb_define_hooked_variable); + test(rb_iterate); + test(rb_block_call); + test(rb_rescue); + test(rb_rescue2); + test(rb_ensure); + test(rb_catch); + test(rb_catch_obj); + test(rb_fiber_new); + test(rb_proc_new); + test(rb_thread_create); + test(st_foreach); + test(st_foreach_check); + test(st_foreach_safe); + test(rb_hash_foreach); + test(rb_ivar_foreach); +} diff --git a/ext/-test-/cxxanyargs/depend b/ext/-test-/cxxanyargs/depend new file mode 100644 index 0000000..61649e1 --- /dev/null +++ b/ext/-test-/cxxanyargs/depend @@ -0,0 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/ext/-test-/cxxanyargs/depend#L1 +# AUTOGENERATED DEPENDENCIES START +cxxanyargs.o: $(RUBY_EXTCONF_H) +cxxanyargs.o: $(arch_hdrdir)/ruby/config.h +cxxanyargs.o: $(hdrdir)/ruby/assert.h +cxxanyargs.o: $(hdrdir)/ruby/backward.h +cxxanyargs.o: $(hdrdir)/ruby/backward/cxxanyargs.hpp +cxxanyargs.o: $(hdrdir)/ruby/defines.h +cxxanyargs.o: $(hdrdir)/ruby/intern.h +cxxanyargs.o: $(hdrdir)/ruby/missing.h +cxxanyargs.o: $(hdrdir)/ruby/ruby.h +cxxanyargs.o: $(hdrdir)/ruby/st.h +cxxanyargs.o: $(hdrdir)/ruby/subst.h +cxxanyargs.o: cxxanyargs.cpp +# AUTOGENERATED DEPENDENCIES END diff --git a/ext/-test-/cxxanyargs/extconf.rb b/ext/-test-/cxxanyargs/extconf.rb new file mode 100644 index 0000000..6241e83 --- /dev/null +++ b/ext/-test-/cxxanyargs/extconf.rb @@ -0,0 +1,2 @@ https://github.com/ruby/ruby/blob/trunk/ext/-test-/cxxanyargs/extconf.rb#L1 +# frozen_string_literal: true +create_makefile("-test-/cxxanyargs") -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/