From a80cb4cf1b2c163cf98a231eab0ced26858819cb Mon Sep 17 00:00:00 2001 From: Cebtenzzre Date: Thu, 14 Sep 2023 15:41:28 -0400 Subject: [PATCH] build : separate common warning flags --- CMakeLists.txt | 13 ++++++------- Makefile | 7 ++++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f24eb99f..a144d39b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/Makefile b/Makefile index f3da318ef..abfef720c 100644 --- a/Makefile +++ b/Makefile @@ -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