summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorSamuel Gaist <samuel.gaist@idiap.ch>2019-12-10 09:00:11 +0100
committerSamuel Gaist <samuel.gaist@idiap.ch>2019-12-10 13:30:31 +0100
commit42aa740df72af0c14f19a498f779d130e8303e54 (patch)
tree854757c11c0c1e75efec6df7c68d35b939bc635a /src/tools
parent5231c26a82a7056f98d99643850754d4e1ebe417 (diff)
rcc: Fix namespace handling for initializer
rcc currently always writes the namespace mangling macros in both the initializer constructor and destructor. This patch add the missing handling of the --namespace option for that part of the generated code. [ChangeLog][Tools][rcc] rcc now generates correct code when using the --namespace option. Change-Id: I7e5e608eb0ad267d11d601fc69c1a87d3f655a6e Fixes: QTBUG-80649 Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/rcc/rcc.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp
index 9acbce25ff..7185219d34 100644
--- a/src/tools/rcc/rcc.cpp
+++ b/src/tools/rcc/rcc.cpp
@@ -1478,13 +1478,19 @@ bool RCCResourceLibrary::writeInitializer()
writeString(" return 1;\n");
writeString("}\n\n");
- writeByteArray(
- "namespace {\n"
- " struct initializer {\n"
- " initializer() { QT_RCC_MANGLE_NAMESPACE(" + initResources + ")(); }\n"
- " ~initializer() { QT_RCC_MANGLE_NAMESPACE(" + cleanResources + ")(); }\n"
- " } dummy;\n"
- "}\n");
+
+ writeString("namespace {\n"
+ " struct initializer {\n");
+
+ if (m_useNameSpace) {
+ writeByteArray(" initializer() { QT_RCC_MANGLE_NAMESPACE(" + initResources + ")(); }\n"
+ " ~initializer() { QT_RCC_MANGLE_NAMESPACE(" + cleanResources + ")(); }\n");
+ } else {
+ writeByteArray(" initializer() { " + initResources + "(); }\n"
+ " ~initializer() { " + cleanResources + "(); }\n");
+ }
+ writeString(" } dummy;\n"
+ "}\n");
} else if (m_format == Binary) {
int i = 4;