moc: put the qt_meta_stringdata_XXXX_t type in an unnamed namespace

Not all user code is compiled with hidden visibility, so make sure one
of the types in the template parameters (the one that is supposed to be
unique anyway) is local and therefore causes the full symbol for the
inline variable not to be exported outside of the translation unit.

Change-Id: I6d3880c7d99d4fc494c8fffd16fb262a59b81283
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 8726647df40c61ed6d79da1e3845ef289bcf8b38)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Thiago Macieira 2022-06-22 21:40:51 -07:00 committed by Qt Cherry-pick Bot
parent 115cd00f0c
commit 24e7671e20

View File

@ -249,6 +249,9 @@ void Generator::generateCode()
QByteArray qualifiedClassNameIdentifier = cdef->qualified; QByteArray qualifiedClassNameIdentifier = cdef->qualified;
qualifiedClassNameIdentifier.replace(':', '_'); qualifiedClassNameIdentifier.replace(':', '_');
// ensure the qt_meta_stringdata_XXXX_t type is local
fprintf(out, "namespace {\n");
// //
// Build stringdata struct // Build stringdata struct
// //
@ -294,7 +297,9 @@ void Generator::generateCode()
// Terminate stringdata struct // Terminate stringdata struct
fprintf(out, "\n};\n"); fprintf(out, "\n};\n");
fprintf(out, "#undef QT_MOC_LITERAL\n\n"); fprintf(out, "#undef QT_MOC_LITERAL\n");
fprintf(out, "} // unnamed namespace\n\n");
// //
// build the data array // build the data array