linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] perf tools: Fix bison object compilation with clang 15
@ 2022-09-29 14:05 Jiri Olsa
  2022-09-29 14:05 ` [PATCH 2/2] perf tools: Remove unused variable in tests/test-basic.c Jiri Olsa
  2022-09-29 18:01 ` [PATCH 1/2] perf tools: Fix bison object compilation with clang 15 Arnaldo Carvalho de Melo
  0 siblings, 2 replies; 7+ messages in thread
From: Jiri Olsa @ 2022-09-29 14:05 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, Peter Zijlstra, Ingo Molnar, Mark Rutland, Namhyung Kim,
	Alexander Shishkin, Ian Rogers, linux-perf-users

Arnaldo reported compilation fail with clang 15:

    CC      util/parse-events-bison.o
  util/parse-events-bison.c:1401:9: error: variable 'parse_events_nerrs'
  set but not used [-Werror,-Wunused-but-set-variable]
      int yynerrs = 0;
        ^
  util/parse-events-bison.c:72:25: note: expanded from macro 'yynerrs'
  #define yynerrs         parse_events_nerrs
                        ^
  1 error generated.

Disabling -Wunused-but-set-variable check for bison object compilation.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/Build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 8fd6dc8de521..d559c80559e3 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -270,7 +270,7 @@ CFLAGS_expr-flex.o          += $(flex_flags)
 bison_flags := -DYYENABLE_NLS=0
 BISON_GE_35 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\)/\1\2/g') \>\= 35)
 ifeq ($(BISON_GE_35),1)
-  bison_flags += -Wno-unused-parameter -Wno-nested-externs -Wno-implicit-function-declaration -Wno-switch-enum
+  bison_flags += -Wno-unused-parameter -Wno-nested-externs -Wno-implicit-function-declaration -Wno-switch-enum -Wno-unused-but-set-variable
 else
   bison_flags += -w
 endif
-- 
2.37.3


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

* [PATCH 2/2] perf tools: Remove unused variable in tests/test-basic.c
  2022-09-29 14:05 [PATCH 1/2] perf tools: Fix bison object compilation with clang 15 Jiri Olsa
@ 2022-09-29 14:05 ` Jiri Olsa
  2022-09-29 18:10   ` Arnaldo Carvalho de Melo
  2022-09-29 18:01 ` [PATCH 1/2] perf tools: Fix bison object compilation with clang 15 Arnaldo Carvalho de Melo
  1 sibling, 1 reply; 7+ messages in thread
From: Jiri Olsa @ 2022-09-29 14:05 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, Peter Zijlstra, Ingo Molnar, Mark Rutland, Namhyung Kim,
	Alexander Shishkin, Ian Rogers, linux-perf-users

The clang 15 build reveal several unused-but-set variables,
removing the 'foo' variable in tests/mmap-basic.o object.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/tests/mmap-basic.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c
index 21b5e68179d7..8322fc2295fa 100644
--- a/tools/perf/tests/mmap-basic.c
+++ b/tools/perf/tests/mmap-basic.c
@@ -112,8 +112,7 @@ static int test__basic_mmap(struct test_suite *test __maybe_unused, int subtest
 
 	for (i = 0; i < nsyscalls; ++i)
 		for (j = 0; j < expected_nr_events[i]; ++j) {
-			int foo = syscalls[i]();
-			++foo;
+			syscalls[i]();
 		}
 
 	md = &evlist->mmap[0];
-- 
2.37.3


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

* Re: [PATCH 1/2] perf tools: Fix bison object compilation with clang 15
  2022-09-29 14:05 [PATCH 1/2] perf tools: Fix bison object compilation with clang 15 Jiri Olsa
  2022-09-29 14:05 ` [PATCH 2/2] perf tools: Remove unused variable in tests/test-basic.c Jiri Olsa
@ 2022-09-29 18:01 ` Arnaldo Carvalho de Melo
  2022-09-29 18:22   ` Namhyung Kim
  2022-09-29 19:24   ` Jiri Olsa
  1 sibling, 2 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-09-29 18:01 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: lkml, Peter Zijlstra, Ingo Molnar, Mark Rutland, Namhyung Kim,
	Alexander Shishkin, Ian Rogers, linux-perf-users

Em Thu, Sep 29, 2022 at 04:05:13PM +0200, Jiri Olsa escreveu:
> Arnaldo reported compilation fail with clang 15:
> 
>     CC      util/parse-events-bison.o
>   util/parse-events-bison.c:1401:9: error: variable 'parse_events_nerrs'
>   set but not used [-Werror,-Wunused-but-set-variable]
>       int yynerrs = 0;
>         ^
>   util/parse-events-bison.c:72:25: note: expanded from macro 'yynerrs'
>   #define yynerrs         parse_events_nerrs
>                         ^
>   1 error generated.
> 
> Disabling -Wunused-but-set-variable check for bison object compilation.

So we have to disable something else:

  37    44.92 fedora:32                     : FAIL clang version 10.0.1 (Fedora 10.0.1-3.fc32)
    error: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option]
    make[3]: *** [/git/perf-6.0.0-rc7/tools/build/Makefile.build:139: util] Error 2
  38    61.77 fedora:33                     : FAIL clang version 11.0.0 (Fedora 11.0.0-3.fc33)
    error: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option]
    make[3]: *** [/git/perf-6.0.0-rc7/tools/build/Makefile.build:139: util] Error 2
  39    66.59 fedora:34                     : FAIL clang version 12.0.1 (Fedora 12.0.1-1.fc34)
    error: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option]
    make[3]: *** [/git/perf-6.0.0-rc7/tools/build/Makefile.build:139: util] Error 2


I'll try yours + -Wno-unknown-warning-option

;-)

- Arnaldo
 
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
>  tools/perf/util/Build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/Build b/tools/perf/util/Build
> index 8fd6dc8de521..d559c80559e3 100644
> --- a/tools/perf/util/Build
> +++ b/tools/perf/util/Build
> @@ -270,7 +270,7 @@ CFLAGS_expr-flex.o          += $(flex_flags)
>  bison_flags := -DYYENABLE_NLS=0
>  BISON_GE_35 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\)/\1\2/g') \>\= 35)
>  ifeq ($(BISON_GE_35),1)
> -  bison_flags += -Wno-unused-parameter -Wno-nested-externs -Wno-implicit-function-declaration -Wno-switch-enum
> +  bison_flags += -Wno-unused-parameter -Wno-nested-externs -Wno-implicit-function-declaration -Wno-switch-enum -Wno-unused-but-set-variable
>  else
>    bison_flags += -w
>  endif
> -- 
> 2.37.3

-- 

- Arnaldo

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

* Re: [PATCH 2/2] perf tools: Remove unused variable in tests/test-basic.c
  2022-09-29 14:05 ` [PATCH 2/2] perf tools: Remove unused variable in tests/test-basic.c Jiri Olsa
@ 2022-09-29 18:10   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-09-29 18:10 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: lkml, Peter Zijlstra, Ingo Molnar, Mark Rutland, Namhyung Kim,
	Alexander Shishkin, Ian Rogers, linux-perf-users

Em Thu, Sep 29, 2022 at 04:05:14PM +0200, Jiri Olsa escreveu:
> The clang 15 build reveal several unused-but-set variables,
> removing the 'foo' variable in tests/mmap-basic.o object.



Thanks, applied.

- Arnaldo

 
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
>  tools/perf/tests/mmap-basic.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c
> index 21b5e68179d7..8322fc2295fa 100644
> --- a/tools/perf/tests/mmap-basic.c
> +++ b/tools/perf/tests/mmap-basic.c
> @@ -112,8 +112,7 @@ static int test__basic_mmap(struct test_suite *test __maybe_unused, int subtest
>  
>  	for (i = 0; i < nsyscalls; ++i)
>  		for (j = 0; j < expected_nr_events[i]; ++j) {
> -			int foo = syscalls[i]();
> -			++foo;
> +			syscalls[i]();
>  		}
>  
>  	md = &evlist->mmap[0];
> -- 
> 2.37.3

-- 

- Arnaldo

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

* Re: [PATCH 1/2] perf tools: Fix bison object compilation with clang 15
  2022-09-29 18:01 ` [PATCH 1/2] perf tools: Fix bison object compilation with clang 15 Arnaldo Carvalho de Melo
@ 2022-09-29 18:22   ` Namhyung Kim
  2022-09-29 18:37     ` Arnaldo Carvalho de Melo
  2022-09-29 19:24   ` Jiri Olsa
  1 sibling, 1 reply; 7+ messages in thread
From: Namhyung Kim @ 2022-09-29 18:22 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Jiri Olsa, lkml, Peter Zijlstra, Ingo Molnar, Mark Rutland,
	Alexander Shishkin, Ian Rogers, linux-perf-users

On Thu, Sep 29, 2022 at 11:01 AM Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
>
> Em Thu, Sep 29, 2022 at 04:05:13PM +0200, Jiri Olsa escreveu:
> > Arnaldo reported compilation fail with clang 15:
> >
> >     CC      util/parse-events-bison.o
> >   util/parse-events-bison.c:1401:9: error: variable 'parse_events_nerrs'
> >   set but not used [-Werror,-Wunused-but-set-variable]
> >       int yynerrs = 0;
> >         ^
> >   util/parse-events-bison.c:72:25: note: expanded from macro 'yynerrs'
> >   #define yynerrs         parse_events_nerrs
> >                         ^
> >   1 error generated.
> >
> > Disabling -Wunused-but-set-variable check for bison object compilation.
>
> So we have to disable something else:
>
>   37    44.92 fedora:32                     : FAIL clang version 10.0.1 (Fedora 10.0.1-3.fc32)
>     error: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option]
>     make[3]: *** [/git/perf-6.0.0-rc7/tools/build/Makefile.build:139: util] Error 2
>   38    61.77 fedora:33                     : FAIL clang version 11.0.0 (Fedora 11.0.0-3.fc33)
>     error: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option]
>     make[3]: *** [/git/perf-6.0.0-rc7/tools/build/Makefile.build:139: util] Error 2
>   39    66.59 fedora:34                     : FAIL clang version 12.0.1 (Fedora 12.0.1-1.fc34)
>     error: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option]
>     make[3]: *** [/git/perf-6.0.0-rc7/tools/build/Makefile.build:139: util] Error 2
>
>
> I'll try yours + -Wno-unknown-warning-option

Is `-Wno-unknown-warning-option` known to older versions? ;-)

Thanks,
Namhyung

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

* Re: [PATCH 1/2] perf tools: Fix bison object compilation with clang 15
  2022-09-29 18:22   ` Namhyung Kim
@ 2022-09-29 18:37     ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-09-29 18:37 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Jiri Olsa, lkml, Peter Zijlstra, Ingo Molnar, Mark Rutland,
	Alexander Shishkin, Ian Rogers, linux-perf-users

Em Thu, Sep 29, 2022 at 11:22:41AM -0700, Namhyung Kim escreveu:
> On Thu, Sep 29, 2022 at 11:01 AM Arnaldo Carvalho de Melo
> <acme@kernel.org> wrote:
> >
> > Em Thu, Sep 29, 2022 at 04:05:13PM +0200, Jiri Olsa escreveu:
> > > Arnaldo reported compilation fail with clang 15:
> > >
> > >     CC      util/parse-events-bison.o
> > >   util/parse-events-bison.c:1401:9: error: variable 'parse_events_nerrs'
> > >   set but not used [-Werror,-Wunused-but-set-variable]
> > >       int yynerrs = 0;
> > >         ^
> > >   util/parse-events-bison.c:72:25: note: expanded from macro 'yynerrs'
> > >   #define yynerrs         parse_events_nerrs
> > >                         ^
> > >   1 error generated.
> > >
> > > Disabling -Wunused-but-set-variable check for bison object compilation.
> >
> > So we have to disable something else:
> >
> >   37    44.92 fedora:32                     : FAIL clang version 10.0.1 (Fedora 10.0.1-3.fc32)
> >     error: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option]
> >     make[3]: *** [/git/perf-6.0.0-rc7/tools/build/Makefile.build:139: util] Error 2
> >   38    61.77 fedora:33                     : FAIL clang version 11.0.0 (Fedora 11.0.0-3.fc33)
> >     error: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option]
> >     make[3]: *** [/git/perf-6.0.0-rc7/tools/build/Makefile.build:139: util] Error 2
> >   39    66.59 fedora:34                     : FAIL clang version 12.0.1 (Fedora 12.0.1-1.fc34)
> >     error: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option]
> >     make[3]: *** [/git/perf-6.0.0-rc7/tools/build/Makefile.build:139: util] Error 2
> >
> >
> > I'll try yours + -Wno-unknown-warning-option
> 
> Is `-Wno-unknown-warning-option` known to older versions? ;-)

Excellent question! ;-)

And one we should learn something from, so that we
can prep tools/perf/ (and other projects we contribute to) for the
future:

So far, so good:

[perfbuilder@five ~]$ echo `grep FAIL dm.log/summary | cut -c15- | cut -d: -f1,2`
alpine:3.12 alpine:3.13 alpine:3.14 alpine:3.15 alt:p10 amazonlinux:devel debian:11 fedora:32 fedora:33 fedora:34 fedora:37 fedora:38 fedora:rawhide ubuntu:21.04
[perfbuilder@five ~]$ export BUILD_TARBALL=http://192.168.86.14/perf/perf-6.0.0-rc7.tar.xz
[perfbuilder@five ~]$ time dm debian:experimental alpine:3.12 alpine:3.13 alpine:3.14 alpine:3.15 alt:p10 amazonlinux:devel debian:11 fedora:32 fedora:33 fedora:34 fedora:37 fedora:38 fedora:rawhide ubuntu:21.04
   1   140.66 debian:experimental           : Ok   gcc (Debian 12.2.0-3) 12.2.0 , Debian clang version 14.0.6-2
   2   132.82 alpine:3.12                   : Ok   gcc (Alpine 9.3.0) 9.3.0 , Alpine clang version 10.0.0 (https://gitlab.alpinelinux.org/alpine/aports.git 7445adce501f8473efdb93b17b5eaf2f1445ed4c)
   3   140.40 alpine:3.13                   : Ok   gcc (Alpine 10.2.1_pre1) 10.2.1 20201203 , Alpine clang version 10.0.1
   4   143.75 alpine:3.14                   : Ok   gcc (Alpine 10.3.1_git20210424) 10.3.1 20210424 , Alpine clang version 11.1.0
   5   147.77 alpine:3.15                   : Ok   gcc (Alpine 10.3.1_git20211027) 10.3.1 20211027 , Alpine clang version 12.0.1
   6    98.79 alt:p10                       : Ok   x86_64-alt-linux-gcc (GCC) 10.3.1 20210703 (ALT Sisyphus 10.3.1-alt2) , clang version 11.0.1
   7: amazonlinux:devel

- Arnaldo

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

* Re: [PATCH 1/2] perf tools: Fix bison object compilation with clang 15
  2022-09-29 18:01 ` [PATCH 1/2] perf tools: Fix bison object compilation with clang 15 Arnaldo Carvalho de Melo
  2022-09-29 18:22   ` Namhyung Kim
@ 2022-09-29 19:24   ` Jiri Olsa
  1 sibling, 0 replies; 7+ messages in thread
From: Jiri Olsa @ 2022-09-29 19:24 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, Peter Zijlstra, Ingo Molnar, Mark Rutland, Namhyung Kim,
	Alexander Shishkin, Ian Rogers, linux-perf-users

On Thu, Sep 29, 2022 at 03:01:48PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, Sep 29, 2022 at 04:05:13PM +0200, Jiri Olsa escreveu:
> > Arnaldo reported compilation fail with clang 15:
> > 
> >     CC      util/parse-events-bison.o
> >   util/parse-events-bison.c:1401:9: error: variable 'parse_events_nerrs'
> >   set but not used [-Werror,-Wunused-but-set-variable]
> >       int yynerrs = 0;
> >         ^
> >   util/parse-events-bison.c:72:25: note: expanded from macro 'yynerrs'
> >   #define yynerrs         parse_events_nerrs
> >                         ^
> >   1 error generated.
> > 
> > Disabling -Wunused-but-set-variable check for bison object compilation.
> 
> So we have to disable something else:
> 
>   37    44.92 fedora:32                     : FAIL clang version 10.0.1 (Fedora 10.0.1-3.fc32)
>     error: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option]
>     make[3]: *** [/git/perf-6.0.0-rc7/tools/build/Makefile.build:139: util] Error 2
>   38    61.77 fedora:33                     : FAIL clang version 11.0.0 (Fedora 11.0.0-3.fc33)
>     error: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option]
>     make[3]: *** [/git/perf-6.0.0-rc7/tools/build/Makefile.build:139: util] Error 2
>   39    66.59 fedora:34                     : FAIL clang version 12.0.1 (Fedora 12.0.1-1.fc34)
>     error: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option]
>     make[3]: *** [/git/perf-6.0.0-rc7/tools/build/Makefile.build:139: util] Error 2
> 
> 
> I'll try yours + -Wno-unknown-warning-option

ugh, of course... thanks ;-)

jirka

> 
> ;-)
> 
> - Arnaldo
>  
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> >  tools/perf/util/Build | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/util/Build b/tools/perf/util/Build
> > index 8fd6dc8de521..d559c80559e3 100644
> > --- a/tools/perf/util/Build
> > +++ b/tools/perf/util/Build
> > @@ -270,7 +270,7 @@ CFLAGS_expr-flex.o          += $(flex_flags)
> >  bison_flags := -DYYENABLE_NLS=0
> >  BISON_GE_35 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\)/\1\2/g') \>\= 35)
> >  ifeq ($(BISON_GE_35),1)
> > -  bison_flags += -Wno-unused-parameter -Wno-nested-externs -Wno-implicit-function-declaration -Wno-switch-enum
> > +  bison_flags += -Wno-unused-parameter -Wno-nested-externs -Wno-implicit-function-declaration -Wno-switch-enum -Wno-unused-but-set-variable
> >  else
> >    bison_flags += -w
> >  endif
> > -- 
> > 2.37.3
> 
> -- 
> 
> - Arnaldo

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

end of thread, other threads:[~2022-09-29 19:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-29 14:05 [PATCH 1/2] perf tools: Fix bison object compilation with clang 15 Jiri Olsa
2022-09-29 14:05 ` [PATCH 2/2] perf tools: Remove unused variable in tests/test-basic.c Jiri Olsa
2022-09-29 18:10   ` Arnaldo Carvalho de Melo
2022-09-29 18:01 ` [PATCH 1/2] perf tools: Fix bison object compilation with clang 15 Arnaldo Carvalho de Melo
2022-09-29 18:22   ` Namhyung Kim
2022-09-29 18:37     ` Arnaldo Carvalho de Melo
2022-09-29 19:24   ` Jiri Olsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).