Skip to content

Commit 5716b74

Browse files
committed
Add -Wno-reserved-id-macro and -Wno-keyword-macro to clang builds. Fixes CppUTest on Xcode 7+, with clang-700+, where warnings were added about using reserved namespaces like __, and for macros that shadow keywords.
1 parent 2edc6bb commit 5716b74

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎build/MakefileWorker.mk‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,12 @@ ifeq ($(COMPILER_NAME),$(CLANG_STR))
198198
CPPUTEST_CXX_WARNINGFLAGS += -Weverything -Wno-disabled-macro-expansion -Wno-padded -Wno-global-constructors -Wno-exit-time-destructors -Wno-weak-vtables -Wno-old-style-cast -Wno-c++11-long-long
199199
CPPUTEST_C_WARNINGFLAGS += -Weverything -Wno-padded
200200

201-
# Clang "7" (Xcode 7 command-line tools) introduced new warnings by default that don't exist on previous versions of clang and cause errors when present.
202-
ifeq ($(findstring clang-7,$(CC_VERSION_OUTPUT)),clang-7)
201+
# Clang "7" or newer (Xcode 7 or newer command-line tools) introduced new warnings by default that don't exist on previous versions of clang and cause errors when present.
202+
CLANG_VERSION := $(shell echo $(CC_VERSION_OUTPUT) | grep -o 'clang-[0-9][0-9][0-9]*.')
203+
CLANG_VERSION_NUM := $(subst .,,$(subst clang-,,$(CLANG_VERSION)))
204+
CLANG_VERSION_NUM_GT_700 := $(shell [[ $(CLANG_VERSION_NUM) -ge 700 ]] && echo Y)
205+
206+
ifeq ($(CLANG_VERSION_NUM_GT_700), Y)
203207
# -Wno-reserved-id-macro -> Many CppUTest macros start with __, which is a reserved namespace
204208
# -Wno-keyword-macro -> CppUTest redefines the 'new' keyword for memory leak tracking
205209
CPPUTEST_CXX_WARNINGFLAGS += -Wno-reserved-id-macro -Wno-keyword-macro

0 commit comments

Comments
 (0)