Make btrfs-progs compile with -fstrict-aliasing (included in -O2) again.

This is done by doing a two-step conversion (rather than a one-step).
First, the variable goes from type * to void *, and then to
implicitly to void **.
(Not sure if this is "good practice", but it shuts up the compiler,
so it seems the compiler takes into account that we are actually punning
it this way.)
This commit is contained in:
Jan Engelhardt 2007-09-14 10:31:06 -04:00 committed by David Woodhouse
parent 8454d619a7
commit ddcaa0171a
4 changed files with 8 additions and 8 deletions

View File

@ -186,7 +186,7 @@ int find_first_radix_bit(struct radix_tree_root *radix, unsigned long *retbits,
unsigned long slot;
slot = start / BIT_RADIX_BITS_PER_ARRAY;
ret = radix_tree_gang_lookup(radix, (void **)gang, slot,
ret = radix_tree_gang_lookup(radix, (void *)gang, slot,
ARRAY_SIZE(gang));
found = start % BIT_RADIX_BITS_PER_ARRAY;
for (i = 0; i < ret && nr > 0; i++) {

View File

@ -420,7 +420,7 @@ int check_extent_refs(struct btrfs_root *root,
int err = 0;
while(1) {
ret = radix_tree_gang_lookup(extent_radix, (void **)rec, 0,
ret = radix_tree_gang_lookup(extent_radix, (void *)rec, 0,
ARRAY_SIZE(rec));
if (!ret)
break;

View File

@ -164,7 +164,7 @@ int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans,
btrfs_init_path(&path);
while(1) {
ret = radix_tree_gang_lookup_tag(radix, (void **)cache,
ret = radix_tree_gang_lookup_tag(radix, (void *)cache,
0, ARRAY_SIZE(cache),
BTRFS_BLOCK_GROUP_DIRTY);
if (!ret)
@ -195,7 +195,7 @@ static int update_block_group(struct btrfs_trans_handle *trans,
while(total) {
ret = radix_tree_gang_lookup(&info->block_group_radix,
(void **)&cache, blocknr, 1);
(void *)&cache, blocknr, 1);
if (!ret)
return -1;
radix_tree_tag_set(&info->block_group_radix,
@ -229,7 +229,7 @@ int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans, struct
while(1) {
ret = radix_tree_gang_lookup(&root->fs_info->pinned_radix,
(void **)gang, 0,
(void *)gang, 0,
ARRAY_SIZE(gang));
if (!ret)
break;
@ -362,7 +362,7 @@ static int del_pending_extents(struct btrfs_trans_handle *trans, struct
while(1) {
ret = radix_tree_gang_lookup_tag(
&extent_root->fs_info->cache_radix,
(void **)gang, 0,
(void *)gang, 0,
ARRAY_SIZE(gang),
CTREE_EXTENT_PENDING_DEL);
if (!ret)
@ -738,7 +738,7 @@ int btrfs_free_block_groups(struct btrfs_fs_info *info)
while(1) {
ret = radix_tree_gang_lookup(&info->block_group_radix,
(void **)cache, 0,
(void *)cache, 0,
ARRAY_SIZE(cache));
if (!ret)
break;

View File

@ -314,7 +314,7 @@ static inline void **__lookup_slot(struct radix_tree_root *root,
return NULL;
if (height == 0 && root->rnode)
return (void **)&root->rnode;
return (void *)&root->rnode;
shift = (height-1) * RADIX_TREE_MAP_SHIFT;
slot = &root->rnode;