From 345907344d228d95848d8c646aaeb051b9228d3b Mon Sep 17 00:00:00 2001 From: Keith Gardner Date: Thu, 17 Oct 2013 17:44:25 -0500 Subject: Fixed Q_DECL_DEPRECATED_X for Gcc 4.4 Apparently the __attribute__((__deprecated__(text))) feature for gcc was introduced in version 4.5. Since Qt's minimum supported version of gcc is 4.4, the declaration of the macro needed to check the compiler's version number. Since clang reports its __GNUC__ and __GNUC_MINOR__ as gcc 4.2, the check for the compiler support had to be added in with __has_feature(attribute_deprecated_with_message). For icc, a check was added to see if __INTEL_COMPILER >= 1300, __GNUC__ is defined and Q_DECL_DEPRECATED_X was not defined. If this is true, the gcc syntax is used in the define. Change-Id: I23980ac28b79264e8fd657cd3bfd2af7674779a1 Reviewed-by: Olivier Goffart --- src/corelib/global/qcompilerdetection.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 1d2d3247a5..ef425e8d85 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -153,6 +153,9 @@ # define Q_CC_INTEL # define Q_ASSUME_IMPL(expr) __assume(expr) # define Q_UNREACHABLE_IMPL() __builtin_unreachable() +# if __INTEL_COMPILER >= 1300 +# define Q_DECL_DEPRECATED_X(text) __attribute__ ((__deprecated__(text))) +# endif # elif defined(__clang__) /* Clang also masquerades as GCC */ # define Q_CC_CLANG @@ -167,6 +170,7 @@ # if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 # define Q_ASSUME_IMPL(expr) if (expr){} else __builtin_unreachable() # define Q_UNREACHABLE_IMPL() __builtin_unreachable() +# define Q_DECL_DEPRECATED_X(text) __attribute__ ((__deprecated__(text))) # endif # endif @@ -183,7 +187,6 @@ # 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) @@ -521,6 +524,9 @@ # if !__has_feature(cxx_rtti) # define QT_NO_RTTI # endif +# if __has_feature(attribute_deprecated_with_message) +# define Q_DECL_DEPRECATED_X(text) __attribute__ ((__deprecated__(text))) +# endif /* C++11 features, see http://clang.llvm.org/cxx_status.html */ # if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) -- cgit v1.2.3