All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH mdadm] raid6check.c: fix "misleading-indentation" error
@ 2016-10-25  5:41 renyl
  2016-10-25 12:00 ` Jes Sorensen
  0 siblings, 1 reply; 4+ messages in thread
From: renyl @ 2016-10-25  5:41 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: LKP, Yilong Ren, NeilBrown, linux-raid

From: Yilong Ren <yilongx.ren@intel.com>

To fix the following error info:

root@vm-lkp-nex04-8G-7 /tmp/mdadm# make test
cc -Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -DMAP_DIR=\"/run/mdadm\" -DMAP_FILE=\"map\" -DMDMON_DIR=\"/run/mdadm\" -DFAILED_SLOTS_DIR=\"/run/mdadm/failed-slots\" -DNO_COROSYNC -DNO_DLM -DVERSION=\"3.4-43-g1dcee1c\" -DVERS_DATE="\"06th April 2016\"" -DUSE_PTHREADS -DBINDIR=\"/sbin\"  -c -o raid6check.o raid6check.c
raid6check.c: In function 'manual_repair':
raid6check.c:267:4: error: this 'else' clause does not guard... [-Werror=misleading-indentation]
    else
    ^~~~
raid6check.c:269:5: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'else'
     printf("Repairing D(%d) and P\n", failed_data);
     ^~~~~~
cc1: all warnings being treated as errors
<builtin>: recipe for target 'raid6check.o' failed
make: *** [raid6check.o] Error 1
root@vm-lkp-nex04-8G-7 /tmp/mdadm# 


Cc: NeilBrown <neilb@suse.com>
Cc: linux-raid <linux-raid@vger.kernel.org>
Cc: LKP <lkp@eclists.intel.com>
Signed-off-by: Yilong Ren <yilongx.ren@intel.com>
---
 raid6check.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/raid6check.c b/raid6check.c
index ad7ffe7..acfc9a3 100644
--- a/raid6check.c
+++ b/raid6check.c
@@ -264,9 +264,10 @@ int manual_repair(int chunk_size, int syndrome_disks,
 			int failed_data;
 			if (failed_slot1 == -1)
 				failed_data = failed_slot2;
-			else
+			else {
 				failed_data = failed_slot1;
 				printf("Repairing D(%d) and P\n", failed_data);
+			}
 			raid6_datap_recov(syndrome_disks+2, chunk_size,
 					  failed_data, (uint8_t**)blocks, 1);
 		} else {
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH mdadm] raid6check.c: fix "misleading-indentation" error
  2016-10-25  5:41 [PATCH mdadm] raid6check.c: fix "misleading-indentation" error renyl
@ 2016-10-25 12:00 ` Jes Sorensen
  2016-10-25 13:21   ` Yilong Ren
  2016-10-25 19:50   ` NeilBrown
  0 siblings, 2 replies; 4+ messages in thread
From: Jes Sorensen @ 2016-10-25 12:00 UTC (permalink / raw)
  To: renyl; +Cc: LKP, NeilBrown, linux-raid

renyl <yilongx.ren@intel.com> writes:
> From: Yilong Ren <yilongx.ren@intel.com>
>
> To fix the following error info:
>
> root@vm-lkp-nex04-8G-7 /tmp/mdadm# make test
> cc -Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -DMAP_DIR=\"/run/mdadm\" -DMAP_FILE=\"map\" -DMDMON_DIR=\"/run/mdadm\" -DFAILED_SLOTS_DIR=\"/run/mdadm/failed-slots\" -DNO_COROSYNC -DNO_DLM -DVERSION=\"3.4-43-g1dcee1c\" -DVERS_DATE="\"06th April 2016\"" -DUSE_PTHREADS -DBINDIR=\"/sbin\"  -c -o raid6check.o raid6check.c
> raid6check.c: In function 'manual_repair':
> raid6check.c:267:4: error: this 'else' clause does not guard... [-Werror=misleading-indentation]
>     else
>     ^~~~
> raid6check.c:269:5: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'else'
>      printf("Repairing D(%d) and P\n", failed_data);
>      ^~~~~~
> cc1: all warnings being treated as errors
> <builtin>: recipe for target 'raid6check.o' failed
> make: *** [raid6check.o] Error 1
> root@vm-lkp-nex04-8G-7 /tmp/mdadm# 
>
>
> Cc: NeilBrown <neilb@suse.com>
> Cc: linux-raid <linux-raid@vger.kernel.org>
> Cc: LKP <lkp@eclists.intel.com>
> Signed-off-by: Yilong Ren <yilongx.ren@intel.com>
> ---
>  raid6check.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/raid6check.c b/raid6check.c
> index ad7ffe7..acfc9a3 100644
> --- a/raid6check.c
> +++ b/raid6check.c
> @@ -264,9 +264,10 @@ int manual_repair(int chunk_size, int syndrome_disks,
>  			int failed_data;
>  			if (failed_slot1 == -1)
>  				failed_data = failed_slot2;
> -			else
> +			else {
>  				failed_data = failed_slot1;
>  				printf("Repairing D(%d) and P\n", failed_data);
> +			}
>  			raid6_datap_recov(syndrome_disks+2, chunk_size,
>  					  failed_data, (uint8_t**)blocks, 1);
>  		} else {

Hi,

I suspect this patch is wrong and the code is meant to print in either
case.

Neil?

Cheers,
Jes

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH mdadm] raid6check.c: fix "misleading-indentation" error
  2016-10-25 12:00 ` Jes Sorensen
@ 2016-10-25 13:21   ` Yilong Ren
  2016-10-25 19:50   ` NeilBrown
  1 sibling, 0 replies; 4+ messages in thread
From: Yilong Ren @ 2016-10-25 13:21 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: LKP, NeilBrown, linux-raid

On Tue, Oct 25, 2016 at 08:00:01AM -0400, Jes Sorensen wrote:
> renyl <yilongx.ren@intel.com> writes:
> > From: Yilong Ren <yilongx.ren@intel.com>
> >
> > To fix the following error info:
> >
> > root@vm-lkp-nex04-8G-7 /tmp/mdadm# make test
> > cc -Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -DMAP_DIR=\"/run/mdadm\" -DMAP_FILE=\"map\" -DMDMON_DIR=\"/run/mdadm\" -DFAILED_SLOTS_DIR=\"/run/mdadm/failed-slots\" -DNO_COROSYNC -DNO_DLM -DVERSION=\"3.4-43-g1dcee1c\" -DVERS_DATE="\"06th April 2016\"" -DUSE_PTHREADS -DBINDIR=\"/sbin\"  -c -o raid6check.o raid6check.c
> > raid6check.c: In function 'manual_repair':
> > raid6check.c:267:4: error: this 'else' clause does not guard... [-Werror=misleading-indentation]
> >     else
> >     ^~~~
> > raid6check.c:269:5: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'else'
> >      printf("Repairing D(%d) and P\n", failed_data);
> >      ^~~~~~
> > cc1: all warnings being treated as errors
> > <builtin>: recipe for target 'raid6check.o' failed
> > make: *** [raid6check.o] Error 1
> > root@vm-lkp-nex04-8G-7 /tmp/mdadm# 
> >
> >
> > Cc: NeilBrown <neilb@suse.com>
> > Cc: linux-raid <linux-raid@vger.kernel.org>
> > Cc: LKP <lkp@eclists.intel.com>
> > Signed-off-by: Yilong Ren <yilongx.ren@intel.com>
> > ---
> >  raid6check.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/raid6check.c b/raid6check.c
> > index ad7ffe7..acfc9a3 100644
> > --- a/raid6check.c
> > +++ b/raid6check.c
> > @@ -264,9 +264,10 @@ int manual_repair(int chunk_size, int syndrome_disks,
> >  			int failed_data;
> >  			if (failed_slot1 == -1)
> >  				failed_data = failed_slot2;
> > -			else
> > +			else {
> >  				failed_data = failed_slot1;
> >  				printf("Repairing D(%d) and P\n", failed_data);
> > +			}
> >  			raid6_datap_recov(syndrome_disks+2, chunk_size,
> >  					  failed_data, (uint8_t**)blocks, 1);
> >  		} else {
> 
> Hi,
> 
> I suspect this patch is wrong and the code is meant to print in either
> case.

Oops, should like below:


diff --git a/raid6check.c b/raid6check.c
index ad7ffe7..551f835 100644
--- a/raid6check.c
+++ b/raid6check.c
@@ -266,7 +266,8 @@ int manual_repair(int chunk_size, int syndrome_disks,
                                failed_data = failed_slot2;
                        else
                                failed_data = failed_slot1;
-                               printf("Repairing D(%d) and P\n", failed_data);
+
+                       printf("Repairing D(%d) and P\n", failed_data);
                        raid6_datap_recov(syndrome_disks+2, chunk_size,
                                          failed_data, (uint8_t**)blocks, 1);
                } else {
--

will send v2 after Neil confirm this point, thanks.

> 
> Neil?
> 
> Cheers,
> Jes

-- 
Thanks
Ren Yilong

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH mdadm] raid6check.c: fix "misleading-indentation" error
  2016-10-25 12:00 ` Jes Sorensen
  2016-10-25 13:21   ` Yilong Ren
@ 2016-10-25 19:50   ` NeilBrown
  1 sibling, 0 replies; 4+ messages in thread
From: NeilBrown @ 2016-10-25 19:50 UTC (permalink / raw)
  To: Jes Sorensen, renyl; +Cc: LKP, linux-raid

[-- Attachment #1: Type: text/plain, Size: 2517 bytes --]

On Tue, Oct 25 2016, Jes Sorensen wrote:

> renyl <yilongx.ren@intel.com> writes:
>> From: Yilong Ren <yilongx.ren@intel.com>
>>
>> To fix the following error info:
>>
>> root@vm-lkp-nex04-8G-7 /tmp/mdadm# make test
>> cc -Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -DMAP_DIR=\"/run/mdadm\" -DMAP_FILE=\"map\" -DMDMON_DIR=\"/run/mdadm\" -DFAILED_SLOTS_DIR=\"/run/mdadm/failed-slots\" -DNO_COROSYNC -DNO_DLM -DVERSION=\"3.4-43-g1dcee1c\" -DVERS_DATE="\"06th April 2016\"" -DUSE_PTHREADS -DBINDIR=\"/sbin\"  -c -o raid6check.o raid6check.c
>> raid6check.c: In function 'manual_repair':
>> raid6check.c:267:4: error: this 'else' clause does not guard... [-Werror=misleading-indentation]
>>     else
>>     ^~~~
>> raid6check.c:269:5: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'else'
>>      printf("Repairing D(%d) and P\n", failed_data);
>>      ^~~~~~
>> cc1: all warnings being treated as errors
>> <builtin>: recipe for target 'raid6check.o' failed
>> make: *** [raid6check.o] Error 1
>> root@vm-lkp-nex04-8G-7 /tmp/mdadm# 
>>
>>
>> Cc: NeilBrown <neilb@suse.com>
>> Cc: linux-raid <linux-raid@vger.kernel.org>
>> Cc: LKP <lkp@eclists.intel.com>
>> Signed-off-by: Yilong Ren <yilongx.ren@intel.com>
>> ---
>>  raid6check.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/raid6check.c b/raid6check.c
>> index ad7ffe7..acfc9a3 100644
>> --- a/raid6check.c
>> +++ b/raid6check.c
>> @@ -264,9 +264,10 @@ int manual_repair(int chunk_size, int syndrome_disks,
>>  			int failed_data;
>>  			if (failed_slot1 == -1)
>>  				failed_data = failed_slot2;
>> -			else
>> +			else {
>>  				failed_data = failed_slot1;
>>  				printf("Repairing D(%d) and P\n", failed_data);
>> +			}
>>  			raid6_datap_recov(syndrome_disks+2, chunk_size,
>>  					  failed_data, (uint8_t**)blocks, 1);
>>  		} else {
>
> Hi,
>
> I suspect this patch is wrong and the code is meant to print in either
> case.
>
> Neil?

Looking at the whole 

	if (failed_slot1 == -2 || failed_slot2 == -2) {

statement it looks like every path through should print a message, and
this section would be more similar to the previous section if, as you
say, the code prints in either case.

So I agree: original code is correct, indentation is wrong.

NeilBrown

>
> Cheers,
> Jes

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-10-25 19:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-25  5:41 [PATCH mdadm] raid6check.c: fix "misleading-indentation" error renyl
2016-10-25 12:00 ` Jes Sorensen
2016-10-25 13:21   ` Yilong Ren
2016-10-25 19:50   ` NeilBrown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.