summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qcompilerdetection.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/global/qcompilerdetection.h')
-rw-r--r--src/corelib/global/qcompilerdetection.h19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index a140e78739..d1ce56fd0a 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -1142,18 +1142,21 @@
# define Q_DECL_UNUSED [[maybe_unused]]
#endif
+#if __has_cpp_attribute(deprecated)
+# ifdef Q_DECL_DEPRECATED
+# undef Q_DECL_DEPRECATED
+# endif
+# ifdef Q_DECL_DEPRECATED_X
+# undef Q_DECL_DEPRECATED_X
+# endif
+# define Q_DECL_DEPRECATED [[deprecated]]
+# define Q_DECL_DEPRECATED_X(x) [[deprecated(x)]]
+#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