build: enable -Wlogical-op picky warning for GCC 4.4+#21893
Closed
vszakats wants to merge 1 commit into
Closed
Conversation
This comment has been minimized.
This comment has been minimized.
3 tasks
vszakats
added a commit
that referenced
this pull request
Jun 12, 2026
To contain the logic of checking for both `EWOULDBLOCK` and/or `EAGAIN` depending on platform/availability. Also to avoid checking for both if they mapp to the same value, and to avoid PP guards around use. This also ensures `EAGAIN` is consistently not checked on Windows, where headers defined it, but `SOCKERRNO` never returns it, because curl maps it to `WSAGetLastError()`. If they map to the same value, checking them both in an `if` expression trips GCC warning `-Wlogical-op` (the same way it triggers duplicate case value error in `switch`). Also: - replace two `switch()` statements with the new macro. - tests/server/sws: make two outliers use the new macro that were only checking for `EWOULDBLOCK` before this patch, in `connect_to()`. - move variables to the left-side of expressions, where missing. - rustls: use a variant of this macro that uses raw `EWOULDBLOCK`. Tried tracing it back to the origins, but I couldn't figure out if this is working as expected on all supported Windows versions in Rust. It seems to be using `GetLastError()`, according to https://docs.rs/system_error/0.2.0/system_error/, which would be probably incorrect. Notes: - it's probably a good idea to assign `SOCKERRNO` to a variable before passing it to this macro. Cherry-picked from #21893 Closes #21992
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.
Follow-up to 879a151 #21992
SOCK_EAGAIN()and use it #21992SOCK_EAGAIN()and use it #21992