From 4d4984657eba9dfb58ce3a87877a137ac6438cf5 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sun, 3 May 2020 19:25:14 +0200 Subject: [PATCH] activate more warnings and ease their mgmt --- Makefile.defs | 15 +++++++++++++++ Makefile.host | 3 +-- client/Makefile | 10 +--------- client/deps/jansson/Makefile | 2 +- client/deps/liblua/Makefile | 2 +- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/Makefile.defs b/Makefile.defs index 4068d7516..1fc794def 100644 --- a/Makefile.defs +++ b/Makefile.defs @@ -44,3 +44,18 @@ else AR= ar rcs RANLIB= ranlib endif + +DEFCFLAGS = -Wall -Werror -O3 +# Some more warnings we want as errors: +DEFCFLAGS += -Wredundant-decls -Wmissing-prototypes -Wchar-subscripts -Wundef -Wwrite-strings -Wunused -Wuninitialized -Wpointer-arith -Winline -Wformat -Wformat-security -Winit-self -Wmissing-include-dirs -Wnested-externs -Wmissing-declarations +# Some more warnings we need first to eliminate, so temporarely tolerated: +DEFCFLAGS += -Wbad-function-cast -Wno-error=bad-function-cast -Wshadow -Wno-error=shadow -Wcast-align -Wno-error=cast-align +# TODO?: +#DEFCFLAGS += -Wextra -Wswitch-enum -Wold-style-definition + +ifeq ($(platform),Darwin) +# their readline has strict-prototype issues +DEFCFLAGS += -Wstrict-prototypes -Wno-error=strict-prototypes +else +DEFCFLAGS += -Wstrict-prototypes +endif diff --git a/Makefile.host b/Makefile.host index 7ed942401..c95f4bb4f 100644 --- a/Makefile.host +++ b/Makefile.host @@ -15,8 +15,7 @@ ifeq ($(DEFSBEENHERE),) $(error Can't find Makefile.defs) endif -CFLAGS ?= -Wall -Werror -O3 -Wchar-subscripts -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wunused -Wuninitialized -Wpointer-arith -Wredundant-decls -Winline -Wformat -Wformat-security -Winit-self -Wmissing-include-dirs -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs -Wmissing-declarations -# -Wbad-function-cast -Wextra -Wswitch-enum -Wold-style-definition +CFLAGS ?= $(DEFCFLAGS) CFLAGS += $(MYDEFS) $(MYCFLAGS) $(MYINCLUDES) vpath %.c $(MYSRCPATHS) diff --git a/client/Makefile b/client/Makefile index 9904e8b27..a17f57c27 100644 --- a/client/Makefile +++ b/client/Makefile @@ -55,15 +55,7 @@ ZLIB = $(OBJDIR)/libz.a LIBS = -I$(LUALIBPATH) -I$(MBEDTLSLIBPATH) -I$(JANSSONLIBPATH) -I$(CBORLIBPATH) -I$(ZLIBPATH) -I$(REVENGPATH) -I$(AMIIBOLIBPATH) -I$(HARDNESTEDPATH) -I$(CLIPARSERPATH) INCLUDES_CLIENT += -I./src -I../include -I../common -I../common_fpga $(LIBS) -#CFLAGS ?= -Wall -Werror -O3 -ifeq ($(platform),Darwin) -# readline has strict-prototype issues -CFLAGS ?= -Wall -Werror -O3 -Wredundant-decls -Wmissing-prototypes -Wchar-subscripts -Wundef -Wcast-align -Wno-error=cast-align -Wwrite-strings -Wunused -Wuninitialized -Wpointer-arith -Winline -Wformat -Wformat-security -Winit-self -Wmissing-include-dirs -Wnested-externs -Wmissing-declarations -else -CFLAGS ?= -Wall -Werror -O3 -Wredundant-decls -Wmissing-prototypes -Wchar-subscripts -Wundef -Wcast-align -Wno-error=cast-align -Wwrite-strings -Wunused -Wuninitialized -Wpointer-arith -Winline -Wformat -Wformat-security -Winit-self -Wmissing-include-dirs -Wstrict-prototypes -Wnested-externs -Wmissing-declarations -endif -# -Wshadow -# -Wbad-function-cast -Wextra -Wswitch-enum -Wold-style-definition +CFLAGS ?= $(DEFCFLAGS) # We cannot just use CFLAGS+=... because it has impact on sub-makes if CFLAGS is defined in env: PM3CFLAGS = $(CFLAGS) $(INCLUDES_CLIENT) diff --git a/client/deps/jansson/Makefile b/client/deps/jansson/Makefile index c0d16d6a3..487a85af8 100644 --- a/client/deps/jansson/Makefile +++ b/client/deps/jansson/Makefile @@ -1,6 +1,6 @@ MYSRCPATHS = MYINCLUDES = -I. -MYCFLAGS = -Wno-unused-function -Wno-cast-align +MYCFLAGS = -Wno-unused-function -Wno-cast-align -Wno-bad-function-cast MYDEFS = -DHAVE_STDINT_H MYSRCS = \ dump.c \ diff --git a/client/deps/liblua/Makefile b/client/deps/liblua/Makefile index 0b05279b7..296fd9e24 100644 --- a/client/deps/liblua/Makefile +++ b/client/deps/liblua/Makefile @@ -1,7 +1,7 @@ MYSRCPATHS = MYINCLUDES = -I. # Lua lib requires GNU extensions (implicit declarations of functions): -std=gnu99 or -std=gnu11 -MYCFLAGS = -Wno-cast-align +MYCFLAGS = -Wno-cast-align -Wno-bad-function-cast MYDEFS = -DLUA_COMPAT_ALL $(SYSCFLAGS) MYSRCS = lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c \ lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c \