chore: align includes in platform-split files with the include policy#53
Merged
Conversation
Portable headers are included unconditionally; only headers that don't exist (or differ materially) across platforms stay gated. Two kinds of drift fixed: - Portable headers that had crept into platform blocks move back to the shared groups: <net/if.h> (duplicated in both branches of interface_address_test), <ifaddrs.h>, <netinet/in.h>, <sys/ioctl.h>, and the std headers in interface_address_test. - Dead includes dropped -- no symbol used on any platform: <unistd.h> three times (fd lifecycle goes through UniqueFd, never raw close()), <cerrno> in the netlink block (errno is only read inside Error::FromErrno), <utility>, a duplicate <sys/socket.h>, and <net/ethernet.h> / <sys/uio.h> in the BPF block.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Align includes in the platform-split files with the include policy: portable headers are included unconditionally (the IDE's unused-include hint on the platform that doesn't use them is accepted); only headers that don't exist — or differ materially — across platforms stay behind
#if.An audit of every file with platform-conditional code found two kinds of drift:
<net/if.h>(duplicated in both branches ofinterface_address_test),<ifaddrs.h>,<netinet/in.h>,<sys/ioctl.h>, and the std headers ininterface_address_test.<unistd.h>×3 (fd lifecycle goes throughUniqueFd, never rawclose()),<cerrno>in the netlink block (errno is only read insideError::FromErrno),<utility>, a duplicate<sys/socket.h>, and<net/ethernet.h>/<sys/uio.h>in the BPF block.Verification
<net/ethernet.h>/<sys/uio.h>removals sit in the!linuxblock; verified on macOS, with the FreeBSD lane as the backstop.