lkml.org 
[lkml]   [2021]   [Oct]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/3] perf tools: Enable strict JSON parsing
Date
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 --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.
--
2.28.0
\
 
 \ /
  Last update: 2021-10-07 13:07    [W:1.949 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site