From: James Clark Date: Thu, 7 Oct 2021 11:05:42 +0000 (+0100) Subject: perf tools: Enable strict JSON parsing X-Git-Tag: v6.1-rc5~2702^2~79 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eda1a84cb4e9375984563c23a950377f915e7e1b;p=platform%2Fkernel%2Flinux-starfive.git 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 Reviewed-by: Kajol Jain Signed-off-by: James Clark Acked-by: Jiri Olsa Cc: Alexander Shishkin Cc: Andrew.Kilroy@arm.com Cc: John Garry Cc: Leo Yan Cc: Mark Rutland Cc: Mathieu Poirier Cc: Namhyung Kim Cc: Nick.Forrington@arm.com Cc: Will Deacon 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 --- diff --git a/tools/perf/pmu-events/jsmn.c b/tools/perf/pmu-events/jsmn.c index 8124d2d..831dc44 100644 --- a/tools/perf/pmu-events/jsmn.c +++ b/tools/perf/pmu-events/jsmn.c @@ -24,6 +24,7 @@ #include #include "jsmn.h" +#define JSMN_STRICT /* * Allocates a fresh unused token from the token pool.