moc: Only use the init_priority attribute when targeting windows

While both GCC and the GCC compatible clang support this attribute in
general, GCC doesn't support it when targeting macOS, ending up with
errors like these:
error: 'init_priority' attribute is not supported on this platform

This error isn't a property of the platform itself though, since
clang supports the attribute just fine on macOS.

The attribute is only used to work around an issue with dllimport
on windows, so limit its use to that platform, to avoid issues
with it potentially being unsupported on platforms other than
macOS as well.

This fixes compiling with GCC for macOS.

Change-Id: I0235e6365635d73233951566c10ad869b26a0fc6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Martin Storsjö 2018-02-21 22:38:15 +02:00
parent 02eb264aa2
commit b97765efd4

View File

@ -549,7 +549,7 @@ using qsizetype = QIntegerForSizeof<std::size_t>::Signed;
# define Q_ALWAYS_INLINE inline
#endif
#ifdef Q_CC_GNU
#if defined(Q_CC_GNU) && defined(Q_OS_WIN)
# define QT_INIT_METAOBJECT __attribute__((init_priority(101)))
#else
# define QT_INIT_METAOBJECT