Re: [PATCH v1 4/6] perf build: Disable fewer flex warnings

From: James Clark
Date: Fri Jul 28 2023 - 04:53:28 EST




On 28/07/2023 07:49, Ian Rogers wrote:
> If flex is version 2.6.4, reduce the number of flex C warnings
> disabled. Earlier flex versions have all C warnings disabled.

Hi Ian,

I get a build error with either this one or the bison warning change:

$ make LLVM=1 -C tools/perf NO_BPF_SKEL=1 DEBUG=1

util/pmu-bison.c:855:9: error: variable 'perf_pmu_nerrs' set but not
used [-Werror,-Wunused-but-set-variable]
int yynerrs = 0;

I tried a clean build which normally fixes these kind of bison errors.
Let me know if you need any version info.

James

>
> Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
> ---
> tools/perf/util/Build | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/tools/perf/util/Build b/tools/perf/util/Build
> index 96f4ea1d45c5..32239c4b0393 100644
> --- a/tools/perf/util/Build
> +++ b/tools/perf/util/Build
> @@ -279,13 +279,9 @@ $(OUTPUT)util/bpf-filter-bison.c $(OUTPUT)util/bpf-filter-bison.h: util/bpf-filt
> $(Q)$(call echo-cmd,bison)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) $(BISON_FILE_PREFIX_MAP) \
> -o $(OUTPUT)util/bpf-filter-bison.c -p perf_bpf_filter_
>
> -FLEX_GE_26 := $(shell expr $(shell $(FLEX) --version | sed -e 's/flex \([0-9]\+\).\([0-9]\+\)/\1\2/g') \>\= 26)
> -ifeq ($(FLEX_GE_26),1)
> - flex_flags := -Wno-switch-enum -Wno-switch-default -Wno-unused-function -Wno-redundant-decls -Wno-sign-compare -Wno-unused-parameter -Wno-missing-prototypes -Wno-missing-declarations
> - CC_HASNT_MISLEADING_INDENTATION := $(shell echo "int main(void) { return 0 }" | $(CC) -Werror -Wno-misleading-indentation -o /dev/null -xc - 2>&1 | grep -q -- -Wno-misleading-indentation ; echo $$?)
> - ifeq ($(CC_HASNT_MISLEADING_INDENTATION), 1)
> - flex_flags += -Wno-misleading-indentation
> - endif
> +FLEX_GE_264 := $(shell expr $(shell $(FLEX) --version | sed -e 's/flex \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \>\= 264)
> +ifeq ($(FLEX_GE_264),1)
> + flex_flags := -Wno-redundant-decls -Wno-switch-default -Wno-unused-function
> else
> flex_flags := -w
> endif