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>
This commit is contained in:
parent
5231c26a82
commit
42aa740df7
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user