From da35793ee5cf73c45e3d1d9a994abf8be61fff14 Mon Sep 17 00:00:00 2001 From: Keith Gardner Date: Sat, 12 Oct 2013 12:13:36 -0500 Subject: [PATCH] Added the preprocessor macro Q_DECL_DEPRECATED_X Added a macro to provide deprecation warnings with a custom text. If the compiler does not support the feature, it falls back to Q_DECL_DEPRECATED instead. Currently supports msvc, gcc, and clang. The armcc documentation didn't show that the feature was available. Change-Id: Iebdb00738a135c756e032eb76152c405a8c29a45 Reviewed-by: Thiago Macieira --- src/corelib/global/qcompilerdetection.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index a388bdb96f..1d2d3247a5 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -98,6 +98,7 @@ # define Q_UNREACHABLE_IMPL() __assume(0) # define Q_NORETURN __declspec(noreturn) # define Q_DECL_DEPRECATED __declspec(deprecated) +# define Q_DECL_DEPRECATED_X(text) __declspec(deprecated(text)) # define Q_DECL_EXPORT __declspec(dllexport) # define Q_DECL_IMPORT __declspec(dllimport) /* Intel C++ disguising as Visual C++: the `using' keyword avoids warnings */ @@ -182,6 +183,7 @@ # define Q_ALIGNOF(type) __alignof__(type) # define Q_TYPEOF(expr) __typeof__(expr) # define Q_DECL_DEPRECATED __attribute__ ((__deprecated__)) +# define Q_DECL_DEPRECATED_X(text) __attribute__ ((__deprecated__(text))) # define Q_DECL_ALIGN(n) __attribute__((__aligned__(n))) # define Q_DECL_UNUSED __attribute__((__unused__)) # define Q_LIKELY(expr) __builtin_expect(!!(expr), true) @@ -838,6 +840,9 @@ #ifndef Q_DECL_VARIABLE_DEPRECATED # define Q_DECL_VARIABLE_DEPRECATED Q_DECL_DEPRECATED #endif +#ifndef Q_DECL_DEPRECATED_X +# define Q_DECL_DEPRECATED_X(text) Q_DECL_DEPRECATED +#endif #ifndef Q_DECL_EXPORT # define Q_DECL_EXPORT #endif