HomeFreeBSD

libsa: make single bit bitfields unsigned to avoid clang 16 warning

Description

libsa: make single bit bitfields unsigned to avoid clang 16 warning

Clang 16 introduced a warning about single bit bitfields in structs,
which is triggered by a declaration in libsa's tftp.c:

stand/libsa/tftp.c:382:20: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
                                h->islastblock = 1;     /* very short file */
                                               ^ ~
stand/libsa/tftp.c:432:18: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
                h->islastblock = 1;     /* EOF */
                               ^ ~

Signed one-bit bitfields can only have values -1 and 0, but the intent
here is to use the field as a boolean, so make it unsigned.

MFC after: 3 days

(cherry picked from commit 1a3ccb8f1552977e1b264e3b89d1fba8e717dad8)

Details

Provenance
dimAuthored on Apr 17 2023, 4:15 PM
Parents
rG02a7d117b591: unionfs.5: Use '.An -nosplit' in the AUTHORS section
Branches
Unknown
Tags
Unknown