]> git.ipfire.org Git - thirdparty/libarchive.git/commit
Make single bit bitfields unsigned to avoid clang 16 warning (#1860)
authorDimitry Andric <dimitry@andric.com>
Tue, 18 Apr 2023 00:59:32 +0000 (02:59 +0200)
committerGitHub <noreply@github.com>
Tue, 18 Apr 2023 00:59:32 +0000 (17:59 -0700)
commitf180dcab3321149ef348e9899737db29eeaaecf0
tree3549b229a2bbb5be90786a2fb8e3908cdadb30f1
parentaa09163691b955812a269451d1401435a09832d9
Make single bit bitfields unsigned to avoid clang 16 warning (#1860)

Clang 16 introduced a warning about single bit bitfields in structs,
which is triggered by a few libarchive formats:

libarchive/archive_write_set_format_7zip.c:1541:13: error: implicit
truncation from 'int' to a one-bit wide bit-field changes value from 1
to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
                    file->dir = 1;
                              ^ ~

This is because single bit bitfields only support values -1 and 0, if
they are signed.

For bitfields with two or more bits this can be intentional, but single
bit bitfields are typically used as booleans, so it is better to make
them unsigned.
libarchive/archive_write_set_format_7zip.c
libarchive/archive_write_set_format_iso9660.c
libarchive/archive_write_set_format_xar.c