All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: qemu-devel@nongnu.org, John Snow <jsnow@redhat.com>,
	Cleber Rosa <crosa@redhat.com>
Subject: Re: [RFC PATCH v2 02/10] scripts/expand-macro.py: helper script exploding macros
Date: Mon, 11 May 2026 18:31:30 +0100	[thread overview]
Message-ID: <agIScsrfiXudewZ3@redhat.com> (raw)
In-Reply-To: <20260511170500.124211-3-alex.bennee@linaro.org>

On Mon, May 11, 2026 at 06:04:51PM +0100, Alex Bennée wrote:
> QEMU makes heavy use of C Macros which can be confusing to humans and
> seems almost impossible for AI agents to follow. In the past I've
> dealt with this by compiling with V=1 and manually copying and pasting
> the gcc command line and appending -E to run the pre-processor step.
> 
> With the modern build system we now have a compile_commands.json so we
> can automate the process with a script.
> 
> There is some trickiness involved in following the line markers so we
> know where in the source file we are. To handle this we implement a
> PreprocessorState object to track where in the include chain we are.
> This allows us to show the including location when we dump the
> expanded macro.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  scripts/expand-macro.py | 272 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 272 insertions(+)
>  create mode 100755 scripts/expand-macro.py
> 
> diff --git a/scripts/expand-macro.py b/scripts/expand-macro.py
> new file mode 100755
> index 00000000000..581f20b9897
> --- /dev/null
> +++ b/scripts/expand-macro.py
> @@ -0,0 +1,272 @@
> +#!/usr/bin/env python3
> +#
> +# Automate the expansion of QEMU macros based on compile_commands.json.
> +#
> +# This script runs the C preprocessor over a file to expand macros
> +# in a specified line range, using the compilation flags defined in
> +# compile_commands.json.
> +#
> +# Copyright (c) Linaro 2026

SPDX-License-Identifier  needed


With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|



  reply	other threads:[~2026-05-11 17:31 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-11 17:04 [RFC PATCH v2 00/10] AGENTS.md and associated skills Alex Bennée
2026-05-11 17:04 ` [RFC PATCH v2 01/10] AGENTS.md: add basic AGENTS.md for QEMU Alex Bennée
2026-05-11 17:58   ` Peter Maydell
2026-05-11 19:10     ` Alex Bennée
2026-05-12  8:39       ` Peter Maydell
2026-05-14  2:58   ` Chao Liu
2026-05-14  6:36     ` Alex Bennée
2026-05-15  4:26       ` Chao Liu
2026-05-15  7:55         ` Alex Bennée
2026-05-11 17:04 ` [RFC PATCH v2 02/10] scripts/expand-macro.py: helper script exploding macros Alex Bennée
2026-05-11 17:31   ` Daniel P. Berrangé [this message]
2026-05-11 17:04 ` [RFC PATCH v2 03/10] .agents/skills: add qemu-code-explorer skill Alex Bennée
2026-05-11 17:32   ` Daniel P. Berrangé
2026-05-11 18:00     ` Alex Bennée
2026-05-11 17:04 ` [RFC PATCH v2 04/10] .agents/skills: add qemu-build skill Alex Bennée
2026-05-12 14:40   ` Chao Liu
2026-05-11 17:04 ` [RFC PATCH v2 05/10] .agents/skills: add qemu-testing skill Alex Bennée
2026-05-11 17:04 ` [RFC PATCH v2 06/10] .agents/skills: add qemu-code-reviewer skill Alex Bennée
2026-05-12  3:21   ` Chao Liu
2026-05-12  9:19     ` Alex Bennée
2026-05-12 14:43       ` Chao Liu
2026-05-11 17:04 ` [RFC PATCH v2 07/10] .agents/skills: add qemu-mail-thread skill Alex Bennée
2026-05-11 18:01   ` Alex Bennée
2026-05-12  3:07   ` Chao Liu
2026-05-11 17:04 ` [RFC PATCH v2 08/10] .agents/skills: add qemu-issue-helper skill Alex Bennée
2026-05-11 17:04 ` [RFC PATCH v2 09/10] .agents/skills: add qemu-issue-triage agent skill Alex Bennée
2026-05-11 17:04 ` [RFC PATCH v2 10/10] MAINTAINERS: add a section for AI agents Alex Bennée
2026-05-11 17:33   ` Daniel P. Berrangé

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=agIScsrfiXudewZ3@redhat.com \
    --to=berrange@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=crosa@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.