mirror of
https://github.com/torvalds/linux.git
synced 2024-12-12 14:12:51 +00:00
3d88aec0d4
By default bison uses global state for compatibility with yacc. Make the parser reentrant so that it may be used in asynchronous and multithreaded situations. Signed-off-by: Ian Rogers <irogers@google.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Gaosheng Cui <cuigaosheng1@huawei.com> Cc: German Gomez <german.gomez@arm.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@arm.com> Cc: Jing Zhang <renyu.zj@linux.alibaba.com> Cc: Leo Yan <leo.yan@linaro.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ravi Bangoria <ravi.bangoria@amd.com> Cc: Rob Herring <robh@kernel.org> Cc: Sean Christopherson <seanjc@google.com> Cc: Suzuki Poulouse <suzuki.poulose@arm.com> Link: https://lore.kernel.org/r/20230406065224.2553640-1-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
87 lines
1.2 KiB
Plaintext
87 lines
1.2 KiB
Plaintext
%define api.pure full
|
|
%parse-param {struct list_head *format}
|
|
%parse-param {char *name}
|
|
%parse-param {void *scanner}
|
|
%lex-param {void* scanner}
|
|
|
|
%{
|
|
|
|
#include <linux/compiler.h>
|
|
#include <linux/list.h>
|
|
#include <linux/bitmap.h>
|
|
#include <string.h>
|
|
#include "pmu.h"
|
|
|
|
#define ABORT_ON(val) \
|
|
do { \
|
|
if (val) \
|
|
YYABORT; \
|
|
} while (0)
|
|
|
|
%}
|
|
|
|
%token PP_CONFIG
|
|
%token PP_VALUE PP_ERROR
|
|
%type <num> PP_VALUE
|
|
%type <bits> bit_term
|
|
%type <bits> bits
|
|
|
|
%union
|
|
{
|
|
unsigned long num;
|
|
DECLARE_BITMAP(bits, PERF_PMU_FORMAT_BITS);
|
|
}
|
|
|
|
%%
|
|
|
|
format:
|
|
format format_term
|
|
|
|
|
format_term
|
|
|
|
format_term:
|
|
PP_CONFIG ':' bits
|
|
{
|
|
ABORT_ON(perf_pmu__new_format(format, name,
|
|
PERF_PMU_FORMAT_VALUE_CONFIG,
|
|
$3));
|
|
}
|
|
|
|
|
PP_CONFIG PP_VALUE ':' bits
|
|
{
|
|
ABORT_ON(perf_pmu__new_format(format, name,
|
|
$2,
|
|
$4));
|
|
}
|
|
|
|
bits:
|
|
bits ',' bit_term
|
|
{
|
|
bitmap_or($$, $1, $3, 64);
|
|
}
|
|
|
|
|
bit_term
|
|
{
|
|
memcpy($$, $1, sizeof($1));
|
|
}
|
|
|
|
bit_term:
|
|
PP_VALUE '-' PP_VALUE
|
|
{
|
|
perf_pmu__set_format($$, $1, $3);
|
|
}
|
|
|
|
|
PP_VALUE
|
|
{
|
|
perf_pmu__set_format($$, $1, 0);
|
|
}
|
|
|
|
%%
|
|
|
|
void perf_pmu_error(struct list_head *list __maybe_unused,
|
|
char *name __maybe_unused,
|
|
void *scanner __maybe_unused,
|
|
char const *msg __maybe_unused)
|
|
{
|
|
}
|