From 5568744b75a344e725d8c71e7ecca930952e79d3 Mon Sep 17 00:00:00 2001 From: Thomas Miller Date: Mon, 30 Jul 2018 14:07:11 -0700 Subject: Fix qtbase build for MSVC 2017 15.8 Fixed breaks caused by MSVC 2017 15.8 introducing the __cpp_enumerator_attributes define. Change-Id: I78144f8f49a7352e574dee379155bd47d8d6d896 Reviewed-by: Thiago Macieira --- src/corelib/global/qcompilerdetection.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 9906425f5b..2b85ea0815 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -1153,9 +1153,17 @@ #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 -- cgit v1.2.3