Skip to content

Commit 10c850b

Browse files
committed
build : fix gcc build
1 parent 4a5fee0 commit 10c850b

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

CMakeLists.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -414,10 +414,11 @@ if (LLAMA_ALL_WARNINGS)
414414
-Wextra
415415
-Wpedantic
416416
-Wcast-qual
417-
-Wunreachable-code-break
418-
-Wunreachable-code-return
419-
-Wextra-semi
417+
-Wno-unused-function
420418
)
419+
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # clang++ only
420+
set(warning_flags ${warning_flags} -Wunreachable-code-break -Wunreachable-code-return)
421+
endif()
421422
set(c_flags
422423
${warning_flags}
423424
-Wdouble-promotion
@@ -426,17 +427,15 @@ if (LLAMA_ALL_WARNINGS)
426427
-Wpointer-arith
427428
-Wmissing-prototypes
428429
-Werror=implicit-int
429-
-Wno-unused-function
430430
)
431431
set(cxx_flags
432432
${warning_flags}
433433
-Wmissing-declarations
434434
-Wmissing-noreturn
435-
-Wrange-loop-bind-reference
436-
-Wno-unused-function
435+
-Wextra-semi
437436
)
438437
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # clang++ only
439-
set(cxx_flags ${cxx_flags} -Wmissing-prototypes)
438+
set(cxx_flags ${cxx_flags} -Wmissing-prototypes -Wrange-loop-bind-reference)
440439
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # g++ only
441440
set(cxx_flags ${cxx_flags} -Wno-format-truncation -Wno-array-bounds)
442441
endif()

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,18 @@ ifdef LLAMA_DISABLE_LOGS
170170
endif # LLAMA_DISABLE_LOGS
171171

172172
# warnings
173-
WARN_FLAGS = -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wunreachable-code-break \
174-
-Wunreachable-code-return -Wextra-semi
173+
WARN_FLAGS = -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function
175174
MK_CFLAGS += $(WARN_FLAGS) -Wdouble-promotion -Wshadow -Wstrict-prototypes -Wpointer-arith -Wmissing-prototypes \
176175
-Werror=implicit-int
177-
MK_CXXFLAGS += $(WARN_FLAGS) -Wmissing-declarations -Wmissing-noreturn -Wrange-loop-bind-reference
176+
MK_CXXFLAGS += $(WARN_FLAGS) -Wmissing-declarations -Wmissing-noreturn -Wextra-semi
178177

179178
# TODO(cebtenzzre): remove this once PR #2632 gets merged
180179
TTFS_CXXFLAGS = $(CXXFLAGS) -Wno-missing-declarations
181180

182181
ifneq '' '$(findstring clang,$(shell $(CXX) --version))'
183182
# clang++ only
184-
MK_CXXFLAGS += -Wmissing-prototypes
183+
WARN_FLAGS += -Wunreachable-code-break -Wunreachable-code-return
184+
MK_CXXFLAGS += -Wmissing-prototypes -Wrange-loop-bind-reference
185185
TTFS_CXXFLAGS += -Wno-missing-prototypes
186186
else
187187
# g++ only

0 commit comments

Comments
 (0)