summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2022-06-22 21:40:51 -0700
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-06-25 02:06:26 +0000
commit24e7671e2014a9ec4b99a5abebeed0f0fb75bf48 (patch)
treee3025947a7c29cdbbc904edf14a28e3c5daaf82d
parent115cd00f0c4d17c6b521b987bcb1539074028e23 (diff)
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>
-rw-r--r--src/tools/moc/generator.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index 5c19697d7f..bfd22930c5 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -249,6 +249,9 @@ void Generator::generateCode()
QByteArray qualifiedClassNameIdentifier = cdef->qualified;
qualifiedClassNameIdentifier.replace(':', '_');
+ // ensure the qt_meta_stringdata_XXXX_t type is local
+ fprintf(out, "namespace {\n");
+
//
// Build stringdata struct
//
@@ -294,7 +297,9 @@ void Generator::generateCode()
// Terminate stringdata struct
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