Skip to content

bsdsocket: silence Windows dead_code warnings (#61) - #165

Merged
sidick merged 1 commit into
mainfrom
fix-61-windows-dead-code-warnings
Oct 18, 2026
Merged

sidick merged 1 commit into
mainfrom
fix-61-windows-dead-code-warnings

Conversation

@sidick

@sidick sidick commented Oct 18, 2026

Copy link
Copy Markdown
Owner

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, and BsdSocketState::servent_allocs/protoent_allocs.

All of them are real -- every non-test use site is inside a #[cfg(unix)] function (wait_select_poll's real poll(2)-based half, ioctl_socket_handler's FIONREAD branch, build_servent/build_protoent), so a Windows build genuinely never reaches them. FD_OOB already 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 command ci.yml's Standalone 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 --check on 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

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
@sidick
sidick merged commit 0ccf437 into main Oct 18, 2026
9 checks passed
@sidick
sidick deleted the fix-61-windows-dead-code-warnings branch October 18, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows build emits dead_code warnings for Unix-only bsdsocket.rs items

1 participant