From 80926572f723323c588a5445a3548fc2389d0629 Mon Sep 17 00:00:00 2001 From: Cebtenzzre Date: Thu, 14 Sep 2023 15:12:56 -0400 Subject: [PATCH] quantize : fix missing 'noreturn' (-Wmissing-noreturn) --- CMakeLists.txt | 1 + Makefile | 2 +- examples/quantize/quantize.cpp | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a144d39b6..ca19b9514 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -431,6 +431,7 @@ if (LLAMA_ALL_WARNINGS) set(cxx_flags ${warning_flags} -Wmissing-declarations + -Wmissing-noreturn ) if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") # clang++ only set(cxx_flags ${cxx_flags} -Wmissing-prototypes) diff --git a/Makefile b/Makefile index abfef720c..b4f3af62b 100644 --- a/Makefile +++ b/Makefile @@ -176,7 +176,7 @@ endif # LLAMA_DISABLE_LOGS 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 +MK_CXXFLAGS += $(WARN_FLAGS) -Wmissing-declarations -Wmissing-noreturn # TODO(cebtenzzre): remove this once PR #2632 gets merged TTFS_CXXFLAGS = $(CXXFLAGS) -Wno-missing-declarations diff --git a/examples/quantize/quantize.cpp b/examples/quantize/quantize.cpp index acb79e690..aa55f2ec5 100644 --- a/examples/quantize/quantize.cpp +++ b/examples/quantize/quantize.cpp @@ -71,6 +71,7 @@ static bool try_parse_ftype(const std::string & ftype_str_in, llama_ftype & ftyp // usage: // ./quantize [--allow-requantize] [--leave-output-tensor] models/llama/ggml-model.gguf [models/llama/ggml-model-quant.gguf] type [nthreads] // +[[noreturn]] static void usage(const char * executable) { printf("usage: %s [--help] [--allow-requantize] [--leave-output-tensor] model-f32.gguf [model-quant.gguf] type [nthreads]\n\n", executable); printf(" --allow-requantize: Allows requantizing tensors that have already been quantized. Warning: This can severely reduce quality compared to quantizing from 16bit or 32bit\n");