diff --git a/examples/example_1/makefile b/examples/example_1/makefile index 8b8fa84ef602248bb6f71db2bb09bd0fabd4d63c..c5a3ca47e2faa2831c3bd6cada773e968e29a249 100644 --- a/examples/example_1/makefile +++ b/examples/example_1/makefile @@ -5,17 +5,14 @@ # ========================================== #We try to detect the OS we are running on, and adjust commands as needed -ifeq ($(OSTYPE),cygwin) - CLEANUP = rm -f - MKDIR = mkdir -p - TARGET_EXTENSION=.out -elseifeq ($(OSTYPE),msys) - CLEANUP = rm -f - MKDIR = mkdir -p - TARGET_EXTENSION=.exe -elseifeq ($(OS),Windows_NT) +ifeq ($(OS),Windows_NT) + ifeq ($(shell uname -s),) # not in a bash-like shell CLEANUP = del /F /Q MKDIR = mkdir + else # in a bash-like shell, like msys + CLEANUP = rm -f + MKDIR = mkdir -p + endif TARGET_EXTENSION=.exe else CLEANUP = rm -f @@ -23,8 +20,12 @@ else TARGET_EXTENSION=.out endif -UNITY_ROOT=../.. C_COMPILER=gcc +ifeq ($(shell uname -s), Darwin) +C_COMPILER=clang +endif + +UNITY_ROOT=../.. CFLAGS=-std=c89 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_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 -SYMBOLS=-DTEST +SYMBOLS= all: clean default diff --git a/examples/example_1/test/test_runners/TestProductionCode2_Runner.c b/examples/example_1/test/test_runners/TestProductionCode2_Runner.c index ebe858f77c994dc90ed5eadb990380c4ff6251d6..cf72c219d2c8fe7df1fb0f5ed5d818ade49f9c63 100644 --- a/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +++ b/examples/example_1/test/test_runners/TestProductionCode2_Runner.c @@ -11,7 +11,7 @@ setUp(); \ TestFunc(); \ } \ - if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + if (TEST_PROTECT()) \ { \ tearDown(); \ } \ diff --git a/examples/example_1/test/test_runners/TestProductionCode_Runner.c b/examples/example_1/test/test_runners/TestProductionCode_Runner.c index f15a76f9236fcde8095037d6f722f0842dd31a85..3b49af748cd3b4176acb2056e0f526233ec50906 100644 --- a/examples/example_1/test/test_runners/TestProductionCode_Runner.c +++ b/examples/example_1/test/test_runners/TestProductionCode_Runner.c @@ -11,7 +11,7 @@ setUp(); \ TestFunc(); \ } \ - if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + if (TEST_PROTECT()) \ { \ tearDown(); \ } \ diff --git a/examples/example_2/makefile b/examples/example_2/makefile index 36d3cd77741298559e3e3c65c1e7dffe7f7eb5cb..cfde2ccb478d94e0c472cb31fbacf94fca315dfd 100644 --- a/examples/example_2/makefile +++ b/examples/example_2/makefile @@ -5,17 +5,14 @@ # ========================================== #We try to detect the OS we are running on, and adjust commands as needed -ifeq ($(OSTYPE),cygwin) - CLEANUP = rm -f - MKDIR = mkdir -p - TARGET_EXTENSION=.out -elseifeq ($(OSTYPE),msys) - CLEANUP = rm -f - MKDIR = mkdir -p - TARGET_EXTENSION=.exe -elseifeq ($(OS),Windows_NT) +ifeq ($(OS),Windows_NT) + ifeq ($(shell uname -s),) # not in a bash-like shell CLEANUP = del /F /Q MKDIR = mkdir + else # in a bash-like shell, like msys + CLEANUP = rm -f + MKDIR = mkdir -p + endif TARGET_EXTENSION=.exe else CLEANUP = rm -f @@ -23,13 +20,16 @@ else TARGET_EXTENSION=.out endif -UNITY_ROOT=../.. C_COMPILER=gcc +ifeq ($(shell uname -s), Darwin) +C_COMPILER=clang +endif + +UNITY_ROOT=../.. -CFLAGS = -std=c99 +CFLAGS=-std=c99 CFLAGS += -Wall CFLAGS += -Wextra -CFLAGS += -Werror CFLAGS += -Wpointer-arith CFLAGS += -Wcast-align CFLAGS += -Wwrite-strings @@ -41,8 +41,6 @@ CFLAGS += -Wno-unknown-pragmas CFLAGS += -Wstrict-prototypes CFLAGS += -Wundef CFLAGS += -Wold-style-definition -CFLAGS += -Wmissing-prototypes -CFLAGS += -Wmissing-declarations TARGET_BASE1=all_tests TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION) @@ -63,8 +61,8 @@ all: clean default default: $(C_COMPILER) $(CFLAGS) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1) - ./$(TARGET1) -v + - ./$(TARGET1) -v clean: - $(CLEANUP) + $(CLEANUP) $(TARGET1) diff --git a/test/targets/clang_file.yml b/test/targets/clang_file.yml index 0d38e73df1a07bddb30a88f5fd9af621a97e5bb1..df1bd24e3475c19c40db48b57f8a8cfa529b0006 100644 --- a/test/targets/clang_file.yml +++ b/test/targets/clang_file.yml @@ -16,13 +16,10 @@ compiler: - '-Winit-self' - '-Winline' - '-Winvalid-pch' - - '-Wmissing-declarations' - '-Wmissing-include-dirs' - - '-Wmissing-prototypes' - '-Wnonnull' - '-Wpacked' - '-Wpointer-arith' - - '-Wredundant-decls' - '-Wswitch-default' - '-Wstrict-aliasing' - '-Wstrict-overflow=5' @@ -33,10 +30,7 @@ compiler: - '-Wshadow' - '-Wundef' - '-Wwrite-strings' - - '-Wno-missing-declarations' - - '-Wno-missing-prototypes' - '-Wno-nested-externs' - - '-Wno-redundant-decls' - '-Wno-unused-parameter' - '-Wno-variadic-macros' - '-Wbad-function-cast' diff --git a/test/targets/clang_strict.yml b/test/targets/clang_strict.yml index b862266bd5f9c239e2d4b2142dc87b67cc4a2d41..b399d76ee30cdff8cc4ed681b67b83bc4effdec2 100644 --- a/test/targets/clang_strict.yml +++ b/test/targets/clang_strict.yml @@ -16,13 +16,10 @@ compiler: - '-Winit-self' - '-Winline' - '-Winvalid-pch' - - '-Wmissing-declarations' - '-Wmissing-include-dirs' - - '-Wmissing-prototypes' - '-Wnonnull' - '-Wpacked' - '-Wpointer-arith' - - '-Wredundant-decls' - '-Wswitch-default' - '-Wstrict-aliasing' - '-Wstrict-overflow=5' @@ -33,10 +30,7 @@ compiler: - '-Wshadow' - '-Wundef' - '-Wwrite-strings' - - '-Wno-missing-declarations' - - '-Wno-missing-prototypes' - '-Wno-nested-externs' - - '-Wno-redundant-decls' - '-Wno-unused-parameter' - '-Wno-variadic-macros' - '-Wbad-function-cast'