Add Q_UNREACHABLE / Q_ASSERT to two conditions that can't happen

Just so the code generation is a little better.

Change-Id: I2a43a4df0ae67900c465a6c2b4f2b8ba284dbbaa
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Reviewed-by: David Faure <faure@kde.org>
This commit is contained in:
Thiago Macieira 2012-09-20 16:16:27 +02:00 committed by The Qt Project
parent 1fc902ac7e
commit 7b696e4ec7

View File

@ -3522,6 +3522,9 @@ static QString errorMessage(QUrlPrivate::ErrorCode errorCode, QChar c)
{
switch (errorCode) {
case QUrlPrivate::NoError:
Q_ASSERT_X(false, "QUrl::errorString",
"Impossible: QUrl::errorString should have treated this condition");
Q_UNREACHABLE();
return QString();
case QUrlPrivate::InvalidSchemeError: {
@ -3573,7 +3576,10 @@ static QString errorMessage(QUrlPrivate::ErrorCode errorCode, QChar c)
case QUrlPrivate::RelativeUrlPathContainsColonBeforeSlash:
return QStringLiteral("Relative URL's path component contains ':' before any '/'");
}
return QStringLiteral("<unknown error>");
Q_ASSERT_X(false, "QUrl::errorString", "Cannot happen, unknown error");
Q_UNREACHABLE();
return QString();
}
static inline void appendComponentIfPresent(QString &msg, bool present, const char *componentName,