activate more warnings and ease their mgmt

This commit is contained in:
Philippe Teuwen 2020-05-03 19:25:14 +02:00
parent c94eae0046
commit 4d4984657e
5 changed files with 19 additions and 13 deletions

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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 \

View file

@ -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 \