From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: from second.openwall.net (second.openwall.net [193.110.157.125]) by inbox.vuxu.org (Postfix) with SMTP id BE6BF20F35 for ; Fri, 2 Aug 2024 23:27:43 +0200 (CEST) Received: (qmail 18250 invoked by uid 550); 2 Aug 2024 21:27:37 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 18147 invoked from network); 2 Aug 2024 21:27:37 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brad-house.com; s=google; t=1722634049; x=1723238849; darn=lists.openwall.com; h=subject:from:to:content-language:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=NEGqAMPr5b7Zd+5XlxdG4dblmvXW4q++84h7qs+TJXE=; b=R0Rn+maqX4W2ov7uKVyCABRFBYc1Lfw3Y0p3b9thXCMTYwb3qiPMla6nd892DOzkkA NJ5SzS9Tg+uU/vaR/uuhDqD4tXoo/aTIhdsP5bA1vBY5A4PDhqJdHR0yWK06aQU5eYU7 Ce7nSonjkJB6jwh8h6i2GUqOuU/YKa4ieXiTJiahjVKlc8dM6VdDZrlkW8JTEfaQ38DX 7Q9AqQ6DSQNiFXbcQYY+SYynPZKbT9ymci9ZDxtT+xaXznishbQfLNZdSCQ6RuGyaJGB h5BQeHFEq7GrU4PGW7+7NSEN3ldaiVwCpwQ1n2AstD+4ek9K8F2sVKvuKtXffaXz7zFM G+5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722634049; x=1723238849; h=subject:from:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NEGqAMPr5b7Zd+5XlxdG4dblmvXW4q++84h7qs+TJXE=; b=eDuOscDFKsgstxIzC/cof6hTDte0ffvB+0EDh8kfiPrvokZaV2f+RcWlQx6kefkyy2 4rVqX9kXvTZkyVI+kpb4VHLJhOTna2zinkVI4gfRpr8PD1PiAIZ+BSS7hABBLim3Cqhz y6JD8j1IyB6IHpBOd1qT8fs4D6VPvhwN/IS0VfnWAJL9S7wawDtFdH4wXFRgnpgBVSpE gUYp/UIDddyvZlBKurK87j81DyuhlkYW0y1G3dY5Vf0CazqlfUFNO78M/VqqKGxMQjLX ZReM3LrQ9vMAaEkiQOHDU6EHKBXRafRtv8tq09GEXo9xFk4+ji1MbYEdYvOSzvU1e9uY ikpQ== X-Gm-Message-State: AOJu0YyU+xE2Rfs24mqgiX6boP0Uhq5pEL5w3n+GHDu5bjOQC1pI5yzJ q6asjiXP0gEhzWWm4ZePE2GHTB0MjrfV+p+eTqNocGZXjPETKSyv/Pav0EAHCD0Z4UnSHJO16m7 J X-Google-Smtp-Source: AGHT+IE+a6Zx1wFmg7X4kDMZBL5vc1+es9BBesL+fs69uHwq8HEj6hYCfVMKooQ4kdQ9aa6aEVnauw== X-Received: by 2002:a81:9482:0:b0:64a:7379:eb53 with SMTP id 00721157ae682-689643927a7mr54336277b3.43.1722634048615; Fri, 02 Aug 2024 14:27:28 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------icOgm4N92zBUnbH33XQdSzIX" Message-ID: Date: Fri, 2 Aug 2024 17:27:26 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: musl@lists.openwall.com From: Brad House Subject: [musl] [PATCH 1/1] IN6_IS_ADDR_LOOPBACK() and similar macros warn on -Wcast-qual This is a multi-part message in MIME format. --------------icOgm4N92zBUnbH33XQdSzIX Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit I'm the maintainer of c-ares (https://c-ares.org) and have been scanning the CI build logs for various systems to catch warnings, and on Alpine Linux (which obviously uses musl c) we get these warnings, specifically when using clang (but not oddly not on gcc): /__w/c-ares/c-ares/src/lib/ares__sortaddrinfo.c:93:9: warning: cast from 'const struct in6_addr *' to 'unsigned char *' drops const qualifier [-Wcast-qual]    93 |     if (IN6_IS_ADDR_MULTICAST(&addr6->sin6_addr)) {       |         ^ /usr/include/netinet/in.h:120:48: note: expanded from macro 'IN6_IS_ADDR_MULTICAST'   120 | #define IN6_IS_ADDR_MULTICAST(a) (((uint8_t *) (a))[0] == 0xff)       |                                                ^ /__w/c-ares/c-ares/src/lib/ares__sortaddrinfo.c:95:16: warning: cast from 'const struct in6_addr *' to 'unsigned int *' drops const qualifier [-Wcast-qual]    95 |     } else if (IN6_IS_ADDR_LOOPBACK(&addr6->sin6_addr) ||       |                ^ /usr/include/netinet/in.h:115:24: note: expanded from macro 'IN6_IS_ADDR_LOOPBACK'   115 |         (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \       |                        ^ /__w/c-ares/c-ares/src/lib/ares__sortaddrinfo.c:96:16: warning: cast from 'const struct in6_addr *' to 'unsigned char *' drops const qualifier [-Wcast-qual]    96 | IN6_IS_ADDR_LINKLOCAL(&addr6->sin6_addr)) {       |                ^ /usr/include/netinet/in.h:123:24: note: expanded from macro 'IN6_IS_ADDR_LINKLOCAL'   123 |         ((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0x80)       |                        ^ /__w/c-ares/c-ares/src/lib/ares__sortaddrinfo.c:141:16: warning: cast from 'const struct in6_addr *' to 'unsigned int *' drops const qualifier [-Wcast-qual]   141 |     } else if (IN6_IS_ADDR_V4MAPPED(&addr6->sin6_addr)) {       |                ^ /usr/include/netinet/in.h:129:24: note: expanded from macro 'IN6_IS_ADDR_V4MAPPED'   129 |         (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \       |                        ^ /__w/c-ares/c-ares/src/lib/ares__sortaddrinfo.c:149:16: warning: cast from 'const struct in6_addr *' to 'unsigned int *' drops const qualifier [-Wcast-qual]   149 |     } else if (IN6_IS_ADDR_V4COMPAT(&addr6->sin6_addr)) {       |                ^ /usr/include/netinet/in.h:134:24: note: expanded from macro 'IN6_IS_ADDR_V4COMPAT'   134 |         (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \       |                        ^ /__w/c-ares/c-ares/src/lib/ares__sortaddrinfo.c:151:16: warning: cast from 'const struct in6_addr *' to 'unsigned char *' drops const qualifier [-Wcast-qual]   151 |     } else if (IN6_IS_ADDR_SITELOCAL(&addr6->sin6_addr)) {       |                ^ /usr/include/netinet/in.h:126:24: note: expanded from macro 'IN6_IS_ADDR_SITELOCAL'   126 |         ((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0xc0)       |                        ^ /__w/c-ares/c-ares/src/lib/ares__sortaddrinfo.c:189:16: warning: cast from 'const struct in6_addr *' to 'unsigned int *' drops const qualifier [-Wcast-qual]   189 |     } else if (IN6_IS_ADDR_V4COMPAT(&addr6->sin6_addr) ||       |                ^ /usr/include/netinet/in.h:134:24: note: expanded from macro 'IN6_IS_ADDR_V4COMPAT'   134 |         (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \       |                        ^ Full build output: https://github.com/c-ares/c-ares/actions/runs/10219723015/job/28278549865 I've attached a patch that will silence this warning by always casting to the comparison to const, but otherwise not impact the behavior. -Brad --------------icOgm4N92zBUnbH33XQdSzIX Content-Type: text/plain; charset=UTF-8; name="musl-netinet-warning-fix.patch" Content-Disposition: attachment; filename="musl-netinet-warning-fix.patch" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL2luY2x1ZGUvbmV0aW5ldC9pbi5oIGIvaW5jbHVkZS9uZXRpbmV0L2lu LmgKaW5kZXggZmI2MjhiNjEuLmYwNDY1N2YzIDEwMDY0NAotLS0gYS9pbmNsdWRlL25ldGlu ZXQvaW4uaAorKysgYi9pbmNsdWRlL25ldGluZXQvaW4uaApAQCAtMTA4LDQ2ICsxMDgsNjMg QEAgdWludDE2X3QgbnRvaHModWludDE2X3QpOwogI2RlZmluZSBJUFBST1RPX01BWCAgICAg IDI2MwogCiAjZGVmaW5lIElONl9JU19BRERSX1VOU1BFQ0lGSUVEKGEpIFwKLSAgICAgICAg KCgodWludDMyX3QgKikgKGEpKVswXSA9PSAwICYmICgodWludDMyX3QgKikgKGEpKVsxXSA9 PSAwICYmIFwKLSAgICAgICAgICgodWludDMyX3QgKikgKGEpKVsyXSA9PSAwICYmICgodWlu dDMyX3QgKikgKGEpKVszXSA9PSAwKQorICAgICAgICAoKChjb25zdCB1aW50MzJfdCAqKSAo YSkpWzBdID09IDAgJiYgXAorICAgICAgICAgKChjb25zdCB1aW50MzJfdCAqKSAoYSkpWzFd ID09IDAgJiYgXAorICAgICAgICAgKChjb25zdCB1aW50MzJfdCAqKSAoYSkpWzJdID09IDAg JiYgXAorICAgICAgICAgKChjb25zdCB1aW50MzJfdCAqKSAoYSkpWzNdID09IDApCiAKICNk ZWZpbmUgSU42X0lTX0FERFJfTE9PUEJBQ0soYSkgXAotICAgICAgICAoKCh1aW50MzJfdCAq KSAoYSkpWzBdID09IDAgJiYgKCh1aW50MzJfdCAqKSAoYSkpWzFdID09IDAgJiYgXAotICAg ICAgICAgKCh1aW50MzJfdCAqKSAoYSkpWzJdID09IDAgJiYgXAotICAgICAgICAgKCh1aW50 OF90ICopIChhKSlbMTJdID09IDAgJiYgKCh1aW50OF90ICopIChhKSlbMTNdID09IDAgJiYg XAotICAgICAgICAgKCh1aW50OF90ICopIChhKSlbMTRdID09IDAgJiYgKCh1aW50OF90ICop IChhKSlbMTVdID09IDEgKQorICAgICAgICAoKChjb25zdCB1aW50MzJfdCAqKSAoYSkpWzBd ID09IDAgJiYgXAorICAgICAgICAgKChjb25zdCB1aW50MzJfdCAqKSAoYSkpWzFdID09IDAg JiYgXAorICAgICAgICAgKChjb25zdCB1aW50MzJfdCAqKSAoYSkpWzJdID09IDAgJiYgXAor ICAgICAgICAgKChjb25zdCB1aW50OF90ICopIChhKSlbMTJdID09IDAgJiYgXAorICAgICAg ICAgKChjb25zdCB1aW50OF90ICopIChhKSlbMTNdID09IDAgJiYgXAorICAgICAgICAgKChj b25zdCB1aW50OF90ICopIChhKSlbMTRdID09IDAgJiYgXAorICAgICAgICAgKChjb25zdCB1 aW50OF90ICopIChhKSlbMTVdID09IDEgKQogCi0jZGVmaW5lIElONl9JU19BRERSX01VTFRJ Q0FTVChhKSAoKCh1aW50OF90ICopIChhKSlbMF0gPT0gMHhmZikKKyNkZWZpbmUgSU42X0lT X0FERFJfTVVMVElDQVNUKGEpICgoKGNvbnN0IHVpbnQ4X3QgKikgKGEpKVswXSA9PSAweGZm KQogCiAjZGVmaW5lIElONl9JU19BRERSX0xJTktMT0NBTChhKSBcCi0gICAgICAgICgoKCh1 aW50OF90ICopIChhKSlbMF0pID09IDB4ZmUgJiYgKCgodWludDhfdCAqKSAoYSkpWzFdICYg MHhjMCkgPT0gMHg4MCkKKyAgICAgICAgKCgoKGNvbnN0IHVpbnQ4X3QgKikgKGEpKVswXSkg PT0gMHhmZSAmJiBcCisgICAgICAgICAoKChjb25zdCB1aW50OF90ICopIChhKSlbMV0gJiAw eGMwKSA9PSAweDgwKQogCiAjZGVmaW5lIElONl9JU19BRERSX1NJVEVMT0NBTChhKSBcCi0g ICAgICAgICgoKCh1aW50OF90ICopIChhKSlbMF0pID09IDB4ZmUgJiYgKCgodWludDhfdCAq KSAoYSkpWzFdICYgMHhjMCkgPT0gMHhjMCkKKyAgICAgICAgKCgoKGNvbnN0IHVpbnQ4X3Qg KikgKGEpKVswXSkgPT0gMHhmZSAmJiBcCisgICAgICAgICAoKChjb25zdCB1aW50OF90ICop IChhKSlbMV0gJiAweGMwKSA9PSAweGMwKQogCiAjZGVmaW5lIElONl9JU19BRERSX1Y0TUFQ UEVEKGEpIFwKLSAgICAgICAgKCgodWludDMyX3QgKikgKGEpKVswXSA9PSAwICYmICgodWlu dDMyX3QgKikgKGEpKVsxXSA9PSAwICYmIFwKLSAgICAgICAgICgodWludDhfdCAqKSAoYSkp WzhdID09IDAgJiYgKCh1aW50OF90ICopIChhKSlbOV0gPT0gMCAmJiBcCi0gICAgICAgICAo KHVpbnQ4X3QgKikgKGEpKVsxMF0gPT0gMHhmZiAmJiAoKHVpbnQ4X3QgKikgKGEpKVsxMV0g PT0gMHhmZikKKyAgICAgICAgKCgoY29uc3QgdWludDMyX3QgKikgKGEpKVswXSA9PSAwICYm IFwKKyAgICAgICAgICgoY29uc3QgdWludDMyX3QgKikgKGEpKVsxXSA9PSAwICYmIFwKKyAg ICAgICAgICgoY29uc3QgdWludDhfdCAqKSAoYSkpWzhdID09IDAgJiYgXAorICAgICAgICAg KChjb25zdCB1aW50OF90ICopIChhKSlbOV0gPT0gMCAmJiBcCisgICAgICAgICAoKGNvbnN0 IHVpbnQ4X3QgKikgKGEpKVsxMF0gPT0gMHhmZiAmJiBcCisgICAgICAgICAoKGNvbnN0IHVp bnQ4X3QgKikgKGEpKVsxMV0gPT0gMHhmZikKIAogI2RlZmluZSBJTjZfSVNfQUREUl9WNENP TVBBVChhKSBcCi0gICAgICAgICgoKHVpbnQzMl90ICopIChhKSlbMF0gPT0gMCAmJiAoKHVp bnQzMl90ICopIChhKSlbMV0gPT0gMCAmJiBcCi0gICAgICAgICAoKHVpbnQzMl90ICopIChh KSlbMl0gPT0gMCAmJiAoKHVpbnQ4X3QgKikgKGEpKVsxNV0gPiAxKQorICAgICAgICAoKChj b25zdCB1aW50MzJfdCAqKSAoYSkpWzBdID09IDAgJiYgXAorICAgICAgICAgKChjb25zdCB1 aW50MzJfdCAqKSAoYSkpWzFdID09IDAgJiYgXAorICAgICAgICAgKChjb25zdCB1aW50MzJf dCAqKSAoYSkpWzJdID09IDAgJiYgXAorICAgICAgICAgKChjb25zdCB1aW50OF90ICopIChh KSlbMTVdID4gMSkKIAogI2RlZmluZSBJTjZfSVNfQUREUl9NQ19OT0RFTE9DQUwoYSkgXAot ICAgICAgICAoSU42X0lTX0FERFJfTVVMVElDQVNUKGEpICYmICgoKCh1aW50OF90ICopIChh KSlbMV0gJiAweGYpID09IDB4MSkpCisgICAgICAgIChJTjZfSVNfQUREUl9NVUxUSUNBU1Qo YSkgJiYgXAorICAgICAgICAgKCgoKGNvbnN0IHVpbnQ4X3QgKikgKGEpKVsxXSAmIDB4Zikg PT0gMHgxKSkKIAogI2RlZmluZSBJTjZfSVNfQUREUl9NQ19MSU5LTE9DQUwoYSkgXAotICAg ICAgICAoSU42X0lTX0FERFJfTVVMVElDQVNUKGEpICYmICgoKCh1aW50OF90ICopIChhKSlb MV0gJiAweGYpID09IDB4MikpCisgICAgICAgIChJTjZfSVNfQUREUl9NVUxUSUNBU1QoYSkg JiYgXAorICAgICAgICAgKCgoKGNvbnN0IHVpbnQ4X3QgKikgKGEpKVsxXSAmIDB4ZikgPT0g MHgyKSkKIAogI2RlZmluZSBJTjZfSVNfQUREUl9NQ19TSVRFTE9DQUwoYSkgXAotICAgICAg ICAoSU42X0lTX0FERFJfTVVMVElDQVNUKGEpICYmICgoKCh1aW50OF90ICopIChhKSlbMV0g JiAweGYpID09IDB4NSkpCisgICAgICAgIChJTjZfSVNfQUREUl9NVUxUSUNBU1QoYSkgJiYg XAorICAgICAgICAgKCgoKGNvbnN0IHVpbnQ4X3QgKikgKGEpKVsxXSAmIDB4ZikgPT0gMHg1 KSkKIAogI2RlZmluZSBJTjZfSVNfQUREUl9NQ19PUkdMT0NBTChhKSBcCi0gICAgICAgIChJ TjZfSVNfQUREUl9NVUxUSUNBU1QoYSkgJiYgKCgoKHVpbnQ4X3QgKikgKGEpKVsxXSAmIDB4 ZikgPT0gMHg4KSkKKyAgICAgICAgKElONl9JU19BRERSX01VTFRJQ0FTVChhKSAmJiBcCisg ICAgICAgICAoKCgoY29uc3QgdWludDhfdCAqKSAoYSkpWzFdICYgMHhmKSA9PSAweDgpKQog CiAjZGVmaW5lIElONl9JU19BRERSX01DX0dMT0JBTChhKSBcCi0gICAgICAgIChJTjZfSVNf QUREUl9NVUxUSUNBU1QoYSkgJiYgKCgoKHVpbnQ4X3QgKikgKGEpKVsxXSAmIDB4ZikgPT0g MHhlKSkKKyAgICAgICAgKElONl9JU19BRERSX01VTFRJQ0FTVChhKSAmJiBcCisgICAgICAg ICAoKCgoY29uc3QgdWludDhfdCAqKSAoYSkpWzFdICYgMHhmKSA9PSAweGUpKQogCiAjZGVm aW5lIF9fQVJFXzRfRVFVQUwoYSxiKSBcCiAJKCEoICgwW2FdLTBbYl0pIHwgKDFbYV0tMVti XSkgfCAoMlthXS0yW2JdKSB8ICgzW2FdLTNbYl0pICkpCg== --------------icOgm4N92zBUnbH33XQdSzIX--