forked from mirrors/qmk_firmware
Fixes for clang not being able to run unit tests (#13546)
This commit is contained in:
parent
857716794b
commit
483691dd73
2 changed files with 12 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
||||||
SYSTEM_TYPE := $(shell gcc -dumpmachine)
|
SYSTEM_TYPE := $(shell gcc -dumpmachine)
|
||||||
|
GCC_VERSION := $(shell gcc --version 2>/dev/null)
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
OBJCOPY =
|
OBJCOPY =
|
||||||
|
@ -12,7 +13,9 @@ BIN =
|
||||||
|
|
||||||
|
|
||||||
COMPILEFLAGS += -funsigned-char
|
COMPILEFLAGS += -funsigned-char
|
||||||
|
ifeq ($(findstring clang, ${GCC_VERSION}),)
|
||||||
COMPILEFLAGS += -funsigned-bitfields
|
COMPILEFLAGS += -funsigned-bitfields
|
||||||
|
endif
|
||||||
COMPILEFLAGS += -ffunction-sections
|
COMPILEFLAGS += -ffunction-sections
|
||||||
COMPILEFLAGS += -fdata-sections
|
COMPILEFLAGS += -fdata-sections
|
||||||
COMPILEFLAGS += -fshort-enums
|
COMPILEFLAGS += -fshort-enums
|
||||||
|
@ -21,7 +24,9 @@ COMPILEFLAGS += -mno-ms-bitfields
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += $(COMPILEFLAGS)
|
CFLAGS += $(COMPILEFLAGS)
|
||||||
|
ifeq ($(findstring clang, ${GCC_VERSION}),)
|
||||||
CFLAGS += -fno-inline-small-functions
|
CFLAGS += -fno-inline-small-functions
|
||||||
|
endif
|
||||||
CFLAGS += -fno-strict-aliasing
|
CFLAGS += -fno-strict-aliasing
|
||||||
|
|
||||||
CXXFLAGS += $(COMPILEFLAGS)
|
CXXFLAGS += $(COMPILEFLAGS)
|
||||||
|
|
|
@ -105,7 +105,10 @@ endif
|
||||||
#CFLAGS += -Wundef
|
#CFLAGS += -Wundef
|
||||||
#CFLAGS += -Wunreachable-code
|
#CFLAGS += -Wunreachable-code
|
||||||
#CFLAGS += -Wsign-compare
|
#CFLAGS += -Wsign-compare
|
||||||
|
GCC_VERSION := $(shell gcc --version 2>/dev/null)
|
||||||
|
ifeq ($(findstring clang, ${GCC_VERSION}),)
|
||||||
CFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
|
CFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
|
||||||
|
endif
|
||||||
CFLAGS += $(CSTANDARD)
|
CFLAGS += $(CSTANDARD)
|
||||||
|
|
||||||
# This fixes lots of keyboards linking errors but SHOULDN'T BE A FINAL SOLUTION
|
# This fixes lots of keyboards linking errors but SHOULDN'T BE A FINAL SOLUTION
|
||||||
|
@ -137,7 +140,9 @@ endif
|
||||||
#CXXFLAGS += -Wstrict-prototypes
|
#CXXFLAGS += -Wstrict-prototypes
|
||||||
#CXXFLAGS += -Wunreachable-code
|
#CXXFLAGS += -Wunreachable-code
|
||||||
#CXXFLAGS += -Wsign-compare
|
#CXXFLAGS += -Wsign-compare
|
||||||
|
ifeq ($(findstring clang, ${GCC_VERSION}),)
|
||||||
CXXFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
|
CXXFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
|
||||||
|
endif
|
||||||
#CXXFLAGS += $(CSTANDARD)
|
#CXXFLAGS += $(CSTANDARD)
|
||||||
|
|
||||||
#---------------- Assembler Options ----------------
|
#---------------- Assembler Options ----------------
|
||||||
|
@ -150,11 +155,13 @@ CXXFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
|
||||||
# -listing-cont-lines: Sets the maximum number of continuation lines of hex
|
# -listing-cont-lines: Sets the maximum number of continuation lines of hex
|
||||||
# dump that will be displayed for a given single line of source input.
|
# dump that will be displayed for a given single line of source input.
|
||||||
ASFLAGS += $(ADEFS)
|
ASFLAGS += $(ADEFS)
|
||||||
|
ifeq ($(findstring clang, ${GCC_VERSION}),)
|
||||||
ifeq ($(strip $(DEBUG_ENABLE)),yes)
|
ifeq ($(strip $(DEBUG_ENABLE)),yes)
|
||||||
ASFLAGS += -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100
|
ASFLAGS += -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100
|
||||||
else
|
else
|
||||||
ASFLAGS += -Wa,-adhlns=$(@:%.o=%.lst),--listing-cont-lines=100
|
ASFLAGS += -Wa,-adhlns=$(@:%.o=%.lst),--listing-cont-lines=100
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
ifeq ($(VERBOSE_AS_CMD),yes)
|
ifeq ($(VERBOSE_AS_CMD),yes)
|
||||||
ASFLAGS += -v
|
ASFLAGS += -v
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in a new issue