diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2022-06-22 21:40:51 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2022-06-24 19:05:58 -0700 |
commit | 8726647df40c61ed6d79da1e3845ef289bcf8b38 (patch) | |
tree | 10a634d1c7ed8f3922d535edefb34fb1cecc41c6 /src/tools/moc/generator.cpp | |
parent | 0978646a65f517f0026fbdd0639415d265876512 (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.
Pick-to: 6.4
Change-Id: I6d3880c7d99d4fc494c8fffd16fb262a59b81283
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/tools/moc/generator.cpp')
-rw-r--r-- | src/tools/moc/generator.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 967178ec56..8219571162 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 |