Use the new warning enabling/disabling macros in qtbase

Change-Id: I91ff06644e8047c2ca483f9768b46c1372eb6171
Reviewed-by: Martin Smith <martin.smith@digia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
This commit is contained in:
Thiago Macieira 2014-10-30 22:44:13 -07:00
parent 63a512023e
commit 1eb7005850
12 changed files with 42 additions and 65 deletions

View File

@ -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)_HEADER[\r\n]*$/); #qt macro
$line .= ";" if($line =~ m/^QT_(BEGIN|END)_NAMESPACE(_[A-Z]+)*[\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_MODULE\(.*\)[\r\n]*$/); # QT_MODULE macro
$line .= ";" if($line =~ m/^QT_WARNING_(PUSH|POP|DISABLE_\w+\(.*\))[\r\n]*$/); # qt macros
$parsable .= " " . $line; $parsable .= " " . $line;
} }
} }

View File

@ -116,6 +116,8 @@ Cpp.ignoretokens += \
QT_END_NAMESPACE \ QT_END_NAMESPACE \
QT_FASTCALL \ QT_FASTCALL \
QT_MUTEX_LOCK_NOEXCEPT \ QT_MUTEX_LOCK_NOEXCEPT \
QT_WARNING_PUSH \
QT_WARNING_POP \
QT_WIDGET_PLUGIN_EXPORT \ QT_WIDGET_PLUGIN_EXPORT \
QWEBKIT_EXPORT QWEBKIT_EXPORT
@ -144,4 +146,8 @@ Cpp.ignoredirectives += \
Q_PRIVATE_PROPERTY \ Q_PRIVATE_PROPERTY \
QT_FORWARD_DECLARE_CLASS \ QT_FORWARD_DECLARE_CLASS \
Q_DECLARE_HANDLE \ Q_DECLARE_HANDLE \
Q_REVISION Q_REVISION \
QT_WARNING_DISABLE_CLANG \
QT_WARNING_DISABLE_GCC \
QT_WARNING_DISABLE_INTEL \
QT_WARNING_DISABLE_MSVC

View File

@ -834,22 +834,22 @@ Q_CORE_EXPORT void qFreeAligned(void *ptr);
#endif #endif
#if defined(QT_NO_WARNINGS) #if defined(QT_NO_WARNINGS)
# if defined(Q_CC_MSVC) # if defined(Q_CC_MSVC)
# pragma warning(disable: 4251) /* class 'type' needs to have dll-interface to be used by clients of class 'type2' */ QT_WARNING_DISABLE_MSVC(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 */ QT_WARNING_DISABLE_MSVC(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' */ QT_WARNING_DISABLE_MSVC(4275) /* non - DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier' */
# pragma warning(disable: 4514) /* unreferenced inline function has been removed */ QT_WARNING_DISABLE_MSVC(4514) /* unreferenced inline function has been removed */
# pragma warning(disable: 4800) /* 'type' : forcing value to bool 'true' or 'false' (performance warning) */ QT_WARNING_DISABLE_MSVC(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' */ QT_WARNING_DISABLE_MSVC(4097) /* typedef-name 'identifier1' used as synonym for class-name 'identifier2' */
# pragma warning(disable: 4706) /* assignment within conditional expression */ QT_WARNING_DISABLE_MSVC(4706) /* assignment within conditional expression */
# if _MSC_VER <= 1310 // MSVC 2003 # 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 # 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 # 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 # endif
# pragma warning(disable: 4710) /* function not inlined */ QT_WARNING_DISABLE_MSVC(4710) /* function not inlined */
# pragma warning(disable: 4530) /* C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc */ QT_WARNING_DISABLE_MSVC(4530) /* C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc */
# elif defined(Q_CC_BOR) # elif defined(Q_CC_BOR)
# pragma option -w-inl # pragma option -w-inl
# pragma option -w-aus # pragma option -w-aus

View File

@ -208,7 +208,7 @@ int qt_wince_SetErrorMode(int);
bool qt_wince__chmod(const char *file, int mode); bool qt_wince__chmod(const char *file, int mode);
bool qt_wince__wchmod(const wchar_t *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); HANDLE qt_wince_CreateFileA(LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE);
// Printer ---------------------------------------------------------- // Printer ----------------------------------------------------------

View File

@ -40,11 +40,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QT_WARNING_PUSH
#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) && !defined(Q_CC_INTEL) QT_WARNING_DISABLE_GCC("-Wextra")
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wextra"
#endif
// High-level atomic integer operations // High-level atomic integer operations
template <typename T> template <typename T>
@ -214,9 +211,7 @@ public:
#endif #endif
}; };
#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) && !defined(Q_CC_INTEL) QT_WARNING_POP
# pragma GCC diagnostic pop
#endif
#ifdef QT_BASIC_ATOMIC_HAS_CONSTRUCTORS #ifdef QT_BASIC_ATOMIC_HAS_CONSTRUCTORS
# undef QT_BASIC_ATOMIC_HAS_CONSTRUCTORS # undef QT_BASIC_ATOMIC_HAS_CONSTRUCTORS

View File

@ -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 inline QString QString::section(QChar asep, int astart, int aend, SectionFlags aflags) const
{ return section(QString(asep), astart, aend, aflags); } { return section(QString(asep), astart, aend, aflags); }
#ifdef Q_CC_MSVC QT_WARNING_PUSH
// "conditional expression is constant" QT_WARNING_DISABLE_MSVC(4127) // "conditional expression is constant"
#pragma warning(push)
#pragma warning(disable : 4127)
#endif
inline int QString::toWCharArray(wchar_t *array) const 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)); return toUcs4_helper(d->data(), size(), reinterpret_cast<uint *>(array));
} }
#ifdef Q_CC_MSVC QT_WARNING_POP
#pragma warning(pop)
#endif
inline QString QString::fromWCharArray(const wchar_t *string, int size) inline QString QString::fromWCharArray(const wchar_t *string, int size)
{ {

View File

@ -349,13 +349,9 @@ inline void QImage::setPixel(const QPoint &pt, uint index_or_rgb) { setPixel(pt.
#if QT_DEPRECATED_SINCE(5, 0) #if QT_DEPRECATED_SINCE(5, 0)
#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) QT_WARNING_PUSH
# pragma GCC diagnostic push QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations")
# pragma GCC diagnostic ignored "-Wdeprecated-declarations" QT_WARNING_DISABLE_MSVC(4996)
#elif defined(Q_CC_MSVC)
# pragma warning(push)
# pragma warning(disable: 4996)
#endif
inline QString QImage::text(const char* key, const char* lang) const 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); setText(k, s);
} }
#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) QT_WARNING_POP
# pragma GCC diagnostic pop
#elif defined(Q_CC_MSVC)
# pragma warning(pop)
#endif
inline int QImage::numColors() const inline int QImage::numColors() const
{ {

View File

@ -484,9 +484,7 @@ void qt_bitmapblit16_sse2(QRasterBuffer *rasterBuffer, int x, int y,
const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint16); const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint16);
const __m128i c128 = _mm_set1_epi16(c); const __m128i c128 = _mm_set1_epi16(c);
#if defined(Q_CC_MSVC) QT_WARNING_DISABLE_MSVC(4309) // truncation of constant value
# pragma warning(disable: 4309) // truncation of constant value
#endif
const __m128i maskmask = _mm_set_epi16(0x0101, 0x0202, 0x0404, 0x0808, const __m128i maskmask = _mm_set_epi16(0x0101, 0x0202, 0x0404, 0x0808,
0x1010, 0x2020, 0x4040, 0x8080); 0x1010, 0x2020, 0x4040, 0x8080);
const __m128i maskadd = _mm_set_epi16(0x7f7f, 0x7e7e, 0x7c7c, 0x7878, const __m128i maskadd = _mm_set_epi16(0x7f7f, 0x7e7e, 0x7c7c, 0x7878,

View File

@ -124,9 +124,7 @@ inline void qt_bitmapblit16_sse_template(QRasterBuffer *rasterBuffer,
const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint16); const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint16);
const __m64 c64 = _mm_set1_pi16(c); const __m64 c64 = _mm_set1_pi16(c);
#ifdef Q_CC_MSVC QT_WARNING_DISABLE_MSVC(4309) // truncation of constant value
# pragma warning(disable: 4309) // truncation of constant value
#endif
const __m64 maskmask1 = _mm_set_pi16(0x1010, 0x2020, 0x4040, 0x8080); const __m64 maskmask1 = _mm_set_pi16(0x1010, 0x2020, 0x4040, 0x8080);
const __m64 maskadd1 = _mm_set_pi16(0x7070, 0x6060, 0x4040, 0x0000); const __m64 maskadd1 = _mm_set_pi16(0x7070, 0x6060, 0x4040, 0x0000);

View File

@ -416,8 +416,8 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
&& [notificationName isEqualToString:_q_NSWindowDidChangeOcclusionStateNotification]) { && [notificationName isEqualToString:_q_NSWindowDidChangeOcclusionStateNotification]) {
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9 #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 // ### HACK Remove the enum declaration, the warning disabling and the cast further down once 10.8 is unsupported
#pragma clang diagnostic push QT_WARNING_PUSH
#pragma clang diagnostic ignored "-Wobjc-method-access" QT_WARNING_DISABLE_CLANG("-Wobjc-method-access")
enum { NSWindowOcclusionStateVisible = 1UL << 1 }; enum { NSWindowOcclusionStateVisible = 1UL << 1 };
#endif #endif
if ((NSUInteger)[self.window occlusionState] & NSWindowOcclusionStateVisible) { if ((NSUInteger)[self.window occlusionState] & NSWindowOcclusionStateVisible) {
@ -432,7 +432,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
m_platformWindow->obscureWindow(); m_platformWindow->obscureWindow();
} }
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9 #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9
#pragma clang diagnostic pop QT_WARNING_POP
#endif #endif
} else if (notificationName == NSWindowDidChangeScreenNotification) { } else if (notificationName == NSWindowDidChangeScreenNotification) {
if (m_window) { if (m_window) {

View File

@ -94,13 +94,9 @@
# define QATOMIC_TEST_NOT_SUPPORTED # define QATOMIC_TEST_NOT_SUPPORTED
#endif #endif
#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) QT_WARNING_DISABLE_GCC("-Wtype-limits")
# pragma GCC diagnostic ignored "-Wtype-limits" QT_WARNING_DISABLE_GCC("-Wsign-compare")
# pragma GCC diagnostic ignored "-Wsign-compare" QT_WARNING_DISABLE_CLANG("-Wtautological-constant-out-of-range-compare")
#endif
#if defined(Q_CC_CLANG) && !defined(Q_CC_INTEL)
# pragma clang diagnostic ignored "-Wtautological-constant-out-of-range-compare"
#endif
typedef signed char schar; typedef signed char schar;

View File

@ -813,10 +813,8 @@ void tst_QString::acc_01()
} }
} }
#ifdef Q_CC_GNU QT_WARNING_PUSH
# pragma GCC diagnostic push QT_WARNING_DISABLE_GCC("-Wformat-security")
# pragma GCC diagnostic ignored "-Wformat-security"
#endif
void tst_QString::isNull() void tst_QString::isNull()
{ {
@ -828,9 +826,7 @@ void tst_QString::isNull()
QVERIFY(!a.isNull()); QVERIFY(!a.isNull());
} }
#ifdef Q_CC_GNU QT_WARNING_POP
# pragma GCC diagnostic pop
#endif
void tst_QString::isEmpty() void tst_QString::isEmpty()
{ {