mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-06 05:06:29 +00:00
perf expr: Allow NaN to be a valid number
Currently only floating point numbers can be parsed, add a special case for NaN. Signed-off-by: Ian Rogers <irogers@google.com> Reviewed-by: Kan Liang <kan.liang@linux.intel.com> Cc: K Prateek Nayak <kprateek.nayak@amd.com> Cc: James Clark <james.clark@arm.com> Cc: Kaige Ye <ye@kaige.org> Cc: John Garry <john.g.garry@oracle.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Link: https://lore.kernel.org/r/20240209204947.3873294-2-irogers@google.com
This commit is contained in:
parent
923e4616ec
commit
4ea7d94407
@ -94,6 +94,14 @@ static int literal(yyscan_t scanner, const struct expr_scanner_ctx *sctx)
|
||||
}
|
||||
return LITERAL;
|
||||
}
|
||||
|
||||
static int nan_value(yyscan_t scanner)
|
||||
{
|
||||
YYSTYPE *yylval = expr_get_lval(scanner);
|
||||
|
||||
yylval->num = NAN;
|
||||
return NUMBER;
|
||||
}
|
||||
%}
|
||||
|
||||
number ([0-9]+\.?[0-9]*|[0-9]*\.?[0-9]+)(e-?[0-9]+)?
|
||||
@ -115,6 +123,7 @@ else { return ELSE; }
|
||||
source_count { return SOURCE_COUNT; }
|
||||
has_event { return HAS_EVENT; }
|
||||
strcmp_cpuid_str { return STRCMP_CPUID_STR; }
|
||||
NaN { return nan_value(yyscanner); }
|
||||
{literal} { return literal(yyscanner, sctx); }
|
||||
{number} { return value(yyscanner); }
|
||||
{symbol} { return str(yyscanner, ID, sctx->runtime); }
|
||||
|
Loading…
Reference in New Issue
Block a user