skip stringop-overflow warning flags if clang is detected

This commit is contained in:
Jamie Fiedler 2020-10-21 12:06:00 -04:00 committed by Philippe Teuwen
commit 006d8923e6

View file

@ -43,6 +43,12 @@ INSTALLDOCSRELPATH ?= share/doc/proxmark3
platform = $(shell uname) platform = $(shell uname)
DETECTED_OS=$(platform) DETECTED_OS=$(platform)
ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1)
DETECTED_COMPILER = clang
else
DETECTED_COMPILER = gcc
endif
ifeq ($(platform),Darwin) ifeq ($(platform),Darwin)
AR= /usr/bin/ar rcs AR= /usr/bin/ar rcs
RANLIB= /usr/bin/ranlib RANLIB= /usr/bin/ranlib
@ -74,7 +80,9 @@ DEFCFLAGS += -Wswitch-enum -Wno-error=switch-enum
# GCC 10 has issues with false positives on stringop-overflow, let's disable them for now (cf https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92955, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94335) # GCC 10 has issues with false positives on stringop-overflow, let's disable them for now (cf https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92955, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94335)
# beware these flags didn't exist for GCC < 7 # beware these flags didn't exist for GCC < 7
ifeq ($(shell expr $(CC_VERSION) \>= 10), 1) ifeq ($(shell expr $(CC_VERSION) \>= 10), 1)
ifneq ($(DETECTED_COMPILER), clang)
DEFCFLAGS += -Wno-stringop-overflow -Wno-error=stringop-overflow DEFCFLAGS += -Wno-stringop-overflow -Wno-error=stringop-overflow
endif
endif endif
ifeq ($(platform),Darwin) ifeq ($(platform),Darwin)
# their readline has strict-prototype issues # their readline has strict-prototype issues