build: silence -Wsign-conversion in FD_SET()/FD_ISSET()#13896
Closed
vszakats wants to merge 8 commits intocurl:masterfrom
Closed
build: silence -Wsign-conversion in FD_SET()/FD_ISSET()#13896vszakats wants to merge 8 commits intocurl:masterfrom
-Wsign-conversion in FD_SET()/FD_ISSET()#13896vszakats wants to merge 8 commits intocurl:masterfrom
Conversation
Seen on Alpine MUSL.
```
multi.c:1201:9: error: conversion to 'long unsigned int' from 'curl_socket_t' {aka 'int'} may change the sign of the result [-Werror=sign-conversion]
1201 | FD_SET(ps.sockets[i], read_fd_set);
| ^~~~~~
multi.c:1201:9: error: conversion to 'long unsigned int' from 'curl_socket_t' {aka 'int'} may change the sign of the result [-Werror=sign-conversion]
multi.c:1203:9: error: conversion to 'long unsigned int' from 'curl_socket_t' {aka 'int'} may change the sign of the result [-Werror=sign-conversion]
1203 | FD_SET(ps.sockets[i], write_fd_set);
| ^~~~~~
multi.c:1203:9: error: conversion to 'long unsigned int' from 'curl_socket_t' {aka 'int'} may change the sign of the result [-Werror=sign-conversion]
```
Ref: https://github.com/curl/curl/actions/runs/8867959370/job/24347027402?pr=13489#step:31:373
Member
Author
|
Should this one remain or be deleted? It's a pattern already done in examples. |
Member
|
I think this is another sign-conversion warning that does not help us and where the fix makes the code harder to read. |
Member
Author
|
What about the pre-existing suppression in the example |
Member
Author
Any guidance on that? Perhaps we want to keep doing this in examples because people with |
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.
Silence toolchain bugs causing warnings in
FD_SET()/FD_ISSET()calls.Seen with older Cygwin/MSYS2 builds. Likely fixed on 2020-08-03 by:
https://cygwin.com/git/?p=newlib-cygwin.git;a=commitdiff;h=5717262b8ecfed0f7fab63e2c09c78991e36f9dd
Also seen on Alpine MUSL:
Ref: https://github.com/curl/curl/actions/runs/8867959370/job/24347027402?pr=13489#step:31:373
And on OmniOS:
Ref: https://github.com/libssh2/libssh2/actions/runs/8854199687/job/24316762831#step:3:2021
Ref: 5b9955e #13501
Ref: 95a882d #12557
Cherry-picked from #13489
Closes #13896
The fix is ugly.
Perhaps creating a macro for it would be nicer, and then putting the original ones on the checksrc blocklist.[macro will not work, wrapper function problematic to match types, and performance.]