Skip to contentSkip to conversation

compile warning on master

PATCH Applied Andreas Dilger 4 participants 4 messages May 22, 2014 – May 27, 2014 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CFA1367A.A6C68%[email protected]

#1 lore raw

When compiling with LLVM, it generates the following warning in debugfs::do_lsdel():

367 debugfs/lsdel.c:155 col 23: warning: '&&' within '||' [-Wlogical-op-parentheses]
368: if (lsd.free_blocks && !lsd.bad_blocks ||
369: ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ ~~
370 debugfs/lsdel.c:155 col 23: note: place parentheses around the '&&' expression to silence this warning
371: if (lsd.free_blocks && !lsd.bad_blocks ||
372: ^
373: ( )

Unfortunately, even looking at this code and the patch that changed it, I can't figure out what the correct parenthesis is for it.

Zheng, could you please send a patch to fix this?

Cheers, Andreas

#2 lore raw

PATCH 1/1 debugfs: fix two warning messages when compiling with LLVM (Re: compile warning on master)

Quoted 15 lines · Andreas Dilger

When compiling with LLVM, it generates the following warning in debugfs::do_lsdel():

367 debugfs/lsdel.c:155 col 23: warning: '&&' within '||' [-Wlogical-op-parentheses]
368: if (lsd.free_blocks && !lsd.bad_blocks ||
369: ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ ~~
370 debugfs/lsdel.c:155 col 23: note: place parentheses around the '&&' expression to silence this warning
371: if (lsd.free_blocks && !lsd.bad_blocks ||
372: ^
373: ( )

Quoted 4 lines

Unfortunately, even looking at this code and the patch that changed it, I can't figure out what the correct parenthesis is for it.

Zheng, could you please send a patch to fix this?

Thanks for reporting this. Could you please try the following patch?

Regards,
- Zheng

Subject: [PATCH] debugfs: fix two warning messages when compiling with LLVM

From: Zheng Liu <[email protected]>

This commit fixes two warning messages when compiling with LLVM.

---
 debugfs/lsdel.c          |    2 +-
 lib/ext2fs/inline_data.c |    3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
debugfs/lsdel.c +1 -1
index 5276014..a7c30b3 100644
@@ -152,7 +152,7 @@ void do_lsdel(int argc, char **argv)
 				goto next;
 			}
 		}
-		if (lsd.free_blocks && !lsd.bad_blocks ||
+		if ((lsd.free_blocks && !lsd.bad_blocks) ||
 		    inode.i_flags & EXT4_INLINE_DATA_FL) {
 			if (num_delarray >= max_delarray) {
 				max_delarray += 50;
lib/ext2fs/inline_data.c +1 -2
index 7a81da0..f318b41 100644
@@ -280,10 +280,9 @@ static errcode_t ext2fs_inline_data_convert_dir(ext2_filsys fs, ext2_ino_t ino,
 	struct ext2_dir_entry *dir, *dir2;
 	struct ext2_dir_entry_tail *t;
 	errcode_t retval;
-	unsigned int offset;
+	unsigned int offset, rec_len;
 	int csum_size = 0;
 	int filetype = 0;
-	int rec_len;
 
 	if (EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
 				       EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))
Signature · 1 line
1.7.9.7
Reviewed-by on v1 1/1
#3 lore raw

Re: [PATCH] debugfs: fix two warning messages when compiling with LLVM (Re: compile warning on master)

Quoted 31 lines · Zheng Liu

Date: Mon, 26 May 2014 14:55:08 +0800
From: Zheng Liu <[email protected]>
To: Andreas Dilger <[email protected]>
Cc: Zheng Liu <[email protected]>,
Ext4 Developers List <[email protected]>
Subject: [PATCH] debugfs: fix two warning messages when compiling with LLVM
(Re: compile warning on master)

Quoted 15 lines · Andreas Dilger

When compiling with LLVM, it generates the following warning in debugfs::do_lsdel():

367 debugfs/lsdel.c:155 col 23: warning: '&&' within '||' [-Wlogical-op-parentheses]
368: if (lsd.free_blocks && !lsd.bad_blocks ||
369: ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ ~~
370 debugfs/lsdel.c:155 col 23: note: place parentheses around the '&&' expression to silence this warning
371: if (lsd.free_blocks && !lsd.bad_blocks ||
372: ^
373: ( )

Quoted 4 lines

Unfortunately, even looking at this code and the patch that changed it, I can't figure out what the correct parenthesis is for it.

Zheng, could you please send a patch to fix this?

Thanks for reporting this. Could you please try the following patch?

Quoted 8 lines

Regards,
- Zheng

Subject: [PATCH] debugfs: fix two warning messages when compiling with LLVM

From: Zheng Liu <[email protected]>

This commit fixes two warning messages when compiling with LLVM.

make sense. Thanks!

Quoted 40 lines
---
 debugfs/lsdel.c          |    2 +-
 lib/ext2fs/inline_data.c |    3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
debugfs/lsdel.c +1 -1
index 5276014..a7c30b3 100644
@@ -152,7 +152,7 @@ void do_lsdel(int argc, char **argv)
 				goto next;
 			}
 		}
-		if (lsd.free_blocks && !lsd.bad_blocks ||
+		if ((lsd.free_blocks && !lsd.bad_blocks) ||
 		    inode.i_flags & EXT4_INLINE_DATA_FL) {
 			if (num_delarray >= max_delarray) {
 				max_delarray += 50;
lib/ext2fs/inline_data.c +1 -2
index 7a81da0..f318b41 100644
@@ -280,10 +280,9 @@ static errcode_t ext2fs_inline_data_convert_dir(ext2_filsys fs, ext2_ino_t ino,
 	struct ext2_dir_entry *dir, *dir2;
 	struct ext2_dir_entry_tail *t;
 	errcode_t retval;
-	unsigned int offset;
+	unsigned int offset, rec_len;
 	int csum_size = 0;
 	int filetype = 0;
-	int rec_len;
 
 	if (EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
 				       EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))
#4 lore raw

Re: [PATCH] debugfs: fix two warning messages when compiling with LLVM (Re: compile warning on master)

Quoted 9 lines · Lukáš Czerner
Quoted 5 lines

Subject: [PATCH] debugfs: fix two warning messages when compiling with LLVM

From: Zheng Liu <[email protected]>

This commit fixes two warning messages when compiling with LLVM.

make sense. Thanks!

Applied, thanks.

- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html