From: Junio C Hamano <gitster@pobox.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Thomas Gummerer <t.gummerer@gmail.com>, Jeff King <peff@peff.net>,
git@vger.kernel.org, Josh Steadmon <steadmon@google.com>,
Masaya Suzuki <masayasuzuki@google.com>
Subject: Re: [PATCH] config.mak.dev: add -Wformat
Date: Thu, 03 Jan 2019 08:55:21 -0800 [thread overview]
Message-ID: <xmqqa7khisue.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20181227185900.GE146609@google.com> (Jonathan Nieder's message of "Thu, 27 Dec 2018 10:59:00 -0800")
Jonathan Nieder <jrnieder@gmail.com> writes:
> In October, Thomas Gummerer wrote:
>> On 10/12, Jonathan Nieder wrote:
>>> Jeff King wrote:
>>> ...
>>>> -Wformat is part of -Wall, which we already turn on by default (even for
>>>> non-developer builds).
> ...
> As discussed in [1], autoconf appears to not put -Wall in CFLAGS:
>
> $ make configure
> GEN configure
> $ ./configure
> [...]
> config.status: creating config.mak.autogen
> config.status: executing config.mak.autogen commands
> $ grep CFLAGS config.mak.autogen
> CFLAGS = -g -O2
> PTHREAD_CFLAGS=-pthread
>
> So this trap for the unwary is still around.
>
> Can we revive this patch? Does it just need a clearer commit message,
> or were there other objections?
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 <t.gummerer@gmail.com>
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 <t.gummerer@gmail.com>
Helped-by: Jeff King <peff@peff.net>
Helped-by: Jonathan Nieder <jrnieder@gmail.com>
[jc: s/-Wformat/-Wall/]
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
config.mak.dev | 1 +
1 file changed, 1 insertion(+)
diff --git a/config.mak.dev b/config.mak.dev
index bfbd3df4e8..74337f1f92 100644
--- a/config.mak.dev
+++ b/config.mak.dev
@@ -1,6 +1,7 @@
ifeq ($(filter no-error,$(DEVOPTS)),)
CFLAGS += -Werror
endif
+CFLAGS += -Wall
CFLAGS += -Wdeclaration-after-statement
CFLAGS += -Wformat-security
CFLAGS += -Wno-format-zero-length
--
2.20.1-2-gb21ebb671b
next prev parent reply other threads:[~2019-01-03 16:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-12 18:40 [PATCH] config.mak.dev: add -Wformat Thomas Gummerer
2018-10-12 18:45 ` Jeff King
2018-10-12 18:54 ` Jonathan Nieder
2018-10-12 19:11 ` Jeff King
2018-10-12 19:15 ` Thomas Gummerer
2018-12-27 18:59 ` Jonathan Nieder
2019-01-03 16:55 ` Junio C Hamano [this message]
2019-01-03 18:54 ` Jonathan Nieder
2019-01-06 18:17 ` Thomas Gummerer
2019-01-07 17:04 ` Junio C Hamano
2019-01-07 21:16 ` Jonathan Nieder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqa7khisue.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=masayasuzuki@google.com \
--cc=peff@peff.net \
--cc=steadmon@google.com \
--cc=t.gummerer@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).