Re: [PATCH] Makefile: detect compiler and enable more warnings in DEVELOPER=1
- From
Jeff King <peff@peff.net>
- Date
- Mar 20, 2018, 05:32 UTC
- Message-ID
- <20180320053220.GB15813@sigill.intra.peff.net>
- In-Reply-To
- <CACsJy8BOCpHiMxJ0K=_-WPf9b4yh0W0i3m9sAo5-Sk5fY9x1+A@mail.gmail.com>
On Sun, Mar 18, 2018 at 04:55:25PM +0100, Duy Nguyen wrote:
Show 8 quoted lines
> On Sun, Mar 18, 2018 at 9:18 AM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote: > > +ifneq ($(or $(filter gcc6,$(COMPILER_FEATURES)),$(filter clang4,$(COMPILER_FEATURES))),) > > +CFLAGS += -Wextra > > Another thing we can add here is -Og instead of standard -O2 (or -O0 > in my build), which is supported since gcc 4.8. clang seems to support > it too (mapped to -O1 at least for clang5) but I don't know what > version added that flag.
I don't know, that feels kind of weird to me. I thought DEVELOPER was supposed to mean "ratchet up the linting, I want to know if I've broken something".
But tweaking -O is about "I am in an edit-compile-debug cycle". Sometimes you are and sometimes you aren't, but you'd presumably want to have extra warnings regardless (especially because some warnings only trigger under particular optimization settings).
Personally, I default to -O0, but then crank up to -O2 for performance testing or for my daily-driver builds. But I _always_ have as many warnings enabled as possible[1].
-Peff
[1] I do have some pretty horrific magic to turn on -Werror when I'm
visiting a "historical" commit, such as during a bisect.