Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf tools: Enable strict JSON parsing

This is to ensure that the PMU event files can always be parsed by
other tools.

Testing
=======

* There are no errors when parsing files for all architectures:
# pmu-events/jevents nds32 pmu-events/arch/ test
# pmu-events/jevents s390 pmu-events/arch/ test
# pmu-events/jevents powerpc pmu-events/arch/ test
# pmu-events/jevents arm64 pmu-events/arch/ test
# pmu-events/jevents test pmu-events/arch/ test
# pmu-events/jevents x86 pmu-events/arch/ test

* Trailing and leading commas now cause a parse error

* Double commas now cause a parse error

* Compilation and parsing works with strict mode disabled and enabled

* A diff of the output files shows no changes

Reviewed-by: Andi Kleen <ak@linux.intel.com>
Reviewed-by: Kajol Jain<kjain@linux.ibm.com>
Signed-off-by: James Clark <james.clark@arm.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andrew.Kilroy@arm.com
Cc: John Garry <john.garry@huawei.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nick.Forrington@arm.com
Cc: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20211007110543.564963-4-james.clark@arm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

James Clark and committed by
Arnaldo Carvalho de Melo
eda1a84c 21813684

+1
+1
tools/perf/pmu-events/jsmn.c
··· 24 24 25 25 #include <stdlib.h> 26 26 #include "jsmn.h" 27 + #define JSMN_STRICT 27 28 28 29 /* 29 30 * Allocates a fresh unused token from the token pool.