aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2023-04-17 16:15:57 +0000
committerDimitry Andric <dim@FreeBSD.org>2023-04-22 08:58:48 +0000
commit01bdf9acd2581b92ad0d7215c7cd744a2533346b (patch)
tree16b501f9c98839ef18b10540e65c9ca0a2ddcf86
parent02a7d117b5914dd8c42b8d98fe92faca381148bd (diff)
downloadsrc-01bdf9acd2581b92ad0d7215c7cd744a2533346b.tar.gz
src-01bdf9acd2581b92ad0d7215c7cd744a2533346b.zip
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)
-rw-r--r--stand/libsa/tftp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/stand/libsa/tftp.c b/stand/libsa/tftp.c
index 903537b4bbe5..f1e056da3561 100644
--- a/stand/libsa/tftp.c
+++ b/stand/libsa/tftp.c
@@ -106,8 +106,8 @@ static int is_open = 0;
struct tftp_handle {
struct iodesc *iodesc;
int currblock; /* contents of lastdata */
- int islastblock:1; /* flag */
- int tries:4; /* number of read attempts */
+ unsigned int islastblock:1; /* flag */
+ unsigned int tries:4; /* number of read attempts */
int validsize;
int off;
char *path; /* saved for re-requests */