From ca13eee19faa407764bf64c79e79bf6815ebc3f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rio=20Feroldi?= Date: Thu, 20 Jul 2017 16:13:24 -0300 Subject: [PATCH] Suppress warning about missing noreturn attribute Adding `[[noreturn]]` to `report_unknown_type` suppresses the Clang/GCC `-Wmissing-noreturn` warning: Clang outputs: .../fmt/fmt/format.cc:294:74: warning: function 'report_unknown_type' could be declared with attribute 'noreturn' [-Wmissing-noreturn] ...code, const char *type) { ^ GCC outputs: .../fmt/fmt/format.cc:294:74: warning: function might be candidate for attribute 'noreturn' [-Wsuggest-attribute=noreturn] ...code, const char *type) { ^ --- fmt/format.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fmt/format.h b/fmt/format.h index a4379da3..f4128df1 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -923,7 +923,11 @@ struct IntTraits { TypeSelector::digits <= 32>::Type MainType; }; +#if FMT_HAS_GXX_CXX11 +FMT_API [[noreturn]] void report_unknown_type(char code, const char *type); +#else FMT_API void report_unknown_type(char code, const char *type); +#endif // Static data is placed in this class template to allow header-only // configuration.