All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Marc-André Lureau" <marcandre.lureau@gmail.com>,
	qemu-devel@nongnu.org, "Thomas Huth" <thuth@redhat.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Michael Roth" <michael.roth@amd.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Laurent Vivier" <lvivier@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Beraldo Leal" <bleal@redhat.com>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Stefan Weil" <sw@weilnetz.de>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Eric Blake" <eblake@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [PATCH v4 07/11] qapi/gen: run C code through clang-format, if possible
Date: Tue, 07 Mar 2023 09:51:40 +0100	[thread overview]
Message-ID: <87a60pc5b7.fsf@pond.sub.org> (raw)
In-Reply-To: <CAFEAcA9ODuOc0i7_iMwCgk3_8hDruNGMbUADF6ymWhxfjuWrsw@mail.gmail.com> (Peter Maydell's message of "Mon, 6 Mar 2023 18:39:05 +0000")

Peter Maydell <peter.maydell@linaro.org> writes:

> On Mon, 6 Mar 2023 at 18:29, Marc-André Lureau
> <marcandre.lureau@gmail.com> wrote:
>>
>> Hi
>>
>> On Mon, Mar 6, 2023 at 8:06 PM Peter Maydell <peter.maydell@linaro.org> wrote:
>> >
>> > On Mon, 6 Mar 2023 at 12:33, <marcandre.lureau@redhat.com> wrote:
>> > >
>> > > From: Marc-André Lureau <marcandre.lureau@redhat.com>
>> > >
>> > > Make the resulting code even prettier, if possible.
>> >
>> > This seems to be a bit short on rationale. This is generated
>> > code, so in general nobody is going to be reading it, and
>> > running clang-format on it every time we generate code feels
>> > like it would be a bit of a waste of cycles...
>>
>> With this reasoning, why do we care about indentation of generated code at all?
>>
>> I think it still makes sense, because you have many reasons to read
>> through it eventually, and making it a bit more friendly helps.
>
> Yeah, sometimes you have to read through it, so not printing

I have to read it frequently enough to make ugly code painful.

> it all one one long line is helpful. But it's a tradeoff --
> "make it basically kinda readable by tracking indent level" is
> easy and quick; running the whole output through a pretty-printer
> is more expensive and doesn't improve the output by very much
> over what we already have. (If I'm wrong about that last part,
> it would be useful for the commit message to give an example
> of currently unreadable output that clang-format makes more usable.)

Tracking indent level is certainly quick, but it can take a bit of
effort.  In review of v3, I asked for more effort, and Marc-André
floated the idea of leaving the job to readily available clang-format
instead:

    ok, I improved the indentation a bit.

    However, I think it would be simpler, and better, if we piped the
    generated code to clang-format (when available). I made a simple patch
    for that too.

My reply was

    Piping through indent or clang-format may well give us neater results
    for less effort.

    We might want to dumb down generator code then.

Message-ID: <87356yq9rs.fsf@pond.sub.org>
https://lists.gnu.org/archive/html/qemu-devel/2023-02/msg06311.html

v4 no longer contains the indentation issue that triggered this
exchange.  Let's treat this patch as if it was separate, so it doesn't
delay the remainder of the series.

You're certainly right to ask for an assessment of costs and benefits.

Costs:

* Yet another dependency, albeit optional

* Running the indenter (not sure it's noticable, but numbers wanted)

Benefits:

* Result is maybe tidier (examples wanted)

* Not in this patch: we could dumb down the code generator some (the
  dependency becomes de facto mandatory for serious QAPI developers
  then)

We may choose to shelve this patch until the next time decent formatting
takes us effort.



  reply	other threads:[~2023-03-07  8:52 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-06 12:27 [PATCH v4 00/11] QMP command to import win32 sockets marcandre.lureau
2023-03-06 12:27 ` [PATCH v4 01/11] tests: fix path separator, use g_build_filename() marcandre.lureau
2023-03-06 12:27 ` [PATCH v4 02/11] char: do not double-close fd when failing to add client marcandre.lureau
2023-03-06 12:27 ` [PATCH v4 03/11] tests/docker: fix a win32 error due to portability marcandre.lureau
2023-03-06 12:27 ` [PATCH v4 04/11] osdep: implement qemu_socketpair() for win32 marcandre.lureau
2023-03-07 14:50   ` Daniel P. Berrangé
2023-03-08  6:53     ` Marc-André Lureau
2023-03-08  9:27       ` Daniel P. Berrangé
2023-03-06 12:27 ` [PATCH v4 05/11] qmp: 'add_client' actually expects sockets marcandre.lureau
2023-03-06 15:02   ` Markus Armbruster
2023-03-06 12:27 ` [PATCH v4 06/11] monitor: release the lock before calling close() marcandre.lureau
2023-03-06 15:29   ` Markus Armbruster
2023-03-06 15:44     ` Markus Armbruster
2023-03-06 12:27 ` [PATCH v4 07/11] qapi/gen: run C code through clang-format, if possible marcandre.lureau
2023-03-06 16:02   ` Markus Armbruster
2023-03-06 18:26     ` Marc-André Lureau
2023-03-06 16:05   ` Peter Maydell
2023-03-06 18:29     ` Marc-André Lureau
2023-03-06 18:39       ` Peter Maydell
2023-03-07  8:51         ` Markus Armbruster [this message]
2023-03-06 12:27 ` [PATCH v4 08/11] qmp: add 'get-win32-socket' marcandre.lureau
2023-03-06 15:47   ` Markus Armbruster
2023-03-07 12:31     ` Marc-André Lureau
2023-03-06 12:27 ` [PATCH v4 09/11] libqtest: make qtest_qmp_add_client work on win32 marcandre.lureau
2023-03-07 14:54   ` Daniel P. Berrangé
2023-03-06 12:27 ` [PATCH v4 10/11] qtest: enable vnc-display test " marcandre.lureau
2023-03-06 12:27 ` [PATCH v4 11/11] QMP/HMP: only actually implement getfd on CONFIG_POSIX marcandre.lureau
2023-03-06 16:01   ` 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=87a60pc5b7.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=berrange@redhat.com \
    --cc=bleal@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=eblake@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=marcandre.lureau@gmail.com \
    --cc=michael.roth@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sw@weilnetz.de \
    --cc=thuth@redhat.com \
    --cc=wainersm@redhat.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 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.