Re: [PATCH 06/13] perf tools: Add compression id into struct kmod_path
From: Jiri Olsa
Date: Fri Aug 17 2018 - 16:01:50 EST
On Fri, Aug 17, 2018 at 03:56:41PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, Aug 17, 2018 at 03:28:49PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Fri, Aug 17, 2018 at 03:23:15PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > Em Fri, Aug 17, 2018 at 11:48:06AM +0200, Jiri Olsa escreveu:
> > > > static const struct {
> > > > const char *fmt;
> > > > int (*decompress)(const char *input, int output);
> > > > } compressions[] = {
> > > > + [COMP_ID__NONE] = { 0 },
> > >
> > >
> > > This broke the build in many places, problems of this kind:
> > >
> > > CC /tmp/build/perf/util/dso.o
> > > LD /tmp/build/perf/scripts/python/Perf-Trace-Util/libperf-in.o
> > > LD /tmp/build/perf/scripts/libperf-in.o
> > > CC /tmp/build/perf/trace/beauty/clone.o
> > > CC /tmp/build/perf/util/symbol.o
> > > util/dso.c:201:24: error: missing field 'decompress' initializer [-Werror,-Wmissing-field-initializers]
> > > [COMP_ID__NONE] = { 0 },
> > > ^
> > > 1 error generated.
> > > CC /tmp/build/perf/trace/beauty/fcntl.o
> > > mv: cannot stat '/tmp/build/perf/util/.dso.o.tmp': No such file or directory
> > > /git/linux/tools/build/Makefile.build:96: recipe for target '/tmp/build/perf/util/dso.o' failed
> > >
> > > If we look just at those that failed, its several gcc versions:
> > >
> > > 11 9.91 centos:5 : FAIL gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55)
> > > 12 14.34 centos:6 : FAIL gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23)
> > > 16 47.50 debian:9 : FAIL gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
> > > 28 53.92 fedora:25 : FAIL gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1)
> > > 29 60.75 fedora:26 : FAIL gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2)
> > > 30 90.76 fedora:27 : FAIL gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6)
> > > 41 12.78 oraclelinux:6 : FAIL gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23.0.1)
> > > 43 12.85 ubuntu:12.04.5 : FAIL gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
> > > 46 45.56 ubuntu:16.04 : FAIL gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
> > > 54 49.60 ubuntu:17.10 : FAIL gcc (Ubuntu 7.2.0-8ubuntu3.2) 7.2.0
> >
> > Sorry, gcc eats this with gusto, its just clang that is not taking it,
> > for instance, this is the one in fedora:27:
> >
> > clang version 5.0.2 (tags/RELEASE_502/final)
>
> Nah, this cures it, and its not just clang, as we don't have it in the older
> images like centos:5.
ugh.. for some reason I thought this one is failing '= { }' , so I used this one '= { 0 }',
so it's this one then ' = { .xxx = 0 }' :-\ nice
thanks,
jirka
>
> Patch below seems to cure in all cases, I'll do what is usual, use
> designated initializers everywhere...
>
> - Arnaldo
>
> diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
> index 8ce3de665993..bbed90e5d9bb 100644
> --- a/tools/perf/util/dso.c
> +++ b/tools/perf/util/dso.c
> @@ -198,7 +198,7 @@ static const struct {
> int (*decompress)(const char *input, int output);
> bool (*is_compressed)(const char *input);
> } compressions[] = {
> - [COMP_ID__NONE] = { 0 },
> + [COMP_ID__NONE] = { .fmt = NULL, },
> #ifdef HAVE_ZLIB_SUPPORT
> { "gz", gzip_decompress_to_file, gzip_is_compressed },
> #endif