Project

General

Profile

Bug #16901 ยป use-rb_warn_deprecated-instead-of-rb_warn.diff

znz (Kazuhiro NISHIYAMA), 05/20/2020 02:55 AM

View differences:

include/ruby/ruby.h
2512 2512
		 int f_var, int f_hash, int f_block,
2513 2513
		 VALUE *vars[], char *fmt, int varc));
2514 2514

  
2515
PRINTF_ARGS(void rb_warn_deprecated(const char *fmt, const char *suggest, ...), 1, 3);
2516

  
2515 2517
inline int
2516 2518
rb_scan_args_set(int argc, const VALUE *argv,
2517 2519
		 int n_lead, int n_opt, int n_trail,
......
2569 2571
                    if (!keyword_given) {
2570 2572
                        /* Warn if treating positional as keyword, as in Ruby 3,
2571 2573
                           this will be an error */
2572
                        rb_warn("Using the last argument as keyword parameters is deprecated");
2574
                        rb_warn_deprecated("Using the last argument as keyword parameters", NULL);
2573 2575
                    }
2574 2576
                    argc--;
2575 2577
                }
......
2584 2586
        }
2585 2587
        else if (f_hash && keyword_given && n_mand == argc) {
2586 2588
            /* Warn if treating keywords as positional, as in Ruby 3, this will be an error */
2587
            rb_warn("Passing the keyword argument as the last hash parameter is deprecated");
2589
            rb_warn_deprecated("Passing the keyword argument as the last hash parameter", NULL);
2588 2590
        }
2589 2591
    }
2590 2592
    if (f_hash && n_mand > 0 && n_mand == argc+1 && empty_keyword_given) {
......
2593 2595
        ptr[argc] = rb_hash_new();
2594 2596
        argc++;
2595 2597
        *(&argv) = ptr;
2596
        rb_warn("Passing the keyword argument as the last hash parameter is deprecated");
2598
        rb_warn_deprecated("Passing the keyword argument as the last hash parameter", NULL);
2597 2599
    }
2598 2600

  
2599 2601