Skip to contentSkip to conversation

reiserfs: Fix warnings with gcc 4.4

PATCH New Jeff Mahoney 1 participant 1 message Jun 8, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 fs/reiserfs/do_balan.c      |    5 +---
 fs/reiserfs/lbalance.c      |   10 +++++----
 include/linux/reiserfs_fs.h |   47 ++++++++++++++++++++++++++++++++++++--------
 3 files changed, 47 insertions(+), 15 deletions(-)
fs/reiserfs/do_balan.c +2 -3
@@ -1270,9 +1270,8 @@ static int balance_leaf(struct tree_bala
 
 					RFALSE(ih, "PAP-12210: ih must be 0");
 
-					if (is_direntry_le_ih
-					    (aux_ih =
-					     B_N_PITEM_HEAD(tbS0, item_pos))) {
+					aux_ih = B_N_PITEM_HEAD(tbS0, item_pos);
+					if (is_direntry_le_ih(aux_ih)) {
 						/* we append to directory item */
 
 						int entry_count;
fs/reiserfs/lbalance.c +6 -4
@@ -390,7 +390,8 @@ static void leaf_item_bottle(struct buff
 
 	if (last_first == FIRST_TO_LAST) {
 		/* if ( if item in position item_num in buffer SOURCE is directory item ) */
-		if (is_direntry_le_ih(ih = B_N_PITEM_HEAD(src, item_num)))
+		ih = B_N_PITEM_HEAD(src, item_num);
+		if (is_direntry_le_ih(ih))
 			leaf_copy_dir_entries(dest_bi, src, FIRST_TO_LAST,
 					      item_num, 0, cpy_bytes);
 		else {
@@ -418,7 +419,8 @@ static void leaf_item_bottle(struct buff
 		}
 	} else {
 		/*  if ( if item in position item_num in buffer SOURCE is directory item ) */
-		if (is_direntry_le_ih(ih = B_N_PITEM_HEAD(src, item_num)))
+		ih = B_N_PITEM_HEAD(src, item_num);
+		if (is_direntry_le_ih(ih))
 			leaf_copy_dir_entries(dest_bi, src, LAST_TO_FIRST,
 					      item_num,
 					      I_ENTRY_COUNT(ih) - cpy_bytes,
@@ -774,8 +776,8 @@ void leaf_delete_items(struct buffer_inf
 			leaf_delete_items_entirely(cur_bi, first + 1,
 						   del_num - 1);
 
-			if (is_direntry_le_ih
-			    (ih = B_N_PITEM_HEAD(bh, B_NR_ITEMS(bh) - 1)))
+			ih = B_N_PITEM_HEAD(bh, B_NR_ITEMS(bh) - 1);
+			if (is_direntry_le_ih(ih))
 				/* the last item is directory  */
 				/* len = numbers of directory entries in this item */
 				len = ih_entry_count(ih);
include/linux/reiserfs_fs.h +39 -8

62 lines not on this page · raw message

Signature · 5 lines
Jeff Mahoney
--
To unsubscribe from this list: send the line "unsubscribe reiserfs-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html