lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 25 Apr 2023 10:40:14 -0700
From:   Ian Rogers <irogers@...gle.com>
To:     Florian Weimer <fweimer@...hat.com>
Cc:     linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Adrian Hunter <adrian.hunter@...el.com>,
        "Justin M. Forbes" <jforbes@...oraproject.org>
Subject: Re: [PATCH v2] perf: Avoid implicit function declarations in
 lexer/parse interface

On Tue, Apr 25, 2023 at 10:12 AM Florian Weimer <fweimer@...hat.com> wrote:
>
> In future compilers, -Wno-implicit-function-declaration may not bring
> back support for implicit function declarations, a feature that was
> removed from the C language in C99.  Instead of relying on implicit
> declarations, include the flex-generated header from the
> bison-generated C code.
>
> he expr-flex.h header needs to be included later than the others

nit: s/he/The/

> because at the early point, the definition of YYSTYPE is not yet
> available.
>
> Signed-off-by: Florian Weimer <fweimer@...hat.com>

Acked-by: Ian Rogers <irogers@...gle.com>

Thanks for fighting the build wrt parallel dependencies!
Ian

> ---
> v2: Include the flex-generated files instead of manually-written prototypes.
>
>  tools/perf/util/Build          | 10 +++++++++-
>  tools/perf/util/expr.y         |  2 ++
>  tools/perf/util/parse-events.y |  1 +
>  tools/perf/util/pmu.y          |  1 +
>  4 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/Build b/tools/perf/util/Build
> index 918b501f9bd8..92897068c362 100644
> --- a/tools/perf/util/Build
> +++ b/tools/perf/util/Build
> @@ -283,7 +283,7 @@ CFLAGS_expr-flex.o          += $(flex_flags)
>  bison_flags := -DYYENABLE_NLS=0
>  BISON_GE_35 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\)/\1\2/g') \>\= 35)
>  ifeq ($(BISON_GE_35),1)
> -  bison_flags += -Wno-unused-parameter -Wno-nested-externs -Wno-implicit-function-declaration -Wno-switch-enum -Wno-unused-but-set-variable -Wno-unknown-warning-option
> +  bison_flags += -Wno-unused-parameter -Wno-nested-externs -Wno-switch-enum -Wno-unused-but-set-variable -Wno-unknown-warning-option
>  else
>    bison_flags += -w
>  endif
> @@ -340,3 +340,11 @@ $(OUTPUT)util/vsprintf.o: ../lib/vsprintf.c FORCE
>  $(OUTPUT)util/list_sort.o: ../lib/list_sort.c FORCE
>         $(call rule_mkdir)
>         $(call if_changed_dep,cc_o_c)
> +
> +# These dependencies ensure that the flex-generated .h file is
> +# available at the time the bison-generated .c sources are compiled.
> +# Do not depend on the generated .h file to prevent triggering
> +# parallel flex invocations for the same two output files.
> +$(OUTPUT)util/expr-bison.o : $(OUTPUT)util/expr-flex.c
> +$(OUTPUT)util/parse-events-bison.o : $(OUTPUT)util/parse-events-flex.c
> +$(OUTPUT)util/pmu-bison.o : $(OUTPUT)util/pmu-flex.c
> diff --git a/tools/perf/util/expr.y b/tools/perf/util/expr.y
> index 635e562350c5..99581193ca4c 100644
> --- a/tools/perf/util/expr.y
> +++ b/tools/perf/util/expr.y
> @@ -53,6 +53,8 @@
>  %destructor { ids__free($$.ids); } <ids>
>
>  %{
> +#include "expr-flex.h"
> +
>  static void expr_error(double *final_val __maybe_unused,
>                        struct expr_parse_ctx *ctx __maybe_unused,
>                        bool compute_ids __maybe_unused,
> diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
> index be8c51770051..67a7f70c4767 100644
> --- a/tools/perf/util/parse-events.y
> +++ b/tools/perf/util/parse-events.y
> @@ -17,6 +17,7 @@
>  #include "evsel.h"
>  #include "parse-events.h"
>  #include "parse-events-bison.h"
> +#include "parse-events-flex.h"
>
>  void parse_events_error(YYLTYPE *loc, void *parse_state, void *scanner, char const *msg);
>
> diff --git a/tools/perf/util/pmu.y b/tools/perf/util/pmu.y
> index e675d79a0274..2170f1ac7b74 100644
> --- a/tools/perf/util/pmu.y
> +++ b/tools/perf/util/pmu.y
> @@ -9,6 +9,7 @@
>  #include <linux/bitmap.h>
>  #include <string.h>
>  #include "pmu.h"
> +#include "pmu-flex.h"
>
>  #define ABORT_ON(val) \
>  do { \
>
> base-commit: 173ea743bf7a9eef04460e03b00ba267cc52aee2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ