forked from libarchive/libarchive
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make single bit bitfields unsigned to avoid clang 16 warning (libarch…
…ive#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. (cherry picked from commit f180dca)
- Loading branch information
1 parent
6c33011
commit 14ec55f
Showing
3 changed files
with
10 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,7 +165,7 @@ struct file { | |
mode_t mode; | ||
uint32_t crc32; | ||
|
||
signed int dir:1; | ||
unsigned dir:1; | ||
}; | ||
|
||
struct _7zip { | ||
|
This file contains 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
This file contains 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