-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.os-windowsMicrosoft WindowsMicrosoft Windows
Milestone
Description
I noticed a bunch of warnings with respect to -Wsingle-bit-bitfield-constant-conversion when building C code with latest zig master (4374ce5). These warnings originated from the mingw code within zig (see the snippet below).
zig/lib/libc/mingw/stdio/mingw_wvfscanf.c
Line 93 in 4374ce5
| int seen_eof : 1; |
Was another way to embed mingw evaluated?
Although the runtime for this specific case is not an issue, but the incorrect code in mingw was fixed at
https://github.com/mirror/mingw-w64/blob/eff726c461e09f35eeaed125a3570fa5f807f02b/mingw-w64-crt/stdio/mingw_wvfscanf.c#L84-L94
typedef struct _IFP
{
__extension__ union {
void *fp;
const wchar_t *str;
};
int bch[1024];
unsigned int is_string : 1;
int back_top;
unsigned int seen_eof : 1; /* changed to unsigned from int earlier */
} _IFP;Logs for reference
Compile C Objects [132/406] mingw_pformatw.c... D:\Work\git\ziglang\zig\stage3\lib\zig\libc\mingw\stdio\mingw_wvfscanf.c:167:17: warning: implicit truncation from 'int'
to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
s->seen_eof = 1;
Compile C Objects [140/406] lltow.c... ^ ~
D:\Work\git\ziglang\zig\stage3\lib\zig\libc\mingw\stdio\mingw_wvfscanf.c:176:22: warning: implicit truncation from 'int'
to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
else s->seen_eof = 1;
^ ~
An interesting reference on -Wsingle-bit-bitfield-constant-conversion is at llvm/llvm-project#53253 for educational purposes.
g012
Metadata
Metadata
Assignees
Labels
enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.os-windowsMicrosoft WindowsMicrosoft Windows