diff options
author | Jeremy Evans <code@jeremyevans.net> | 2019-09-29 09:15:43 -0700 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2019-09-29 10:34:07 -0700 |
commit | 869e4f6e4c683bf8e76ae7db54a26b33fb925410 (patch) | |
tree | 4985302b04065eb0e42156006f60d8b191632e6b /spec/ruby/optional/capi/ext/util_spec.c | |
parent | 070cbe22b70ec2bec36c7cfc84b726510afa306f (diff) | |
download | ruby-869e4f6e4c683bf8e76ae7db54a26b33fb925410.tar.gz |
Fix or suppress keyword argument separation warnings in util_spec
Some warnings are because the @o.rb_scan_args call doesn't
include keyword arguments, but the first argument is passed to
rb_scan_args may have a last hash treated as keywords. Those
should be handled using rb_scan_args_kw on Ruby 2.7.
Other warnings are for the deprecated rb_scan_args behavior to
split option hashes or treat a nil argument as an option hash.
Those warnings should just be suppressed.
Diffstat (limited to 'spec/ruby/optional/capi/ext/util_spec.c')
-rw-r--r-- | spec/ruby/optional/capi/ext/util_spec.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/ruby/optional/capi/ext/util_spec.c b/spec/ruby/optional/capi/ext/util_spec.c index 50a5fcb095..e579b5e0af 100644 --- a/spec/ruby/optional/capi/ext/util_spec.c +++ b/spec/ruby/optional/capi/ext/util_spec.c @@ -16,7 +16,14 @@ VALUE util_spec_rb_scan_args(VALUE self, VALUE argv, VALUE fmt, VALUE expected, args[i] = rb_ary_entry(argv, i); } - result = rb_scan_args(argc, args, RSTRING_PTR(fmt), &a1, &a2, &a3, &a4, &a5, &a6); + if (*RSTRING_PTR(fmt) == 'k') { +#ifdef RB_SCAN_ARGS_KEYWORDS + result = rb_scan_args_kw(RB_SCAN_ARGS_KEYWORDS, argc, args, RSTRING_PTR(fmt)+1, &a1, &a2, &a3, &a4, &a5, &a6); +#endif + } + else { + result = rb_scan_args(argc, args, RSTRING_PTR(fmt), &a1, &a2, &a3, &a4, &a5, &a6); + } switch(NUM2INT(expected)) { case 6: |