diff options
Diffstat (limited to 'src/corelib/global/qcompilerdetection.h')
-rw-r--r-- | src/corelib/global/qcompilerdetection.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index f46ff73527..345ab9e8ad 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -206,6 +206,9 @@ # define Q_DECL_NS_RETURNS_AUTORELEASED __attribute__((ns_returns_autoreleased)) # endif # endif +# ifdef __EMSCRIPTEN__ +# define Q_CC_EMSCRIPTEN +# endif # else /* Plain GCC */ # if Q_CC_GNU >= 405 @@ -898,7 +901,7 @@ /* C11 features supported in GCC 4.7: */ # define Q_COMPILER_STATIC_ASSERT # endif -# if Q_CC_GNU >= 409 +# if Q_CC_GNU >= 409 && defined(__has_include) /* C11 features supported in GCC 4.9: */ # if __has_include(<threads.h>) # define Q_COMPILER_THREAD_LOCAL @@ -1152,6 +1155,19 @@ # define Q_REQUIRED_RESULT [[nodiscard]] #endif +#if defined(__cpp_enumerator_attributes) && __cpp_enumerator_attributes >= 201411 +#if defined(Q_CC_MSVC) +// Can't mark enum values as __declspec(deprecated) with MSVC, also can't move +// everything to [[deprecated]] because MSVC gives a compilation error when marking +// friend methods of a class as [[deprecated("text")]], breaking qstring.h +# define Q_DECL_ENUMERATOR_DEPRECATED [[deprecated]] +# define Q_DECL_ENUMERATOR_DEPRECATED_X(x) [[deprecated(x)]] +#else +# define Q_DECL_ENUMERATOR_DEPRECATED Q_DECL_DEPRECATED +# define Q_DECL_ENUMERATOR_DEPRECATED_X(x) Q_DECL_DEPRECATED_X(x) +#endif +#endif + /* * Fallback macros to certain compiler features */ @@ -1186,6 +1202,12 @@ #ifndef Q_DECL_DEPRECATED_X # define Q_DECL_DEPRECATED_X(text) Q_DECL_DEPRECATED #endif +#ifndef Q_DECL_ENUMERATOR_DEPRECATED +# define Q_DECL_ENUMERATOR_DEPRECATED +#endif +#ifndef Q_DECL_ENUMERATOR_DEPRECATED_X +# define Q_DECL_ENUMERATOR_DEPRECATED_X(x) +#endif #ifndef Q_DECL_EXPORT # define Q_DECL_EXPORT #endif |