build : separate common warning flags

This commit is contained in:
Cebtenzzre 2023-09-14 15:41:28 -04:00
parent 724a0c2071
commit a80cb4cf1b
2 changed files with 10 additions and 10 deletions

View file

@ -412,26 +412,25 @@ endif()
if (LLAMA_ALL_WARNINGS)
if (NOT MSVC)
set(c_flags
set(warning_flags
-Wall
-Wextra
-Wpedantic
-Wcast-qual
-Wno-unused-function
)
set(c_flags
${warning_flags}
-Wdouble-promotion
-Wshadow
-Wstrict-prototypes
-Wpointer-arith
-Wmissing-prototypes
-Werror=implicit-int
-Wno-unused-function
)
set(cxx_flags
-Wall
-Wextra
-Wpedantic
-Wcast-qual
${warning_flags}
-Wmissing-declarations
-Wno-unused-function
)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") # clang++ only
set(cxx_flags ${cxx_flags} -Wmissing-prototypes)

View file

@ -173,9 +173,10 @@ ifdef LLAMA_DISABLE_LOGS
endif # LLAMA_DISABLE_LOGS
# warnings
MK_CFLAGS += -Wall -Wextra -Wpedantic -Wcast-qual -Wdouble-promotion -Wshadow -Wstrict-prototypes -Wpointer-arith \
-Wmissing-prototypes -Werror=implicit-int -Wno-unused-function
MK_CXXFLAGS += -Wall -Wextra -Wpedantic -Wcast-qual -Wmissing-declarations -Wno-unused-function
WARN_FLAGS = -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function
MK_CFLAGS += $(WARN_FLAGS) -Wdouble-promotion -Wshadow -Wstrict-prototypes -Wpointer-arith -Wmissing-prototypes \
-Werror=implicit-int
MK_CXXFLAGS += $(WARN_FLAGS) -Wmissing-declarations
# TODO(cebtenzzre): remove this once PR #2632 gets merged
TTFS_CXXFLAGS = $(CXXFLAGS) -Wno-missing-declarations