From 9d55380b5aecd4ae5324e7d4ab0a7dfc510b634d Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sat, 14 Sep 2019 17:34:56 +0200 Subject: qapi: Remove null from schema language We represent the parse tree as OrderedDict. We fetch optional dict members with .get(). So far, so good. We represent null literals as None. .get() returns None both for "absent" and for "present, value is the null literal". Uh-oh. Test features-if-invalid exposes this bug: "'if': null" is misinterpreted as absent "if". We added null to the schema language to "allow [...] an explicit default value" (commit e53188ada5 "qapi: Allow true, false and null in schema json", v2.4.0). Hasn't happened; null is still unused except as generic invalid value in tests/. To fix, we'd have to replace .get() by something more careful, or represent null differently. Feasible, but we got more and bigger fish to fry right now. Remove the null literal from the schema language. Replace null in tests by another invalid value. Test features-if-invalid now behaves as it should. Signed-off-by: Markus Armbruster Message-Id: <20190914153506.2151-10-armbru@redhat.com> Reviewed-by: Eric Blake --- docs/devel/qapi-code-gen.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/devel/qapi-code-gen.txt') diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt index b12a5b4..64d9e4c 100644 --- a/docs/devel/qapi-code-gen.txt +++ b/docs/devel/qapi-code-gen.txt @@ -52,7 +52,7 @@ Differences: * Strings are restricted to printable ASCII, and escape sequences to just '\\'. -* Numbers are not supported. +* Numbers and null are not supported. A second layer of syntax defines the sequences of JSON texts that are a correctly structured QAPI schema. We provide a grammar for this @@ -67,7 +67,7 @@ syntax in an EBNF-like notation: expression A separated by , * Grouping: expression ( A ) matches expression A * JSON's structural characters are terminals: { } [ ] : , -* JSON's literal names are terminals: false true null +* JSON's literal names are terminals: false true * String literals enclosed in 'single quotes' are terminal, and match this JSON string, with a leading '*' stripped off * When JSON object member's name starts with '*', the member is -- cgit v1.1