musllvm

musl and LLVM cross-toolchain build system
git clone https://git.daat.foo/musllvm.git
Log | Files | Refs | README | LICENSE

nxthdr.patch (1473B)


      1 commit cbad54c13d4c919d2d9b489de526451b8fa00409
      2 Author: q66 <q66@chimera-linux.org>
      3 Date:   Mon Mar 23 18:18:01 2026 +0100
      4 
      5     silence CMSG_NXTHDR warnings with higher clang warnlevels
      6     
      7     The first line fixes:
      8     
      9     msg.cc:8:15: warning: comparison of integers of different signs: 'unsigned long' and 'long' [-Wsign-compare]
     10         8 |     auto *x = CMSG_NXTHDR(a, b);
     11     
     12     The second line fixes:
     13     
     14     msg.cc:8:15: warning: cast from 'unsigned char *' to 'struct cmsghdr *' increases required alignment from 1 to 4 [-Wcast-align]
     15         8 |     auto *x = CMSG_NXTHDR(a, b);
     16 
     17 diff --git a/include/sys/socket.h b/include/sys/socket.h
     18 index 6dc1e40..b805f7d 100644
     19 --- a/include/sys/socket.h
     20 +++ b/include/sys/socket.h
     21 @@ -355,8 +355,8 @@ struct linger {
     22  
     23  #define CMSG_DATA(cmsg) ((unsigned char *) (((struct cmsghdr *)(cmsg)) + 1))
     24  #define CMSG_NXTHDR(mhdr, cmsg) ((cmsg)->cmsg_len < sizeof (struct cmsghdr) || \
     25 -	__CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \
     26 -	? 0 : (struct cmsghdr *)__CMSG_NEXT(cmsg))
     27 +	__CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= (size_t)(__MHDR_END(mhdr) - (unsigned char *)(cmsg)) \
     28 +	? 0 : (struct cmsghdr *)(void *)__CMSG_NEXT(cmsg))
     29  #define CMSG_FIRSTHDR(mhdr) ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0)
     30  
     31  #define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) & (size_t) ~(sizeof (size_t) - 1))