summaryrefslogtreecommitdiffstats
path: root/src/tools/moc/generator.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2018-07-01 10:20:21 -0700
committerThiago Macieira <thiago.macieira@intel.com>2018-09-01 15:19:46 +0000
commit7bd79b3cffbbbece23867c5e111a3dd2ebcad016 (patch)
tree9563078fb7aeae16b1f4321bfcbc18c969f9f6ed /src/tools/moc/generator.cpp
parentd9766ddc3d525cf08acec4c3483e61d86c9899a8 (diff)
Plugins: Save some architectural requirement flags
...not just the debug flag. The information is saved outside of the CBOR map for two reasons: 1) removing the hack that depended on how QCborStreamWriter and TinyCBOR internally work, allowing for the extra parameter to be written directly. We wouldn't be able to use that hack anyway and would have needed a further, uglier hack to encode a byte whose value we don't know. 2) outside the map, this information can be parsed more quickly and then we can discard any plugins we shouldn't actually load. Since we're doing this for a flag, I decided to move the Qt version there too for reason #2. Change-Id: I61ecce6b1324410bbab4fffd153d4e5fc696d19e Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'src/tools/moc/generator.cpp')
-rw-r--r--src/tools/moc/generator.cpp21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index e5154b779b..e499d22618 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -1624,8 +1624,11 @@ void Generator::generatePluginMetaData()
return;
fputs("\nQT_PLUGIN_METADATA_SECTION\n"
- "static const unsigned char qt_pluginMetaData[] = {\n"
- " 'Q', 'T', 'M', 'E', 'T', 'A', 'D', 'A', 'T', 'A', ' ', '!',", out);
+ "static constexpr unsigned char qt_pluginMetaData[] = {\n"
+ " 'Q', 'T', 'M', 'E', 'T', 'A', 'D', 'A', 'T', 'A', ' ', '!',\n"
+ " // metadata version, Qt version, architectural requirements\n"
+ " 0, QT_VERSION_MAJOR, QT_VERSION_MINOR, qPluginArchRequirements(),", out);
+
CborDevice dev(out);
CborEncoder enc;
@@ -1634,20 +1637,6 @@ void Generator::generatePluginMetaData()
CborEncoder map;
cbor_encoder_create_map(&enc, &map, CborIndefiniteLength);
- dev.nextItem("\"version\"");
- cbor_encode_int(&map, int(QtPluginMetaDataKeys::QtVersion));
- cbor_encode_int(&map, QT_VERSION);
-
- fputs("\n#ifdef QT_NO_DEBUG", out);
- dev.nextItem("\"debug\" = false");
- cbor_encode_int(&map, int(QtPluginMetaDataKeys::Debug));
- cbor_encode_boolean(&map, false);
- fputs("\n#else", out);
- dev.nextItem("\"debug\" = true");
- cbor_encode_int(&map, int(QtPluginMetaDataKeys::Debug));
- cbor_encode_boolean(&map, true);
- fputs("\n#endif", out);
-
dev.nextItem("\"IID\"");
cbor_encode_int(&map, int(QtPluginMetaDataKeys::IID));
cbor_encode_text_string(&map, cdef->pluginData.iid.constData(), cdef->pluginData.iid.size());