[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] add scripts/indent.sh
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH] add scripts/indent.sh |
Date: |
Mon, 17 Jul 2017 11:43:11 +0100 |
On 17 July 2017 at 11:17, Gerd Hoffmann <address@hidden> wrote:
> Script to reformat sources in qemu style.
>
> Signed-off-by: Gerd Hoffmann <address@hidden>
> ---
> 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