[PATCH v5 06/14] tools/nolibc: arch-*.h: clean up multiple whitespaces
Willy Tarreau
w at 1wt.eu
Sun Jul 2 11:44:53 PDT 2023
Hi Zhangjin,
On Wed, Jun 28, 2023 at 09:19:33PM +0800, Zhangjin Wu wrote:
> To align with Linux code style and let scripts/checkpatch.pl happy, the
> multiple whitespaces in arch-<ARCH>.h files are cleaned up.
>
> Most of them are modified by these commands automatically:
>
> $ sed -i -e '/#define my_syscall/,/})/{s/ /\t/g}' tools/include/nolibc/arch-*.h
> $ sed -i -e '/#define my_syscall/,/})/{s/ *\\$/\t\\/g}' tools/include/nolibc/arch-*.h
>
> And checked with:
>
> $ grep ' *\\$' tools/include/nolibc/arch-*.h
I'm surprised by this one, I never saw checkpatch complain here. For me,
putting a tab after a non-tab is an error. It makes the code harder to
edit and re-align, and diffs are harder to read on lines whose lengths
varies by +/-1 around a multiple of 8 as it makes the post-tab stuff
zigzag. You made me recheck the coding style file, and there's nothing
about alignment there, only about indent (and indent uses tabs here).
There are also other parts which use spaces for alignment (albeit not
that many), so unless there is a solid reason for changing that, I'd
rather not do it, as for me it's the exact opposite of a cleanup as it
will cause me quite some discomfort.
> Besides, more multiple whitespaces are cleaned up:
>
> - convert "__asm__ volatile" to "__asm__ volatile"
I totally agree on this one, it's very likely the result of a mechanical
change.
> - "foo _num bar" should be "foo _num bar"
In theory yes, except that for those where it appears it was only to
keep all declarations aligned given that this _num was shorter by one
char than all other local names. Especially when it comes to enumerating
register names, you definitely want to keep them aligned. It's sufficiently
difficult to avoid mistakes there, any help for visual check counts.
Willy
More information about the linux-riscv
mailing list