From: Duy Nguyen <pclouds@gmail.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>,
Ramsay Jones <ramsay@ramsayjones.plus.com>,
Lars Schneider <larsxschneider@gmail.com>,
ric Sunshine <sunshine@sunshineco.com>
Subject: Re: [PATCH 4/3] Makefile: untangle DEVELOPER and -Werror
Date: Tue, 3 Apr 2018 17:17:00 +0200 [thread overview]
Message-ID: <20180403151700.GA24602@duynguyen.home> (raw)
In-Reply-To: <87woxove8d.fsf@evledraar.gmail.com>
On Tue, Apr 03, 2018 at 11:19:46AM +0200, Ævar Arnfjörð Bjarmason wrote:
>
> On Sat, Mar 31 2018, Duy Nguyen wrote:
>
> > On Sat, Mar 31, 2018 at 6:40 PM, Ævar Arnfjörð Bjarmason
> > <avarab@gmail.com> wrote:
> >> Change the DEVELOPER flag, and the newly added EAGER_DEVELOPER flag
> >> which (approximately) enables -Wextra so that any combination of them
> >> and -Werror can be set.
> >>
> >> I've long wanted to use DEVELOPER=1 in my production builds, but on
> >> some old systems I still get warnings, and thus the build would
> >> fail. However if the build/tests fail for some other reason, it would
> >> still be useful to scroll up and see what the relevant code is warning
> >> about.
> >>
> >> This change allows for that. Now setting DEVELOPER will set -Werror as
> >> before, but if DEVELOPER_NONFATAL is set you'll get the same warnings,
> >> but without -Werror.
> >>
> >> I've renamed the newly added EAGER_DEVELOPER flag to
> >> DEVELOPER_EXTRA. The reason is that it approximately turns on -Wextra,
> >> and it'll be more consistent to add e.g. DEVELOPER_PEDANTIC later than
> >> inventing some new name of our own (VERY_EAGER_DEVELOPER?).
> >
> > Before we go with zillions of *DEVELOPER* maybe we can have something
> > like DEVOPTS where you can give multiple keywords to a single variable
> > to influence config.mak.dev. This is similar to COMPILER_FEATURES we
> > already have in there, but now it's driven by the dev instead of the
> > compiler. So you can have keywords like "gentle" (no -Werror) "extra"
> > (-Wextra with no suppression) and something else.
>
> We could do that, but I don't think it's that bad. This patch is one
> extra option on top of yours,
And that eager this was marked experimental because I was not sure if
it was the right way :)
> and it's not going to result in some combinatorial explosion of
> options, i.e. if we add DEVELOPER_PEDANTIC we'll just add one extra
> flag.
>
> But sure, we could make this some string we'd need to parse out similar
> to COMPILER_FEATURES, it just seems more complex to me for this task.
It's not that complex. With the EAGER_DEVELOPER patch removed, we can
have something like this where eager devs just need to put
DEVOPTS = gentle no-suppression
and you put
DEVOPTS = gentle
(bad naming, I didn't spend time thinking about names)
-- 8< --
diff --git a/Makefile b/Makefile
index e6680a8977..7b4e038e1d 100644
--- a/Makefile
+++ b/Makefile
@@ -435,6 +435,11 @@ all::
# Define DEVELOPER to enable more compiler warnings. Compiler version
# and faimily are auto detected, but could be overridden by defining
# COMPILER_FEATURES (see config.mak.dev)
+#
+# When DEVELOPER is set, DEVOPTS can be used to control compiler options.
+# This variable contains keywords separated by whitespace. Two keywords
+# are recognized: "gentle" removes -Werror and "no-suppression"
+# removes all "-Wno-" options.
GIT-VERSION-FILE: FORCE
@$(SHELL_PATH) ./GIT-VERSION-GEN
diff --git a/config.mak.dev b/config.mak.dev
index 716a14ecc7..1d7aba6a6a 100644
--- a/config.mak.dev
+++ b/config.mak.dev
@@ -1,4 +1,6 @@
+ifeq ($(filter gentle,$(DEVOPTS)),)
CFLAGS += -Werror
+endif
CFLAGS += -Wdeclaration-after-statement
CFLAGS += -Wno-format-zero-length
CFLAGS += -Wold-style-definition
@@ -21,6 +23,7 @@ CFLAGS += -Wextra
# if a function is public, there should be a prototype and the right
# header file should be included. If not, it should be static.
CFLAGS += -Wmissing-prototypes
+ifeq ($(filter no-suppression,$(DEVOPTS)),)
# These are disabled because we have these all over the place.
CFLAGS += -Wno-empty-body
CFLAGS += -Wno-missing-field-initializers
@@ -28,6 +31,7 @@ CFLAGS += -Wno-sign-compare
CFLAGS += -Wno-unused-function
CFLAGS += -Wno-unused-parameter
endif
+endif
# uninitialized warnings on gcc 4.9.2 in xdiff/xdiffi.c and config.c
# not worth fixing since newer compilers correctly stop complaining
-- 8< --
next prev parent reply other threads:[~2018-04-03 15:17 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-03 1:46 [PATCH] travis-ci: enable more warnings on travis linux-gcc job Nguyễn Thái Ngọc Duy
2018-03-16 19:33 ` [PATCH v2] " Nguyễn Thái Ngọc Duy
2018-03-16 21:22 ` Jeff King
2018-03-17 8:01 ` Duy Nguyen
2018-03-17 14:29 ` Lars Schneider
2018-03-17 14:59 ` Duy Nguyen
2018-03-17 16:08 ` Jeff King
2018-03-17 16:12 ` Jeff King
2018-03-17 23:50 ` Junio C Hamano
2018-03-18 8:18 ` [PATCH] Makefile: detect compiler and enable more warnings in DEVELOPER=1 Nguyễn Thái Ngọc Duy
2018-03-18 9:06 ` Eric Sunshine
2018-03-18 9:17 ` Duy Nguyen
2018-03-18 9:20 ` Jeff King
2018-03-18 9:24 ` Eric Sunshine
2018-03-18 9:28 ` Jeff King
2018-03-18 9:37 ` Eric Sunshine
2018-03-18 9:26 ` Jeff King
2018-03-18 9:45 ` Duy Nguyen
2018-03-18 15:55 ` Duy Nguyen
2018-03-18 18:56 ` Ramsay Jones
2018-03-19 16:30 ` Duy Nguyen
2018-03-20 5:32 ` Jeff King
2018-03-24 12:53 ` [PATCH v2] " Nguyễn Thái Ngọc Duy
2018-03-25 0:40 ` Eric Sunshine
2018-03-26 22:02 ` Junio C Hamano
2018-03-27 15:03 ` Duy Nguyen
2018-03-27 16:52 ` Junio C Hamano
2018-03-29 15:03 ` [PATCH v3 0/3] Enable more compiler warnings for devs Nguyễn Thái Ngọc Duy
2018-03-29 15:03 ` [PATCH v3 1/3] connect.c: mark die_initial_contact() NORETURN Nguyễn Thái Ngọc Duy
2018-03-29 15:03 ` [PATCH v3 2/3] Makefile: detect compiler and enable more warnings in DEVELOPER=1 Nguyễn Thái Ngọc Duy
2018-03-29 15:03 ` [PATCH v3 3/3] Makefile: add EAGER_DEVELOPER mode Nguyễn Thái Ngọc Duy
2018-03-31 16:40 ` [PATCH 4/3] Makefile: untangle DEVELOPER and -Werror Ævar Arnfjörð Bjarmason
2018-03-31 18:36 ` Duy Nguyen
2018-04-03 9:19 ` Ævar Arnfjörð Bjarmason
2018-04-03 15:17 ` Duy Nguyen [this message]
2018-04-06 21:42 ` Jeff King
2018-04-07 9:52 ` Duy Nguyen
2018-04-07 12:36 ` Ævar Arnfjörð Bjarmason
2018-04-07 17:03 ` Duy Nguyen
2018-04-07 18:38 ` Ævar Arnfjörð Bjarmason
2018-04-14 19:19 ` [PATCH v4 0/4] Make DEVELOPER more more flexible with DEVOPTS Ævar Arnfjörð Bjarmason
2018-04-16 4:57 ` Junio C Hamano
2018-04-14 19:19 ` [PATCH v4 1/4] connect.c: mark die_initial_contact() NORETURN Ævar Arnfjörð Bjarmason
2018-04-14 19:19 ` [PATCH v4 2/4] Makefile: detect compiler and enable more warnings in DEVELOPER=1 Ævar Arnfjörð Bjarmason
2018-04-14 19:19 ` [PATCH v4 3/4] Makefile: add a DEVOPTS to suppress -Werror under DEVELOPER Ævar Arnfjörð Bjarmason
2018-04-14 19:19 ` [PATCH v4 4/4] Makefile: add a DEVOPTS to get all of -Wextra Ævar Arnfjörð Bjarmason
2018-03-17 15:16 ` [PATCH v2] travis-ci: enable more warnings on travis linux-gcc job Jeff King
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180403151700.GA24602@duynguyen.home \
--to=pclouds@gmail.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=larsxschneider@gmail.com \
--cc=peff@peff.net \
--cc=ramsay@ramsayjones.plus.com \
--cc=sunshine@sunshineco.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.
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 NNTP newsgroup(s).