[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kdevelop-devel
Subject:    [PATCH] fix build errors in kdevplatform-1.2.0
From:       Erik <esigra () gmail ! com>
Date:       2011-03-27 20:14:37
Message-ID: 4D8F9AAD.9000508 () gmail ! com
[Download RAW message or body]

This patch fixes the following errors in kdevplatform 1.2.0 so that it 
can be built:
* Define metatypes in header files and include them instead of having 
multiple Q_DECLARE_METATYPE(TYPE) for the same TYPE (see 
http://www.mail-archive.com/kde-core-devel@kde.org/msg00416.html).
* Explicit static casts where needed according to the compiler.
* Define urlToData in one place only (a separate new header file).
* Rename one of the functions appendActions to appendContextMenuActions 
to make the signature unique.
* Add include guard to greputil.h
* Rename one of the structs Visitor to selfAnalysisVisitor to make the 
identifier unique.
* Use a unique include guard in appendlist_static.h (not the same as in 
appendlist.h)
* Undefine the macro "mix" after use to not pollute the namespace.


["kdevplatform-1.2.0-fix_build-1.diff" (text/plain)]

diff -rNXi -U2 kdevplatform-1.2.0.orig/debugger/util/pathmappings.cpp \
                kdevplatform-1.2.0/debugger/util/pathmappings.cpp
--- kdevplatform-1.2.0.orig/debugger/util/pathmappings.cpp	2011-03-27 \
                12:26:44.364000046 +0200
+++ kdevplatform-1.2.0/debugger/util/pathmappings.cpp	2011-03-27 13:30:36.608000057 \
+0200 @@ -139,5 +139,5 @@
         if (index.parent().isValid()) return Qt::NoItemFlags;
         if (!index.isValid()) return Qt::NoItemFlags;
-        return ( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled );
+        return static_cast<Qt::ItemFlags>( Qt::ItemIsSelectable | Qt::ItemIsEditable \
| Qt::ItemIsEnabled );  
     }
diff -rNXi -U2 kdevplatform-1.2.0.orig/debugger/util/treemodel.cpp \
                kdevplatform-1.2.0/debugger/util/treemodel.cpp
--- kdevplatform-1.2.0.orig/debugger/util/treemodel.cpp	2011-03-27 12:26:44.365000046 \
                +0200
+++ kdevplatform-1.2.0/debugger/util/treemodel.cpp	2011-03-27 13:43:55.650000290 \
+0200 @@ -69,5 +69,5 @@
         return 0;
 
-    return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
+    return static_cast<Qt::ItemFlags>(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
 }
 
diff -rNXi -U2 kdevplatform-1.2.0.orig/language/backgroundparser/parsejob.cpp \
                kdevplatform-1.2.0/language/backgroundparser/parsejob.cpp
--- kdevplatform-1.2.0.orig/language/backgroundparser/parsejob.cpp	2011-03-27 \
                12:26:44.338000046 +0200
+++ kdevplatform-1.2.0/language/backgroundparser/parsejob.cpp	2011-03-27 \
13:28:43.588000057 +0200 @@ -53,11 +53,8 @@
 #include <duchain/use.h>
 
+#include "metatypes.h"
 
 using namespace KTextEditor;
 
-Q_DECLARE_METATYPE(KDevelop::IndexedString)
-Q_DECLARE_METATYPE(KDevelop::IndexedTopDUContext)
-Q_DECLARE_METATYPE(KDevelop::ReferencedTopDUContext)
-
 static QMutex minimumFeaturesMutex;
 static QHash<KDevelop::IndexedString, QList<KDevelop::TopDUContext::Features> > \
                staticMinimumFeatures;
diff -rNXi -U2 kdevplatform-1.2.0.orig/language/duchain/appendedlist_static.h \
                kdevplatform-1.2.0/language/duchain/appendedlist_static.h
--- kdevplatform-1.2.0.orig/language/duchain/appendedlist_static.h	2011-03-27 \
                12:26:44.334000042 +0200
+++ kdevplatform-1.2.0/language/duchain/appendedlist_static.h	2011-03-27 \
12:33:12.758000045 +0200 @@ -17,6 +17,6 @@
 */
 
-#ifndef APPENDEDLIST_H
-#define APPENDEDLIST_H
+#ifndef APPENDEDLIST_STATIC_H
+#define APPENDEDLIST_STATIC_H
 
 #include <util/kdevvarlengtharray.h>
diff -rNXi -U2 kdevplatform-1.2.0.orig/language/duchain/duchain.cpp \
                kdevplatform-1.2.0/language/duchain/duchain.cpp
--- kdevplatform-1.2.0.orig/language/duchain/duchain.cpp	2011-03-27 \
                12:26:44.335000039 +0200
+++ kdevplatform-1.2.0/language/duchain/duchain.cpp	2011-03-27 13:29:04.279000057 \
+0200 @@ -65,7 +65,5 @@
 #include "importers.h"
 
-Q_DECLARE_METATYPE(KDevelop::IndexedString)
-Q_DECLARE_METATYPE(KDevelop::IndexedTopDUContext)
-Q_DECLARE_METATYPE(KDevelop::ReferencedTopDUContext)
+#include "metatypes.h"
 
 namespace {
diff -rNXi -U2 kdevplatform-1.2.0.orig/language/duchain/persistentsymboltable.cpp \
                kdevplatform-1.2.0/language/duchain/persistentsymboltable.cpp
--- kdevplatform-1.2.0.orig/language/duchain/persistentsymboltable.cpp	2011-03-27 \
                12:26:44.332000050 +0200
+++ kdevplatform-1.2.0/language/duchain/persistentsymboltable.cpp	2011-03-27 \
12:50:11.178000045 +0200 @@ -348,5 +348,5 @@
 }
 
-struct Visitor {
+struct selfAnalysisVisitor {
   bool operator() (const PersistentSymbolTableItem* item) {
     QualifiedIdentifier id(item->id.identifier());
@@ -384,5 +384,5 @@
     QMutexLocker lock(d->m_declarations.mutex());
     
-    Visitor v;
+    selfAnalysisVisitor v;
     kDebug() << d->m_declarations.statistics();
     d->m_declarations.visitAllItems(v);
diff -rNXi -U2 kdevplatform-1.2.0.orig/language/metatypes.h \
                kdevplatform-1.2.0/language/metatypes.h
--- kdevplatform-1.2.0.orig/language/metatypes.h	1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.2.0/language/metatypes.h	2011-03-27 13:28:14.607000465 +0200
@@ -0,0 +1,27 @@
+/* This  is part of KDevelop
+    Copyright 2006-2008 Hamish Rodda <rodda@kde.org>
+    Copyright 2007-2008 David Nolden <david.nolden.kdevelop@art-master.de>
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public
+   License version 2 as published by the Free Software Foundation.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public License
+   along with this library; see the file COPYING.LIB.  If not, write to
+   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.
+*/
+
+#ifndef LANGUAGE_METATYPES_H
+#define LANGUAGE_METATYPES_H
+
+Q_DECLARE_METATYPE(KDevelop::IndexedString)
+Q_DECLARE_METATYPE(KDevelop::IndexedTopDUContext)
+Q_DECLARE_METATYPE(KDevelop::ReferencedTopDUContext)
+
+#endif
diff -rNXi -U2 kdevplatform-1.2.0.orig/language/util/somehash.cpp \
                kdevplatform-1.2.0/language/util/somehash.cpp
--- kdevplatform-1.2.0.orig/language/util/somehash.cpp	2011-03-27 12:26:44.338000046 \
                +0200
+++ kdevplatform-1.2.0/language/util/somehash.cpp	2011-03-27 12:47:05.803000045 +0200
@@ -758,2 +758,4 @@
   return c;
 }
+
+#undef mix
diff -rNXi -U2 kdevplatform-1.2.0.orig/plugins/grepview/greputil.h \
                kdevplatform-1.2.0/plugins/grepview/greputil.h
--- kdevplatform-1.2.0.orig/plugins/grepview/greputil.h	2011-03-27 12:26:44.348000046 \
                +0200
+++ kdevplatform-1.2.0/plugins/grepview/greputil.h	2011-03-27 13:06:57.217000044 \
+0200 @@ -11,4 +11,7 @@
 // some utility functions used at various places
 
+#ifndef GREPUTIL_H
+#define GREPUTIL_H
+
 #include <QStringList>
 #include <QString>
@@ -21,2 +24,4 @@
 /// Replaces each occurence of "%s" in pattern by searchString (and "%%" by "%")
 QString substitudePattern(const QString& pattern, const QString& searchString);
+
+#endif
diff -rNXi -U2 kdevplatform-1.2.0.orig/plugins/pastebin/pastebinplugin.cpp \
                kdevplatform-1.2.0/plugins/pastebin/pastebinplugin.cpp
--- kdevplatform-1.2.0.orig/plugins/pastebin/pastebinplugin.cpp	2011-03-27 \
                12:26:44.357000046 +0200
+++ kdevplatform-1.2.0/plugins/pastebin/pastebinplugin.cpp	2011-03-27 \
13:22:55.442000056 +0200 @@ -20,4 +20,5 @@
 
 #include "pastebinplugin.h"
+#include "../urltodata.h"
 #include <QVariantList>
 
@@ -30,5 +31,4 @@
 #include <KMessageBox>
 #include <KDebug>
-#include <QFile>
 #include <interfaces/icore.h>
 #include <interfaces/iruncontroller.h>
@@ -48,26 +48,4 @@
 {}
 
-namespace
-{
-QByteArray urlToData(const KUrl& url)
-{
-    QByteArray ret;
-    if(url.isLocalFile()) {
-        QFile f(url.toLocalFile());
-        Q_ASSERT(f.exists());
-        bool corr=f.open(QFile::ReadOnly | QFile::Text);
-        Q_ASSERT(corr);
-        
-        ret = f.readAll();
-        
-    } else {
-#if defined(__GNUC__)
-#warning TODO: add downloading the data
-#endif
-    }
-    return ret;
-}
-}
-
 void PastebinPlugin::exportPatch(IPatchSource::Ptr source)
 {
diff -rNXi -U2 kdevplatform-1.2.0.orig/plugins/projectmanagerview/projectbuildsetwidget.cpp \
                kdevplatform-1.2.0/plugins/projectmanagerview/projectbuildsetwidget.cpp
                
--- kdevplatform-1.2.0.orig/plugins/projectmanagerview/projectbuildsetwidget.cpp	2011-03-27 \
                12:26:44.359000046 +0200
+++ kdevplatform-1.2.0/plugins/projectmanagerview/projectbuildsetwidget.cpp	2011-03-27 \
13:03:52.420000045 +0200 @@ -116,5 +116,5 @@
 }
 
-static void appendActions(QMenu& menu, const QList<QAction*>& actions)
+static void appendContextMenuActions(QMenu& menu, const QList<QAction*>& actions)
 {
     menu.addSeparator();
@@ -171,12 +171,12 @@
         }
 
-        appendActions(m, buildActions);
-        appendActions(m, runActions);
-        appendActions(m, fileActions);
+        appendContextMenuActions(m, buildActions);
+        appendContextMenuActions(m, runActions);
+        appendContextMenuActions(m, fileActions);
 
-        appendActions(m, vcsActions);
-        appendActions(m, extActions);
+        appendContextMenuActions(m, vcsActions);
+        appendContextMenuActions(m, extActions);
 
-        appendActions(m, projectActions);
+        appendContextMenuActions(m, projectActions);
     }
     
diff -rNXi -U2 kdevplatform-1.2.0.orig/plugins/reviewboard/reviewboardjobs.cpp \
                kdevplatform-1.2.0/plugins/reviewboard/reviewboardjobs.cpp
--- kdevplatform-1.2.0.orig/plugins/reviewboard/reviewboardjobs.cpp	2011-03-27 \
                12:26:44.355000046 +0200
+++ kdevplatform-1.2.0/plugins/reviewboard/reviewboardjobs.cpp	2011-03-27 \
13:41:39.346000057 +0200 @@ -20,4 +20,5 @@
 
 #include "reviewboardjobs.h"
+#include "../urltodata.h"
 #include <qjson/parser.h>
 #include <KLocalizedString>
@@ -25,5 +26,4 @@
 #include <KRandom>
 #include <KMimeType>
-#include <QFile>
 #include <QDebug>
 #include <QNetworkAccessManager>
@@ -37,22 +37,4 @@
 namespace
 {
-QByteArray urlToData(const KUrl& url)
-{
-    QByteArray ret;
-    if (url.isLocalFile()) {
-        QFile f(url.toLocalFile());
-        Q_ASSERT(f.exists());
-        bool corr=f.open(QFile::ReadOnly | QFile::Text);
-        Q_ASSERT(corr);
-
-        ret = f.readAll();
-
-    } else {
-#if defined(__GNUC__)
-#warning TODO: add downloading the data
-#endif
-    }
-    return ret;
-}
 static const QByteArray m_boundary = "----------" + KRandom::randomString( 42 + 13 \
).toLatin1();  
diff -rNXi -U2 kdevplatform-1.2.0.orig/plugins/reviewboard/reviewboardplugin.cpp \
                kdevplatform-1.2.0/plugins/reviewboard/reviewboardplugin.cpp
--- kdevplatform-1.2.0.orig/plugins/reviewboard/reviewboardplugin.cpp	2011-03-27 \
                12:26:44.355000046 +0200
+++ kdevplatform-1.2.0/plugins/reviewboard/reviewboardplugin.cpp	2011-03-27 \
13:24:32.760000057 +0200 @@ -30,5 +30,4 @@
 #include <KDebug>
 #include <KIO/Job>
-#include <QFile>
 #include <interfaces/icore.h>
 #include <interfaces/ipatchsource.h>
@@ -55,23 +54,4 @@
 {}
 
-QByteArray urlToData(const KUrl& url)
-{
-    QByteArray ret;
-    if(url.isLocalFile()) {
-        QFile f(url.toLocalFile());
-        Q_ASSERT(f.exists());
-        bool corr=f.open(QFile::ReadOnly | QFile::Text);
-        Q_ASSERT(corr);
-        
-        ret = f.readAll();
-        
-    } else {
-#if defined(__GNUC__)
-#warning TODO: add downloading the data
-#endif
-    }
-    return ret;
-}
-
 void ReviewBoardPlugin::exportPatch(IPatchSource::Ptr source)
 {
diff -rNXi -U2 kdevplatform-1.2.0.orig/plugins/urltodata.h \
                kdevplatform-1.2.0/plugins/urltodata.h
--- kdevplatform-1.2.0.orig/plugins/urltodata.h	1970-01-01 01:00:00.000000000 +0100
+++ kdevplatform-1.2.0/plugins/urltodata.h	2011-03-27 13:23:01.013000056 +0200
@@ -0,0 +1,45 @@
+/*
+ * This file is part of KDevelop
+ * Copyright 2010 Aleix Pol Gonzalez <aleixpol@kde.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef URLTODATA_H
+#define URLTODATA_H
+
+#include <QFile>
+
+inline QByteArray urlToData(const KUrl& url)
+{
+    QByteArray ret;
+    if (url.isLocalFile()) {
+        QFile f(url.toLocalFile());
+        Q_ASSERT(f.exists());
+        bool corr=f.open(QFile::ReadOnly | QFile::Text);
+        Q_ASSERT(corr);
+
+        ret = f.readAll();
+
+    } else {
+#if defined(__GNUC__)
+#warning TODO: add downloading the data
+#endif
+    }
+    return ret;
+}
+
+#endif
diff -rNXi -U2 kdevplatform-1.2.0.orig/shell/progresswidget.cpp \
                kdevplatform-1.2.0/shell/progresswidget.cpp
--- kdevplatform-1.2.0.orig/shell/progresswidget.cpp	2011-03-27 12:26:44.343000046 \
                +0200
+++ kdevplatform-1.2.0/shell/progresswidget.cpp	2011-03-27 12:58:27.532000045 +0200
@@ -75,5 +75,5 @@
 
   m_pLabel = new QLabel( QString(), this );
-  m_pLabel->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
+  m_pLabel->setAlignment( static_cast<Qt::Alignment>(Qt::AlignHCenter | \
Qt::AlignVCenter) );  m_pLabel->installEventFilter( this );
   m_pLabel->setMinimumWidth( w );
diff -rNXi -U2 kdevplatform-1.2.0.orig/shell/sessiondialog.cpp \
                kdevplatform-1.2.0/shell/sessiondialog.cpp
--- kdevplatform-1.2.0.orig/shell/sessiondialog.cpp	2011-03-27 12:26:44.339000046 \
                +0200
+++ kdevplatform-1.2.0/shell/sessiondialog.cpp	2011-03-27 13:31:46.218000056 +0200
@@ -90,5 +90,5 @@
         return 0;
     }
-    return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
+    return static_cast<Qt::ItemFlags>(Qt::ItemIsEnabled | Qt::ItemIsSelectable | \
Qt::ItemIsEditable);  }
 
diff -rNXi -U2 kdevplatform-1.2.0.orig/tests/modeltest.cpp \
                kdevplatform-1.2.0/tests/modeltest.cpp
--- kdevplatform-1.2.0.orig/tests/modeltest.cpp	2011-03-27 12:26:44.361000046 +0200
+++ kdevplatform-1.2.0/tests/modeltest.cpp	2011-03-27 13:01:52.681000046 +0200
@@ -26,5 +26,5 @@
 #include <QtGui/QtGui>
 
-Q_DECLARE_METATYPE(QModelIndex)
+#include "../project/tests/projectmodeltest.h"
 
 /*!



-- 
KDevelop-devel mailing list
KDevelop-devel@kdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic