[PATCH] perf tools: Use %define api.pure full instead of %pure-parser

From: Jiri Olsa
Date: Sun Jan 12 2020 - 14:26:35 EST


On Fri, Dec 06, 2019 at 12:35:09PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, Dec 06, 2019 at 04:04:55PM +0100, Jiri Olsa escreveu:
> > On Fri, Dec 06, 2019 at 11:43:54AM -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Fri, Dec 06, 2019 at 03:25:16PM +0100, Jiri Olsa escreveu:
> > > > On Fri, Dec 06, 2019 at 08:57:01AM +0100, Ingo Molnar wrote:
> > > >
> > > > SNIP
> > > >
> > > > > > tools/include/uapi/drm/drm.h | 3 +-
> > > > > > tools/include/uapi/drm/i915_drm.h | 128 +++++++++++++++++++++++++++++++++++++-
> > > > > > tools/perf/builtin-inject.c | 13 +---
> > > > > > tools/perf/builtin-report.c | 8 +++
> > > > > > tools/perf/util/sort.c | 16 +++--
> > > > > > 5 files changed, 147 insertions(+), 21 deletions(-)
> > > > >
> > > > > Pulled, thanks a lot Arnaldo!
> > > > >
> > > > > JFYI, on my system the default perf/urgent build still has this noise
> > > > > generated by util/parse-events.y and util/expr.y:
> > > > >
> > > > > util/parse-events.y:1.1-12: warning: deprecated directive, use â%define api.pureâ [-Wdeprecated]
> > > > > 1 | %pure-parser
> > > > > | ^~~~~~~~~~~~
> > > > > util/parse-events.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
> > > > > util/expr.y:15.1-12: warning: deprecated directive, use â%define api.pureâ [-Wdeprecated]
> > > > > 15 | %pure-parser
> > > > > | ^~~~~~~~~~~~
> > > > > util/expr.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
> > > >
> > > > just saw it in fedora 31 with new bison, change below
> > > > should fix it, I'll post it with other fixes later
> > >
> > > As I explained to Ingo, this will make it fail with older systems, for
> > > now this is just a warning, thus I've not been eager to get this merged,
> > > Andi alredy submitted this, for instance.
> > >
> > > Is there some way to have some sort of ifdef based on bison's version so
> > > that we can have both?
> >
> > I see, I guess we could use one or another based on
> > bison version with macro
>
> If you could do that, that would be great, the attempt may well
> enlighten us if that is possible and if not, then, oh well, I can just
> update bison on these older systems and keep a note in my container
> definition files :-)

hi,
so I checked and the api.pure define was introduced quite
long time ago, so perhaps we could change it as it is..
could you please run your distro check on the patch below?

thanks,
jirka


---
Bison deprecated %pure-parser directive in favor of
%define api.pure full. The api.pure got introduced
in bison 2.3 (Oct 2007), so it seems safe to use it
without any version check.

Link: https://lkml.kernel.org/n/tip-qhrf915k2ynym32vf5ii8vzy@xxxxxxxxxxxxxx
Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
---
tools/perf/util/expr.y | 3 ++-
tools/perf/util/parse-events.y | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/expr.y b/tools/perf/util/expr.y
index f9a20a39b64a..7d226241f1d7 100644
--- a/tools/perf/util/expr.y
+++ b/tools/perf/util/expr.y
@@ -12,7 +12,8 @@
#define MAXIDLEN 256
%}

-%pure-parser
+%define api.pure full
+
%parse-param { double *final_val }
%parse-param { struct parse_ctx *ctx }
%parse-param { const char **pp }
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index e2eea4e601b4..94f8bcd83582 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -1,4 +1,4 @@
-%pure-parser
+%define api.pure full
%parse-param {void *_parse_state}
%parse-param {void *scanner}
%lex-param {void* scanner}
--
2.24.1