summaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
authorDonald Kjer <don.kjer@gmail.com>2021-08-17 14:12:12 -0700
committerGitHub <noreply@github.com>2021-08-18 07:12:12 +1000
commit483691dd73e5260fac958c524e0a12e705db43f6 (patch)
tree8a044839de7c6906e021a54abe5ee2bc15dbf507 /tmk_core
parent857716794b233f3d4ac078c85a5a142091264aa6 (diff)
Fixes for clang not being able to run unit tests (#13546)
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/native.mk5
-rw-r--r--tmk_core/rules.mk7
2 files changed, 12 insertions, 0 deletions
diff --git a/tmk_core/native.mk b/tmk_core/native.mk
index 3caf644546..f609fd0e6f 100644
--- a/tmk_core/native.mk
+++ b/tmk_core/native.mk
@@ -1,4 +1,5 @@
SYSTEM_TYPE := $(shell gcc -dumpmachine)
+GCC_VERSION := $(shell gcc --version 2>/dev/null)
CC = gcc
OBJCOPY =
@@ -12,7 +13,9 @@ BIN =
COMPILEFLAGS += -funsigned-char
+ifeq ($(findstring clang, ${GCC_VERSION}),)
COMPILEFLAGS += -funsigned-bitfields
+endif
COMPILEFLAGS += -ffunction-sections
COMPILEFLAGS += -fdata-sections
COMPILEFLAGS += -fshort-enums
@@ -21,7 +24,9 @@ COMPILEFLAGS += -mno-ms-bitfields
endif
CFLAGS += $(COMPILEFLAGS)
+ifeq ($(findstring clang, ${GCC_VERSION}),)
CFLAGS += -fno-inline-small-functions
+endif
CFLAGS += -fno-strict-aliasing
CXXFLAGS += $(COMPILEFLAGS)
diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk
index 597f7aa827..5a7f299102 100644
--- a/tmk_core/rules.mk
+++ b/tmk_core/rules.mk
@@ -105,7 +105,10 @@ endif
#CFLAGS += -Wundef
#CFLAGS += -Wunreachable-code
#CFLAGS += -Wsign-compare
+GCC_VERSION := $(shell gcc --version 2>/dev/null)
+ifeq ($(findstring clang, ${GCC_VERSION}),)
CFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
+endif
CFLAGS += $(CSTANDARD)
# This fixes lots of keyboards linking errors but SHOULDN'T BE A FINAL SOLUTION
@@ -137,7 +140,9 @@ endif
#CXXFLAGS += -Wstrict-prototypes
#CXXFLAGS += -Wunreachable-code
#CXXFLAGS += -Wsign-compare
+ifeq ($(findstring clang, ${GCC_VERSION}),)
CXXFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
+endif
#CXXFLAGS += $(CSTANDARD)
#---------------- Assembler Options ----------------
@@ -150,11 +155,13 @@ CXXFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
# -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.
ASFLAGS += $(ADEFS)
+ifeq ($(findstring clang, ${GCC_VERSION}),)
ifeq ($(strip $(DEBUG_ENABLE)),yes)
ASFLAGS += -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100
else
ASFLAGS += -Wa,-adhlns=$(@:%.o=%.lst),--listing-cont-lines=100
endif
+endif
ifeq ($(VERBOSE_AS_CMD),yes)
ASFLAGS += -v
endif