diff options
author | Donald Kjer <don.kjer@gmail.com> | 2021-08-17 14:12:12 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-18 07:12:12 +1000 |
commit | 483691dd73e5260fac958c524e0a12e705db43f6 (patch) | |
tree | 8a044839de7c6906e021a54abe5ee2bc15dbf507 | |
parent | 857716794b233f3d4ac078c85a5a142091264aa6 (diff) | |
download | qmk_firmware-483691dd73e5260fac958c524e0a12e705db43f6.tar.gz qmk_firmware-483691dd73e5260fac958c524e0a12e705db43f6.zip |
Fixes for clang not being able to run unit tests (#13546)
-rw-r--r-- | tmk_core/native.mk | 5 | ||||
-rw-r--r-- | tmk_core/rules.mk | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/tmk_core/native.mk b/tmk_core/native.mk index 3caf64454..f609fd0e6 100644 --- a/tmk_core/native.mk +++ b/tmk_core/native.mk | |||
@@ -1,4 +1,5 @@ | |||
1 | SYSTEM_TYPE := $(shell gcc -dumpmachine) | 1 | SYSTEM_TYPE := $(shell gcc -dumpmachine) |
2 | GCC_VERSION := $(shell gcc --version 2>/dev/null) | ||
2 | 3 | ||
3 | CC = gcc | 4 | CC = gcc |
4 | OBJCOPY = | 5 | OBJCOPY = |
@@ -12,7 +13,9 @@ BIN = | |||
12 | 13 | ||
13 | 14 | ||
14 | COMPILEFLAGS += -funsigned-char | 15 | COMPILEFLAGS += -funsigned-char |
16 | ifeq ($(findstring clang, ${GCC_VERSION}),) | ||
15 | COMPILEFLAGS += -funsigned-bitfields | 17 | COMPILEFLAGS += -funsigned-bitfields |
18 | endif | ||
16 | COMPILEFLAGS += -ffunction-sections | 19 | COMPILEFLAGS += -ffunction-sections |
17 | COMPILEFLAGS += -fdata-sections | 20 | COMPILEFLAGS += -fdata-sections |
18 | COMPILEFLAGS += -fshort-enums | 21 | COMPILEFLAGS += -fshort-enums |
@@ -21,7 +24,9 @@ COMPILEFLAGS += -mno-ms-bitfields | |||
21 | endif | 24 | endif |
22 | 25 | ||
23 | CFLAGS += $(COMPILEFLAGS) | 26 | CFLAGS += $(COMPILEFLAGS) |
27 | ifeq ($(findstring clang, ${GCC_VERSION}),) | ||
24 | CFLAGS += -fno-inline-small-functions | 28 | CFLAGS += -fno-inline-small-functions |
29 | endif | ||
25 | CFLAGS += -fno-strict-aliasing | 30 | CFLAGS += -fno-strict-aliasing |
26 | 31 | ||
27 | CXXFLAGS += $(COMPILEFLAGS) | 32 | CXXFLAGS += $(COMPILEFLAGS) |
diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk index 597f7aa82..5a7f29910 100644 --- a/tmk_core/rules.mk +++ b/tmk_core/rules.mk | |||
@@ -105,7 +105,10 @@ endif | |||
105 | #CFLAGS += -Wundef | 105 | #CFLAGS += -Wundef |
106 | #CFLAGS += -Wunreachable-code | 106 | #CFLAGS += -Wunreachable-code |
107 | #CFLAGS += -Wsign-compare | 107 | #CFLAGS += -Wsign-compare |
108 | GCC_VERSION := $(shell gcc --version 2>/dev/null) | ||
109 | ifeq ($(findstring clang, ${GCC_VERSION}),) | ||
108 | CFLAGS += -Wa,-adhlns=$(@:%.o=%.lst) | 110 | CFLAGS += -Wa,-adhlns=$(@:%.o=%.lst) |
111 | endif | ||
109 | CFLAGS += $(CSTANDARD) | 112 | CFLAGS += $(CSTANDARD) |
110 | 113 | ||
111 | # This fixes lots of keyboards linking errors but SHOULDN'T BE A FINAL SOLUTION | 114 | # This fixes lots of keyboards linking errors but SHOULDN'T BE A FINAL SOLUTION |
@@ -137,7 +140,9 @@ endif | |||
137 | #CXXFLAGS += -Wstrict-prototypes | 140 | #CXXFLAGS += -Wstrict-prototypes |
138 | #CXXFLAGS += -Wunreachable-code | 141 | #CXXFLAGS += -Wunreachable-code |
139 | #CXXFLAGS += -Wsign-compare | 142 | #CXXFLAGS += -Wsign-compare |
143 | ifeq ($(findstring clang, ${GCC_VERSION}),) | ||
140 | CXXFLAGS += -Wa,-adhlns=$(@:%.o=%.lst) | 144 | CXXFLAGS += -Wa,-adhlns=$(@:%.o=%.lst) |
145 | endif | ||
141 | #CXXFLAGS += $(CSTANDARD) | 146 | #CXXFLAGS += $(CSTANDARD) |
142 | 147 | ||
143 | #---------------- Assembler Options ---------------- | 148 | #---------------- Assembler Options ---------------- |
@@ -150,11 +155,13 @@ CXXFLAGS += -Wa,-adhlns=$(@:%.o=%.lst) | |||
150 | # -listing-cont-lines: Sets the maximum number of continuation lines of hex | 155 | # -listing-cont-lines: Sets the maximum number of continuation lines of hex |
151 | # dump that will be displayed for a given single line of source input. | 156 | # dump that will be displayed for a given single line of source input. |
152 | ASFLAGS += $(ADEFS) | 157 | ASFLAGS += $(ADEFS) |
158 | ifeq ($(findstring clang, ${GCC_VERSION}),) | ||
153 | ifeq ($(strip $(DEBUG_ENABLE)),yes) | 159 | ifeq ($(strip $(DEBUG_ENABLE)),yes) |
154 | ASFLAGS += -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100 | 160 | ASFLAGS += -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100 |
155 | else | 161 | else |
156 | ASFLAGS += -Wa,-adhlns=$(@:%.o=%.lst),--listing-cont-lines=100 | 162 | ASFLAGS += -Wa,-adhlns=$(@:%.o=%.lst),--listing-cont-lines=100 |
157 | endif | 163 | endif |
164 | endif | ||
158 | ifeq ($(VERBOSE_AS_CMD),yes) | 165 | ifeq ($(VERBOSE_AS_CMD),yes) |
159 | ASFLAGS += -v | 166 | ASFLAGS += -v |
160 | endif | 167 | endif |