From nobody Mon Feb 9 12:25:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1635416774; cv=none; d=zohomail.com; s=zohoarc; b=SxK9u0GljzfUyCm3Ed1IpsXXQE7V0oeaTFFZ4ikwRM+Iv5U+BntHRfRVeIrPWUmCG5WulCxLOsIIKk/prFStJjwGGOADQMVYCkCZZdIfB4Nx7gyddFH+D9R4BbnRrUdwmDaaua98K1/bp0a9DD9keRcM9VbvfShe3rsbqaVnGF0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635416774; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oqE7rF9IM7mRRsuUCSxKju0OgS59eNBKa7ba+uQGeVA=; b=EW71aENrARgWzcFF2LsXo4mZV5UVKmDjO1WRBljrzefW4wgsQ0beE5JrMZ1bKaYEnll+GAWbBBTXbqNWcyA2nCgk2lDXXHQDFiMFgTyFU/Ajhg7uJc5DFheLclUwJaXZKZSCGsbh5fAN6IFQUybRLrk4fXUnA1eQnCPSOBHtv3g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1635416774131637.3661571419185; Thu, 28 Oct 2021 03:26:14 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-352-uG5qCv0ZOSO82DkN0fip5A-1; Thu, 28 Oct 2021 06:26:10 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 86AC21808310; Thu, 28 Oct 2021 10:26:05 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 61B8810016FE; Thu, 28 Oct 2021 10:26:05 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 00FCC4EA31; Thu, 28 Oct 2021 10:26:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19SAPhnE007364 for ; Thu, 28 Oct 2021 06:25:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 138CA69FB9; Thu, 28 Oct 2021 10:25:43 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-7.ams2.redhat.com [10.36.112.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1292069219; Thu, 28 Oct 2021 10:25:21 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 4505F11380C3; Thu, 28 Oct 2021 12:25:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635416773; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=oqE7rF9IM7mRRsuUCSxKju0OgS59eNBKa7ba+uQGeVA=; b=Js8q7Y3UpbCOyXWmHvEYGjpbHqQOAnqTqj35xz0HcsabaqxxdlnBs0J6Y7Zxj//HcvXvMy b2IPiPef5d6cmcI/wEba5T/QqxwOYh/t+pMSVIxd2y0fZMuFf5U8X9ksD9qgG1BgOGZ22F j27dd+CT0uSkq+broNowzy99XkuOsdQ= X-MC-Unique: uG5qCv0ZOSO82DkN0fip5A-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 4/9] qapi: Tools for sets of special feature flags in generated code Date: Thu, 28 Oct 2021 12:25:15 +0200 Message-Id: <20211028102520.747396-5-armbru@redhat.com> In-Reply-To: <20211028102520.747396-1-armbru@redhat.com> References: <20211028102520.747396-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, quintela@redhat.com, libvir-list@redhat.com, eblake@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, marcandre.lureau@redhat.com, philmd@redhat.com, jsnow@redhat.com, libguestfs@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1635416775737100001 Content-Type: text/plain; charset="utf-8" New enum QapiSpecialFeature enumerates the special feature flags. New helper gen_special_features() returns code to represent a collection of special feature flags as a bitset. The next few commits will put them to use. Signed-off-by: Markus Armbruster Reviewed-by: John Snow Reviewed-by: Juan Quintela Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/qapi/util.h | 4 ++++ scripts/qapi/gen.py | 8 ++++++++ scripts/qapi/schema.py | 3 +++ 3 files changed, 15 insertions(+) diff --git a/include/qapi/util.h b/include/qapi/util.h index 257c600f99..7a8d5c7d72 100644 --- a/include/qapi/util.h +++ b/include/qapi/util.h @@ -11,6 +11,10 @@ #ifndef QAPI_UTIL_H #define QAPI_UTIL_H =20 +typedef enum { + QAPI_DEPRECATED, +} QapiSpecialFeature; + /* QEnumLookup flags */ #define QAPI_ENUM_DEPRECATED 1 =20 diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py index 2ec1e7b3b6..995a97d2b8 100644 --- a/scripts/qapi/gen.py +++ b/scripts/qapi/gen.py @@ -18,6 +18,7 @@ Dict, Iterator, Optional, + Sequence, Tuple, ) =20 @@ -29,6 +30,7 @@ mcgen, ) from .schema import ( + QAPISchemaFeature, QAPISchemaIfCond, QAPISchemaModule, QAPISchemaObjectType, @@ -37,6 +39,12 @@ from .source import QAPISourceInfo =20 =20 +def gen_special_features(features: Sequence[QAPISchemaFeature]) -> str: + special_features =3D [f"1u << QAPI_{feat.name.upper()}" + for feat in features if feat.is_special()] + return ' | '.join(special_features) or '0' + + class QAPIGen: def __init__(self, fname: str): self.fname =3D fname diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 6d5f46509a..55f82d7389 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -725,6 +725,9 @@ def connect_doc(self, doc): class QAPISchemaFeature(QAPISchemaMember): role =3D 'feature' =20 + def is_special(self): + return self.name in ('deprecated') + =20 class QAPISchemaObjectTypeMember(QAPISchemaMember): def __init__(self, name, info, typ, optional, ifcond=3DNone, features= =3DNone): --=20 2.31.1