summaryrefslogtreecommitdiff
path: root/tools/perf/util/pmu.l
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/pmu.l')
-rw-r--r--tools/perf/util/pmu.l17
1 files changed, 12 insertions, 5 deletions
diff --git a/tools/perf/util/pmu.l b/tools/perf/util/pmu.l
index 58b4926cfaca..67b247be693b 100644
--- a/tools/perf/util/pmu.l
+++ b/tools/perf/util/pmu.l
@@ -1,4 +1,6 @@
%option prefix="perf_pmu_"
+%option reentrant
+%option bison-bridge
%{
#include <stdlib.h>
@@ -6,16 +8,21 @@
#include "pmu.h"
#include "pmu-bison.h"
-static int value(int base)
+char *perf_pmu_get_text(yyscan_t yyscanner);
+YYSTYPE *perf_pmu_get_lval(yyscan_t yyscanner);
+
+static int value(yyscan_t scanner, int base)
{
+ YYSTYPE *yylval = perf_pmu_get_lval(scanner);
+ char *text = perf_pmu_get_text(scanner);
long num;
errno = 0;
- num = strtoul(perf_pmu_text, NULL, base);
+ num = strtoul(text, NULL, base);
if (errno)
return PP_ERROR;
- perf_pmu_lval.num = num;
+ yylval->num = num;
return PP_VALUE;
}
@@ -25,7 +32,7 @@ num_dec [0-9]+
%%
-{num_dec} { return value(10); }
+{num_dec} { return value(yyscanner, 10); }
config { return PP_CONFIG; }
- { return '-'; }
: { return ':'; }
@@ -35,7 +42,7 @@ config { return PP_CONFIG; }
%%
-int perf_pmu_wrap(void)
+int perf_pmu_wrap(void *scanner __maybe_unused)
{
return 1;
}