Commit a9afc574 authored by Milian Wolff's avatar Milian Wolff

fix a bunch of compiler warnings, esp. when compiling in release mode

parent 02611bbe
......@@ -9,6 +9,7 @@ set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 1000)
set(CTEST_CUSTOM_WARNING_EXCEPTION
${CTEST_CUSTOM_WARNING_EXCEPTION}
"/plugins/subversion/kdevsvncpp/"
"/tests/modeltest.cpp"
)
# Errors that will be ignored
......
......@@ -193,6 +193,7 @@ void VariableToolTip::slotLinkActivated(const QString& link)
void VariableToolTip::slotRangeChanged(int min, int max)
{
Q_ASSERT(min == 0);
Q_UNUSED(min);
QRect rect = QApplication::desktop()->screenGeometry(this);
if (pos().y() + height() + max*itemHeight_ < rect.bottom())
resize(width(), height() + max*itemHeight_);
......
......@@ -140,8 +140,8 @@ public:
virtual bool isReady() const=0;
Q_SIGNALS:
virtual void fileAddedToSet( KDevelop::IProject* project, const KDevelop::IndexedString& file);
virtual void fileRemovedFromSet( KDevelop::IProject* project, const KDevelop::IndexedString& file);
void fileAddedToSet( KDevelop::IProject* project, const KDevelop::IndexedString& file);
void fileRemovedFromSet( KDevelop::IProject* project, const KDevelop::IndexedString& file);
public Q_SLOTS:
/**
......
......@@ -410,12 +410,19 @@ BackgroundParser::BackgroundParser(ILanguageController *languageController)
connect(ICore::self()->documentController(), SIGNAL(documentClosed(KDevelop::IDocument*)), this, SLOT(documentClosed(KDevelop::IDocument*)));
connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(aboutToQuit()));
bool connected = QObject::connect(ICore::self()->projectController(), SIGNAL(projectAboutToBeOpened(KDevelop::IProject*)), this, SLOT(projectAboutToBeOpened(KDevelop::IProject*)));
bool connected = QObject::connect(ICore::self()->projectController(),
SIGNAL(projectAboutToBeOpened(KDevelop::IProject*)),
this, SLOT(projectAboutToBeOpened(KDevelop::IProject*)));
Q_ASSERT(connected);
connected = QObject::connect(ICore::self()->projectController(), SIGNAL(projectOpened(KDevelop::IProject*)), this, SLOT(projectOpened(KDevelop::IProject*)));
connected = QObject::connect(ICore::self()->projectController(),
SIGNAL(projectOpened(KDevelop::IProject*)),
this, SLOT(projectOpened(KDevelop::IProject*)));
Q_ASSERT(connected);
connected = QObject::connect(ICore::self()->projectController(), SIGNAL(projectOpeningAborted(KDevelop::IProject*)), this, SLOT(projectOpeningAborted(KDevelop::IProject*)));
connected = QObject::connect(ICore::self()->projectController(),
SIGNAL(projectOpeningAborted(KDevelop::IProject*)),
this, SLOT(projectOpeningAborted(KDevelop::IProject*)));
Q_ASSERT(connected);
Q_UNUSED(connected);
}
void BackgroundParser::aboutToQuit()
......
......@@ -125,7 +125,7 @@ JobPrototype JobPlan::jobForUrl(const KUrl& url)
return JobPrototype();
}
void JobPlan::updateReady(const IndexedString& url, const ReferencedTopDUContext& context)
void JobPlan::updateReady(const IndexedString& url, const ReferencedTopDUContext& /*context*/)
{
kDebug() << "update ready on " << url.toUrl();
......
......@@ -31,7 +31,7 @@ using namespace KDevelop;
class TestLanguageSupport : public QObject, public KDevelop::ILanguageSupport
{
Q_OBJECT
Q_INTERFACES(KDevelop::ILanguageSupport)
public:
virtual KDevelop::ParseJob* createParseJob(const KUrl& url);
virtual QString name() const;
......
......@@ -190,6 +190,7 @@ Declaration::~Declaration()
setAbstractType(AbstractType::Ptr());
}
Q_ASSERT(d_func()->isDynamic() == (!topContext->deleting() || !topContext->isOnDisk() || topContext->m_dynamicData->isTemporaryDeclarationIndex(oldOwnIndex)));
Q_UNUSED(oldOwnIndex);
//DUChain::declarationChanged(this, DUChainObserver::Deletion, DUChainObserver::NotApplicable);
}
......
......@@ -492,6 +492,8 @@ public:
m_environmentInfo.deleteItem(index);
}
Q_UNUSED(removed);
Q_UNUSED(removed2);
Q_ASSERT(index || (removed && removed2));
Q_ASSERT(!findInformation(info->indexedTopContext().index()));
}
......@@ -856,6 +858,7 @@ public:
QFile f(globalItemRepositoryRegistry().path() + "/parsing_environment_data");
bool opened = f.open(QIODevice::WriteOnly);
Q_ASSERT(opened);
Q_UNUSED(opened);
f.write((char*)ParsingEnvironmentFile::m_staticData, sizeof(StaticParsingEnvironmentData));
}
......@@ -1252,6 +1255,7 @@ void DUChain::addToEnvironmentManager( TopDUContext * chain ) {
///If this triggers, there has already been another environment-information registered for this top-context.
///removeFromEnvironmentManager should have been called before to remove the old environment-information.
Q_ASSERT(alreadyHave == file.data());
Q_UNUSED(alreadyHave);
return;
}
......
......@@ -334,6 +334,7 @@ void ParsingEnvironmentFile::addModificationRevision(const IndexedString& url, c
//Test
Q_ASSERT(d_func_dynamic()->m_allModificationRevisions.index());
bool result = d_func_dynamic()->m_allModificationRevisions.removeModificationRevision(url, revision);
Q_UNUSED( result );
Q_ASSERT( result );
d_func_dynamic()->m_allModificationRevisions.addModificationRevision(url, revision);
}
......@@ -345,6 +346,7 @@ void ParsingEnvironmentFile::setModificationRevision( const KDevelop::Modificati
Q_ASSERT(d_func_dynamic()->m_allModificationRevisions.index());
bool result = d_func_dynamic()->m_allModificationRevisions.removeModificationRevision(d_func()->m_url, d_func()->m_modificationTime);
Q_ASSERT( result );
Q_UNUSED( result );
#ifdef LEXERCACHE_DEBUG
if(debugging()) {
......
......@@ -195,6 +195,7 @@ void ItemRepositoryRegistry::deleteDataDirectory() {
m_lock->unlock();
bool result = removeDirectory(m_path);
Q_ASSERT(result);
Q_UNUSED(result);
Q_ASSERT(m_lock);
//Just remove the old directory, and allocate a new one. Probably it'll be the same one.
QPair<QString, KLockFile::Ptr> repo = allocateRepository();
......
......@@ -251,6 +251,7 @@ void TopDUContextDynamicData::loadData() const {
QString fileName = baseDir + '/' + QString("%1").arg(m_topContext->ownIndex());
QFile* file = new QFile(fileName);
bool open = file->open(QIODevice::ReadOnly);
Q_UNUSED(open);
Q_ASSERT(open);
Q_ASSERT(file->size());
......@@ -376,6 +377,7 @@ void TopDUContextDynamicData::deleteOnDisk() {
m_onDisk = false;
bool successfullyRemoved = QFile::remove(filePath());
Q_UNUSED(successfullyRemoved);
Q_ASSERT(successfullyRemoved);
kDebug() << "deletion ready";
}
......
......@@ -197,28 +197,6 @@
</property>
</widget>
</item>
<!--
<item row="3" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>External Terminal:</string>
</property>
<property name="buddy">
<cstring>runInTerminal</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="runInTerminal">
<property name="toolTip">
<string>When enabled, runs the application in an external terminal.</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
-->
</layout>
</widget>
</item>
......@@ -226,9 +204,9 @@
</widget>
<customwidgets>
<customwidget>
<class>KUrlRequester</class>
<extends>QFrame</extends>
<header>kurlrequester.h</header>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
<customwidget>
<class>KLineEdit</class>
......@@ -236,9 +214,9 @@
<header>klineedit.h</header>
</customwidget>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
<class>KUrlRequester</class>
<extends>QFrame</extends>
<header>kurlrequester.h</header>
</customwidget>
<customwidget>
<class>KDevelop::EnvironmentSelectionWidget</class>
......@@ -252,14 +230,17 @@
</customwidget>
</customwidgets>
<tabstops>
<tabstop>interpreter</tabstop>
<tabstop>projectTargetRadio</tabstop>
<tabstop>projectTarget</tabstop>
<tabstop>executableRadio</tabstop>
<tabstop>executablePath</tabstop>
<tabstop>localHostRadio</tabstop>
<tabstop>remoteHostRadio</tabstop>
<tabstop>remoteHost</tabstop>
<tabstop>arguments</tabstop>
<tabstop>workingDirectory</tabstop>
<tabstop>environment</tabstop>
<tabstop>runInTerminal</tabstop>
</tabstops>
<resources/>
<connections>
......
......@@ -826,6 +826,7 @@ void GitPlugin::initBranchHash(const QString &repo)
QScopedPointer<DVcsJob> job(gitRevList(repo, QStringList(root)));
bool ret = job->exec();
Q_ASSERT(ret && job->status()==VcsJob::JobSucceeded && "TODO: provide a fall back in case of failing");
Q_UNUSED(ret);
QStringList commits = job->output().split('\n', QString::SkipEmptyParts);
// kDebug() << "\n\n\n commits" << commits << "\n\n\n";
branchesShas.append(commits);
......
......@@ -285,25 +285,6 @@ ContextMenuExtension ProjectManagerViewPlugin::contextMenuExtension( KDevelop::C
return menuExt;
}
KDevelop::IProjectBuilder* ProjectManagerViewPlugin::getProjectBuilder( KDevelop::ProjectBaseItem* item )
{
if( !item )
return 0;
IProject* project = item->project();
if (!project)
return 0;
ProjectFolderItem* prjitem = project->projectItem();
IPlugin* fmgr = project->managerPlugin();
IBuildSystemManager* mgr = fmgr->extension<IBuildSystemManager>();
if( mgr )
{
return mgr->builder();
}
return 0;
}
void ProjectManagerViewPlugin::closeProjects()
{
QList<KDevelop::IProject*> projectsToClose;
......
......@@ -85,7 +85,6 @@ protected Q_SLOTS:
void updateActionState( KDevelop::Context* ctx );
void updateFromBuildSetChange();
private:
static KDevelop::IProjectBuilder* getProjectBuilder( KDevelop::ProjectBaseItem* item );
QList<KDevelop::ProjectBaseItem*> recurseAndFetchCheckedItems( KDevelop::ProjectBaseItem* item );
void runBuilderJob( KDevelop::BuilderJob::BuildType );
class ProjectManagerViewPluginPrivate* const d;
......
......@@ -535,6 +535,7 @@ void ProjectModelTest::testItemsForUrl_data()
ProjectFileItem* file = new ProjectFileItem(0, KUrl(folder->url(), "foo"), folder);
ProjectTargetItem* target = new ProjectTargetItem(0, "b", root);
ProjectFileItem* file2 = new ProjectFileItem(0, file->url(), target);
Q_UNUSED(file2);
QTest::newRow("find two") << file->url() << static_cast<ProjectBaseItem*>(root) << 2;
}
}
......
......@@ -222,6 +222,7 @@ void MainWindowPrivate::xmlguiclientDestroyed(QObject* obj)
get a weird crash a bit later. */
Q_ASSERT(obj == lastXMLGUIClientView);
Q_ASSERT(false && "xmlgui clients management is messed up");
Q_UNUSED(obj);
}
void MainWindowPrivate::setupActions()
......
......@@ -43,7 +43,7 @@ OpenProjectDialog::OpenProjectDialog( bool fetch, const KUrl& startUrl, QWidget*
resize(QSize(700, 500));
KUrl start = startUrl.isValid() ? startUrl : Core::self()->projectController()->projectsBaseDirectory();
KPageWidgetItem* currentPage;
KPageWidgetItem* currentPage = 0;
start.adjustPath(KUrl::AddTrailingSlash);
if( fetch ) {
......
......@@ -895,14 +895,12 @@ void SessionChooserDialog::updateState() {
if(session == i18n("Create New Session"))
continue;
bool running = false;
QString state;
SessionController::LockSessionState lockState = KDevelop::SessionController::tryLockSession(session);
if(!lockState)
{
state = i18n("[running, pid %1, app %2, host %3]", lockState.holderPid,
lockState.holderApp, lockState.holderHostname);
running = true;
}
if(m_model->item(row, 2))
......
......@@ -95,7 +95,7 @@
<property name="title">
<string>Tabbed Browsing</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="gridLayout_1">
<item row="0" column="0">
<widget class="QCheckBox" name="kcfg_TabBarVisibility">
<property name="text">
......
......@@ -71,7 +71,7 @@ class TestBuddyFinder : public KDevelop::IBuddyDocumentFinder
qDebug() << "found buddies: " << url1 << url2;
return true;
}
virtual bool buddyOrder(const KUrl& url1, const KUrl& url2)
virtual bool buddyOrder(const KUrl& url1, const KUrl& /*url2*/)
{
const QStringList name1 = url1.fileName().split('.');
return name1.at(1) == "l";
......
......@@ -428,6 +428,7 @@ void UiController::loadArea(Sublime::Area * area, const KConfigGroup & group)
if (!area->workingSet().isEmpty()) {
WorkingSet* set = Core::self()->workingSetControllerInternal()->getWorkingSet(area->workingSet());
Q_ASSERT(set->isConnected(area));
Q_UNUSED(set);
}
}
......
......@@ -80,6 +80,7 @@ void ClosedWorkingSetsWidget::areaChanged( Sublime::Area* area )
void ClosedWorkingSetsWidget::changedWorkingSet( Sublime::Area* area, const QString& from, const QString& to )
{
Q_ASSERT(area == m_connectedArea);
Q_UNUSED(area);
if (!from.isEmpty()) {
WorkingSet* oldSet = getWorkingSet(from);
......
......@@ -64,6 +64,7 @@ void WorkingSetWidget::changingWorkingSet( Sublime::Area* area, const QString& /
kDebug() << "re-creating widget" << m_area;
Q_ASSERT(area == m_area);
Q_UNUSED(area);
if (workingSet()) {
disconnect(workingSet(), SIGNAL(setChangedSignificantly()),
......
......@@ -403,8 +403,7 @@ struct ShownToolViewFinder {
QList<View *> views;
};
void MainWindowPrivate::
slotDockShown(Sublime::View* view, Sublime::Position pos, bool shown)
void MainWindowPrivate::slotDockShown(Sublime::View* /*view*/, Sublime::Position pos, bool /*shown*/)
{
if (ignoreDockShown)
return;
......@@ -665,7 +664,7 @@ void MainWindowPrivate::activateFirstVisibleView()
m_mainWindow->activateView(area->views().first());
}
void MainWindowPrivate::widgetResized(Qt::DockWidgetArea dockArea, int thickness)
void MainWindowPrivate::widgetResized(Qt::DockWidgetArea /*dockArea*/, int /*thickness*/)
{
//TODO: adymo: remove all thickness business
}
......
......@@ -86,6 +86,7 @@ QToolBar* ToolViewToolBarTest::fetchToolBarFor(Sublime::View* view)
{
QWidget* toolWidget = view->widget();
const char* loc = "fetchToolBarFor";
Q_UNUSED(loc);
Q_ASSERT_X(toolWidget, loc, "Tool refuses to create widget (null).");
Q_ASSERT(toolWidget->parent());
QMainWindow* toolWin = dynamic_cast<QMainWindow*>(toolWidget->parent());
......@@ -93,6 +94,7 @@ QToolBar* ToolViewToolBarTest::fetchToolBarFor(Sublime::View* view)
QList<QToolBar*> toolBars = toolWin->findChildren<QToolBar*>();
int barCount = toolBars.count();
char* failMsg = qstrdup(QString("Expected to find a toolbar but found %1").arg(barCount).toLatin1().data());
Q_UNUSED(failMsg);
Q_ASSERT_X(barCount == 1, loc, failMsg);
return toolBars.at(0);
}
......
......@@ -40,6 +40,7 @@ struct TestFile::TestFilePrivate {
void updateReady(const IndexedString& _url, ReferencedTopDUContext _topContext)
{
Q_ASSERT(_url == url);
Q_UNUSED(_url);
topContext = _topContext;
ready = true;
}
......
......@@ -170,7 +170,7 @@ bool operator==(const std::set<uint> a, const std::set<uint> b) {
uint freeCount = 0;
for(int a = 0; a < data.size(); ++a) {
if(data[a].value) {
Q_ASSERT(last < data[a].value);
QVERIFY(last < data[a].value);
last = data[a].value;
}else{
++freeCount;
......@@ -210,10 +210,10 @@ class TestSet {
public:
void add(uint i) {
if(realSet.find(i) != realSet.end()) {
Q_ASSERT(set.contains(i));
QVERIFY(set.contains(i));
return;
}else{
Q_ASSERT(!set.contains(i));
QVERIFY(!set.contains(i));
}
clock_t start = clock();
realSet.insert(i);
......@@ -235,15 +235,15 @@ class TestSet {
set.contains(i);
emb_contains += clock() - start;
Q_ASSERT(set.contains(i));
QVERIFY(set.contains(i));
set.verify();
}
void remove(uint i) {
if(realSet.find(i) != realSet.end()) {
Q_ASSERT(set.contains(i));
QVERIFY(set.contains(i));
}else{
Q_ASSERT(!set.contains(i));
QVERIFY(!set.contains(i));
return;
}
clock_t start = clock();
......@@ -255,7 +255,7 @@ class TestSet {
std_removal += clock() - start;
Q_ASSERT(!set.contains(i));
QVERIFY(!set.contains(i));
}
uint size() const {
......@@ -285,7 +285,7 @@ class TestSet {
}
void verify() {
Q_ASSERT(realSet == set.toSet());
QVERIFY(realSet == set.toSet());
set.verify();
}
private:
......@@ -466,8 +466,12 @@ class TestEmbeddedFreeTree : public QObject {
std::set<uint>::const_iterator it = testSet1.lower_bound(value);
int pos = set1.iterator().lowerBound(TestItem(value));
//This tests the upperBound functionality
Q_ASSERT((pos != -1 && it != testSet1.end() && set1.data()[pos].value == *it) || (pos == -1 && it == testSet1.end()));
if (pos != -1) {
QVERIFY(it != testSet1.end());
QVERIFY(set1.data()[pos].value == *it);
} else {
QVERIFY(it == testSet1.end());
}
if((rand() % 10) == 0) {
......
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