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>
This commit is contained in:
Giuseppe D'Angelo 2022-12-05 13:01:51 +01:00
parent 21425c05e0
commit b3b15f4caf

View File

@ -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(); }