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

John Snow <jsnow@redhat.com> writes:

> 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 | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
> index 9e14c2f7921..6a9a5589c14 100644
> --- a/scripts/qapi/parser.py
> +++ b/scripts/qapi/parser.py
> @@ -845,6 +845,14 @@ 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)

Isn't this a roundabout way to do

               self.all_sections.insert(1, section)

?

> +            return
> +
>          index = 0
>          for index, ref_section in enumerate(self.all_sections):
>              if ref_section.kind.name in ("PLAIN", "INTRO"):
                   continue
               break
           else:
               index += 1

           self.all_sections.insert(index, section)


  reply	other threads:[~2026-09-17  5:13 UTC|newest]

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

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=87tsno5ulh.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=farosas@suse.de \
    --cc=hreitz@redhat.com \
    --cc=jasowangio@gmail.com \
    --cc=jic23@kernel.org \
    --cc=jsnow@redhat.com \
    --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