Fix the unsupported Q_UNREACHABLE_RETURN statement in constexpr functions
GCC 8.x does not treat __builtin_unreachable() as constexpr and disallows using the Q_UNREACHABLE_RETURN macro. Guard the statements with the respective checks. Amends b0b34c56a99130bfc9c82cb006653ce6b8f0516e Pick-to: 6.8 Task-number: QTBUG-125285 Fixes: QTBUG-132804 Change-Id: I88cdbe3bae1a336edc255e3e93e8d948bde253da Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io> (cherry picked from commit a57d5b1fd60b6b6848ef8ad9db237941229d7a23) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
ee97f24ef4
commit
09590ee995
@ -694,7 +694,12 @@ static constexpr QLatin1StringView settingsPrefix(QKdeThemePrivate::KdeSettingTy
|
||||
case QKdeThemePrivate::KdeSettingType::ToolBarStyle:
|
||||
return QLatin1StringView("Toolbar style/");
|
||||
}
|
||||
Q_UNREACHABLE_RETURN(QLatin1StringView());
|
||||
// GCC 8.x does not treat __builtin_unreachable() as constexpr
|
||||
# if !defined(Q_CC_GNU_ONLY) || (Q_CC_GNU >= 900)
|
||||
// NOLINTNEXTLINE(qt-use-unreachable-return): Triggers on Clang, breaking GCC 8
|
||||
Q_UNREACHABLE();
|
||||
# endif
|
||||
return {};
|
||||
}
|
||||
|
||||
static constexpr QKdeThemePrivate::KdeSettingType settingsType(QKdeThemePrivate::KdeSetting setting)
|
||||
@ -733,7 +738,12 @@ static constexpr QKdeThemePrivate::KdeSettingType settingsType(QKdeThemePrivate:
|
||||
CASE(TooltipBackground, Colors);
|
||||
CASE(TooltipForeground, Colors);
|
||||
};
|
||||
Q_UNREACHABLE_RETURN(QKdeThemePrivate::KdeSettingType::Root);
|
||||
// GCC 8.x does not treat __builtin_unreachable() as constexpr
|
||||
# if !defined(Q_CC_GNU_ONLY) || (Q_CC_GNU >= 900)
|
||||
// NOLINTNEXTLINE(qt-use-unreachable-return): Triggers on Clang, breaking GCC 8
|
||||
Q_UNREACHABLE();
|
||||
# endif
|
||||
return QKdeThemePrivate::KdeSettingType::Root;
|
||||
}
|
||||
#undef CASE
|
||||
|
||||
@ -799,7 +809,12 @@ static constexpr QLatin1StringView settingsKey(QKdeThemePrivate::KdeSetting sett
|
||||
case QKdeThemePrivate::KdeSetting::TooltipForeground:
|
||||
return QLatin1StringView("Tooltip/ForegroundNormal");
|
||||
};
|
||||
Q_UNREACHABLE_RETURN(QLatin1StringView());
|
||||
// GCC 8.x does not treat __builtin_unreachable() as constexpr
|
||||
# if !defined(Q_CC_GNU_ONLY) || (Q_CC_GNU >= 900)
|
||||
// NOLINTNEXTLINE(qt-use-unreachable-return): Triggers on Clang, breaking GCC 8
|
||||
Q_UNREACHABLE();
|
||||
# endif
|
||||
return {};
|
||||
}
|
||||
|
||||
void QKdeThemePrivate::refresh()
|
||||
|
Loading…
x
Reference in New Issue
Block a user