msvc: drop exception, make BIT() a bitfield with Visual Studio#20142
Closed
vszakats wants to merge 13 commits intocurl:masterfrom
Closed
msvc: drop exception, make BIT() a bitfield with Visual Studio#20142vszakats wants to merge 13 commits intocurl:masterfrom
BIT() a bitfield with Visual Studio#20142vszakats wants to merge 13 commits intocurl:masterfrom
Conversation
BIT() a bitfield
BIT() a bitfieldBIT() a bitfield
BIT() a bitfieldBIT() a bitfield with Visual Studio
a7f1a2a to
daddef4
Compare
..\..\lib\url.c(1368): warning C4242: '=' : conversion from 'bit' to 'unsigned char', possible loss of data https://ci.appveyor.com/project/curlorg/curl/builds/53311748/job/jdbaakbfqagm9149
/home/runner/work/curl/curl/lib/ftp.c:2064:30: error: conversion from ‘bit’ {aka ‘unsigned int’} to ‘unsigned char:1’ may change value [-Werror=conversion]
2064 | data->set.include_header = save;
| ^~~~
https://github.com/curl/curl/actions/runs/20649020582/job/59290673546?pr=20142
…asses without cast)
…penssl passes without cast)" This reverts commit bd4447b.
src\tool_cb_wrt.c(247,23): error C2220: the following warning is treated as an error src\tool_cb_wrt.c(247,23): warning C4242: 'initializing': conversion from 'bit' to 'bool', possible loss of data src\tool_operate.c(1141,32): warning C4242: 'initializing': conversion from 'bit' to 'bool', possible loss of data src\tool_operate.c(1142,28): warning C4242: 'initializing': conversion from 'bit' to 'bool', possible loss of data src\tool_operate.c(2148,32): warning C4242: 'initializing': conversion from 'bit' to 'bool', possible loss of data src\tool_operate.c(2149,28): warning C4242: 'initializing': conversion from 'bit' to 'bool', possible loss of data https://ci.appveyor.com/project/curlorg/curl/builds/53311787/job/yfpcwxuuyl2qq14v
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.
Add casts to
bool, or usebittype in local variables, whereneccessary to avoid MSVC compiler warnings C4242.
Note: There may remain places needing the above updates, where not
tested in CI, and missed in manual review.
Also:
connect_onlyto bitfield to match itscounterpart in another struct.
bittype tocurl_bit.BIT()#20152.bittocurl_bit? [DONE, though maybe move it to separate post-PR, because it changes a few (=5) pre-existing lines and unrelated to this PR stricly speaking.]Also tried switching over
boolarguments tobit, to avoid casts.I expected it to work, but in practice it resulted in GCC warnings,
possibly where the bitfields ended up using different integer types
depending on how many of them were declared next to each other. That's
my guess at least.