summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2012-09-20 16:16:27 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-02 22:34:42 +0200
commit7b696e4ec72bff9a606658e70258fcdba55c6cd0 (patch)
treef95099c99e4254b55734de3752a9ade81995f847 /src
parent1fc902ac7eb5791158f3757b10bd9424fe1d395f (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qurl.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 1e0d7d7ded..b7339a202e 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -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,