cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-qapi.py-Permit-comments-starting-anywhere-on-the-lin.patch

0a122b
From eee270ab05e29d24d26d8834a00ec0dfcfc99d66 Mon Sep 17 00:00:00 2001
0a122b
Message-Id: <eee270ab05e29d24d26d8834a00ec0dfcfc99d66.1387369730.git.minovotn@redhat.com>
0a122b
In-Reply-To: <091eecc4fa42754760dfff393dabcc2b444e9693.1387369730.git.minovotn@redhat.com>
0a122b
References: <091eecc4fa42754760dfff393dabcc2b444e9693.1387369730.git.minovotn@redhat.com>
0a122b
From: Markus Armbruster <armbru@redhat.com>
0a122b
Date: Tue, 10 Dec 2013 15:29:19 +0100
0a122b
Subject: [PATCH 19/21] qapi.py: Permit comments starting anywhere on the line
0a122b
0a122b
RH-Author: Markus Armbruster <armbru@redhat.com>
0a122b
Message-id: <1386689361-30281-17-git-send-email-armbru@redhat.com>
0a122b
Patchwork-id: 56128
0a122b
O-Subject: [PATCH 7.0 qemu-kvm 16/18] qapi.py: Permit comments starting anywhere on the line
0a122b
Bugzilla: 997915
0a122b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
0a122b
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
0a122b
RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
0a122b
0a122b
From: Markus Armbruster <armbru@redhat.com>
0a122b
0a122b
Signed-off-by: Markus Armbruster <armbru@redhat.com>
0a122b
Reviewed-by: Eric Blake <eblake@redhat.com>
0a122b
Message-id: 1374939721-7876-10-git-send-email-armbru@redhat.com
0a122b
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
0a122b
(cherry picked from commit f1a145e154b0a227a1e192009ca30b351de0a8ef)
0a122b
0a122b
Backporting hack: now that indented comments work properly, revert the
0a122b
damage to qapi-schema.json.
0a122b
---
0a122b
 qapi-schema.json                | 2 +-
0a122b
 scripts/qapi.py                 | 3 +--
0a122b
 tests/qapi-schema/comments.err  | 1 -
0a122b
 tests/qapi-schema/comments.exit | 2 +-
0a122b
 tests/qapi-schema/comments.out  | 3 +++
0a122b
 5 files changed, 6 insertions(+), 5 deletions(-)
0a122b
0a122b
Signed-off-by: Michal Novotny <minovotn@redhat.com>
0a122b
---
0a122b
 qapi-schema.json                | 2 +-
0a122b
 scripts/qapi.py                 | 3 +--
0a122b
 tests/qapi-schema/comments.err  | 1 -
0a122b
 tests/qapi-schema/comments.exit | 2 +-
0a122b
 tests/qapi-schema/comments.out  | 3 +++
0a122b
 5 files changed, 6 insertions(+), 5 deletions(-)
0a122b
0a122b
diff --git a/qapi-schema.json b/qapi-schema.json
0a122b
index 81fe591..b27108f 100644
0a122b
--- a/qapi-schema.json
0a122b
+++ b/qapi-schema.json
0a122b
@@ -3437,7 +3437,7 @@
0a122b
                                        'spiceport' : 'ChardevSpicePort',
0a122b
                                        'vc'     : 'ChardevVC',
0a122b
                                        'ringbuf': 'ChardevRingbuf',
0a122b
-# next one is just for compatibility
0a122b
+                                       # next one is just for compatibility
0a122b
                                        'memory' : 'ChardevRingbuf' } }
0a122b
 
0a122b
 ##
0a122b
diff --git a/scripts/qapi.py b/scripts/qapi.py
0a122b
index f64b7b2..0ebea94 100644
0a122b
--- a/scripts/qapi.py
0a122b
+++ b/scripts/qapi.py
0a122b
@@ -68,13 +68,12 @@ class QAPISchema:
0a122b
 
0a122b
     def accept(self):
0a122b
         while True:
0a122b
-            bol = self.cursor == 0 or self.src[self.cursor-1] == '\n'
0a122b
             self.tok = self.src[self.cursor]
0a122b
             self.pos = self.cursor
0a122b
             self.cursor += 1
0a122b
             self.val = None
0a122b
 
0a122b
-            if self.tok == '#' and bol:
0a122b
+            if self.tok == '#':
0a122b
                 self.cursor = self.src.find('\n', self.cursor)
0a122b
             elif self.tok in ['{', '}', ':', ',', '[', ']']:
0a122b
                 return
0a122b
diff --git a/tests/qapi-schema/comments.err b/tests/qapi-schema/comments.err
0a122b
index 4a82b26..e69de29 100644
0a122b
--- a/tests/qapi-schema/comments.err
0a122b
+++ b/tests/qapi-schema/comments.err
0a122b
@@ -1 +0,0 @@
0a122b
-<stdin>:2:33: Stray "#"
0a122b
diff --git a/tests/qapi-schema/comments.exit b/tests/qapi-schema/comments.exit
0a122b
index d00491f..573541a 100644
0a122b
--- a/tests/qapi-schema/comments.exit
0a122b
+++ b/tests/qapi-schema/comments.exit
0a122b
@@ -1 +1 @@
0a122b
-1
0a122b
+0
0a122b
diff --git a/tests/qapi-schema/comments.out b/tests/qapi-schema/comments.out
0a122b
index e69de29..e3bd904 100644
0a122b
--- a/tests/qapi-schema/comments.out
0a122b
+++ b/tests/qapi-schema/comments.out
0a122b
@@ -0,0 +1,3 @@
0a122b
+[OrderedDict([('enum', 'Status'), ('data', ['good', 'bad', 'ugly'])])]
0a122b
+['Status']
0a122b
+[]
0a122b
-- 
0a122b
1.7.11.7
0a122b