|
Michel Lind |
f3c48a |
From: Florian Weimer <fweimer@redhat.com>
|
|
Michel Lind |
f3c48a |
Subject: [PATCH v4] perf: Avoid implicit function declarations in
|
|
Michel Lind |
f3c48a |
lexer/parse interface
|
|
Michel Lind |
f3c48a |
To: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
|
|
Michel Lind |
f3c48a |
Cc: Peter Zijlstra <peterz@infradead.org>,
|
|
Michel Lind |
f3c48a |
Ingo Molnar <mingo@redhat.com>,
|
|
Michel Lind |
f3c48a |
Arnaldo Carvalho de Melo <acme@kernel.org>,
|
|
Michel Lind |
f3c48a |
Mark Rutland <mark.rutland@arm.com>,
|
|
Michel Lind |
f3c48a |
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
|
|
Michel Lind |
f3c48a |
Jiri Olsa <jolsa@kernel.org>,
|
|
Michel Lind |
f3c48a |
Namhyung Kim <namhyung@kernel.org>,
|
|
Michel Lind |
f3c48a |
Ian Rogers <irogers@google.com>,
|
|
Michel Lind |
f3c48a |
Adrian Hunter <adrian.hunter@intel.com>,
|
|
Michel Lind |
f3c48a |
Ian Rogers <irogers@google.com>,
|
|
Michel Lind |
f3c48a |
Justin M. Forbes <jforbes@fedoraproject.org>
|
|
Michel Lind |
f3c48a |
Date: Wed, 03 May 2023 20:06:09 +0200 (25 minutes, 29 seconds ago)
|
|
Michel Lind |
f3c48a |
Message-ID: <874jot47e6.fsf@oldenburg.str.redhat.com>
|
|
Michel Lind |
f3c48a |
|
|
Michel Lind |
f3c48a |
In future compilers, -Wno-implicit-function-declaration may not bring
|
|
Michel Lind |
f3c48a |
back support for implicit function declarations, a feature that was
|
|
Michel Lind |
f3c48a |
removed from the C language in C99. Instead of relying on implicit
|
|
Michel Lind |
f3c48a |
declarations, include the flex-generated header from the
|
|
Michel Lind |
f3c48a |
bison-generated C code.
|
|
Michel Lind |
f3c48a |
|
|
Michel Lind |
f3c48a |
The expr-flex.h and pmu-flex.h headers needs to be included very late,
|
|
Michel Lind |
f3c48a |
so that the definition of YYSTYPE is available at that point.
|
|
Michel Lind |
f3c48a |
|
|
Michel Lind |
f3c48a |
Signed-off-by: Florian Weimer <fweimer@redhat.com>
|
|
Michel Lind |
f3c48a |
|
|
Michel Lind |
f3c48a |
---
|
|
Michel Lind |
f3c48a |
v4: Rebase on top of perf-next and integrate with bpf-filter.y as well.
|
|
Michel Lind |
f3c48a |
Even later inclusion of "pmu-flex.h".
|
|
Michel Lind |
f3c48a |
v3: Fix commit message typo. Try to repost via different mail server.
|
|
Michel Lind |
f3c48a |
v2: Include the flex-generated files instead of manually-written prototypes.
|
|
Michel Lind |
f3c48a |
tools/perf/util/Build | 11 ++++++++++-
|
|
Michel Lind |
f3c48a |
tools/perf/util/bpf-filter.y | 1 +
|
|
Michel Lind |
f3c48a |
tools/perf/util/expr.y | 2 ++
|
|
Michel Lind |
f3c48a |
tools/perf/util/parse-events.y | 1 +
|
|
Michel Lind |
f3c48a |
tools/perf/util/pmu.y | 4 ++++
|
|
Michel Lind |
f3c48a |
5 files changed, 18 insertions(+), 1 deletion(-)
|
|
Michel Lind |
f3c48a |
|
|
Michel Lind |
f3c48a |
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
|
|
Michel Lind |
f3c48a |
index bd18fe5f2719..865ce4f66756 100644
|
|
Michel Lind |
f3c48a |
--- a/tools/perf/util/Build
|
|
Michel Lind |
f3c48a |
+++ b/tools/perf/util/Build
|
|
Michel Lind |
f3c48a |
@@ -298,7 +298,7 @@ CFLAGS_bpf-filter-flex.o += $(flex_flags)
|
|
Michel Lind |
f3c48a |
bison_flags := -DYYENABLE_NLS=0
|
|
Michel Lind |
f3c48a |
BISON_GE_35 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\)/\1\2/g') \>\= 35)
|
|
Michel Lind |
f3c48a |
ifeq ($(BISON_GE_35),1)
|
|
Michel Lind |
f3c48a |
- bison_flags += -Wno-unused-parameter -Wno-nested-externs -Wno-implicit-function-declaration -Wno-switch-enum -Wno-unused-but-set-variable -Wno-unknown-warning-option
|
|
Michel Lind |
f3c48a |
+ bison_flags += -Wno-unused-parameter -Wno-nested-externs -Wno-switch-enum -Wno-unused-but-set-variable -Wno-unknown-warning-option
|
|
Michel Lind |
f3c48a |
else
|
|
Michel Lind |
f3c48a |
bison_flags += -w
|
|
Michel Lind |
f3c48a |
endif
|
|
Michel Lind |
f3c48a |
@@ -357,3 +357,12 @@ $(OUTPUT)util/vsprintf.o: ../lib/vsprintf.c FORCE
|
|
Michel Lind |
f3c48a |
$(OUTPUT)util/list_sort.o: ../lib/list_sort.c FORCE
|
|
Michel Lind |
f3c48a |
$(call rule_mkdir)
|
|
Michel Lind |
f3c48a |
$(call if_changed_dep,cc_o_c)
|
|
Michel Lind |
f3c48a |
+
|
|
Michel Lind |
f3c48a |
+# These dependencies ensure that the flex-generated .h file is
|
|
Michel Lind |
f3c48a |
+# available at the time the bison-generated .c sources are compiled.
|
|
Michel Lind |
f3c48a |
+# Do not depend on the generated .h file to prevent triggering
|
|
Michel Lind |
f3c48a |
+# parallel flex invocations for the same two output files.
|
|
Michel Lind |
f3c48a |
+$(OUTPUT)util/bpf-filter-bison.o : $(OUTPUT)util/bpf-filter-flex.c
|
|
Michel Lind |
f3c48a |
+$(OUTPUT)util/expr-bison.o : $(OUTPUT)util/expr-flex.c
|
|
Michel Lind |
f3c48a |
+$(OUTPUT)util/parse-events-bison.o : $(OUTPUT)util/parse-events-flex.c
|
|
Michel Lind |
f3c48a |
+$(OUTPUT)util/pmu-bison.o : $(OUTPUT)util/pmu-flex.c
|
|
Michel Lind |
f3c48a |
diff --git a/tools/perf/util/bpf-filter.y b/tools/perf/util/bpf-filter.y
|
|
Michel Lind |
f3c48a |
index 07d6c7926c13..935afafe22eb 100644
|
|
Michel Lind |
f3c48a |
--- a/tools/perf/util/bpf-filter.y
|
|
Michel Lind |
f3c48a |
+++ b/tools/perf/util/bpf-filter.y
|
|
Michel Lind |
f3c48a |
@@ -8,6 +8,7 @@
|
|
Michel Lind |
f3c48a |
#include <linux/compiler.h>
|
|
Michel Lind |
f3c48a |
#include <linux/list.h>
|
|
Michel Lind |
f3c48a |
#include "bpf-filter.h"
|
|
Michel Lind |
f3c48a |
+#include "bpf-filter-flex.h"
|
|
Michel Lind |
f3c48a |
|
|
Michel Lind |
f3c48a |
static void perf_bpf_filter_error(struct list_head *expr __maybe_unused,
|
|
Michel Lind |
f3c48a |
char const *msg)
|
|
Michel Lind |
f3c48a |
diff --git a/tools/perf/util/expr.y b/tools/perf/util/expr.y
|
|
Michel Lind |
f3c48a |
index 250e444bf032..8879fa14960f 100644
|
|
Michel Lind |
f3c48a |
--- a/tools/perf/util/expr.y
|
|
Michel Lind |
f3c48a |
+++ b/tools/perf/util/expr.y
|
|
Michel Lind |
f3c48a |
@@ -53,6 +53,8 @@
|
|
Michel Lind |
f3c48a |
%destructor { ids__free($$.ids); } <ids>
|
|
Michel Lind |
f3c48a |
|
|
Michel Lind |
f3c48a |
%{
|
|
Michel Lind |
f3c48a |
+#include "expr-flex.h"
|
|
Michel Lind |
f3c48a |
+
|
|
Michel Lind |
f3c48a |
static void expr_error(double *final_val __maybe_unused,
|
|
Michel Lind |
f3c48a |
struct expr_parse_ctx *ctx __maybe_unused,
|
|
Michel Lind |
f3c48a |
bool compute_ids __maybe_unused,
|
|
Michel Lind |
f3c48a |
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
|
|
Michel Lind |
f3c48a |
index 4488443e506e..401d33714b23 100644
|
|
Michel Lind |
f3c48a |
--- a/tools/perf/util/parse-events.y
|
|
Michel Lind |
f3c48a |
+++ b/tools/perf/util/parse-events.y
|
|
Michel Lind |
f3c48a |
@@ -17,6 +17,7 @@
|
|
Michel Lind |
f3c48a |
#include "evsel.h"
|
|
Michel Lind |
f3c48a |
#include "parse-events.h"
|
|
Michel Lind |
f3c48a |
#include "parse-events-bison.h"
|
|
Michel Lind |
f3c48a |
+#include "parse-events-flex.h"
|
|
Michel Lind |
f3c48a |
|
|
Michel Lind |
f3c48a |
void parse_events_error(YYLTYPE *loc, void *parse_state, void *scanner, char const *msg);
|
|
Michel Lind |
f3c48a |
|
|
Michel Lind |
f3c48a |
diff --git a/tools/perf/util/pmu.y b/tools/perf/util/pmu.y
|
|
Michel Lind |
f3c48a |
index dff4e892ac4d..9c67f3d05a80 100644
|
|
Michel Lind |
f3c48a |
--- a/tools/perf/util/pmu.y
|
|
Michel Lind |
f3c48a |
+++ b/tools/perf/util/pmu.y
|
|
Michel Lind |
f3c48a |
@@ -32,6 +32,10 @@ do { \
|
|
Michel Lind |
f3c48a |
DECLARE_BITMAP(bits, PERF_PMU_FORMAT_BITS);
|
|
Michel Lind |
f3c48a |
}
|
|
Michel Lind |
f3c48a |
|
|
Michel Lind |
f3c48a |
+%{
|
|
Michel Lind |
f3c48a |
+#include "pmu-flex.h"
|
|
Michel Lind |
f3c48a |
+%}
|
|
Michel Lind |
f3c48a |
+
|
|
Michel Lind |
f3c48a |
%%
|
|
Michel Lind |
f3c48a |
|
|
Michel Lind |
f3c48a |
format:
|
|
Michel Lind |
f3c48a |
|
|
Michel Lind |
f3c48a |
base-commit: 5d27a645f60940fdf589e4ff5351506a7f0fdbaa
|