diff options
author | Jeff Mahoney <jeffm@jeffreymahoney.com> | 2009-06-17 19:26:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-18 16:03:46 -0400 |
commit | 1d965fe0eb435b3f9a10538815f6a68de0aef03c (patch) | |
tree | 67859aad430ba6e83be86ad227b704d31e0a818e /include/linux/reiserfs_fs.h | |
parent | 37044c86baf8cb894c69bb811e35a7f6f6dbce1c (diff) |
reiserfs: fix warnings with gcc 4.4
Several code paths in reiserfs have a construct like:
if (is_direntry_le_ih(ih = B_N_PITEM_HEAD(src, item_num))) ...
which, in addition to being ugly, end up causing compiler warnings with
gcc 4.4.0. Previous compilers didn't issue a warning.
fs/reiserfs/do_balan.c:1273: warning: operation on `aux_ih' may be undefined
fs/reiserfs/lbalance.c:393: warning: operation on `ih' may be undefined
fs/reiserfs/lbalance.c:421: warning: operation on `ih' may be undefined
fs/reiserfs/lbalance.c:777: warning: operation on `ih' may be undefined
I believe this is due to the ih being passed to macros which evaluate the
argument more than once. This is old code and we haven't seen any
problems with it, but this patch eliminates the warnings.
It converts the multiple evaluation macros to static inlines and does a
preassignment for the cases that were causing the warnings because that
code is just ugly.
Reported-by: Chris Mason <mason@oracle.com>
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/reiserfs_fs.h')
-rw-r--r-- | include/linux/reiserfs_fs.h | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index 2245c78d5876..dd31e7bae35c 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
@@ -660,23 +660,54 @@ static inline void set_le_key_k_type(int version, struct reiserfs_key *key, | |||
660 | cpu_to_le32(type2uniqueness(type))) | 660 | cpu_to_le32(type2uniqueness(type))) |
661 | : (void)(set_offset_v2_k_type(&(key->u.k_offset_v2), type)); | 661 | : (void)(set_offset_v2_k_type(&(key->u.k_offset_v2), type)); |
662 | } | 662 | } |
663 | |||
663 | static inline void set_le_ih_k_type(struct item_head *ih, int type) | 664 | static inline void set_le_ih_k_type(struct item_head *ih, int type) |
664 | { | 665 | { |
665 | set_le_key_k_type(ih_version(ih), &(ih->ih_key), type); | 666 | set_le_key_k_type(ih_version(ih), &(ih->ih_key), type); |
666 | } | 667 | } |
667 | 668 | ||
668 | #define is_direntry_le_key(version,key) (le_key_k_type (version, key) == TYPE_DIRENTRY) | 669 | static inline int is_direntry_le_key(int version, struct reiserfs_key *key) |
669 | #define is_direct_le_key(version,key) (le_key_k_type (version, key) == TYPE_DIRECT) | 670 | { |
670 | #define is_indirect_le_key(version,key) (le_key_k_type (version, key) == TYPE_INDIRECT) | 671 | return le_key_k_type(version, key) == TYPE_DIRENTRY; |
671 | #define is_statdata_le_key(version,key) (le_key_k_type (version, key) == TYPE_STAT_DATA) | 672 | } |
673 | |||
674 | static inline int is_direct_le_key(int version, struct reiserfs_key *key) | ||
675 | { | ||
676 | return le_key_k_type(version, key) == TYPE_DIRECT; | ||
677 | } | ||
678 | |||
679 | static inline int is_indirect_le_key(int version, struct reiserfs_key *key) | ||
680 | { | ||
681 | return le_key_k_type(version, key) == TYPE_INDIRECT; | ||
682 | } | ||
683 | |||
684 | static inline int is_statdata_le_key(int version, struct reiserfs_key *key) | ||
685 | { | ||
686 | return le_key_k_type(version, key) == TYPE_STAT_DATA; | ||
687 | } | ||
672 | 688 | ||
673 | // | 689 | // |
674 | // item header has version. | 690 | // item header has version. |
675 | // | 691 | // |
676 | #define is_direntry_le_ih(ih) is_direntry_le_key (ih_version (ih), &((ih)->ih_key)) | 692 | static inline int is_direntry_le_ih(struct item_head *ih) |
677 | #define is_direct_le_ih(ih) is_direct_le_key (ih_version (ih), &((ih)->ih_key)) | 693 | { |
678 | #define is_indirect_le_ih(ih) is_indirect_le_key (ih_version(ih), &((ih)->ih_key)) | 694 | return is_direntry_le_key(ih_version(ih), &ih->ih_key); |
679 | #define is_statdata_le_ih(ih) is_statdata_le_key (ih_version (ih), &((ih)->ih_key)) | 695 | } |
696 | |||
697 | static inline int is_direct_le_ih(struct item_head *ih) | ||
698 | { | ||
699 | return is_direct_le_key(ih_version(ih), &ih->ih_key); | ||
700 | } | ||
701 | |||
702 | static inline int is_indirect_le_ih(struct item_head *ih) | ||
703 | { | ||
704 | return is_indirect_le_key(ih_version(ih), &ih->ih_key); | ||
705 | } | ||
706 | |||
707 | static inline int is_statdata_le_ih(struct item_head *ih) | ||
708 | { | ||
709 | return is_statdata_le_key(ih_version(ih), &ih->ih_key); | ||
710 | } | ||
680 | 711 | ||
681 | // | 712 | // |
682 | // key is pointer to cpu key, result is cpu | 713 | // key is pointer to cpu key, result is cpu |