Repository navigation
bsdsocket: silence Windows dead_code warnings (#61) - #165
Merged
Merged
Conversation
The real callers of these FD_*/FIONREAD/FD_SET_BYTES constants, fd_set_test/zero/add, and the servent_allocs/protoent_allocs fields are all inside #[cfg(unix)] handler bodies (wait_select_poll's real poll(2)-based half, ioctl_socket_handler's FIONREAD branch, build_servent/build_protoent), so a Windows build sees them as genuinely unused -- same gap FD_OOB already had an #[allow(dead_code)] for. cargo build --release -p volamos --target x86_64-pc-windows-gnu (the real release-binary CI step) now produces zero warnings. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Godbk9UDW5obqYsdkXkyRR
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.
Summary
Fixes #61. The original issue listed 7 warnings from the Windows release-binary build; re-running it today surfaces 12 (the module has grown since v0.4):
FIONREAD,FD_ACCEPT/FD_CONNECT/FD_READ/FD_WRITE/FD_ERROR/FD_CLOSE,FD_SET_BYTES,fd_set_test/fd_set_zero/fd_set_add, andBsdSocketState::servent_allocs/protoent_allocs.All of them are real -- every non-test use site is inside a
#[cfg(unix)]function (wait_select_poll's realpoll(2)-based half,ioctl_socket_handler'sFIONREADbranch,build_servent/build_protoent), so a Windows build genuinely never reaches them.FD_OOBalready had an#[allow(dead_code)]for exactly this reason (a pre-existing precedent in the same const block) -- this PR applies the same treatment to the rest via#[cfg_attr(not(unix), allow(dead_code))], which is slightly more precise than a bare#[allow(dead_code)]: it only suppresses the warning on the platform where it's expected, so a genuinely new dead-code regression on Unix would still be caught.Test plan
cargo build --release -p volamos --target x86_64-pc-windows-gnu(the exact commandci.yml'sStandalone binary (x86_64-pc-windows-gnu)job runs) -- zero warnings, was 12 before.cargo build --workspace,cargo clippy --workspace --all-targets -- -D warnings,cargo fmt --all --checkon the native target all clean.cargo test --workspace(1102 tests) passes -- no behavior change, this is purely attribute annotations.🤖 Generated with Claude Code
https://claude.ai/code/session_01Godbk9UDW5obqYsdkXkyRR