summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorAleix Pol <aleixpol@kde.org>2014-07-10 02:39:37 +0200
committerAleix Pol Gonzalez <aleixpol@kde.org>2014-07-10 16:10:59 +0200
commit52eccc6cfa0f3b3649d60e3173382cdb68828f44 (patch)
treefc73ee3969a9601faaad37bbb0a2309f23a78c73 /src/tools
parent0af228700e85167b9406193a38ea27584c6dc4d7 (diff)
Introduce a new warning in moc, to notify about duplicated properties
At the moment, it's possible to have 2 properties with the same name, which doesn't make much sense. Notify the user about that so she can react on it. Change-Id: I4865b71730921b79ce9dd8abb0cc760b3f1dbfd8 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/moc/moc.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index f5700899fa..91aa97a443 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -1552,10 +1552,17 @@ void Moc::checkProperties(ClassDef *cdef)
// specify get function, for compatibiliy we accept functions
// returning pointers, or const char * for QByteArray.
//
+ QSet<QByteArray> definedProperties;
for (int i = 0; i < cdef->propertyList.count(); ++i) {
PropertyDef &p = cdef->propertyList[i];
if (p.read.isEmpty() && p.member.isEmpty())
continue;
+ if (definedProperties.contains(p.name)) {
+ QByteArray msg = "The property '" + p.name + "' is defined multiple times in class " + cdef->classname + ".";
+ warning(msg.constData());
+ }
+ definedProperties.insert(p.name);
+
for (int j = 0; j < cdef->publicList.count(); ++j) {
const FunctionDef &f = cdef->publicList.at(j);
if (f.name != p.read)