From 40c9e9dc5f31a4063a71e90208b5bf976977b054 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 23 Nov 2016 15:39:57 -0800 Subject: Add a macros for disabling deprecated declaration warnings This is the only warning we disable in a lot of places in Qt 5.8 source code. If other warnings become common, we can add macros for them too. Change-Id: Iaeecaffe26af4535b416fffd1489d1968e29c52a Reviewed-by: Oswald Buddenhagen Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/global/qcompilerdetection.h | 6 ++++++ src/corelib/tools/qalgorithms.h | 3 +-- src/gui/image/qimage.h | 3 +-- src/testlib/qxctestlogger.mm | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index d1d5373146..d978c141a4 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -1273,6 +1273,7 @@ # define QT_WARNING_DISABLE_INTEL(number) __pragma(warning(disable: number)) # define QT_WARNING_DISABLE_CLANG(text) # define QT_WARNING_DISABLE_GCC(text) +# define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_INTEL(1786) #elif defined(Q_CC_INTEL) /* icc: Intel compiler on Linux or OS X */ # define QT_WARNING_PUSH QT_DO_PRAGMA(warning(push)) @@ -1281,6 +1282,7 @@ # define QT_WARNING_DISABLE_MSVC(number) # define QT_WARNING_DISABLE_CLANG(text) # define QT_WARNING_DISABLE_GCC(text) +# define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_INTEL(1786) #elif defined(Q_CC_MSVC) && _MSC_VER >= 1500 && !defined(Q_CC_CLANG) # undef QT_DO_PRAGMA /* not needed */ # define QT_WARNING_PUSH __pragma(warning(push)) @@ -1289,6 +1291,7 @@ # define QT_WARNING_DISABLE_INTEL(number) # define QT_WARNING_DISABLE_CLANG(text) # define QT_WARNING_DISABLE_GCC(text) +# define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_MSVC(4996) #elif defined(Q_CC_CLANG) # define QT_WARNING_PUSH QT_DO_PRAGMA(clang diagnostic push) # define QT_WARNING_POP QT_DO_PRAGMA(clang diagnostic pop) @@ -1296,6 +1299,7 @@ # define QT_WARNING_DISABLE_GCC(text) # define QT_WARNING_DISABLE_INTEL(number) # define QT_WARNING_DISABLE_MSVC(number) +# define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_CLANG("-Wdeprecated-declarations") #elif defined(Q_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) # define QT_WARNING_PUSH QT_DO_PRAGMA(GCC diagnostic push) # define QT_WARNING_POP QT_DO_PRAGMA(GCC diagnostic pop) @@ -1303,6 +1307,7 @@ # define QT_WARNING_DISABLE_CLANG(text) # define QT_WARNING_DISABLE_INTEL(number) # define QT_WARNING_DISABLE_MSVC(number) +# define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations") #else // All other compilers, GCC < 4.6 and MSVC < 2008 # define QT_WARNING_DISABLE_GCC(text) # define QT_WARNING_PUSH @@ -1311,6 +1316,7 @@ # define QT_WARNING_DISABLE_MSVC(number) # define QT_WARNING_DISABLE_CLANG(text) # define QT_WARNING_DISABLE_GCC(text) +# define QT_WARNING_DISABLE_DEPRECATED #endif /* diff --git a/src/corelib/tools/qalgorithms.h b/src/corelib/tools/qalgorithms.h index 38753a6726..303374b06d 100644 --- a/src/corelib/tools/qalgorithms.h +++ b/src/corelib/tools/qalgorithms.h @@ -48,8 +48,7 @@ QT_BEGIN_NAMESPACE QT_WARNING_PUSH -QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations") -QT_WARNING_DISABLE_CLANG("-Wdeprecated-declarations") +QT_WARNING_DISABLE_DEPRECATED /* Warning: The contents of QAlgorithmsPrivate is not a part of the public Qt API diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index 91aaf673d0..fd2298561e 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -381,8 +381,7 @@ inline void QImage::setPixelColor(const QPoint &pt, const QColor &c) { setPixelC #if QT_DEPRECATED_SINCE(5, 0) QT_WARNING_PUSH -QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations") -QT_WARNING_DISABLE_MSVC(4996) +QT_WARNING_DISABLE_DEPRECATED inline QString QImage::text(const char* key, const char* lang) const { diff --git a/src/testlib/qxctestlogger.mm b/src/testlib/qxctestlogger.mm index ffabe88db2..62fd73070f 100644 --- a/src/testlib/qxctestlogger.mm +++ b/src/testlib/qxctestlogger.mm @@ -66,7 +66,7 @@ QT_WARNING_PUSH // Ignore XCTestProbe deprecation -QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations") +QT_WARNING_DISABLE_DEPRECATED // --------------------------------------------------------- -- cgit v1.2.3