qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH for-2.9 31/47] qapi: Fix detection of doc / expr


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH for-2.9 31/47] qapi: Fix detection of doc / expression mismatch
Date: Wed, 15 Mar 2017 08:39:26 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Eric Blake <address@hidden> writes:

> On 03/13/2017 01:18 AM, Markus Armbruster wrote:
>> This fixes the errors uncovered by the previous commit.
>> 
>> Signed-off-by: Markus Armbruster <address@hidden>
>> ---
>
>>  
>>              expr = self.get_expr(False)
>>              if 'include' in expr:
>> +                self.reject_expr_doc()
>>                  if len(expr) != 1:
>
> Do you also need to handle 'pragma' expressions added earlier in the series?

Yes.

> /me goes and experiments:
>
> diff --git i/tests/qapi-schema/doc-bad-expr.json
> w/tests/qapi-schema/doc-bad-expr.json
> index 0caa0ae..6c1204d 100644
> --- i/tests/qapi-schema/doc-bad-expr.json
> +++ w/tests/qapi-schema/doc-bad-expr.json
> @@ -4,4 +4,5 @@
>  # @foo:
>  ##
>  { 'include': 'empty.json' }
> +{ 'pragma': {} }
>  { 'struct': 'foo', 'data': {} }
>
> Oops - back to accepting the program.

Need to squash in

diff --git a/scripts/qapi.py b/scripts/qapi.py
index 1dc33c9..8d55ff4 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -301,6 +301,7 @@ class QAPISchemaParser(object):
                 self._include(include, info, os.path.dirname(abs_fname),
                               previously_included)
             elif "pragma" in expr:
+                self.reject_expr_doc()
                 if len(expr) != 1:
                     raise QAPISemError(info, "Invalid 'pragma' directive")
                 for name, value in expr['pragma'].iteritems():



reply via email to

[Prev in Thread] Current Thread [Next in Thread]