QNativeSocketEngine: disable sign-compare warning-turned-error on Clang

On the WASM platform, the macro CMDG_NEXTHDR, which is not under our
control, emits a warning about comparing ulong and long with each
other, which -Werror turns into an error:

  qnativesocketengine_unix.cpp:1004:24: error: comparison of integers of different signs: 'unsigned long' and 'long' [-Werror,-Wsign-compare]
    cmsgptr = CMSG_NXTHDR(&msg, cmsgptr)) {
              ^~~~~~~~~~~~~~~~~~~~~~~~~~
  emsdk/emscripten/1.38.30/system/include/libc/sys/socket.h:286:44: note: expanded from macro 'CMSG_NXTHDR'
    __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fix by locally disabling the warning.

Change-Id: Ia2ed4318b2ef679b84ac8544835d1e383568ccac
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2019-07-13 14:27:49 +02:00
parent eaf2e6daf6
commit 319e0f097d

View File

@ -1000,8 +1000,11 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxS
// parse the ancillary data
struct cmsghdr *cmsgptr;
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wsign-compare")
for (cmsgptr = CMSG_FIRSTHDR(&msg); cmsgptr != NULL;
cmsgptr = CMSG_NXTHDR(&msg, cmsgptr)) {
QT_WARNING_POP
if (cmsgptr->cmsg_level == IPPROTO_IPV6 && cmsgptr->cmsg_type == IPV6_PKTINFO
&& cmsgptr->cmsg_len >= CMSG_LEN(sizeof(in6_pktinfo))) {
in6_pktinfo *info = reinterpret_cast<in6_pktinfo *>(CMSG_DATA(cmsgptr));