summaryrefslogtreecommitdiffstats
path: root/src/tools/moc
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2012-04-11 14:10:12 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-13 08:33:34 +0200
commitd1329e43cbb243f3b28d172569befc0c28f49b8b (patch)
tree88af164c7c95d29bf5075a1f39015fbb3a7fde91 /src/tools/moc
parent53112c51674680a55bcf3104352175528af19e9f (diff)
moc: fix compilation of signals returning pointers.
That was a regression introduced in 1c5db1aff Example: signals: int *someSignal(); would produce this code: int* _t0 = int*(); which does not compile So have special handling for pointer to change it to '= 0' Change-Id: Ie695e15e309d15c3cfd5c5a69ac8bf6d61ae9915 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'src/tools/moc')
-rw-r--r--src/tools/moc/generator.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index ac602fd6e8..608d53c1f2 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -1036,8 +1036,14 @@ void Generator::generateSignal(FunctionDef *def,int index)
fprintf(out, "%s _t%d%s", a.type.name.constData(), offset++, a.rightType.constData());
}
fprintf(out, ")%s\n{\n", constQualifier);
- if (def->type.name.size() && def->normalizedType.size())
- fprintf(out, " %s _t0 = %s();\n", noRef(def->normalizedType).constData(), noRef(def->normalizedType).constData());
+ if (def->type.name.size() && def->normalizedType.size()) {
+ QByteArray returnType = noRef(def->normalizedType);
+ if (returnType.endsWith('*')) {
+ fprintf(out, " %s _t0 = 0;\n", returnType.constData());
+ } else {
+ fprintf(out, " %s _t0 = %s();\n", returnType.constData(), returnType.constData());
+ }
+ }
fprintf(out, " void *_a[] = { ");
if (def->normalizedType.isEmpty()) {