From b3b15f4cafcfc58792da5bcf4e73bf6a5a16ab19 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 5 Dec 2022 13:01:51 +0100 Subject: QLoggingCategory: enable fatal messages if critical is disabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The if constexpr chain assumed the "last case" was critical, when instead we need to handle fatal as well. Use the opportunity to have the compiler break compilation in case someone adds a new enumerator in the future and doesn't handle it (i.e. does not repeat the mistake that I just did). Thanks to Kai for spotting the problem. Amends eb63f2eb05 Change-Id: I21e1dfd0dd17ccf0d6403f1dcd6d56cc2a95ce26 Reviewed-by: Kai Köhne Reviewed-by: Thiago Macieira --- src/corelib/io/qloggingcategory.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qloggingcategory.h b/src/corelib/io/qloggingcategory.h index c9b32a7227..37cb3c2de1 100644 --- a/src/corelib/io/qloggingcategory.h +++ b/src/corelib/io/qloggingcategory.h @@ -84,8 +84,12 @@ template struct QLoggingCategoryMacroHolder control = cat.isInfoEnabled(); } else if constexpr (Which == QtWarningMsg) { control = cat.isWarningEnabled(); - } else { + } else if constexpr (Which == QtCriticalMsg) { control = cat.isCriticalEnabled(); + } else if constexpr (Which == QtFatalMsg) { + control = true; + } else { + static_assert(QtPrivate::value_dependent_false(), "Unknown Qt message type"); } } const char *name() const { return category->categoryName(); } -- cgit v1.2.3