From e2d5c06e1afca1ae7f296fa9293dc7c2c22f90e6 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Mon, 5 Dec 2011 13:05:44 +0100 Subject: Fix QT_DEPRECATED_SINCE evaluation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QT_DEPRECATED is defined by default by the logic in qglobal.h, but QT_DEPRECATED_SINCE is evaluated before that definition, making QT_DEPRECATED_SINCE evaluate to 0, disabling all deprecated code (even though it shouldn't be disabled). Fix this by moving the QT_DEPRECATED_SINCE evaluation to after the evaluation of QT_NO_DEPRECATED and/or definition of QT_DEPRECATED, to ensure that QT_DEPRECATED_SINCE works as expected. Change-Id: I57d9f6a3e1859b0057fd4f37bcf2d2cc3dfba230 Reviewed-by: Friedemann Kleint Reviewed-by: João Abecasis Reviewed-by: Olivier Goffart --- src/corelib/global/qglobal.h | 46 ++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index aa6a1e853c..e22d66628e 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -54,29 +54,6 @@ */ #define QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch)) -#ifndef QT_DISABLE_DEPRECATED_BEFORE -// ### Qt5: remember to change that to 5 when we reach feature freeze -#define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(4, 9, 0) -#endif - -/* - QT_DEPRECATED_SINCE(major, minor) evaluates as true if the Qt version is greater than - the deprecation point specified. - - Use it to specify from which version of Qt a function or class has been deprecated - - Example: - #if QT_DEPRECATED_SINCE(5,1) - QT_DEPRECATED void deprecatedFunction(); //function deprecated since Qt 5.1 - #endif - -*/ -#ifdef QT_DEPRECATED -#define QT_DEPRECATED_SINCE(major, minor) (QT_VERSION_CHECK(major, minor, 0) > QT_DISABLE_DEPRECATED_BEFORE) -#else -#define QT_DEPRECATED_SINCE(major, minor) 0 -#endif - #define QT_PACKAGEDATE_STR "YYYY-MM-DD" #define QT_PACKAGE_TAG "" @@ -1014,6 +991,29 @@ redefine to built-in booleans to make autotests work properly */ # define QT_DEPRECATED_CONSTRUCTOR #endif +#ifndef QT_DISABLE_DEPRECATED_BEFORE +// ### Qt5: remember to change that to 5 when we reach feature freeze +#define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(4, 9, 0) +#endif + +/* + QT_DEPRECATED_SINCE(major, minor) evaluates as true if the Qt version is greater than + the deprecation point specified. + + Use it to specify from which version of Qt a function or class has been deprecated + + Example: + #if QT_DEPRECATED_SINCE(5,1) + QT_DEPRECATED void deprecatedFunction(); //function deprecated since Qt 5.1 + #endif + +*/ +#ifdef QT_DEPRECATED +#define QT_DEPRECATED_SINCE(major, minor) (QT_VERSION_CHECK(major, minor, 0) > QT_DISABLE_DEPRECATED_BEFORE) +#else +#define QT_DEPRECATED_SINCE(major, minor) 0 +#endif + /* moc compats (signals/slots) */ #ifndef QT_MOC_COMPAT # define QT_MOC_COMPAT -- cgit v1.2.3