diff --git a/bin/syncqt.pl b/bin/syncqt.pl
index a394ffac0d18aaa48fce838cfc5d406ad33fa98f..3780c9f422a2b6cf0e7461c88d09af89287f33a0 100755
--- a/bin/syncqt.pl
+++ b/bin/syncqt.pl
@@ -230,6 +230,7 @@ sub classNames {
                 $line .= ";" if($line =~ m/^QT_(BEGIN|END)_HEADER[\r\n]*$/); #qt macro
                 $line .= ";" if($line =~ m/^QT_(BEGIN|END)_NAMESPACE(_[A-Z]+)*[\r\n]*$/); #qt macro
                 $line .= ";" if($line =~ m/^QT_MODULE\(.*\)[\r\n]*$/); # QT_MODULE macro
+                $line .= ";" if($line =~ m/^QT_WARNING_(PUSH|POP|DISABLE_\w+\(.*\))[\r\n]*$/); # qt macros
                 $parsable .= " " . $line;
             }
         }
diff --git a/doc/global/qt-cpp-defines.qdocconf b/doc/global/qt-cpp-defines.qdocconf
index e806a0048016fe55cc0b36c56b277be48e14bfe8..cf84a6ee6eefe23b2cf84a394b5f5bcb6c6a7875 100644
--- a/doc/global/qt-cpp-defines.qdocconf
+++ b/doc/global/qt-cpp-defines.qdocconf
@@ -116,6 +116,8 @@ Cpp.ignoretokens        += \
                           QT_END_NAMESPACE \
                           QT_FASTCALL \
                           QT_MUTEX_LOCK_NOEXCEPT \
+                          QT_WARNING_PUSH \
+                          QT_WARNING_POP \
                           QT_WIDGET_PLUGIN_EXPORT \
                           QWEBKIT_EXPORT
 
@@ -144,4 +146,8 @@ Cpp.ignoredirectives    += \
                           Q_PRIVATE_PROPERTY \
                           QT_FORWARD_DECLARE_CLASS \
                           Q_DECLARE_HANDLE \
-                          Q_REVISION
+                          Q_REVISION \
+                          QT_WARNING_DISABLE_CLANG \
+                          QT_WARNING_DISABLE_GCC \
+                          QT_WARNING_DISABLE_INTEL \
+                          QT_WARNING_DISABLE_MSVC
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 4e8721f7d75dd92d87f857684faf8d2113f1b031..19e368defc4d924c407c724f25ef49e8e314c29b 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -834,22 +834,22 @@ Q_CORE_EXPORT void qFreeAligned(void *ptr);
 #endif
 #if defined(QT_NO_WARNINGS)
 #  if defined(Q_CC_MSVC)
-#    pragma warning(disable: 4251) /* class 'type' needs to have dll-interface to be used by clients of class 'type2' */
-#    pragma warning(disable: 4244) /* conversion from 'type1' to 'type2', possible loss of data */
-#    pragma warning(disable: 4275) /* non - DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier' */
-#    pragma warning(disable: 4514) /* unreferenced inline function has been removed */
-#    pragma warning(disable: 4800) /* 'type' : forcing value to bool 'true' or 'false' (performance warning) */
-#    pragma warning(disable: 4097) /* typedef-name 'identifier1' used as synonym for class-name 'identifier2' */
-#    pragma warning(disable: 4706) /* assignment within conditional expression */
+QT_WARNING_DISABLE_MSVC(4251) /* class 'type' needs to have dll-interface to be used by clients of class 'type2' */
+QT_WARNING_DISABLE_MSVC(4244) /* conversion from 'type1' to 'type2', possible loss of data */
+QT_WARNING_DISABLE_MSVC(4275) /* non - DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier' */
+QT_WARNING_DISABLE_MSVC(4514) /* unreferenced inline function has been removed */
+QT_WARNING_DISABLE_MSVC(4800) /* 'type' : forcing value to bool 'true' or 'false' (performance warning) */
+QT_WARNING_DISABLE_MSVC(4097) /* typedef-name 'identifier1' used as synonym for class-name 'identifier2' */
+QT_WARNING_DISABLE_MSVC(4706) /* assignment within conditional expression */
 #    if _MSC_VER <= 1310 // MSVC 2003
-#      pragma warning(disable: 4786) /* 'identifier' : identifier was truncated to 'number' characters in the debug information */
+QT_WARNING_DISABLE_MSVC(4786) /* 'identifier' : identifier was truncated to 'number' characters in the debug information */
 #    endif
-#    pragma warning(disable: 4355) /* 'this' : used in base member initializer list */
+QT_WARNING_DISABLE_MSVC(4355) /* 'this' : used in base member initializer list */
 #    if _MSC_VER < 1800 // MSVC 2013
-#      pragma warning(disable: 4231) /* nonstandard extension used : 'identifier' before template explicit instantiation */
+QT_WARNING_DISABLE_MSVC(4231) /* nonstandard extension used : 'identifier' before template explicit instantiation */
 #    endif
-#    pragma warning(disable: 4710) /* function not inlined */
-#    pragma warning(disable: 4530) /* C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc */
+QT_WARNING_DISABLE_MSVC(4710) /* function not inlined */
+QT_WARNING_DISABLE_MSVC(4530) /* C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc */
 #  elif defined(Q_CC_BOR)
 #    pragma option -w-inl
 #    pragma option -w-aus
diff --git a/src/corelib/kernel/qfunctions_wince.h b/src/corelib/kernel/qfunctions_wince.h
index cc5e0ca83fd0efe4f215837a73dfe0ea81187cfc..8cbde6c4654c5b7583a0fec6ff0df12603fb8548 100644
--- a/src/corelib/kernel/qfunctions_wince.h
+++ b/src/corelib/kernel/qfunctions_wince.h
@@ -208,7 +208,7 @@ int qt_wince_SetErrorMode(int);
 bool qt_wince__chmod(const char *file, int mode);
 bool qt_wince__wchmod(const wchar_t *file, int mode);
 
-#pragma warning(disable: 4273)
+QT_WARNING_DISABLE_MSVC(4273)
 HANDLE qt_wince_CreateFileA(LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE);
 
 // Printer ----------------------------------------------------------
diff --git a/src/corelib/thread/qatomic.h b/src/corelib/thread/qatomic.h
index 7526cfe0e6998f6833c4b7dc6bc132e41273d768..a665746db4adbf3258aec71dae1e7e17678ffe59 100644
--- a/src/corelib/thread/qatomic.h
+++ b/src/corelib/thread/qatomic.h
@@ -40,11 +40,8 @@
 
 QT_BEGIN_NAMESPACE
 
-
-#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) && !defined(Q_CC_INTEL)
-# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Wextra"
-#endif
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_GCC("-Wextra")
 
 // High-level atomic integer operations
 template <typename T>
@@ -214,9 +211,7 @@ public:
 #endif
 };
 
-#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) && !defined(Q_CC_INTEL)
-# pragma GCC diagnostic pop
-#endif
+QT_WARNING_POP
 
 #ifdef QT_BASIC_ATOMIC_HAS_CONSTRUCTORS
 #  undef QT_BASIC_ATOMIC_HAS_CONSTRUCTORS
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index 718f10860acad7d5f6539f1a967eb54c570292c4..4d51521b120b8342b20da923916936787964698e 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -924,11 +924,8 @@ inline QString QString::arg(const QString &a1, const QString &a2, const QString
 inline QString QString::section(QChar asep, int astart, int aend, SectionFlags aflags) const
 { return section(QString(asep), astart, aend, aflags); }
 
-#ifdef Q_CC_MSVC
-// "conditional expression is constant"
-#pragma warning(push)
-#pragma warning(disable : 4127)
-#endif
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_MSVC(4127)   // "conditional expression is constant"
 
 inline int QString::toWCharArray(wchar_t *array) const
 {
@@ -939,9 +936,7 @@ inline int QString::toWCharArray(wchar_t *array) const
     return toUcs4_helper(d->data(), size(), reinterpret_cast<uint *>(array));
 }
 
-#ifdef Q_CC_MSVC
-#pragma warning(pop)
-#endif
+QT_WARNING_POP
 
 inline QString QString::fromWCharArray(const wchar_t *string, int size)
 {
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index 6a483f610f80c6c8ab5a640ae3c4b300a751df1a..8984af12d1e3a82ff08acd7d5d0dc445be4b2486 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -349,13 +349,9 @@ inline void QImage::setPixel(const QPoint &pt, uint index_or_rgb) { setPixel(pt.
 
 #if QT_DEPRECATED_SINCE(5, 0)
 
-#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
-# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#elif defined(Q_CC_MSVC)
-# pragma warning(push)
-# pragma warning(disable: 4996)
-#endif
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations")
+QT_WARNING_DISABLE_MSVC(4996)
 
 inline QString QImage::text(const char* key, const char* lang) const
 {
@@ -427,11 +423,7 @@ inline void QImage::setText(const char* key, const char* lang, const QString &s)
     setText(k, s);
 }
 
-#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
-# pragma GCC diagnostic pop
-#elif defined(Q_CC_MSVC)
-# pragma warning(pop)
-#endif
+QT_WARNING_POP
 
 inline int QImage::numColors() const
 {
diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp
index 77889b3c35ec49a2522845db7b57196169f07e8d..95552afbee04e7448f87ae7e21f9f57dd85689ed 100644
--- a/src/gui/painting/qdrawhelper_sse2.cpp
+++ b/src/gui/painting/qdrawhelper_sse2.cpp
@@ -484,9 +484,7 @@ void qt_bitmapblit16_sse2(QRasterBuffer *rasterBuffer, int x, int y,
     const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint16);
 
     const __m128i c128 = _mm_set1_epi16(c);
-#if defined(Q_CC_MSVC)
-#  pragma warning(disable: 4309) // truncation of constant value
-#endif
+QT_WARNING_DISABLE_MSVC(4309) // truncation of constant value
     const __m128i maskmask = _mm_set_epi16(0x0101, 0x0202, 0x0404, 0x0808,
                                            0x1010, 0x2020, 0x4040, 0x8080);
     const __m128i maskadd = _mm_set_epi16(0x7f7f, 0x7e7e, 0x7c7c, 0x7878,
diff --git a/src/gui/painting/qdrawhelper_sse_p.h b/src/gui/painting/qdrawhelper_sse_p.h
index a1f878b5c0eaeecd8c7fbec27ed828e49b205bcf..de1a1d86be982fc8df728d445dc6a83a1b2119b6 100644
--- a/src/gui/painting/qdrawhelper_sse_p.h
+++ b/src/gui/painting/qdrawhelper_sse_p.h
@@ -124,9 +124,7 @@ inline void qt_bitmapblit16_sse_template(QRasterBuffer *rasterBuffer,
     const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint16);
 
     const __m64 c64 = _mm_set1_pi16(c);
-#ifdef Q_CC_MSVC
-#  pragma warning(disable: 4309) // truncation of constant value
-#endif
+QT_WARNING_DISABLE_MSVC(4309) // truncation of constant value
     const __m64 maskmask1 = _mm_set_pi16(0x1010, 0x2020, 0x4040, 0x8080);
     const __m64 maskadd1 = _mm_set_pi16(0x7070, 0x6060, 0x4040, 0x0000);
 
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 798e349538b306db3759e8a6d20737e6000c8c8f..9dcad519a36ccf7474ecc21dfa69c548ed0c2332 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -416,8 +416,8 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
                && [notificationName isEqualToString:_q_NSWindowDidChangeOcclusionStateNotification]) {
 #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9
 // ### HACK Remove the enum declaration, the warning disabling and the cast further down once 10.8 is unsupported
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wobjc-method-access"
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_CLANG("-Wobjc-method-access")
         enum { NSWindowOcclusionStateVisible = 1UL << 1 };
 #endif
         if ((NSUInteger)[self.window occlusionState] & NSWindowOcclusionStateVisible) {
@@ -432,7 +432,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
                 m_platformWindow->obscureWindow();
         }
 #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9
-#pragma clang diagnostic pop
+QT_WARNING_POP
 #endif
     } else if (notificationName == NSWindowDidChangeScreenNotification) {
         if (m_window) {
diff --git a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp
index 425a07b3a7a5e7622e011768a436db199b0c440f..605a1525e303a03facd44e3069008fbb244ee871 100644
--- a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp
+++ b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp
@@ -94,13 +94,9 @@
 #  define QATOMIC_TEST_NOT_SUPPORTED
 #endif
 
-#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL)
-#  pragma GCC diagnostic ignored "-Wtype-limits"
-#  pragma GCC diagnostic ignored "-Wsign-compare"
-#endif
-#if defined(Q_CC_CLANG) && !defined(Q_CC_INTEL)
-#  pragma clang diagnostic ignored "-Wtautological-constant-out-of-range-compare"
-#endif
+QT_WARNING_DISABLE_GCC("-Wtype-limits")
+QT_WARNING_DISABLE_GCC("-Wsign-compare")
+QT_WARNING_DISABLE_CLANG("-Wtautological-constant-out-of-range-compare")
 
 typedef signed char schar;
 
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index e001440045d9d09d5e84594f787e821dc7ca124e..ed72b58d6e4066082bb6734a04a6601b6e1777df 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -813,10 +813,8 @@ void tst_QString::acc_01()
     }
 }
 
-#ifdef Q_CC_GNU
-#    pragma GCC diagnostic push
-#    pragma GCC diagnostic ignored "-Wformat-security"
-#endif
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_GCC("-Wformat-security")
 
 void tst_QString::isNull()
 {
@@ -828,9 +826,7 @@ void tst_QString::isNull()
     QVERIFY(!a.isNull());
 }
 
-#ifdef Q_CC_GNU
-#    pragma GCC diagnostic pop
-#endif
+QT_WARNING_POP
 
 void tst_QString::isEmpty()
 {