Re: [PATCH bpf-next] libbpf: fix build by renaming variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 16, 2019 at 4:17 PM Prashant Bhole
<prashantbhole.linux@xxxxxxxxx> wrote:
>
>
>
> On 12/16/19 11:02 PM, Alexei Starovoitov wrote:
> > On Mon, Dec 16, 2019 at 5:25 AM Daniel Borkmann <daniel@xxxxxxxxxxxxx> wrote:
> >>
> >> On Mon, Dec 16, 2019 at 05:27:38PM +0900, Prashant Bhole wrote:
> >>> In btf__align_of() variable name 't' is shadowed by inner block
> >>> declaration of another variable with same name. Patch renames
> >>> variables in order to fix it.
> >>>
> >>>    CC       sharedobjs/btf.o
> >>> btf.c: In function ‘btf__align_of’:
> >>> btf.c:303:21: error: declaration of ‘t’ shadows a previous local [-Werror=shadow]
> >>>    303 |   int i, align = 1, t;
> >>>        |                     ^
> >>> btf.c:283:25: note: shadowed declaration is here
> >>>    283 |  const struct btf_type *t = btf__type_by_id(btf, id);
> >>>        |
> >>>
> >>> Fixes: 3d208f4ca111 ("libbpf: Expose btf__align_of() API")
> >>> Signed-off-by: Prashant Bhole <prashantbhole.linux@xxxxxxxxx>
> >>
> >> Applied, thanks!
> >
> > Prashant,
> > Thanks for the fixes.
> > Which compiler do use?
>
> gcc (GCC) 9.1.1 20190503 (Red Hat 9.1.1-1)

I've tried devtoolset-8 and devtoolset-9.
Which is
gcc version 9.1.1 20190605 (Red Hat 9.1.1-2) (GCC)

make clean;make doesn't produce that warning.
make V=1 tells me:
gcc -O2 -W -Wall -Wextra -Wno-unused-parameter
-Wno-missing-field-initializers -Wbad-function-cast
-Wdeclaration-after-statement -Wformat-security -Wformat-y2k
-Winit-self -Wmissing-declarations -Wmissing-prototypes
-Wnested-externs -Wno-system-headers -Wold-style-definition -Wpacked
-Wredundant-decls -Wstrict-prototypes -Wswitch-default -Wundef
-Wwrite-strings -Wformat -Wstrict-aliasing=3 -fno-strict-aliasing
-Wno-shadow
... -c -MMD -o gen.o gen.c

For some odd reason this check is failing for me
$ tools/scripts/Makefile.include
ifneq ($(filter 3.%,$(MAKE_VERSION)),)  # make-3
EXTRA_WARNINGS += -fno-strict-aliasing
EXTRA_WARNINGS += -Wno-shadow
else
EXTRA_WARNINGS += -Wshadow
endif

$ make -v
GNU Make 3.82

Not sure how to fix this.




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux