[PATCH] config.mak.dev: enable -Wpedantic in clang

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



DEVOPTS=pedantic adds -pedantic to the compiler flags, but misses on some
diagnostics when using clang, and that are only enabled with -Wpedantic

46c0eb5843 ("files-backend.c: fix build error on Solaris", 2018-11-25)
fixes an issue that was visible also with gcc but not clang so correct
that with the hope that in the future CI could be used for early detection
of similar issues

-Wpedantic is only enabled for clang 10 or higher (only available in macOS
with latest Xcode) but this restriction should be relaxed further as more
environments are tested

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@xxxxxxxxx>
---
 config.mak.dev | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/config.mak.dev b/config.mak.dev
index bbeeff44fe..ad25beacd8 100644
--- a/config.mak.dev
+++ b/config.mak.dev
@@ -1,8 +1,15 @@
+ifndef COMPILER_FEATURES
+COMPILER_FEATURES := $(shell ./detect-compiler $(CC))
+endif
+
 ifeq ($(filter no-error,$(DEVOPTS)),)
 CFLAGS += -Werror
 endif
 ifneq ($(filter pedantic,$(DEVOPTS)),)
 CFLAGS += -pedantic
+ifneq ($(filter clang10,$(COMPILER_FEATURES)),)
+CFLAGS += -Wpedantic
+endif
 # don't warn for each N_ use
 CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=0
 endif
@@ -16,10 +23,6 @@ CFLAGS += -Wstrict-prototypes
 CFLAGS += -Wunused
 CFLAGS += -Wvla
 
-ifndef COMPILER_FEATURES
-COMPILER_FEATURES := $(shell ./detect-compiler $(CC))
-endif
-
 ifneq ($(filter clang4,$(COMPILER_FEATURES)),)
 CFLAGS += -Wtautological-constant-out-of-range-compare
 endif
-- 
2.20.0.rc1




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux