diff mbox series

[3/3] perf tools: Enable strict JSON parsing

Message ID 20211007110543.564963-4-james.clark@arm.com (mailing list archive)
State New, archived
Headers show
Series perf tools: Enable strict JSON parsing | expand

Commit Message

James Clark Oct. 7, 2021, 11:05 a.m. UTC
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

Signed-off-by: James Clark <james.clark@arm.com>
---
 tools/perf/pmu-events/jsmn.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/tools/perf/pmu-events/jsmn.c b/tools/perf/pmu-events/jsmn.c
index 8124d2d3ff0c..831dc44c4558 100644
--- a/tools/perf/pmu-events/jsmn.c
+++ b/tools/perf/pmu-events/jsmn.c
@@ -24,6 +24,7 @@ 
 
 #include <stdlib.h>
 #include "jsmn.h"
+#define JSMN_STRICT
 
 /*
  * Allocates a fresh unused token from the token pool.