ruby-changes:57814
From: Nobuyoshi <ko1@a...>
Date: Thu, 19 Sep 2019 20:58:32 +0900 (JST)
Subject: [ruby-changes:57814] a3daf8e49a (master): Ensure that unmatched arity fails in C++
https://git.ruby-lang.org/ruby.git/commit/?id=a3daf8e49a From a3daf8e49a36dc5501b020a882d611676a6ad264 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Thu, 19 Sep 2019 20:07:24 +0900 Subject: Ensure that unmatched arity fails in C++ diff --git a/ext/-test-/cxxanyargs/extconf.rb b/ext/-test-/cxxanyargs/extconf.rb index 7e2449a..90ab856 100644 --- a/ext/-test-/cxxanyargs/extconf.rb +++ b/ext/-test-/cxxanyargs/extconf.rb @@ -22,5 +22,18 @@ begin https://github.com/ruby/ruby/blob/trunk/ext/-test-/cxxanyargs/extconf.rb#L22 end if ok - create_makefile("-test-/cxxanyargs") + $srcs = %w[cxxanyargs.cpp] + $cleanfiles << "failure.failed" + create_makefile("-test-/cxxanyargs") do |mk| + mk << <<MK + +cxxanyargs.#$OBJEXT: failure.failed + +failure.failed: failure.cpp +\t$(Q)$(RUBY) -rfileutils \\ +\t -e "err = IO.popen(%[$(MAKE) failure.#$OBJEXT], err:[:child, :out], &:read)" \\ +\t -e "abort err unless /rb_define_method/ =~ err" \\ +\t -e "FileUtils.touch(*ARGV)" $@ +MK + end end diff --git a/ext/-test-/cxxanyargs/failure.cpp b/ext/-test-/cxxanyargs/failure.cpp new file mode 100644 index 0000000..039beb1 --- /dev/null +++ b/ext/-test-/cxxanyargs/failure.cpp @@ -0,0 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ext/-test-/cxxanyargs/failure.cpp#L1 +#include <ruby/ruby.h> + +static VALUE +func_arg1(VALUE self, VALUE arg1) +{ + return arg1; +} + +extern "C" void +Init_failure(void) +{ + rb_define_method(rb_cObject, "arg1", func_arg1, 0); +} -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/