diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2023-03-02 12:23:42 -0800 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2023-03-04 10:59:44 -0800 |
commit | 2a19c7ed13608e5f0784c0ea2ba0b1c515226665 (patch) | |
tree | bbc171d376a7b9bb9005b1a546b8f60445b45599 | |
parent | e2446afaa10ddd365d8de834d3fb1d00fd661355 (diff) |
QNetworkInterface/Unix: replace one Q_ASSERT with static_asserts
This requires compilers with constexpr offsetof(), which Clang seems to
be since at least 3.0 and GCC since 4.7, both of which are way older
than anything we need to support.
Pick-to: 6.5
Change-Id: I7f354474adce419ca6c2fffd1748b3dcfc616f4a
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r-- | src/network/kernel/qnetworkinterface_unix.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/network/kernel/qnetworkinterface_unix.cpp b/src/network/kernel/qnetworkinterface_unix.cpp index 51a266b2e3..082d83e9dc 100644 --- a/src/network/kernel/qnetworkinterface_unix.cpp +++ b/src/network/kernel/qnetworkinterface_unix.cpp @@ -459,7 +459,8 @@ static QList<QNetworkInterfacePrivate *> createInterfaces(ifaddrs *rawList) // ensure both structs start with the name field, of size IFNAMESIZ static_assert(sizeof(mediareq.ifm_name) == sizeof(req.ifr_name)); - Q_ASSERT(&mediareq.ifm_name == &req.ifr_name); + static_assert(offsetof(struct ifmediareq, ifm_name) == 0); + static_assert(offsetof(struct ifreq, ifr_name) == 0); // on NetBSD we use AF_LINK and sockaddr_dl // scan the list for that family |