From 2a1d0c2669609f4e646143b279064c1979426a02 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Tue, 19 Jun 2018 22:51:05 +0200 Subject: [PATCH] Compiler detection: add support for C++17's [[deprecated]] on enumerators Change-Id: I5cff94d036bd311aee2b6418dd793fde89de0938 Reviewed-by: Thiago Macieira --- src/corelib/global/qcompilerdetection.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index e5e47082d8..87ade23503 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -1152,6 +1152,11 @@ # define Q_REQUIRED_RESULT [[nodiscard]] #endif +#if defined(__cpp_enumerator_attributes) && __cpp_enumerator_attributes >= 201411 +# define Q_DECL_ENUMERATOR_DEPRECATED Q_DECL_DEPRECATED +# define Q_DECL_ENUMERATOR_DEPRECATED_X(x) Q_DECL_DEPRECATED_X(x) +#endif + /* * Fallback macros to certain compiler features */ @@ -1186,6 +1191,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