diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2022-06-18 08:41:42 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2022-06-22 13:03:17 -0700 |
commit | 116d8f987bfbb0ec1744fe6c2989f8f2a5756aba (patch) | |
tree | fbac06fdbd952ab3cfc5e6677125c42e9549bb3c /src/tools/moc/moc.cpp | |
parent | 9959cf60d360a43c87c77f44a7d17e2fae25a303 (diff) |
moc: add Q_CONSTINIT to the static const variables we emit
The macro was added to Qt 6.4, so we define it in each moc output to
empty if it wasn't previously defined. Thus, moc retains compatibility
with older Qt versions.
Pick-to: 6.4
Change-Id: Id0fb9ab0089845ee8843fffd16f9c1539fa0368f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Diffstat (limited to 'src/tools/moc/moc.cpp')
-rw-r--r-- | src/tools/moc/moc.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 5ea79a4280..e931e32f4e 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -1103,6 +1103,12 @@ void Moc::generate(FILE *out, FILE *jsonOutput) " much.)\"\n", QT_VERSION_STR); fprintf(out, "#endif\n\n"); +#if QT_VERSION <= QT_VERSION_CHECK(7, 0, 0) + fprintf(out, "#ifndef Q_CONSTINIT\n" + "#define Q_CONSTINIT\n" + "#endif\n\n"); +#endif + fprintf(out, "QT_BEGIN_MOC_NAMESPACE\n"); fprintf(out, "QT_WARNING_PUSH\n"); fprintf(out, "QT_WARNING_DISABLE_DEPRECATED\n"); |