Linux CXL
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Fabiano Rosas" <farosas@suse.de>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
	"Philippe Mathieu-Daudé" <philmd@mailo.com>,
	"Hanna Reitz" <hreitz@redhat.com>,
	qemu-block@nongnu.org, "Zhao Liu" <zhao1.liu@intel.com>,
	linux-cxl@vger.kernel.org, "Lukas Straub" <lukasstraub2@web.de>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Peter Xu" <peterx@redhat.com>,
	"Michael Roth" <michael.roth@amd.com>,
	"Jason Wang" <jasowangio@gmail.com>,
	"Eric Blake" <eblake@redhat.com>, "Kevin Wolf" <kwolf@redhat.com>,
	"Junjie Cao" <junjie.cao@intel.com>,
	"John Snow" <jsnow@redhat.com>
Subject: [PATCH v3 5/7] qapi/parser: fix intermediate "intro" detection
Date: Tue, 15 Sep 2026 17:14:32 -0400	[thread overview]
Message-ID: <20260915211434.3511110-6-jsnow@redhat.com> (raw)
In-Reply-To: <20260915211434.3511110-1-jsnow@redhat.com>

In 43e7ad1a3fa5, I adjusted the insertion algorithm for inserting
something after the "introduction" to cope with both the old and new
syntax while we converted QAPI to the new syntax. There's a bug in
that code that only shows up in a handful of cases and only when using
the new syntax while this affordance/flex code is still enabled.

In the case that we do actually have a real bona-fide intro section,
we want to insert directly after that real-deal intro section, not
after any plaintext sections that may follow it. This code adjusts the
temporary code to strongly prefer inserting after the actual intro
section if it exists.

Once again: once conversion is done, you will be delighted by how much
of this ugly code goes away.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 scripts/qapi/parser.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
index 9e14c2f7921..79f03062eea 100644
--- a/scripts/qapi/parser.py
+++ b/scripts/qapi/parser.py
@@ -845,6 +845,13 @@ def _insert_after_intro(
         needed and ``_insert_near_kind(QAPIDoc.Kind.INTRO, ...)`` will
         be sufficient.
         """
+        first = self.all_sections[0]
+        if first.text and first.kind == QAPIDoc.Kind.INTRO:
+            # First section is introduction and is non-empty: insert here.
+            # Rest assured all of this ugliness will very soon go away.
+            # Pinkie-swear.
+            self._insert_near_kind(QAPIDoc.Kind.INTRO, section, after=True)
+
         index = 0
         for index, ref_section in enumerate(self.all_sections):
             if ref_section.kind.name in ("PLAIN", "INTRO"):
-- 
2.55.0


  parent reply	other threads:[~2026-09-15 21:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15 21:14 [PATCH v3 0/7] qapi: convert remaining "simple" intro sections John Snow
2026-09-15 21:14 ` [PATCH v3 1/7] qapi: convert remaining simple intros for block-export.json John Snow
2026-09-15 21:14 ` [PATCH v3 2/7] qapi: convert remaining simple intros for cxl.json John Snow
2026-09-15 21:14 ` [PATCH v3 3/7] qapi: convert remaining simple intros for machine.json John Snow
2026-09-15 21:14 ` [PATCH v3 4/7] qapi: convert remaining simple intros for block-core.json John Snow
2026-09-15 21:14 ` John Snow [this message]
2026-09-16  7:10   ` [PATCH v3 5/7] qapi/parser: fix intermediate "intro" detection Markus Armbruster
2026-09-15 21:14 ` [PATCH v3 6/7] qapi: convert intro sections with "TODO" markers John Snow
2026-09-15 21:14 ` [PATCH v3 7/7] qapi: convert intro sections followed by notes/examples John Snow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260915211434.3511110-6-jsnow@redhat.com \
    --to=jsnow@redhat.com \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=farosas@suse.de \
    --cc=hreitz@redhat.com \
    --cc=jasowangio@gmail.com \
    --cc=jic23@kernel.org \
    --cc=junjie.cao@intel.com \
    --cc=kwolf@redhat.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=lukasstraub2@web.de \
    --cc=michael.roth@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=philmd@mailo.com \
    --cc=philmd@oss.qualcomm.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=zhao1.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox