|
From: | Akim Demaille |
Subject: | Re: Generated code triggers a warning |
Date: | Fri, 21 Nov 2008 20:47:58 +0100 |
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.
[Prev in Thread] | Current Thread | [Next in Thread] |