
On Mon, 25 Apr 2011 13:53:50 -0400 Mike Frysinger vapier@gentoo.org wrote:
On Mon, Apr 25, 2011 at 13:45, Scott Wood wrote:
Why encourage bad habits? Are there any instances of this in U-Boot where conversion to puts() wouldn't be an improvement, especially given the lack of an automatic newline in U-Boot's version?
that wasnt what i was saying. my point is simply that changing printf(foo); to printf("%s", foo); simply to satisfy a gcc warning is wrong and unnecessarily bloats the compiled code.
My point was that the warning should stay, until such a time as it's complaining about something that we actually want to do -- I've yet to see an example cited so far that didn't have an easy non-"bloating" fix.
Even in a context such as U-Boot, IMHO format-string functions shouldn't be used in such a way -- it may not be a security issue, but it's a potential readability/maintainability issue when it may not be obvious from the other context where the string is defined, that any embedded percent characters must be doubled. It's a different situation from where a string literal is defined right in the context of the format-string function.
if you want to change it from printf(foo) to puts(foo), that's fine by me (and is actually what i suggested).
And after writing this, you sent a patch changing the warning options...
-Scott