Re: [Linux-6.11-rc4] perf BROKEN with LLVM/Clang 19.1.0-rc3

From: Arnaldo Carvalho de Melo
Date: Thu Aug 22 2024 - 13:19:56 EST


On Thu, Aug 22, 2024 at 02:12:46PM -0300, Arnaldo Carvalho de Melo wrote:
> On Thu, Aug 22, 2024 at 07:02:52PM +0200, Sedat Dilek wrote:
> > On Thu, Aug 22, 2024 at 5:10 PM Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> wrote:
> > > +++ b/tools/perf/util/setup.py
> > > @@ -17,7 +17,7 @@ src_feature_tests = getenv('srctree') + '/tools/build/feature'
>
> > > def clang_has_option(option):
> > > cc_output = Popen([cc, cc_options + option, path.join(src_feature_tests, "test-hello.c") ], stderr=PIPE).stderr.readlines()
> > > - return [o for o in cc_output if ((b"unknown argument" in o) or (b"is not supported" in o))] == [ ]
> > > + return [o for o in cc_output if ((b"unknown argument" in o) or (b"is not supported" in o) or (b"unknown warning option" in o))] == [ ]
> > > if cc_is_clang:
> > > from sysconfig import get_config_vars
> > > @@ -63,6 +63,8 @@ cflags = getenv('CFLAGS', '').split()
> > > cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter', '-Wno-redundant-decls' ]
> > > if cc_is_clang:
> > > cflags += ["-Wno-unused-command-line-argument" ]
> > > + if clang_has_option("-Wno-cast-function-type-mismatch"):
> > > + cflags += ["-Wno-cast-function-type-mismatch" ]
> > > else:
> > > cflags += ['-Wno-cast-function-type' ]
>
> > I tried with your diff with SLIM LLVM toolchains 18 and 19.
>
> > Both work - see attached build-logs.
>
> > Yes, are right that LLVM/Clang v19 was first introducing:
>
> > -Wcast-function-type-mismatch / -Wno-cast-function-type-mismatch
>
> > [4] says for LLVM 18.1.8:
>
> > -Wcast-function-type
> > -Wcast-function-type-strict
>
> > Feel free to add my Reported-by/Tested-by credentials if you sent a full patch.
>
> Thanks for the report and test of the fix, I'll add both tags,

So below is the part that deals with disabling the warning if present,
the other patch supporting checking warning options I merged as a prep
patch.

Thanks!

- Arnaldo