diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-06-11 11:35:19 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-06-19 19:38:23 +0200 |
commit | 3e1d03b1eaf6a5e842bed4ae4f9bb8cca05e5b31 (patch) | |
tree | 74dd3478dce3bc96121238300fc0bbc6ef97fc3e /src/dbus | |
parent | 5b686e208ffc68f9f660d36c468280d50a40e3ad (diff) |
Port Q_STATIC_ASSERT(_X) to static_assert
There is no reason for keep using our macro now that we have C++17.
The macro itself is left in for the moment being, as well as its
detection logic, because it's needed for C code (not everything
supports C11 yet). A few more cleanups will arrive in the next few
patches.
Note that this is a mere search/replace; some places were using
double braces to work around the presence of commas in a macro, no
attempt has been done to fix those.
tst_qglobal had just some minor changes to keep testing the macro.
Change-Id: I1c1c397d9f3e63db3338842bf350c9069ea57639
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/dbus')
-rw-r--r-- | src/dbus/qdbusconnection.cpp | 2 | ||||
-rw-r--r-- | src/dbus/qdbusmessage.cpp | 10 | ||||
-rw-r--r-- | src/dbus/qdbusmetaobject.cpp | 2 | ||||
-rw-r--r-- | src/dbus/qdbuspendingreply.h | 2 |
4 files changed, 8 insertions, 8 deletions
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index 5757567a87..0334b1156d 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -78,7 +78,7 @@ Q_GLOBAL_STATIC(QDBusConnectionManager, _q_manager) QDBusConnectionPrivate *QDBusConnectionManager::busConnection(QDBusConnection::BusType type) { - Q_STATIC_ASSERT(int(QDBusConnection::SessionBus) + int(QDBusConnection::SystemBus) == 1); + static_assert(int(QDBusConnection::SessionBus) + int(QDBusConnection::SystemBus) == 1); Q_ASSERT(type == QDBusConnection::SessionBus || type == QDBusConnection::SystemBus); if (!qdbus_loadLibDBus()) diff --git a/src/dbus/qdbusmessage.cpp b/src/dbus/qdbusmessage.cpp index 10d2f07d4d..1625dcdfea 100644 --- a/src/dbus/qdbusmessage.cpp +++ b/src/dbus/qdbusmessage.cpp @@ -56,11 +56,11 @@ QT_BEGIN_NAMESPACE -Q_STATIC_ASSERT(QDBusMessage::InvalidMessage == DBUS_MESSAGE_TYPE_INVALID); -Q_STATIC_ASSERT(QDBusMessage::MethodCallMessage == DBUS_MESSAGE_TYPE_METHOD_CALL); -Q_STATIC_ASSERT(QDBusMessage::ReplyMessage == DBUS_MESSAGE_TYPE_METHOD_RETURN); -Q_STATIC_ASSERT(QDBusMessage::ErrorMessage == DBUS_MESSAGE_TYPE_ERROR); -Q_STATIC_ASSERT(QDBusMessage::SignalMessage == DBUS_MESSAGE_TYPE_SIGNAL); +static_assert(QDBusMessage::InvalidMessage == DBUS_MESSAGE_TYPE_INVALID); +static_assert(QDBusMessage::MethodCallMessage == DBUS_MESSAGE_TYPE_METHOD_CALL); +static_assert(QDBusMessage::ReplyMessage == DBUS_MESSAGE_TYPE_METHOD_RETURN); +static_assert(QDBusMessage::ErrorMessage == DBUS_MESSAGE_TYPE_ERROR); +static_assert(QDBusMessage::SignalMessage == DBUS_MESSAGE_TYPE_SIGNAL); static inline const char *data(const QByteArray &arr) { diff --git a/src/dbus/qdbusmetaobject.cpp b/src/dbus/qdbusmetaobject.cpp index 0846c3ed9b..dc52dacca5 100644 --- a/src/dbus/qdbusmetaobject.cpp +++ b/src/dbus/qdbusmetaobject.cpp @@ -416,7 +416,7 @@ void QDBusMetaObjectGenerator::write(QDBusMetaObject *obj) - methods.count(); // ditto QDBusMetaObjectPrivate *header = reinterpret_cast<QDBusMetaObjectPrivate *>(idata.data()); - Q_STATIC_ASSERT_X(QMetaObjectPrivate::OutputRevision == 9, "QtDBus meta-object generator should generate the same version as moc"); + static_assert(QMetaObjectPrivate::OutputRevision == 9, "QtDBus meta-object generator should generate the same version as moc"); header->revision = QMetaObjectPrivate::OutputRevision; header->className = 0; header->classInfoCount = 0; diff --git a/src/dbus/qdbuspendingreply.h b/src/dbus/qdbuspendingreply.h index 1d7e60ad7f..9d25115a67 100644 --- a/src/dbus/qdbuspendingreply.h +++ b/src/dbus/qdbuspendingreply.h @@ -154,7 +154,7 @@ public: template<int Index> inline const typename Select<Index>::Type argumentAt() const { - Q_STATIC_ASSERT_X(Index >= 0 && Index < Count, "Index out of bounds"); + static_assert(Index >= 0 && Index < Count, "Index out of bounds"); typedef typename Select<Index>::Type ResultType; return qdbus_cast<ResultType>(argumentAt(Index), nullptr); } |