Commit 18b3d258 authored by hjk's avatar hjk

some QTC_ASSERT polishing

parent 4a552ead
......@@ -36,13 +36,11 @@
#include <QtCore/QDebug>
#ifdef Q_OS_UNIX
// we do not use the 'do {...} while (0)' idiom here to be able to use
// 'break' and 'continue' as 'actions'.
#define QTC_ASSERT(cond, action) \
if(cond){}else{qDebug()<<"ASSERTION"<<#cond<<"FAILED"<<__FILE__<<__LINE__;action;}
#else
#define QTC_ASSERT(cond, action) \
if(cond){}else{qDebug()<<"ASSERTION"<<#cond<<"FAILED";action;}
#endif
#endif // QTC_ASSERT_H
......@@ -34,7 +34,8 @@
#include "breakhandler.h"
#include "imports.h" // TextEditor::BaseTextMark
#include "qtcassert.h"
#include <utils/qtcassert.h>
#include <QtCore/QDebug>
#include <QtCore/QFileInfo>
......
......@@ -10,8 +10,6 @@ include(../../plugins/texteditor/texteditor.pri)
include(../../plugins/cpptools/cpptools.pri)
include(../../libs/cplusplus/cplusplus.pri)
INCLUDEPATH += ../../libs/utils
# DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII
QT += gui network script
......
......@@ -39,7 +39,6 @@
#include "gdboptionpage.h"
#include "gdbengine.h"
#include "mode.h"
#include "qtcassert.h"
#include <coreplugin/actionmanager/actionmanagerinterface.h>
#include <coreplugin/coreconstants.h>
......@@ -48,20 +47,27 @@
#include <coreplugin/messagemanager.h>
#include <coreplugin/modemanager.h>
#include <coreplugin/uniqueidmanager.h>
#include <cplusplus/ExpressionUnderCursor.h>
#include <cppeditor/cppeditorconstants.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/session.h>
#include <texteditor/basetexteditor.h>
#include <texteditor/basetextmark.h>
#include <texteditor/itexteditor.h>
#include <texteditor/texteditorconstants.h>
#include <texteditor/basetexteditor.h>
#include <utils/qtcassert.h>
#include <QtCore/QDebug>
#include <QtCore/qplugin.h>
#include <QtCore/QObject>
#include <QtCore/QPoint>
#include <QtCore/QSettings>
#include <QtGui/QPlainTextEdit>
#include <QtGui/QTextBlock>
#include <QtGui/QTextCursor>
......
......@@ -37,7 +37,6 @@
#include "debuggermanager.h"
#include "gdbmi.h"
#include "procinterrupt.h"
#include "qtcassert.h"
#include "disassemblerhandler.h"
#include "breakhandler.h"
......@@ -49,6 +48,8 @@
#include "startexternaldialog.h"
#include "attachexternaldialog.h"
#include <utils/qtcassert.h>
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
......
......@@ -32,10 +32,10 @@
***************************************************************************/
#include "gdbmi.h"
#include "qtcassert.h"
#include <utils/qtcassert.h>
#include <QtCore/QByteArray>
#include <QtCore/QDebug>
#include <QtCore/QTextStream>
namespace Debugger {
......
......@@ -35,7 +35,6 @@
#include "debuggerconstants.h"
#include "debuggermanager.h"
#include "qtcassert.h"
#include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h>
......@@ -48,10 +47,14 @@
#include <coreplugin/outputpane.h>
#include <coreplugin/navigationwidget.h>
#include <coreplugin/rightpane.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <utils/qtcassert.h>
#include <QtCore/QDebug>
#include <QtCore/QSettings>
#include <QtGui/QDockWidget>
#include <QtGui/QLabel>
#include <QtGui/QMainWindow>
......
......@@ -33,19 +33,18 @@
#include "scriptengine.h"
#include "qtcassert.h"
#include "attachexternaldialog.h"
#include "breakhandler.h"
#include "debuggerconstants.h"
#include "debuggermanager.h"
#include "disassemblerhandler.h"
#include "breakhandler.h"
#include "moduleshandler.h"
#include "registerhandler.h"
#include "stackhandler.h"
#include "startexternaldialog.h"
#include "watchhandler.h"
#include "startexternaldialog.h"
#include "attachexternaldialog.h"
#include <utils/qtcassert.h>
#include <QtCore/QDateTime>
#include <QtCore/QDebug>
......
......@@ -33,7 +33,7 @@
#include "stackhandler.h"
#include "qtcassert.h"
#include <utils/qtcassert.h>
#include <QtCore/QAbstractTableModel>
#include <QtCore/QDebug>
......
......@@ -37,7 +37,7 @@
#include "modeltest.h"
#endif
#include "qtcassert.h"
#include <utils/qtcassert.h>
#include <QtCore/QDebug>
#include <QtCore/QEvent>
......
......@@ -314,8 +314,8 @@ void ProjectNode::addProjectNodes(const QList<ProjectNode*> &subProjects)
emit watcher->foldersAboutToBeAdded(this, folderNodes);
foreach (ProjectNode *project, subProjects) {
Q_ASSERT_X(!project->parentFolderNode(), "addProjectNodes",
"Project node has already a parent");
QTC_ASSERT(!project->parentFolderNode(),
qDebug("Project node has already a parent"));
project->setParentFolderNode(this);
foreach (NodesWatcher *watcher, m_watchers)
project->registerWatcher(watcher);
......@@ -353,13 +353,13 @@ void ProjectNode::removeProjectNodes(const QList<ProjectNode*> &subProjects)
for (; toRemoveIter != toRemove.constEnd(); ++toRemoveIter) {
while ((*projectIter)->path() != (*toRemoveIter)->path()) {
++projectIter;
Q_ASSERT_X(projectIter != m_subProjectNodes.end(), "removeProjectNodes",
"Project to remove is not part of specified folder!");
QTC_ASSERT(projectIter != m_subProjectNodes.end(),
qDebug("Project to remove is not part of specified folder!"));
}
while ((*folderIter)->path() != (*toRemoveIter)->path()) {
++folderIter;
Q_ASSERT_X(folderIter != m_subFolderNodes.end(), "removeProjectNodes",
"Project to remove is not part of specified folder!");
QTC_ASSERT(folderIter != m_subFolderNodes.end(),
qDebug("Project to remove is not part of specified folder!"));
}
delete *projectIter;
projectIter = m_subProjectNodes.erase(projectIter);
......@@ -386,15 +386,15 @@ void ProjectNode::addFolderNodes(const QList<FolderNode*> &subFolders, FolderNod
watcher->foldersAboutToBeAdded(parentFolder, subFolders);
foreach (FolderNode *folder, subFolders) {
Q_ASSERT_X(!folder->parentFolderNode(), "addFolderNodes",
"Project node has already a parent folder");
QTC_ASSERT(!folder->parentFolderNode(),
qDebug("Project node has already a parent folder"));
folder->setParentFolderNode(parentFolder);
folder->setProjectNode(this);
parentFolder->m_subFolderNodes.append(folder);
// project nodes have to be added via addProjectNodes
Q_ASSERT_X(folder->nodeType() != ProjectNodeType, "addFolderNodes",
"project nodes have to be added via addProjectNodes");
QTC_ASSERT(folder->nodeType() != ProjectNodeType,
qDebug("project nodes have to be added via addProjectNodes"));
}
qSort(parentFolder->m_subFolderNodes.begin(), parentFolder->m_subFolderNodes.end(),
sortNodesByPath);
......@@ -427,12 +427,12 @@ void ProjectNode::removeFolderNodes(const QList<FolderNode*> &subFolders,
QList<FolderNode*>::const_iterator toRemoveIter = toRemove.constBegin();
QList<FolderNode*>::iterator folderIter = parentFolder->m_subFolderNodes.begin();
for (; toRemoveIter != toRemove.constEnd(); ++toRemoveIter) {
Q_ASSERT_X(((*toRemoveIter)->nodeType() != ProjectNodeType), "removeFolderNodes",
"project nodes have to be removed via removeProjectNodes");
QTC_ASSERT((*toRemoveIter)->nodeType() != ProjectNodeType,
qDebug("project nodes have to be removed via removeProjectNodes"));
while ((*folderIter)->path() != (*toRemoveIter)->path()) {
++folderIter;
Q_ASSERT_X(folderIter != parentFolder->m_subFolderNodes.end(), "removeFileNodes",
"Folder to remove is not part of specified folder!");
QTC_ASSERT(folderIter != parentFolder->m_subFolderNodes.end(),
qDebug("Folder to remove is not part of specified folder!"));
}
delete *folderIter;
folderIter = parentFolder->m_subFolderNodes.erase(folderIter);
......@@ -460,8 +460,8 @@ void ProjectNode::addFileNodes(const QList<FileNode*> &files, FolderNode *folder
emit watcher->filesAboutToBeAdded(folder, files);
foreach (FileNode *file, files) {
Q_ASSERT_X(!file->parentFolderNode(), "addFileNodes",
"File node has already a parent folder");
QTC_ASSERT(!file->parentFolderNode(),
qDebug("File node has already a parent folder"));
file->setParentFolderNode(folder);
file->setProjectNode(this);
......@@ -499,8 +499,8 @@ void ProjectNode::removeFileNodes(const QList<FileNode*> &files, FolderNode *fol
for (; toRemoveIter != toRemove.constEnd(); ++toRemoveIter) {
while ((*filesIter)->path() != (*toRemoveIter)->path()) {
++filesIter;
Q_ASSERT_X(filesIter != folder->m_fileNodes.end(), "removeFileNodes",
"File to remove is not part of specified folder!");
QTC_ASSERT(filesIter != folder->m_fileNodes.end(),
qDebug("File to remove is not part of specified folder!"));
}
delete *filesIter;
filesIter = folder->m_fileNodes.erase(filesIter);
......@@ -591,8 +591,8 @@ void SessionNode::addProjectNodes(const QList<ProjectNode*> &projectNodes)
emit watcher->foldersAboutToBeAdded(this, folderNodes);
foreach (ProjectNode *project, projectNodes) {
Q_ASSERT_X(!project->parentFolderNode(), "addProjectNodes",
"Project node has already a parent folder");
QTC_ASSERT(!project->parentFolderNode(),
qDebug("Project node has already a parent folder"));
project->setParentFolderNode(this);
foreach (NodesWatcher *watcher, m_watchers)
project->registerWatcher(watcher);
......@@ -621,13 +621,13 @@ void SessionNode::removeProjectNodes(const QList<ProjectNode*> &projectNodes)
for (; toRemoveIter != toRemove.constEnd(); ++toRemoveIter) {
while ((*projectIter)->path() != (*toRemoveIter)->path()) {
++projectIter;
Q_ASSERT_X(projectIter != m_projectNodes.end(), "removeProjectNodes",
"Project to remove is not part of specified folder!");
QTC_ASSERT(projectIter != m_projectNodes.end(),
qDebug("Project to remove is not part of specified folder!"));
}
while ((*folderIter)->path() != (*toRemoveIter)->path()) {
++folderIter;
Q_ASSERT_X(folderIter != m_subFolderNodes.end(), "removeProjectNodes",
"Project to remove is not part of specified folder!");
QTC_ASSERT(folderIter != m_subFolderNodes.end(),
qDebug("Project to remove is not part of specified folder!"));
}
projectIter = m_projectNodes.erase(projectIter);
folderIter = m_subFolderNodes.erase(folderIter);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment