diff options
author | Pierre Rossi <pierre.rossi@gmail.com> | 2011-07-28 11:04:07 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2011-07-28 11:04:07 +0200 |
commit | e9770b468474dbb1e2774d76b5309d729f35f4b8 (patch) | |
tree | 04c1056aa45f8e823ba398efbf68a3c99208fc58 | |
parent | Merge branch 'HOOKS' (diff) | |
download | rekonq-e9770b468474dbb1e2774d76b5309d729f35f4b8.tar.xz |
Introducing ASSERT_NOT_REACHED
In a similar fashion as WebKit, this might make those cases
where we don't expect to go more obvious in debug builds.
I also took the liberty to revisit a lot of switch statements
but it could potentially be used elsewhere
Reviewed-by: andrea
-rw-r--r-- | src/application.cpp | 5 | ||||
-rw-r--r-- | src/bookmarks/bookmarkowner.cpp | 1 | ||||
-rw-r--r-- | src/history/historymanager.cpp | 2 | ||||
-rw-r--r-- | src/mainwindow.cpp | 6 | ||||
-rw-r--r-- | src/rekonq_defines.h | 8 | ||||
-rw-r--r-- | src/urlbar/urlbar.cpp | 2 | ||||
-rw-r--r-- | src/webpage.cpp | 2 | ||||
-rw-r--r-- | src/webpluginfactory.cpp | 2 |
8 files changed, 15 insertions, 13 deletions
diff --git a/src/application.cpp b/src/application.cpp index fc4e81fc..a62d548e 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -238,12 +238,10 @@ int Application::newInstance() case 0: // new tab page loadUrl(KUrl("about:home") , Rekonq::NewWindow); break; - case 1: // blank page - loadUrl(KUrl("about:blank") , Rekonq::NewWindow); - break; case 2: // homepage loadUrl(KUrl(ReKonfig::homePage()) , Rekonq::NewWindow); break; + case 1: // blank page default: loadUrl(KUrl("about:blank") , Rekonq::NewWindow); break; @@ -632,6 +630,7 @@ void Application::updateConfiguration() break; default: // non extant case + ASSERT_NOT_REACHED(); break; } diff --git a/src/bookmarks/bookmarkowner.cpp b/src/bookmarks/bookmarkowner.cpp index b15bf28b..40b070dd 100644 --- a/src/bookmarks/bookmarkowner.cpp +++ b/src/bookmarks/bookmarkowner.cpp @@ -96,6 +96,7 @@ KAction* BookmarkOwner::createAction(const KBookmark &bookmark, const BookmarkAc return createAction(i18n("Unset this folder as the toolbar folder"), "bookmark-toolbar", "", SLOT(unsetToolBarFolder()), bookmark); default: + ASSERT_NOT_REACHED(); return 0; } } diff --git a/src/history/historymanager.cpp b/src/history/historymanager.cpp index 0a29950e..a5cd29e3 100644 --- a/src/history/historymanager.cpp +++ b/src/history/historymanager.cpp @@ -304,8 +304,6 @@ void HistoryManager::loadSettings() days = 365; break; case 5: - days = -1; - break; default: days = -1; break; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d0d4d401..09e2ae1a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1190,17 +1190,13 @@ void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status) switch (status) { - case Rekonq::Url: - break; case Rekonq::Info: m_hidePopupTimer->start(500); break; + case Rekonq::Url: case Rekonq::Success: - break; case Rekonq::Error: - break; case Rekonq::Download: - break; default: break; } diff --git a/src/rekonq_defines.h b/src/rekonq_defines.h index fd0d1e25..bd11c24e 100644 --- a/src/rekonq_defines.h +++ b/src/rekonq_defines.h @@ -51,7 +51,13 @@ #define QL1S(x) QLatin1String(x) #define QL1C(x) QLatin1Char(x) - +#ifndef ASSERT_NOT_REACHED +# ifndef QT_NO_DEBUG +# define ASSERT_NOT_REACHED(msg) qt_assert(#msg,__FILE__,__LINE__); kDebug() << #msg +# else +# define ASSERT_NOT_REACHED(msg) kDebug() << #msg +# endif +#endif //ASSERT_NOT_REACHED // ---------------------------------------------------------------------------------------------------- // ENUMS diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp index 0d17f6cf..17ba4bb9 100644 --- a/src/urlbar/urlbar.cpp +++ b/src/urlbar/urlbar.cpp @@ -510,7 +510,7 @@ IconButton *UrlBar::addRightIcon(UrlBar::icon ic) rightIcon->setToolTip(i18n("Remove from favorite")); break; default: - kDebug() << "ERROR.. default non extant case!!"; + ASSERT_NOT_REACHED("ERROR.. default non extant case!!"); break; } diff --git a/src/webpage.cpp b/src/webpage.cpp index a7baac6d..e9f71232 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -364,6 +364,7 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r break; default: + ASSERT_NOT_REACHED(); break; } } @@ -452,6 +453,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) return; default: // non extant case + ASSERT_NOT_REACHED(); break; } } diff --git a/src/webpluginfactory.cpp b/src/webpluginfactory.cpp index 0a47aef8..d4a1bfe1 100644 --- a/src/webpluginfactory.cpp +++ b/src/webpluginfactory.cpp @@ -83,7 +83,7 @@ QObject *WebPluginFactory::create(const QString &mimeType, return 0; default: - kDebug() << "oh oh.. this should NEVER happen.."; + ASSERT_NOT_REACHED("oh oh.. this should NEVER happen.."); break; } |