From 27ed9f1d290a6ff6b788976ea7139c608920ee1e Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 22 Apr 2017 08:32:33 +0000 Subject: [PATCH] parse.y: fix compile_error format * parse.y (ripper_compile_error, parser_compile_error): declare as PRINTF_ARGS attribute. * parse.y (id_is_var_gen): fix format specifier for string value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- parse.y | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/parse.y b/parse.y index a55d27982d..fe366d027b 100644 --- a/parse.y +++ b/parse.y @@ -843,7 +843,7 @@ static ID id_warn, id_warning, id_gets; # else # define WARNING_CALL rb_funcall # endif -static void ripper_compile_error(struct parser_params*, const char *fmt, ...); +PRINTF_ARGS(static void ripper_compile_error(struct parser_params*, const char *fmt, ...), 2, 3); # define compile_error ripper_compile_error # define PARSER_ARG parser, #else @@ -857,7 +857,7 @@ static void ripper_compile_error(struct parser_params*, const char *fmt, ...); # define WARNING_ARGS(fmt,n) WARN_ARGS(fmt,n) # define WARNING_ARGS_L(l,fmt,n) WARN_ARGS_L(l,fmt,n) # define WARNING_CALL rb_compile_warning -static void parser_compile_error(struct parser_params*, const char *fmt, ...); +PRINTF_ARGS(static void parser_compile_error(struct parser_params*, const char *fmt, ...), 2, 3); # define compile_error parser_compile_error # define PARSER_ARG parser, #endif @@ -9001,7 +9001,7 @@ id_is_var_gen(struct parser_params *parser, ID id) return 0; } } - compile_error(PARSER_ARG "identifier %s is not valid to get", rb_id2str(id)); + compile_error(PARSER_ARG "identifier %"PRIsVALUE" is not valid to get", rb_id2str(id)); return 0; }