From ad14ccf26b083e74790c23ec1f4271daf0272f0c Mon Sep 17 00:00:00 2001 From: jsalling Date: Tue, 9 Feb 2016 14:24:00 -0600 Subject: [PATCH] Add strict compiler flags to Makefile and a 'clean' target Comment out -Wconversion for now, since the build would fail --- extras/fixture/test/Makefile | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/extras/fixture/test/Makefile b/extras/fixture/test/Makefile index 8f9a324..66fc58b 100644 --- a/extras/fixture/test/Makefile +++ b/extras/fixture/test/Makefile @@ -1,8 +1,11 @@ CC = gcc -CFLAGS += -Werror +#DEBUG = -O0 -g CFLAGS += -std=c99 CFLAGS += -pedantic -CFLAGS += -Wundef +CFLAGS += -Wall +CFLAGS += -Wextra +CFLAGS += -Werror +CFLAGS += $(DEBUG) DEFINES = -D UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar SRC = ../src/unity_fixture.c \ ../../../src/unity.c \ @@ -32,7 +35,26 @@ noStdlibMalloc: ../build/ ./$(TARGET) clangEverything: - $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -m64 -Weverything # || true #prevents make from failing + clang $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -m64 -Weverything ../build : mkdir -p ../build + +clean: + rm -f $(TARGET) + +# These extended flags DO get included before any target build runs +CFLAGS += -Wbad-function-cast +CFLAGS += -Wcast-qual +#CFLAGS += -Wconversion +CFLAGS += -Wformat=2 +CFLAGS += -Wmissing-prototypes +CFLAGS += -Wold-style-definition +CFLAGS += -Wpointer-arith +CFLAGS += -Wshadow +CFLAGS += -Wstrict-overflow=5 +CFLAGS += -Wstrict-prototypes +CFLAGS += -Wswitch-default +CFLAGS += -Wundef +CFLAGS += -Wunused +CFLAGS += -fstrict-aliasing -- GitLab