mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-14 10:25:27 +00:00
5bee5c99bf
When compiling btrfs-progs on 32bit x86 using GCC 11.1.0, there are several warnings: In file included from ./common/utils.h:30, from check/main.c:36: check/main.c: In function 'run_next_block': ./common/messages.h:42:31: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'u32' {aka 'unsigned int'} [-Wformat=] 42 | __btrfs_error((fmt), ##__VA_ARGS__); \ | ^~~~~ check/main.c:6496:33: note: in expansion of macro 'error' 6496 | error( | ^~~~~ In file included from ./common/utils.h:30, from kernel-shared/volumes.c:32: kernel-shared/volumes.c: In function 'btrfs_check_chunk_valid': ./common/messages.h:42:31: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'u32' {aka 'unsigned int'} [-Wformat=] 42 | __btrfs_error((fmt), ##__VA_ARGS__); \ | ^~~~~ kernel-shared/volumes.c:2052:17: note: in expansion of macro 'error' 2052 | error("invalid chunk item size, have %u expect [%zu, %lu)", | ^~~~~ image/main.c: In function 'search_for_chunk_blocks': ./common/messages.h:42:31: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Wformat=] 42 | __btrfs_error((fmt), ##__VA_ARGS__); \ | ^~~~~ image/main.c:2122:33: note: in expansion of macro 'error' 2122 | error( | ^~~~~ There are two types of problems: - __BTRFS_LEAF_DATA_SIZE() This macro has no type definition, making it behaves differently on different arches. Fix this by following kernel to use inline function to make its return value fixed to u32. - size_t related output For x86_64 %lu is OK but not for x86. Fix this by using %zu. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com> |
||
---|---|---|
.. | ||
main.c | ||
Makefile | ||
metadump.h | ||
sanitize.c | ||
sanitize.h |