Subject: Re: [PATCH] config.mak.dev: add -Wformat

From: Jonathan Nieder <[email-masked]>
Date: Thu, 3 Jan 2019 10:54:27 -0800

Hi,

Junio C Hamano wrote:

> I think it is a good idea to give fallback/redundancy for this
> case.  I do not have strong opinion between -Wall and -Wformat,
> but I'd probably vote for the former if pressed.
>
> -- >8 --
> From: Thomas Gummerer <[email-masked]>
> Date: Fri, 12 Oct 2018 19:40:37 +0100
> Subject: [PATCH] config.mak.dev: add -Wformat
>
> 801fa63a90 ("config.mak.dev: add -Wformat-security", 2018-09-08)
> added the "-Wformat-security" to the flags set in config.mak.dev.
> In the gcc man page this is documented as:
>
>          If -Wformat is specified, also warn about uses of format
>          functions that represent possible security problems.  [...]
>
> The commit did however not add the "-Wformat" flag, but instead
> relied on the fact that "-Wall" is set in the Makefile by default
> and that "-Wformat" is part of "-Wall".
>
> Unfortunately, those who use config.mak.autogen generated with the
> autoconf to configure toolchain do *not* get "-Wall" in their CFLAGS
> and the added -Wformat-security had no effect.  Worse yet, newer
> versions of gcc (gcc 8.2.1 in this particular case) warn about the
> lack of "-Wformat" and thus compilation fails only with this option
> set.
>
> We could fix it by adding "-Wformat", but in general we do want all
> checks included in "-Wall", so let's add it to config.mak.dev to
> cover more cases.
>
> Signed-off-by: Thomas Gummerer <[email-masked]>
> Helped-by: Jeff King <[email-masked]>
> Helped-by: Jonathan Nieder <[email-masked]>
> [jc: s/-Wformat/-Wall/]
> Signed-off-by: Junio C Hamano <[email-masked]>
> ---
>  config.mak.dev | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Jonathan Nieder <[email-masked]>

Thanks for tying up this loose end.