From: Peter Maydell <peter.maydell@linaro.org>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] add scripts/indent.sh
Date: Mon, 17 Jul 2017 11:43:11 +0100 [thread overview]
Message-ID: <CAFEAcA_=_5Y_DBJnvhHsOwGfKX-TKB+OPR5g_EgpUSNvqoS60w@mail.gmail.com> (raw)
In-Reply-To: <20170717101700.23552-1-kraxel@redhat.com>
On 17 July 2017 at 11:17, Gerd Hoffmann <kraxel@redhat.com> wrote:
> Script to reformat sources in qemu style.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> scripts/indent.sh | 11 +++++++++++
> 1 file changed, 11 insertions(+)
> create mode 100755 scripts/indent.sh
>
> diff --git a/scripts/indent.sh b/scripts/indent.sh
> new file mode 100755
> index 0000000000..8f045ecb1d
> --- /dev/null
> +++ b/scripts/indent.sh
> @@ -0,0 +1,11 @@
> +#!/bin/sh
> +#
> +# indent wrapper script, with args to format
> +# source code according to qemu coding style.
> +#
> +indent --ignore-profile \
> + --k-and-r-style \
> + --line-length 80 \
> + --indent-level 4 \
> + --no-tabs \
> + "$@"
A quick pass of this over target/arm suggests it's probably
missing some arguments. For instance, things it gets wrong:
(1) it's adding spaces after '*' in "SomeType *foo" parameters:
-static void aarch64_note_init(struct aarch64_note *note, DumpState *s,
+static void aarch64_note_init(struct aarch64_note *note, DumpState * s,
(2) weird extra space after cast:
- ((TaskState *)cs->opaque)->swi_errno = err;
+ ((TaskState *) cs->opaque)->swi_errno = err;
(3) weird spacing around address-of operator:
- cpu_memory_rw_debug(cs, arm_flen_buf(cpu) + 32, (uint8_t *)&size, 4, 0);
+ cpu_memory_rw_debug(cs, arm_flen_buf(cpu) + 32, (uint8_t *) & size, 4, 0);
(4) weird spacing addition to a negative number constant:
- return (uint32_t)-1;
+ return (uint32_t) - 1;
(5) mis-indentation of second line of multi-line assignment:
static Property arm_cpu_reset_cbar_property =
- DEFINE_PROP_UINT64("reset-cbar", ARMCPU, reset_cbar, 0);
+DEFINE_PROP_UINT64("reset-cbar", ARMCPU, reset_cbar, 0);
(6) incorrectly deletes spaces in a named-struct-field initializer:
- .name = "IFAR", .cp = 15, .crn = 6, .crm = 0, .opc1 = 0, .opc2 = 1,
+ .name = "IFAR",.cp = 15,.crn = 6,.crm = 0,.opc1 = 0,.opc2 = 1,
(7) gets confused by HELPER() macro in function definition:
-int64_t HELPER(sdiv64)(int64_t num, int64_t den)
-{
+int64_t HELPER(sdiv64) (int64_t num, int64_t den) {
(8) It disagrees with our emacs indent config about level of
indent for expressions:
return arm_feature(env, ARM_FEATURE_PMSA) &&
- arm_feature(env, ARM_FEATURE_V7);
+ arm_feature(env, ARM_FEATURE_V7);
--no-space-after-casts ought to fix 2, but in practice doesn't
seem to...
thanks
-- PMM
next prev parent reply other threads:[~2017-07-17 10:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-17 10:17 [Qemu-devel] [PATCH] add scripts/indent.sh Gerd Hoffmann
2017-07-17 10:36 ` Marc-André Lureau
2017-07-17 10:49 ` Gerd Hoffmann
2017-07-17 10:58 ` Marc-André Lureau
2017-07-17 11:14 ` Gerd Hoffmann
2017-08-29 16:33 ` Marc-André Lureau
2017-07-17 10:43 ` Peter Maydell [this message]
2017-07-17 18:11 ` no-reply
2017-07-17 19:54 ` Peter Maydell
-- strict thread matches above, loose matches on Subject: below --
2015-09-03 10:42 Gerd Hoffmann
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='CAFEAcA_=_5Y_DBJnvhHsOwGfKX-TKB+OPR5g_EgpUSNvqoS60w@mail.gmail.com' \
--to=peter.maydell@linaro.org \
--cc=kraxel@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 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).