mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-01 23:04:54 +01:00
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 <[email protected]> Acked-by: Jiri Olsa <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Gaosheng Cui <[email protected]> Cc: German Gomez <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: James Clark <[email protected]> Cc: Jing Zhang <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Ravi Bangoria <[email protected]> Cc: Rob Herring <[email protected]> Cc: Sean Christopherson <[email protected]> Cc: Suzuki Poulouse <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
49 lines
767 B
Plaintext
49 lines
767 B
Plaintext
%option prefix="perf_pmu_"
|
|
%option reentrant
|
|
%option bison-bridge
|
|
|
|
%{
|
|
#include <stdlib.h>
|
|
#include <linux/bitops.h>
|
|
#include "pmu.h"
|
|
#include "pmu-bison.h"
|
|
|
|
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(text, NULL, base);
|
|
if (errno)
|
|
return PP_ERROR;
|
|
|
|
yylval->num = num;
|
|
return PP_VALUE;
|
|
}
|
|
|
|
%}
|
|
|
|
num_dec [0-9]+
|
|
|
|
%%
|
|
|
|
{num_dec} { return value(yyscanner, 10); }
|
|
config { return PP_CONFIG; }
|
|
- { return '-'; }
|
|
: { return ':'; }
|
|
, { return ','; }
|
|
. { ; }
|
|
\n { ; }
|
|
|
|
%%
|
|
|
|
int perf_pmu_wrap(void *scanner __maybe_unused)
|
|
{
|
|
return 1;
|
|
}
|