Hi Jürgen,

I tried that and also with some variations such as "CFLAGS+=-Wno-error" but nothing changes in the compiler output. I am compiling for Phycore-AM335x SOM, if that matters.


make[1]: Entering directory `/export/home/oyouwen/phyCORE-AM335x-PD13.1.2/platform-phyCORE-AM335x/build-target/libsepol_2.8'
make -C src
make[2]: Entering directory `/export/home/oyouwen/phyCORE-AM335x-PD13.1.2/platform-phyCORE-AM335x/build-target/libsepol_2.8/src'
cc -Werror -Wall -W -Wundef -Wshadow -Wmissing-format-attribute -O2 -I. -I../include -D_GNU_SOURCE -I../cil/include -fPIC -c -o assertion.o assertion.c
cc -Werror -Wall -W -Wundef -Wshadow -Wmissing-format-attribute -O2 -I. -I../include -D_GNU_SOURCE -I../cil/include -fPIC -c -o avrule_block.o avrule_block.c
cc -Werror -Wall -W -Wundef -Wshadow -Wmissing-format-attribute -O2 -I. -I../include -D_GNU_SOURCE -I../cil/include -fPIC -c -o avtab.o avtab.c
cc -Werror -Wall -W -Wundef -Wshadow -Wmissing-format-attribute -O2 -I. -I../include -D_GNU_SOURCE -I../cil/include -fPIC -c -o boolean_record.o boolean_record.c
cc -Werror -Wall -W -Wundef -Wshadow -Wmissing-format-attribute -O2 -I. -I../include -D_GNU_SOURCE -I../cil/include -fPIC -c -o booleans.o booleans.c

...

cc -Werror -Wall -W -Wundef -Wshadow -Wmissing-format-attribute -O2 -I. -I../include -D_GNU_SOURCE -I../cil/include -fPIC -c -o interfaces.o interfaces.c
cc -Werror -Wall -W -Wundef -Wshadow -Wmissing-format-attribute -O2 -I. -I../include -D_GNU_SOURCE -I../cil/include -fPIC -c -o kernel_to_cil.o kernel_to_cil.c
cc -Werror -Wall -W -Wundef -Wshadow -Wmissing-format-attribute -O2 -I. -I../include -D_GNU_SOURCE -I../cil/include -fPIC -c -o kernel_to_common.o kernel_to_common.c
kernel_to_common.c: In function 'strs_add_at_index':
kernel_to_common.c:212:60: error: declaration of 'index' shadows a global declaration [-Werror=shadow]
kernel_to_common.c: In function 'strs_read_at_index':
kernel_to_common.c:237:54: error: declaration of 'index' shadows a global declaration [-Werror=shadow]
cc1: all warnings being treated as errors
make[2]: *** [kernel_to_common.o] Error 1
make[2]: *** Waiting for unfinished jobs....


Regards,
You Wen


On Mon, Feb 18, 2019 at 5:56 PM Juergen Borleis <jbe@pengutronix.de> wrote:
Hi You Wen,

On Monday 18 February 2019 10:43:59 Chin You Wen (WMSC-HW) wrote:
> I am writing a rule to compile the libsepol package that comes with plain
> Makefiles. I am trying to pass *-Wno-error* option through the
> <PKG>_MAKE_OPT variable to override the *-Werror *option specified in the
> package Makefile.
>
> I have set
>  LIBSEPOL_CONF_TOOL      := NO
>
> and also
> LIBSEPOL_MAKE_ENV := $(CROSS_ENV)
> LIBSEPOL_MAKE_OPT := \
>                 -Wno-error=shadow
>
> The make still runs without the *-Wno-error *option during compilation.

Hmm, the "-Wno-error=shadow" must be forwarded to the compiler. You may need
something like "CFLAGS=-Wno-error=shadow" in your case instead. This
variable is used in the project's Makefiles (like in src/Makefile, line 50
for example).

Cheers,
Jürgen

--
Pengutronix e.K.                             | Juergen Borleis             |
Industrial Linux Solutions                   | http://www.pengutronix.de/  |


--
Regards,
You Wen