From: Jeff King Date: Fri, 08 Jul 2016 09:25:10 GMT Subject: Re: [PATCH 7/8] write_file: add format attribute Message-ID: <20160708092510.GB17072@sigill.intra.peff.net> In-Reply-To: <20160708091241.GG10152@sigill.intra.peff.net> On Fri, Jul 08, 2016 at 05:12:41AM -0400, Jeff King wrote: > I had also hoped it would help with confusing write_file() > and write_file_buf(), since the former's "..." can make it > match the signature of the latter. But given that the buffer > for write_file_buf() is generally not a string literal, the > compiler won't complain unless -Wformat-nonliteral is on, > and that creates a ton of false positives elsewhere in the > code base. I poked around at the results of compiling with -Wformat-nonliteral, but gave up at trying to make it work. There are a number of clever uses of formats that would be hard to do otherwise. There are also several cases where a format string is used multiple times and we want to avoid repeating it. But using #define doesn't work, because we want to be able to translate it. I did find a little bit of low-hanging fruit, though. [1/2]: walker: let walker_say take arbitrary formats [2/2]: avoid using sha1_to_hex output as printf format These are totally independent of the main series, so they can be a separate topic, go on top, or just get dropped entirely if it's not worth the trouble. -Peff