btrfs: replace BUILD_BUG_ON by static_assert
authorDavid Sterba <dsterba@suse.com>
Tue, 1 Feb 2022 14:42:07 +0000 (15:42 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 28 Feb 2022 15:19:50 +0000 (16:19 +0100)
commit3bf5f8785235da89fa0ffd161e0dbeba4c1a232d
tree4efce0b413e04e2b477fa79f68daa9f88ca118be
parentdcf5652291f6bfb9e31964b1c1a7270a61bd9fe8
btrfs: replace BUILD_BUG_ON by static_assert

The static_assert introduced in 6bab69c65013 ("build_bug.h: add wrapper
for _Static_assert") has been supported by compilers for a long time
(gcc 4.6, clang 3.0) and can be used in header files. We don't need to
put BUILD_BUG_ON to random functions but rather keep it next to the
definition.

The exception here is the UAPI header btrfs_tree.h that could be
potentially included by userspace code and the static assert is not
defined (nor used in any other header).

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/compression.h
fs/btrfs/ctree.h
fs/btrfs/inode.c
fs/btrfs/ioctl.c
fs/btrfs/sysfs.c