diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2021-12-06 08:11:00 -0800 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2021-12-17 07:56:24 +0000 |
commit | 4631b61c813ed9c095db638f25c21916cd2928e4 (patch) | |
tree | 1be76cb21339455228e76431cedc388693e194ca /src/corelib/global/qglobalstatic.h | |
parent | 48b4f144e7f690f5ae840124eaad4eaa67a02681 (diff) |
Q_{APPLICATION,GLOBAL}_STATIC: use variadic macros
We can't remove Q_GLOBAL_STATIC_WITH_ARGS, for compatibility reasons.
It's also the only way to pass uniform initialization (i.e., initialize
the value as value{with_braces}), though I don't think this is used
almost anywhere due to the fact that you couldn't pass more than one
argument. But Q_APPLICATION_STATIC is new in 6.3, so we have time to
change it.
[ChangeLog][QtCore][QGlobalStatic] The Q_GLOBAL_STATIC macro is now
variadic. Any extra arguments are used as constructor arguments,
obliterating the need to use Q_GLOBAL_STATIC_WITH_ARGS().
Pick-to: 6.3
Change-Id: Ib42b3adc93bf4d43bd55fffd16be3656a512fe53
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/corelib/global/qglobalstatic.h')
-rw-r--r-- | src/corelib/global/qglobalstatic.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/global/qglobalstatic.h b/src/corelib/global/qglobalstatic.h index cf96e5ae8e..098aee966b 100644 --- a/src/corelib/global/qglobalstatic.h +++ b/src/corelib/global/qglobalstatic.h @@ -145,8 +145,8 @@ protected: static QGlobalStatic<QtGlobalStatic::Holder<Q_QGS_ ## NAME>> NAME; \ /**/ -#define Q_GLOBAL_STATIC(TYPE, NAME) \ - Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ()) +#define Q_GLOBAL_STATIC(TYPE, NAME, ...) \ + Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, (__VA_ARGS__)) QT_END_NAMESPACE #endif // QGLOBALSTATIC_H |