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 (LLAMA_ALL_WARNINGS)
if (NOT MSVC) if (NOT MSVC)
set(c_flags set(warning_flags
-Wall -Wall
-Wextra -Wextra
-Wpedantic -Wpedantic
-Wcast-qual -Wcast-qual
-Wno-unused-function
)
set(c_flags
${warning_flags}
-Wdouble-promotion -Wdouble-promotion
-Wshadow -Wshadow
-Wstrict-prototypes -Wstrict-prototypes
-Wpointer-arith -Wpointer-arith
-Wmissing-prototypes -Wmissing-prototypes
-Werror=implicit-int -Werror=implicit-int
-Wno-unused-function
) )
set(cxx_flags set(cxx_flags
-Wall ${warning_flags}
-Wextra
-Wpedantic
-Wcast-qual
-Wmissing-declarations -Wmissing-declarations
-Wno-unused-function
) )
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") # clang++ only if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") # clang++ only
set(cxx_flags ${cxx_flags} -Wmissing-prototypes) set(cxx_flags ${cxx_flags} -Wmissing-prototypes)

View file

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