From: Paolo Bonzini <pbonzini@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: "Eduardo Habkost" <ehabkost@redhat.com>,
qemu-block@nongnu.org, "Juan Quintela" <quintela@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Yuval Shaia" <yuval.shaia.ml@gmail.com>,
"Markus Armbruster" <armbru@redhat.com>,
qemu-devel@nongnu.org, "Gerd Hoffmann" <kraxel@redhat.com>,
"Andrea Bolognani" <abologna@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"John Snow" <jsnow@redhat.com>,
"Michael Roth" <mdroth@linux.vnet.ibm.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"Stefan Berger" <stefanb@linux.ibm.com>
Subject: Re: cleanups with long-term benefits (was Re: [PATCH] schemas: Add vim modeline)
Date: Fri, 31 Jul 2020 19:16:54 +0200 [thread overview]
Message-ID: <c2ad1dd6-d53e-b4fa-79e2-0006ddf2f5b2@redhat.com> (raw)
In-Reply-To: <20200731170500.GF3660103@redhat.com>
On 31/07/20 19:05, Daniel P. Berrangé wrote:
> NB our files are not JSON documents, they are a concatenation of a list
> of JSON documents.
This is not something that editors generally have problems with.
> If you use javascript mode, then emacs will highlight all the javascript
> language keywords in the comments because it doesn't recognise "#" as a
> comment - you need // or /* .. */ for comments in JavaScript
Oops, good point. So yeah, using // comments and double quotes would
fix editor problems and be much more kind to downstreams.
> I'd also suggest replacing fprintf/printf/sprintf with the g*printf*
> equivalents. The benefit here is that GLib guarantees that its variants
> work the same way on Windows as on Linux. They pulled in the GNULIB
> printf impl to replace Microsoft's broken impl.
That should not be an issue to replace. Most of our printf uses anyway
are wrapped within error_report, or they are g_strdup_printf which we're
already preferring to the messy libc asprintf for obvious reasons.
> There's various silly little things like ARRAY_SIZE vs G_N_ELEMENTS,
> and __attribute__ macros - QEMU_NORETURN vs G_GNUC_NORETURN.
> QEMU_BUILD_BUG_ON vs G_STATIC_ASSERT
> There's util/buffer.{c.h} that can be replaced by GString or GArray.
Some of these are no brainers too. QEMU_BUILD_BUG_ON reverses the
logic; I'm not sure if Coccinelle can do De Morgan laws.
>>> Another example would be adopting a standard code style and using a
>>> tool like clang-format to enforce this for entire of existing code
>>> base and future contributions and throwing away our checkpatch.pl
>>> which nearly everyone is scared of touching as it is Perl code.
>> Checkpatch does much more than that, though the scary part is indeed the
>> one that enfoces coding style. I wouldn't have a problem with using
>> clang-format and calling it a day.
> If there are things missing that we consider important, a long term
> better strategy would be to use the Python binding to libclang to
> detect the problem, instead of trying to parse C code with Perl and
> regexes.
Most of it is simply "use this function instead of this one" or "place a
comment to explain why you're using this". The main feature of
checkpatch.pl however is that it works on patches, not just files, but
still there would be a substantial advantage in employing clang-format.
Paolo
next prev parent reply other threads:[~2020-07-31 17:17 UTC|newest]
Thread overview: 85+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-29 18:50 [PATCH] schemas: Add vim modeline Andrea Bolognani
2020-07-30 9:07 ` Markus Armbruster
2020-07-30 9:37 ` Daniel P. Berrangé
2020-07-30 11:51 ` Markus Armbruster
2020-07-30 13:24 ` Daniel P. Berrangé
2020-07-31 6:45 ` John Snow
2020-07-31 9:21 ` Markus Armbruster
2020-07-31 9:32 ` Daniel P. Berrangé
2020-07-31 12:55 ` Markus Armbruster
2020-07-31 15:07 ` Daniel P. Berrangé
2020-07-31 15:26 ` John Snow
2020-07-31 15:44 ` Daniel P. Berrangé
2020-08-03 7:28 ` Markus Armbruster
2020-08-03 8:41 ` Paolo Bonzini
2020-08-03 11:24 ` Markus Armbruster
2020-08-03 11:36 ` Daniel P. Berrangé
2020-08-03 12:16 ` Paolo Bonzini
2020-08-03 12:23 ` Daniel P. Berrangé
2020-08-03 12:33 ` Paolo Bonzini
2020-08-03 12:43 ` Daniel P. Berrangé
2020-08-03 15:48 ` Markus Armbruster
2020-08-03 21:02 ` Nir Soffer
2020-07-31 16:35 ` Paolo Bonzini
2020-07-31 16:41 ` Dr. David Alan Gilbert
2020-07-31 17:20 ` Daniel P. Berrangé
2020-07-31 17:47 ` Paolo Bonzini
2020-08-03 9:44 ` Daniel P. Berrangé
2020-07-31 17:53 ` John Snow
2020-07-31 18:01 ` Paolo Bonzini
2020-08-03 7:45 ` Markus Armbruster
2020-07-31 16:28 ` cleanups with long-term benefits (was Re: [PATCH] schemas: Add vim modeline) Paolo Bonzini
2020-07-31 17:05 ` Daniel P. Berrangé
2020-07-31 17:16 ` Paolo Bonzini [this message]
2020-07-31 17:27 ` Daniel P. Berrangé
2020-07-31 17:42 ` Paolo Bonzini
2020-08-03 9:27 ` Daniel P. Berrangé
2020-08-03 8:18 ` Markus Armbruster
2020-08-03 8:42 ` Paolo Bonzini
2020-08-03 11:28 ` Markus Armbruster
2020-08-03 12:01 ` Paolo Bonzini
2020-08-03 16:03 ` Markus Armbruster
2020-08-03 16:36 ` Kevin Wolf
2020-08-04 7:28 ` Markus Armbruster
2020-08-03 17:19 ` Paolo Bonzini
2020-08-04 8:03 ` Markus Armbruster
2020-08-04 18:24 ` John Snow
2020-08-05 7:36 ` Markus Armbruster
2020-08-05 8:25 ` Paolo Bonzini
2020-08-05 8:39 ` Dr. David Alan Gilbert
2020-08-05 8:49 ` Paolo Bonzini
2020-08-05 9:05 ` Daniel P. Berrangé
2020-08-05 9:11 ` cleanups with long-term benefits Cornelia Huck
2020-08-05 10:08 ` Daniel P. Berrangé
2020-08-05 10:24 ` Cornelia Huck
2020-08-05 16:23 ` Kevin Wolf
2020-08-05 16:46 ` Eduardo Habkost
2020-08-06 5:44 ` Markus Armbruster
2020-08-05 8:47 ` Cornelia Huck
2020-08-05 8:56 ` cleanups with long-term benefits (was Re: [PATCH] schemas: Add vim modeline) Markus Armbruster
2020-08-05 10:15 ` Alex Bennée
2020-08-05 16:04 ` John Snow
2020-08-06 4:58 ` Markus Armbruster
2020-08-05 8:42 ` Markus Armbruster
2020-08-03 18:10 ` John Snow
2020-08-03 18:16 ` Paolo Bonzini
2020-08-03 18:19 ` John Snow
2020-08-03 19:54 ` Nir Soffer
2020-08-03 20:48 ` John Snow
2020-08-03 9:50 ` Daniel P. Berrangé
2020-08-03 11:32 ` Markus Armbruster
2020-07-31 16:39 ` [PATCH] schemas: Add vim modeline Kevin Wolf
2020-07-30 15:11 ` Eric Blake
2020-07-30 20:53 ` John Snow
2020-07-30 20:56 ` John Snow
2020-07-31 7:15 ` Kevin Wolf
2020-07-31 8:48 ` Daniel P. Berrangé
2020-07-31 9:01 ` Markus Armbruster
2020-07-31 11:26 ` Kevin Wolf
2020-08-03 8:51 ` Markus Armbruster
2020-07-31 23:12 ` Nir Soffer
2020-08-03 12:16 ` Paolo Bonzini
2020-08-04 7:28 ` Markus Armbruster
2020-08-04 8:29 ` Alex Bennée
2020-09-07 13:54 ` Markus Armbruster
2020-07-30 13:14 ` 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=c2ad1dd6-d53e-b4fa-79e2-0006ddf2f5b2@redhat.com \
--to=pbonzini@redhat.com \
--cc=abologna@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=dgilbert@redhat.com \
--cc=ehabkost@redhat.com \
--cc=jasowang@redhat.com \
--cc=jsnow@redhat.com \
--cc=kraxel@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=mst@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanb@linux.ibm.com \
--cc=yuval.shaia.ml@gmail.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;
as well as URLs for NNTP newsgroup(s).