Skip to contentSkip to conversation

qapi: fix flat union on uncovered branches conditionals

PATCH Applied Marc-André Lureau 3 participants 4 messages Dec 17, 2018 – Dec 18, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qapi: fix flat union on uncovered branches conditionals

Default branches variant should use the member conditional.

This fixes compilation with --disable-replication.

Fixes 335d10cd8e2c3bb6067804b095aaf6371fc1983e
---
 scripts/qapi/common.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/qapi/common.py +1 -1
index 8c2d97369e..d385a08270 100644
@@ -1460,7 +1460,7 @@ class QAPISchemaObjectTypeVariants(object):
             cases = set([v.name for v in self.variants])
             for m in self.tag_member.type.members:
                 if m.name not in cases:
-                    v = QAPISchemaObjectTypeVariant(m.name, 'q_empty')
+                    v = QAPISchemaObjectTypeVariant(m.name, 'q_empty', m.ifcond)
                     v.set_owner(self.tag_member.owner)
                     self.variants.append(v)
         for v in self.variants:
Signature · 1 line
2.20.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Marc-André Lureau

Default branches variant should use the member conditional.

This fixes compilation with --disable-replication.

Fixes 335d10cd8e2c3bb6067804b095aaf6371fc1983e
---
 scripts/qapi/common.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/qapi/common.py +0 -0
index 8c2d97369e..d385a08270 100644

scripts/qapi/common.py class QAPISchemaObjectTypeVariants(object): · line 1466

Quoted 8 lines
scripts/qapi/common.py +1 -1
@@ -1460,7 +1460,7 @@ class QAPISchemaObjectTypeVariants(object):
             cases = set([v.name for v in self.variants])
             for m in self.tag_member.type.members:
                 if m.name not in cases:
-                    v = QAPISchemaObjectTypeVariant(m.name, 'q_empty')
+                    v = QAPISchemaObjectTypeVariant(m.name, 'q_empty', m.ifcond)
                     v.set_owner(self.tag_member.owner)
                     self.variants.append(v)
         for v in self.variants:

Long line, happy to wrap it when I apply.

I append the diff of generated code.

qapi-introspect.c +2 -0
diff -rup qapi-gen-fb06411210/qapi-introspect.c qapi-gen-ce1a1aec47/qapi-introspect.c
@@ -10068,11 +10068,13 @@ const QLitObject qmp_schema_qlit = QLIT_
                 { "type", QLIT_QSTR("0"), },
                 {}
             })),
+#if defined(CONFIG_REPLICATION)
             QLIT_QDICT(((QLitDictEntry[]) {
                 { "case", QLIT_QSTR("replication"), },
                 { "type", QLIT_QSTR("0"), },
                 {}
             })),
+#endif /* defined(CONFIG_REPLICATION) */
             QLIT_QDICT(((QLitDictEntry[]) {
                 { "case", QLIT_QSTR("throttle"), },
                 { "type", QLIT_QSTR("0"), },
qapi-visit-block-core.c +2 -0
diff -rup qapi-gen-fb06411210/qapi-visit-block-core.c qapi-gen-ce1a1aec47/qapi-visit-block-core.c
@@ -7175,8 +7175,10 @@ void visit_type_BlockdevCreateOptions_me
         break;
     case BLOCKDEV_DRIVER_RAW:
         break;
+#if defined(CONFIG_REPLICATION)
     case BLOCKDEV_DRIVER_REPLICATION:
         break;
+#endif /* defined(CONFIG_REPLICATION) */
     case BLOCKDEV_DRIVER_THROTTLE:
         break;
     case BLOCKDEV_DRIVER_VMDK:
Tested-by on v1 1/1
#3 lore raw
In reply to Marc-André Lureau
Quoted 16 lines · Marc-André Lureau

Default branches variant should use the member conditional.

This fixes compilation with --disable-replication.

Fixes 335d10cd8e2c3bb6067804b095aaf6371fc1983e
---
 scripts/qapi/common.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/qapi/common.py +0 -0
index 8c2d97369e..d385a08270 100644

scripts/qapi/common.py class QAPISchemaObjectTypeVariants(object): · line 1466

Quoted 8 lines
scripts/qapi/common.py +1 -1
@@ -1460,7 +1460,7 @@ class QAPISchemaObjectTypeVariants(object):
             cases = set([v.name for v in self.variants])
             for m in self.tag_member.type.members:
                 if m.name not in cases:
-                    v = QAPISchemaObjectTypeVariant(m.name, 'q_empty')
+                    v = QAPISchemaObjectTypeVariant(m.name, 'q_empty', m.ifcond)
                     v.set_owner(self.tag_member.owner)
                     self.variants.append(v)
         for v in self.variants:

This fixes the compilation problem for me, indeed!