Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1290250 > unrolled thread

[PATCH] Fix misleading indentation issues in perf

Started byMarkus Trippelsdorf <markus@trippelsdorf.de>
First post2015-12-12 19:10 +0100
Last post2015-12-14 19:00 +0100
Articles 8 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] Fix misleading indentation issues in perf Markus Trippelsdorf <markus@trippelsdorf.de> - 2015-12-12 19:10 +0100
    Re: [PATCH] Fix misleading indentation issues in perf Ingo Molnar <mingo@kernel.org> - 2015-12-14 09:30 +0100
    Re: [PATCH] Fix misleading indentation issues in perf Matt Fleming <matt@codeblueprint.co.uk> - 2015-12-14 11:50 +0100
      Re: [PATCH] Fix misleading indentation issues in perf Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-12-14 16:20 +0100
        [PATCH 3/3] Fix misleadingly indented assignment (whitespace) Markus Trippelsdorf <markus@trippelsdorf.de> - 2015-12-14 16:50 +0100
        [PATCH 2/3] Add missing braces to if statement Markus Trippelsdorf <markus@trippelsdorf.de> - 2015-12-14 16:50 +0100
        [PATCH 1/3] Remove wrong semicolon in while loop Markus Trippelsdorf <markus@trippelsdorf.de> - 2015-12-14 16:50 +0100
          Re: [PATCH 1/3] Remove wrong semicolon in while loop Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-12-14 19:00 +0100

#1290250 — [PATCH] Fix misleading indentation issues in perf

FromMarkus Trippelsdorf <markus@trippelsdorf.de>
Date2015-12-12 19:10 +0100
Subject[PATCH] Fix misleading indentation issues in perf
Message-ID<qEWMi-5yY-1@gated-at.bofh.it>
perf doesn't build with gcc-6 because of several misleading-indentation
warnings, e.g.:

arch/x86/tests/intel-cqm.c: In function ‘spawn’:
arch/x86/tests/intel-cqm.c:21:3: error: statement is indented as if it were guarded by... [-Werror=misleading-indentation]
   sleep(5);
   ^~~~~

arch/x86/tests/intel-cqm.c:20:2: note: ...this ‘while’ clause, but it is not
  while(1);
  ^~~~~

Signed-off-by: Markus Trippelsdorf <markus@trippelsdorf.de>

diff --git a/tools/perf/arch/x86/tests/intel-cqm.c b/tools/perf/arch/x86/tests/intel-cqm.c
index d28c1b6a3b54..fa5d17af88b7 100644
--- a/tools/perf/arch/x86/tests/intel-cqm.c
+++ b/tools/perf/arch/x86/tests/intel-cqm.c
@@ -17,7 +17,7 @@ static pid_t spawn(void)
 	if (pid)
 		return pid;
 
-	while(1);
+	while(1)
 		sleep(5);
 	return 0;
 }
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index d4d7cc27252f..718bd46d47fa 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -755,11 +755,11 @@ static int annotate_browser__run(struct annotate_browser *browser,
 				nd = browser->curr_hot;
 			break;
 		case K_UNTAB:
-			if (nd != NULL)
+			if (nd != NULL) {
 				nd = rb_next(nd);
 				if (nd == NULL)
 					nd = rb_first(&browser->entries);
-			else
+			} else
 				nd = browser->curr_hot;
 			break;
 		case K_F1:
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index e4b173dec4b9..c900b664ab8f 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -153,7 +153,7 @@ static int perf_pmu__parse_unit(struct perf_pmu_alias *alias, char *dir, char *n
 	if (fd == -1)
 		return -1;
 
-		sret = read(fd, alias->unit, UNIT_MAX_LEN);
+	sret = read(fd, alias->unit, UNIT_MAX_LEN);
 	if (sret < 0)
 		goto error;
 
-- 
Markus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1290947

FromIngo Molnar <mingo@kernel.org>
Date2015-12-14 09:30 +0100
Message-ID<qFwG7-3zr-39@gated-at.bofh.it>
In reply to#1290250
* Markus Trippelsdorf <markus@trippelsdorf.de> wrote:

> perf doesn't build with gcc-6 because of several misleading-indentation
> warnings, e.g.:
> 
> arch/x86/tests/intel-cqm.c: In function ‘spawn’:
> arch/x86/tests/intel-cqm.c:21:3: error: statement is indented as if it were guarded by... [-Werror=misleading-indentation]
>    sleep(5);
>    ^~~~~
> 
> arch/x86/tests/intel-cqm.c:20:2: note: ...this ‘while’ clause, but it is not
>   while(1);
>   ^~~~~

Nice warnings!

> diff --git a/tools/perf/arch/x86/tests/intel-cqm.c b/tools/perf/arch/x86/tests/intel-cqm.c
> index d28c1b6a3b54..fa5d17af88b7 100644
> --- a/tools/perf/arch/x86/tests/intel-cqm.c
> +++ b/tools/perf/arch/x86/tests/intel-cqm.c
> @@ -17,7 +17,7 @@ static pid_t spawn(void)
>  	if (pid)
>  		return pid;
>  
> -	while(1);
> +	while(1)
>  		sleep(5);

looks like it caught a real bug here.


>  		case K_UNTAB:
> -			if (nd != NULL)
> +			if (nd != NULL) {
>  				nd = rb_next(nd);
>  				if (nd == NULL)
>  					nd = rb_first(&browser->entries);
> -			else
> +			} else
>  				nd = browser->curr_hot;
>  			break;

That looks like a real bug as well AFAICS.

>  		case K_F1:
> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> index e4b173dec4b9..c900b664ab8f 100644
> --- a/tools/perf/util/pmu.c
> +++ b/tools/perf/util/pmu.c
> @@ -153,7 +153,7 @@ static int perf_pmu__parse_unit(struct perf_pmu_alias *alias, char *dir, char *n
>  	if (fd == -1)
>  		return -1;
>  
> -		sret = read(fd, alias->unit, UNIT_MAX_LEN);
> +	sret = read(fd, alias->unit, UNIT_MAX_LEN);
>  	if (sret < 0)
>  		goto error;

This is just whitespace noise, but annoying.

Cool compiler feature.

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1291105

FromMatt Fleming <matt@codeblueprint.co.uk>
Date2015-12-14 11:50 +0100
Message-ID<qFyRB-4Xv-39@gated-at.bofh.it>
In reply to#1290250
On Sat, 12 Dec, at 07:07:02PM, Markus Trippelsdorf wrote:
> perf doesn't build with gcc-6 because of several misleading-indentation
> warnings, e.g.:
> 
> arch/x86/tests/intel-cqm.c: In function ‘spawn’:
> arch/x86/tests/intel-cqm.c:21:3: error: statement is indented as if it were guarded by... [-Werror=misleading-indentation]
>    sleep(5);
>    ^~~~~
> 
> arch/x86/tests/intel-cqm.c:20:2: note: ...this ‘while’ clause, but it is not
>   while(1);
>   ^~~~~
> 
> Signed-off-by: Markus Trippelsdorf <markus@trippelsdorf.de>
> 
> diff --git a/tools/perf/arch/x86/tests/intel-cqm.c b/tools/perf/arch/x86/tests/intel-cqm.c
> index d28c1b6a3b54..fa5d17af88b7 100644
> --- a/tools/perf/arch/x86/tests/intel-cqm.c
> +++ b/tools/perf/arch/x86/tests/intel-cqm.c
> @@ -17,7 +17,7 @@ static pid_t spawn(void)
>  	if (pid)
>  		return pid;
>  
> -	while(1);
> +	while(1)
>  		sleep(5);
>  	return 0;
>  }

Whoops. Good catch.

Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1291263

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-12-14 16:20 +0100
Message-ID<qFD4T-7Rv-31@gated-at.bofh.it>
In reply to#1291105
Em Mon, Dec 14, 2015 at 10:46:07AM +0000, Matt Fleming escreveu:
> On Sat, 12 Dec, at 07:07:02PM, Markus Trippelsdorf wrote:
> > perf doesn't build with gcc-6 because of several misleading-indentation
> > warnings, e.g.:
> > 
> > arch/x86/tests/intel-cqm.c: In function ‘spawn’:
> > arch/x86/tests/intel-cqm.c:21:3: error: statement is indented as if it were guarded by... [-Werror=misleading-indentation]
> >    sleep(5);
> >    ^~~~~
> > 
> > arch/x86/tests/intel-cqm.c:20:2: note: ...this ‘while’ clause, but it is not
> >   while(1);
> >   ^~~~~
> > 
> > Signed-off-by: Markus Trippelsdorf <markus@trippelsdorf.de>
> > 
> > diff --git a/tools/perf/arch/x86/tests/intel-cqm.c b/tools/perf/arch/x86/tests/intel-cqm.c
> > index d28c1b6a3b54..fa5d17af88b7 100644
> > --- a/tools/perf/arch/x86/tests/intel-cqm.c
> > +++ b/tools/perf/arch/x86/tests/intel-cqm.c
> > @@ -17,7 +17,7 @@ static pid_t spawn(void)
> >  	if (pid)
> >  		return pid;
> >  
> > -	while(1);
> > +	while(1)
> >  		sleep(5);
> >  	return 0;
> >  }
> 
> Whoops. Good catch.
> 
> Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>

So, Markus, can you split this in three patches, stating that in some
cases its just cosmetic stuff while in others really a bug got fixed,
adding the Reviewed-by:  tag for the cqm one? And acked-by for all, from
Ingo?

- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1291290 — [PATCH 3/3] Fix misleadingly indented assignment (whitespace)

FromMarkus Trippelsdorf <markus@trippelsdorf.de>
Date2015-12-14 16:50 +0100
Subject[PATCH 3/3] Fix misleadingly indented assignment (whitespace)
Message-ID<qFDxU-83l-9@gated-at.bofh.it>
In reply to#1291263
Fix misleadingly indented assignment.
This is just a simple whitespace fix.

The issue was pointed out by gcc-6's -Wmisleading-indentation.

Acked-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Markus Trippelsdorf <markus@trippelsdorf.de>

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index e4b173dec4b9..c900b664ab8f 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -153,7 +153,7 @@ static int perf_pmu__parse_unit(struct perf_pmu_alias *alias, char *dir, char *n
 	if (fd == -1)
 		return -1;
 
-		sret = read(fd, alias->unit, UNIT_MAX_LEN);
+	sret = read(fd, alias->unit, UNIT_MAX_LEN);
 	if (sret < 0)
 		goto error;
 
-- 
Markus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1291293 — [PATCH 2/3] Add missing braces to if statement

FromMarkus Trippelsdorf <markus@trippelsdorf.de>
Date2015-12-14 16:50 +0100
Subject[PATCH 2/3] Add missing braces to if statement
Message-ID<qFDxU-83l-11@gated-at.bofh.it>
In reply to#1291263
Add missing braces to if statement.

The issue was pointed out by gcc-6's -Wmisleading-indentation.

Acked-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Markus Trippelsdorf <markus@trippelsdorf.de>

diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index d4d7cc27252f..718bd46d47fa 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -755,11 +755,11 @@ static int annotate_browser__run(struct annotate_browser *browser,
 				nd = browser->curr_hot;
 			break;
 		case K_UNTAB:
-			if (nd != NULL)
+			if (nd != NULL) {
 				nd = rb_next(nd);
 				if (nd == NULL)
 					nd = rb_first(&browser->entries);
-			else
+			} else
 				nd = browser->curr_hot;
 			break;
 		case K_F1:
-- 
Markus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1291296 — [PATCH 1/3] Remove wrong semicolon in while loop

FromMarkus Trippelsdorf <markus@trippelsdorf.de>
Date2015-12-14 16:50 +0100
Subject[PATCH 1/3] Remove wrong semicolon in while loop
Message-ID<qFDxU-83l-17@gated-at.bofh.it>
In reply to#1291263
The while loop was spinning. Fix by removing a semicolon.

The issue was pointed out by gcc-6's -Wmisleading-indentation.

Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
Acked-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Markus Trippelsdorf <markus@trippelsdorf.de>

diff --git a/tools/perf/arch/x86/tests/intel-cqm.c b/tools/perf/arch/x86/tests/intel-cqm.c
index d28c1b6a3b54..fa5d17af88b7 100644
--- a/tools/perf/arch/x86/tests/intel-cqm.c
+++ b/tools/perf/arch/x86/tests/intel-cqm.c
@@ -17,7 +17,7 @@ static pid_t spawn(void)
 	if (pid)
 		return pid;
 
-	while(1);
+	while(1)
 		sleep(5);
 	return 0;
 }
-- 
Markus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1291397 — Re: [PATCH 1/3] Remove wrong semicolon in while loop

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-12-14 19:00 +0100
SubjectRe: [PATCH 1/3] Remove wrong semicolon in while loop
Message-ID<qFFzJ-Ts-23@gated-at.bofh.it>
In reply to#1291296
Em Mon, Dec 14, 2015 at 04:43:35PM +0100, Markus Trippelsdorf escreveu:
> The while loop was spinning. Fix by removing a semicolon.

Thanks for splitting it up!

- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web