From: Scott Wood Date: Mon, 25 Apr 2011 14:45:18 -0500 Subject: [U-Boot] [PATCH 2/3] Fix a few gcc warnings. In-Reply-To: References: <20110420201335.BC035152160@gemini.denx.de> <1303633774-22961-3-git-send-email-Joakim.Tjernlund@transmode.se> <20110424221458.90B6CD5269F@gemini.denx.de> <20110425124500.1d6c064f@schlenkerla.am.freescale.net> Message-ID: <20110425144518.5a37bd4c@schlenkerla.am.freescale.net> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Mon, 25 Apr 2011 13:53:50 -0400 Mike Frysinger 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