Le 18 nov. 08 à 14:01, Csaba Raduly a écrit :

Line 2687 in parse-gram.c reads:
yyerror (yymsg);

This triggers a warning from gcc under -Wformat=2
"format not a string literal and no format arguments"

The line should be
yyerror ("%s", yymsg);

(affects both 2.3 and 2.4)

This report is very unclear :( yyerror is to be provided by the user, and it is not expected that yyerror be a printf-like function. Bison never generates printf-like calls to yyerror. I guess that the author of this grammar file made yyerror a variadic printf-like function, which a legitimate idea, but in which case the complaint from the compiler is legitimate too. In that case, I would call the printf-like function something like yyerrorf, and have another yyerror function/ macro that bounces to it to avoid the warnings.



Reply via email to