summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2022-12-05 13:01:51 +0100
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2022-12-06 06:30:55 +0100
commitb3b15f4cafcfc58792da5bcf4e73bf6a5a16ab19 (patch)
tree535214564542e444823fbc550df8d22ef477554e
parent21425c05e0a91a2b16503958bbf0201c108df967 (diff)
QLoggingCategory: enable fatal messages if critical is disabled
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 <kai.koehne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/corelib/io/qloggingcategory.h6
1 files changed, 5 insertions, 1 deletions
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 <QtMsgType Which> 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<Which>(), "Unknown Qt message type");
}
}
const char *name() const { return category->categoryName(); }