llvm-project
05d152bd - [libc] Add definition of struct in6_addr to netinet/in.h (#201057)

Commit
76 days ago
[libc] Add definition of struct in6_addr to netinet/in.h (#201057) This patch implements the struct in6_addr definition for netinet/in.h, mapping it from netinet/in.yaml to the generated public header. I've defined struct in6_addr under include/llvm-libc-types/ using an anonymous union containing s6_addr, s6_addr16, and s6_addr32 (only the first one is mandated by POSIX). Other implementations achieve this by using a named union and defining the members as macros. This approach is cleaner, but could potentially run into compatibility problems with code which expects s6_addr is a macro. If we do, we may have to re-evaluate this approach, but I'd like to avoid uglyfying this preemptively. I added a simple test to check the memory layout of the address. Assisted by Gemini.
Author
Parents
Loading