1
0
mirror of https://github.com/ThrowTheSwitch/Unity.git synced 2026-01-27 18:24:27 +01:00

Cleanup example Makefiles, update test runners

Delete clang flags that were disabled with -Wno-*
This commit is contained in:
jsalling
2017-01-18 08:13:41 -06:00
parent d460a89a04
commit 185fb49380
6 changed files with 28 additions and 41 deletions

View File

@@ -5,17 +5,14 @@
# ========================================== # ==========================================
#We try to detect the OS we are running on, and adjust commands as needed #We try to detect the OS we are running on, and adjust commands as needed
ifeq ($(OSTYPE),cygwin) ifeq ($(OS),Windows_NT)
CLEANUP = rm -f ifeq ($(shell uname -s),) # not in a bash-like shell
MKDIR = mkdir -p
TARGET_EXTENSION=.out
elseifeq ($(OSTYPE),msys)
CLEANUP = rm -f
MKDIR = mkdir -p
TARGET_EXTENSION=.exe
elseifeq ($(OS),Windows_NT)
CLEANUP = del /F /Q CLEANUP = del /F /Q
MKDIR = mkdir MKDIR = mkdir
else # in a bash-like shell, like msys
CLEANUP = rm -f
MKDIR = mkdir -p
endif
TARGET_EXTENSION=.exe TARGET_EXTENSION=.exe
else else
CLEANUP = rm -f CLEANUP = rm -f
@@ -23,8 +20,12 @@ else
TARGET_EXTENSION=.out TARGET_EXTENSION=.out
endif endif
UNITY_ROOT=../..
C_COMPILER=gcc C_COMPILER=gcc
ifeq ($(shell uname -s), Darwin)
C_COMPILER=clang
endif
UNITY_ROOT=../..
CFLAGS=-std=c89 CFLAGS=-std=c89
CFLAGS += -Wall CFLAGS += -Wall
@@ -48,7 +49,7 @@ TARGET2 = $(TARGET_BASE2)$(TARGET_EXTENSION)
SRC_FILES1=$(UNITY_ROOT)/src/unity.c src/ProductionCode.c test/TestProductionCode.c test/test_runners/TestProductionCode_Runner.c SRC_FILES1=$(UNITY_ROOT)/src/unity.c src/ProductionCode.c test/TestProductionCode.c test/test_runners/TestProductionCode_Runner.c
SRC_FILES2=$(UNITY_ROOT)/src/unity.c src/ProductionCode2.c test/TestProductionCode2.c test/test_runners/TestProductionCode2_Runner.c SRC_FILES2=$(UNITY_ROOT)/src/unity.c src/ProductionCode2.c test/TestProductionCode2.c test/test_runners/TestProductionCode2_Runner.c
INC_DIRS=-Isrc -I$(UNITY_ROOT)/src INC_DIRS=-Isrc -I$(UNITY_ROOT)/src
SYMBOLS=-DTEST SYMBOLS=
all: clean default all: clean default

View File

@@ -11,7 +11,7 @@
setUp(); \ setUp(); \
TestFunc(); \ TestFunc(); \
} \ } \
if (TEST_PROTECT() && !TEST_IS_IGNORED) \ if (TEST_PROTECT()) \
{ \ { \
tearDown(); \ tearDown(); \
} \ } \

View File

@@ -11,7 +11,7 @@
setUp(); \ setUp(); \
TestFunc(); \ TestFunc(); \
} \ } \
if (TEST_PROTECT() && !TEST_IS_IGNORED) \ if (TEST_PROTECT()) \
{ \ { \
tearDown(); \ tearDown(); \
} \ } \

View File

@@ -5,17 +5,14 @@
# ========================================== # ==========================================
#We try to detect the OS we are running on, and adjust commands as needed #We try to detect the OS we are running on, and adjust commands as needed
ifeq ($(OSTYPE),cygwin) ifeq ($(OS),Windows_NT)
CLEANUP = rm -f ifeq ($(shell uname -s),) # not in a bash-like shell
MKDIR = mkdir -p
TARGET_EXTENSION=.out
elseifeq ($(OSTYPE),msys)
CLEANUP = rm -f
MKDIR = mkdir -p
TARGET_EXTENSION=.exe
elseifeq ($(OS),Windows_NT)
CLEANUP = del /F /Q CLEANUP = del /F /Q
MKDIR = mkdir MKDIR = mkdir
else # in a bash-like shell, like msys
CLEANUP = rm -f
MKDIR = mkdir -p
endif
TARGET_EXTENSION=.exe TARGET_EXTENSION=.exe
else else
CLEANUP = rm -f CLEANUP = rm -f
@@ -23,13 +20,16 @@ else
TARGET_EXTENSION=.out TARGET_EXTENSION=.out
endif endif
UNITY_ROOT=../..
C_COMPILER=gcc C_COMPILER=gcc
ifeq ($(shell uname -s), Darwin)
C_COMPILER=clang
endif
CFLAGS = -std=c99 UNITY_ROOT=../..
CFLAGS=-std=c99
CFLAGS += -Wall CFLAGS += -Wall
CFLAGS += -Wextra CFLAGS += -Wextra
CFLAGS += -Werror
CFLAGS += -Wpointer-arith CFLAGS += -Wpointer-arith
CFLAGS += -Wcast-align CFLAGS += -Wcast-align
CFLAGS += -Wwrite-strings CFLAGS += -Wwrite-strings
@@ -41,8 +41,6 @@ CFLAGS += -Wno-unknown-pragmas
CFLAGS += -Wstrict-prototypes CFLAGS += -Wstrict-prototypes
CFLAGS += -Wundef CFLAGS += -Wundef
CFLAGS += -Wold-style-definition CFLAGS += -Wold-style-definition
CFLAGS += -Wmissing-prototypes
CFLAGS += -Wmissing-declarations
TARGET_BASE1=all_tests TARGET_BASE1=all_tests
TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION) TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION)
@@ -63,8 +61,8 @@ all: clean default
default: default:
$(C_COMPILER) $(CFLAGS) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1) $(C_COMPILER) $(CFLAGS) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1)
./$(TARGET1) -v - ./$(TARGET1) -v
clean: clean:
$(CLEANUP) $(CLEANUP) $(TARGET1)

View File

@@ -16,13 +16,10 @@ compiler:
- '-Winit-self' - '-Winit-self'
- '-Winline' - '-Winline'
- '-Winvalid-pch' - '-Winvalid-pch'
- '-Wmissing-declarations'
- '-Wmissing-include-dirs' - '-Wmissing-include-dirs'
- '-Wmissing-prototypes'
- '-Wnonnull' - '-Wnonnull'
- '-Wpacked' - '-Wpacked'
- '-Wpointer-arith' - '-Wpointer-arith'
- '-Wredundant-decls'
- '-Wswitch-default' - '-Wswitch-default'
- '-Wstrict-aliasing' - '-Wstrict-aliasing'
- '-Wstrict-overflow=5' - '-Wstrict-overflow=5'
@@ -33,10 +30,7 @@ compiler:
- '-Wshadow' - '-Wshadow'
- '-Wundef' - '-Wundef'
- '-Wwrite-strings' - '-Wwrite-strings'
- '-Wno-missing-declarations'
- '-Wno-missing-prototypes'
- '-Wno-nested-externs' - '-Wno-nested-externs'
- '-Wno-redundant-decls'
- '-Wno-unused-parameter' - '-Wno-unused-parameter'
- '-Wno-variadic-macros' - '-Wno-variadic-macros'
- '-Wbad-function-cast' - '-Wbad-function-cast'

View File

@@ -16,13 +16,10 @@ compiler:
- '-Winit-self' - '-Winit-self'
- '-Winline' - '-Winline'
- '-Winvalid-pch' - '-Winvalid-pch'
- '-Wmissing-declarations'
- '-Wmissing-include-dirs' - '-Wmissing-include-dirs'
- '-Wmissing-prototypes'
- '-Wnonnull' - '-Wnonnull'
- '-Wpacked' - '-Wpacked'
- '-Wpointer-arith' - '-Wpointer-arith'
- '-Wredundant-decls'
- '-Wswitch-default' - '-Wswitch-default'
- '-Wstrict-aliasing' - '-Wstrict-aliasing'
- '-Wstrict-overflow=5' - '-Wstrict-overflow=5'
@@ -33,10 +30,7 @@ compiler:
- '-Wshadow' - '-Wshadow'
- '-Wundef' - '-Wundef'
- '-Wwrite-strings' - '-Wwrite-strings'
- '-Wno-missing-declarations'
- '-Wno-missing-prototypes'
- '-Wno-nested-externs' - '-Wno-nested-externs'
- '-Wno-redundant-decls'
- '-Wno-unused-parameter' - '-Wno-unused-parameter'
- '-Wno-variadic-macros' - '-Wno-variadic-macros'
- '-Wbad-function-cast' - '-Wbad-function-cast'