Re: [PATCH] Makefile: detect compiler and enable more warnings in DEVELOPER=1
From: Jeff King <hidden>
Date: 2018-03-20 05:32:27
On Sun, Mar 18, 2018 at 04:55:25PM +0100, Duy Nguyen wrote:
On Sun, Mar 18, 2018 at 9:18 AM, Nguyễn Thái Ngọc Duy [off-list ref] wrote:quoted
+ifneq ($(or $(filter gcc6,$(COMPILER_FEATURES)),$(filter clang4,$(COMPILER_FEATURES))),) +CFLAGS += -WextraAnother 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.