Fix modernize-use-bool-literals issues
Reported by clang-tidy. Skipped fixes in implementation files, only changed headers. Change-Id: I5cfd266b3d4046f90baebc0c538b1b6ab03a02d2 Reviewed-by: Volker Krause <volker.krause@kdab.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
2300629df5
commit
9db09b4700
@ -1336,14 +1336,14 @@
|
|||||||
do {\
|
do {\
|
||||||
Q_ASSERT_X(false, "Q_UNREACHABLE()", "Q_UNREACHABLE was reached");\
|
Q_ASSERT_X(false, "Q_UNREACHABLE()", "Q_UNREACHABLE was reached");\
|
||||||
Q_UNREACHABLE_IMPL();\
|
Q_UNREACHABLE_IMPL();\
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
#define Q_ASSUME(Expr) \
|
#define Q_ASSUME(Expr) \
|
||||||
do {\
|
do {\
|
||||||
const bool valueOfExpression = Expr;\
|
const bool valueOfExpression = Expr;\
|
||||||
Q_ASSERT_X(valueOfExpression, "Q_ASSUME()", "Assumption in Q_ASSUME(\"" #Expr "\") was not correct");\
|
Q_ASSERT_X(valueOfExpression, "Q_ASSUME()", "Assumption in Q_ASSUME(\"" #Expr "\") was not correct");\
|
||||||
Q_ASSUME_IMPL(valueOfExpression);\
|
Q_ASSUME_IMPL(valueOfExpression);\
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
#if QT_HAS_CPP_ATTRIBUTE(fallthrough)
|
#if QT_HAS_CPP_ATTRIBUTE(fallthrough)
|
||||||
|
@ -339,10 +339,10 @@ typedef double qreal;
|
|||||||
|
|
||||||
#define Q_INIT_RESOURCE(name) \
|
#define Q_INIT_RESOURCE(name) \
|
||||||
do { extern int QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); \
|
do { extern int QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); \
|
||||||
QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); } while (0)
|
QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); } while (false)
|
||||||
#define Q_CLEANUP_RESOURCE(name) \
|
#define Q_CLEANUP_RESOURCE(name) \
|
||||||
do { extern int QT_MANGLE_NAMESPACE(qCleanupResources_ ## name) (); \
|
do { extern int QT_MANGLE_NAMESPACE(qCleanupResources_ ## name) (); \
|
||||||
QT_MANGLE_NAMESPACE(qCleanupResources_ ## name) (); } while (0)
|
QT_MANGLE_NAMESPACE(qCleanupResources_ ## name) (); } while (false)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we're compiling C++ code:
|
* If we're compiling C++ code:
|
||||||
@ -646,7 +646,7 @@ inline void qt_noop(void) {}
|
|||||||
# define QT_CATCH(A) else
|
# define QT_CATCH(A) else
|
||||||
# define QT_THROW(A) qt_noop()
|
# define QT_THROW(A) qt_noop()
|
||||||
# define QT_RETHROW qt_noop()
|
# define QT_RETHROW qt_noop()
|
||||||
# define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (0)
|
# define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (false)
|
||||||
#else
|
#else
|
||||||
# define QT_TRY try
|
# define QT_TRY try
|
||||||
# define QT_CATCH(A) catch (A)
|
# define QT_CATCH(A) catch (A)
|
||||||
@ -654,9 +654,9 @@ inline void qt_noop(void) {}
|
|||||||
# define QT_RETHROW throw
|
# define QT_RETHROW throw
|
||||||
Q_NORETURN Q_CORE_EXPORT void qTerminate() Q_DECL_NOTHROW;
|
Q_NORETURN Q_CORE_EXPORT void qTerminate() Q_DECL_NOTHROW;
|
||||||
# ifdef Q_COMPILER_NOEXCEPT
|
# ifdef Q_COMPILER_NOEXCEPT
|
||||||
# define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (0)
|
# define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (false)
|
||||||
# else
|
# else
|
||||||
# define QT_TERMINATE_ON_EXCEPTION(expr) do { try { expr; } catch (...) { qTerminate(); } } while (0)
|
# define QT_TERMINATE_ON_EXCEPTION(expr) do { try { expr; } catch (...) { qTerminate(); } } while (false)
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -760,10 +760,10 @@ Q_CORE_EXPORT void qBadAlloc();
|
|||||||
# if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
|
# if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
|
||||||
# define Q_CHECK_PTR(p) qt_noop()
|
# define Q_CHECK_PTR(p) qt_noop()
|
||||||
# else
|
# else
|
||||||
# define Q_CHECK_PTR(p) do {if(!(p))qt_check_pointer(__FILE__,__LINE__);} while (0)
|
# define Q_CHECK_PTR(p) do {if (!(p)) qt_check_pointer(__FILE__,__LINE__);} while (false)
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# define Q_CHECK_PTR(p) do { if (!(p)) qBadAlloc(); } while (0)
|
# define Q_CHECK_PTR(p) do { if (!(p)) qBadAlloc(); } while (false)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -211,14 +211,14 @@ struct QDBusDispatchLocker: QDBusMutexLocker
|
|||||||
QDBusLockerBase::reportThreadAction(action, QDBusLockerBase::BeforeAcquire, this); \
|
QDBusLockerBase::reportThreadAction(action, QDBusLockerBase::BeforeAcquire, this); \
|
||||||
sem.acquire(); \
|
sem.acquire(); \
|
||||||
QDBusLockerBase::reportThreadAction(action, QDBusLockerBase::AfterAcquire, this); \
|
QDBusLockerBase::reportThreadAction(action, QDBusLockerBase::AfterAcquire, this); \
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
# define SEM_RELEASE(action, sem) \
|
# define SEM_RELEASE(action, sem) \
|
||||||
do { \
|
do { \
|
||||||
QDBusLockerBase::reportThreadAction(action, QDBusLockerBase::BeforeRelease, that); \
|
QDBusLockerBase::reportThreadAction(action, QDBusLockerBase::BeforeRelease, that); \
|
||||||
sem.release(); \
|
sem.release(); \
|
||||||
QDBusLockerBase::reportThreadAction(action, QDBusLockerBase::AfterRelease, that); \
|
QDBusLockerBase::reportThreadAction(action, QDBusLockerBase::AfterRelease, that); \
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
# define SEM_ACQUIRE(action, sem) sem.acquire()
|
# define SEM_ACQUIRE(action, sem) sem.acquire()
|
||||||
|
@ -885,7 +885,7 @@ do { \
|
|||||||
case 1: *--_d = *--_s; \
|
case 1: *--_d = *--_s; \
|
||||||
} while (--n > 0); \
|
} while (--n > 0); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
#define QT_MEMCPY_USHORT(dest, src, length) \
|
#define QT_MEMCPY_USHORT(dest, src, length) \
|
||||||
do { \
|
do { \
|
||||||
@ -905,7 +905,7 @@ do { \
|
|||||||
case 1: *_d++ = *_s++; \
|
case 1: *_d++ = *_s++; \
|
||||||
} while (--n > 0); \
|
} while (--n > 0); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
inline ushort qConvertRgb32To16(uint c)
|
inline ushort qConvertRgb32To16(uint c)
|
||||||
{
|
{
|
||||||
|
@ -45,9 +45,9 @@
|
|||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
|
||||||
#define QTEST_ASSERT(cond) do { if (!(cond)) qt_assert(#cond,__FILE__,__LINE__); } while (0)
|
#define QTEST_ASSERT(cond) do { if (!(cond)) qt_assert(#cond,__FILE__,__LINE__); } while (false)
|
||||||
|
|
||||||
#define QTEST_ASSERT_X(cond, where, what) do { if (!(cond)) qt_assert_x(where, what,__FILE__,__LINE__); } while (0)
|
#define QTEST_ASSERT_X(cond, where, what) do { if (!(cond)) qt_assert_x(where, what,__FILE__,__LINE__); } while (false)
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
@ -63,13 +63,13 @@ class QRegularExpression;
|
|||||||
do {\
|
do {\
|
||||||
if (!QTest::qVerify(static_cast<bool>(statement), #statement, "", __FILE__, __LINE__))\
|
if (!QTest::qVerify(static_cast<bool>(statement), #statement, "", __FILE__, __LINE__))\
|
||||||
return;\
|
return;\
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
#define QFAIL(message) \
|
#define QFAIL(message) \
|
||||||
do {\
|
do {\
|
||||||
QTest::qFail(message, __FILE__, __LINE__);\
|
QTest::qFail(message, __FILE__, __LINE__);\
|
||||||
return;\
|
return;\
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
#define QVERIFY2(statement, description) \
|
#define QVERIFY2(statement, description) \
|
||||||
do {\
|
do {\
|
||||||
@ -80,13 +80,13 @@ do {\
|
|||||||
if (!QTest::qVerify(false, #statement, (description), __FILE__, __LINE__))\
|
if (!QTest::qVerify(false, #statement, (description), __FILE__, __LINE__))\
|
||||||
return;\
|
return;\
|
||||||
}\
|
}\
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
#define QCOMPARE(actual, expected) \
|
#define QCOMPARE(actual, expected) \
|
||||||
do {\
|
do {\
|
||||||
if (!QTest::qCompare(actual, expected, #actual, #expected, __FILE__, __LINE__))\
|
if (!QTest::qCompare(actual, expected, #actual, #expected, __FILE__, __LINE__))\
|
||||||
return;\
|
return;\
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
|
|
||||||
#ifndef QT_NO_EXCEPTIONS
|
#ifndef QT_NO_EXCEPTIONS
|
||||||
@ -111,7 +111,7 @@ do {\
|
|||||||
" but unknown exception caught", __FILE__, __LINE__);\
|
" but unknown exception caught", __FILE__, __LINE__);\
|
||||||
return;\
|
return;\
|
||||||
}\
|
}\
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
#else // QT_NO_EXCEPTIONS
|
#else // QT_NO_EXCEPTIONS
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ do {\
|
|||||||
do { \
|
do { \
|
||||||
QTRY_IMPL((expr), timeout);\
|
QTRY_IMPL((expr), timeout);\
|
||||||
QVERIFY(expr); \
|
QVERIFY(expr); \
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
#define QTRY_VERIFY(expr) QTRY_VERIFY_WITH_TIMEOUT((expr), 5000)
|
#define QTRY_VERIFY(expr) QTRY_VERIFY_WITH_TIMEOUT((expr), 5000)
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ do { \
|
|||||||
do { \
|
do { \
|
||||||
QTRY_IMPL((expr), timeout);\
|
QTRY_IMPL((expr), timeout);\
|
||||||
QVERIFY2(expr, messageExpression); \
|
QVERIFY2(expr, messageExpression); \
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
#define QTRY_VERIFY2(expr, messageExpression) QTRY_VERIFY2_WITH_TIMEOUT((expr), (messageExpression), 5000)
|
#define QTRY_VERIFY2(expr, messageExpression) QTRY_VERIFY2_WITH_TIMEOUT((expr), (messageExpression), 5000)
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ do { \
|
|||||||
do { \
|
do { \
|
||||||
QTRY_IMPL(((expr) == (expected)), timeout);\
|
QTRY_IMPL(((expr) == (expected)), timeout);\
|
||||||
QCOMPARE((expr), expected); \
|
QCOMPARE((expr), expected); \
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
#define QTRY_COMPARE(expr, expected) QTRY_COMPARE_WITH_TIMEOUT((expr), expected, 5000)
|
#define QTRY_COMPARE(expr, expected) QTRY_COMPARE_WITH_TIMEOUT((expr), expected, 5000)
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ do { \
|
|||||||
do {\
|
do {\
|
||||||
QTest::qSkip(statement, __FILE__, __LINE__);\
|
QTest::qSkip(statement, __FILE__, __LINE__);\
|
||||||
return;\
|
return;\
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
#ifdef Q_COMPILER_VARIADIC_MACROS
|
#ifdef Q_COMPILER_VARIADIC_MACROS
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ do {\
|
|||||||
do {\
|
do {\
|
||||||
if (!QTest::qExpectFail(dataIndex, comment, QTest::mode, __FILE__, __LINE__))\
|
if (!QTest::qExpectFail(dataIndex, comment, QTest::mode, __FILE__, __LINE__))\
|
||||||
return;\
|
return;\
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
#define QFETCH(Type, name)\
|
#define QFETCH(Type, name)\
|
||||||
Type name = *static_cast<Type *>(QTest::qData(#name, ::qMetaTypeId<typename std::remove_cv<Type >::type>()))
|
Type name = *static_cast<Type *>(QTest::qData(#name, ::qMetaTypeId<typename std::remove_cv<Type >::type>()))
|
||||||
@ -212,7 +212,7 @@ do {\
|
|||||||
do {\
|
do {\
|
||||||
if (!QTest::qTest(actual, testElement, #actual, #testElement, __FILE__, __LINE__))\
|
if (!QTest::qTest(actual, testElement, #actual, #testElement, __FILE__, __LINE__))\
|
||||||
return;\
|
return;\
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
#define QWARN(msg)\
|
#define QWARN(msg)\
|
||||||
QTest::qWarn(msg, __FILE__, __LINE__)
|
QTest::qWarn(msg, __FILE__, __LINE__)
|
||||||
|
@ -159,7 +159,7 @@ typedef void (^QCocoaDrawRectBlock)(NSRect, CGContextRef);
|
|||||||
do { \
|
do { \
|
||||||
static const int sizes[] = { (large), (small), (mini) }; \
|
static const int sizes[] = { (large), (small), (mini) }; \
|
||||||
return sizes[controlSize]; \
|
return sizes[controlSize]; \
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
#if QT_CONFIG(pushbutton)
|
#if QT_CONFIG(pushbutton)
|
||||||
bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option);
|
bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user