Skip to content

Commit

Permalink
Add -Wno-reserved-id-macro and -Wno-keyword-macro to clang builds. Fi…
Browse files Browse the repository at this point in the history
…xes CppUTest on Xcode 7+, with clang-700+, where warnings were added about using reserved namespaces like __, and for macros that shadow keywords.
  • Loading branch information
SaeedYasin committed Jul 1, 2018
1 parent 2edc6bb commit 5716b74
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions build/MakefileWorker.mk
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,12 @@ ifeq ($(COMPILER_NAME),$(CLANG_STR))
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
CPPUTEST_C_WARNINGFLAGS += -Weverything -Wno-padded

# 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.
ifeq ($(findstring clang-7,$(CC_VERSION_OUTPUT)),clang-7)
# 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.
CLANG_VERSION := $(shell echo $(CC_VERSION_OUTPUT) | grep -o 'clang-[0-9][0-9][0-9]*.')
CLANG_VERSION_NUM := $(subst .,,$(subst clang-,,$(CLANG_VERSION)))
CLANG_VERSION_NUM_GT_700 := $(shell [[ $(CLANG_VERSION_NUM) -ge 700 ]] && echo Y)

ifeq ($(CLANG_VERSION_NUM_GT_700), Y)
# -Wno-reserved-id-macro -> Many CppUTest macros start with __, which is a reserved namespace
# -Wno-keyword-macro -> CppUTest redefines the 'new' keyword for memory leak tracking
CPPUTEST_CXX_WARNINGFLAGS += -Wno-reserved-id-macro -Wno-keyword-macro
Expand Down

0 comments on commit 5716b74

Please sign in to comment.