[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH 5/5] xen: Add clang-format configuration


  • To: Luca Fancellu <luca.fancellu@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 9 Aug 2023 17:48:30 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ymVo+NV60+65k9RHPYq16orj79qnJL1RT/G9okpDYzE=; b=bGhrDUT+uqZLLkRA8T+8repXx7waL9RLK+CBiUQLP7sh8hwjm8wEDIJ2NdMNtTeDjzsJCjiDxPZlEm4Suxgv3qdo8qWgjaYKKchRY2kSJvmJP2kk1aarMksSg9c+qcESCPyn6Q+oRjoa5DxuBLW7a4JGQkY6VnijERsMR2KCLyuQtfaKF4hft23BBzmEpzaZoK4dPGQq9k8JZwim16xD6ZhfLis6FNKjDVeOeeN7VmrYQ7JTJKZ/MQl8Enp4hNhRpNv+IglLZU8VtOik0A7nnJ3CXImD/RRGR09oC8bEd8JQlMKTs2FR2+B6bltP0RovSgBe0qAhuAaVK0XBcjKpJw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c1nDpbAM0pF2HjZONhsNrZ/JgAZh7Vk9bv0CGWGyCQleOPbatpPPDDDPcUPipxx5qwSTKPNnI6VQLZw6LTCNaXgcsLJKSKmrgZrylfW0dEQE0YzAv1bbdzRqwBWHX64Z2y1qZsFoK0vCvuUwSzqpAdpid86ySMEYF2QKbrOwxYndU2rJCOlzo1GssNZ1N0PxVj9gjMPQ4rqNdx7HrFYnIUrBYeRDYkt5gM8Fc7iBwg9ntNCLWfeOC4Wo1KIhqpIp7dL4ITc5C7/lsL1yAj1jcT/Te9bT7ZMX/kyjmr2fm3wIgIxWeciDVkxsXQVQOZ/FKUHEw92Xv1yUg5Kd6xNTBQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: bertrand.marquis@xxxxxxx, wei.chen@xxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 09 Aug 2023 15:48:46 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 28.07.2023 10:11, Luca Fancellu wrote:
> --- /dev/null
> +++ b/xen/.clang-format
> @@ -0,0 +1,693 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +#
> +# clang-format configuration file. Intended for clang-format >= 15.
> +#
> +# For more information, see:
> +#
> +#   Documentation/process/clang-format.rst
> +#   https://clang.llvm.org/docs/ClangFormat.html
> +#   https://clang.llvm.org/docs/ClangFormatStyleOptions.html
> +#
> +---
> +
> +# [not specified]
> +# Align function parameter that goes into a new line, under the open bracket
> +# (supported in clang-format 3.8)
> +AlignAfterOpenBracket: Align

I'm not convinced this rule (assuming I'm getting it right) is
suitable in all cases, especially for functions with long names or
very many parameters.

> +# [not specified]
> +# Align array of struct's elements by column and justify
> +# struct test demo[] =
> +# {
> +#     {56, 23,    "hello"},
> +#     {-1, 93463, "world"},
> +#     {7,  5,     "!!"   }
> +# };

I'm pretty sure we want to have blanks immediately inside the braces.

> +# (supported in clang-format 13)
> +AlignArrayOfStructures: Left
> +
> +# [not specified]
> +# Align consecutive assignments (supported in clang-format 3.8)
> +AlignConsecutiveAssignments:
> +  Enabled: true
> +  AcrossEmptyLines: true
> +  AcrossComments: false

This is something we want to permit, but not demand, I think. I'm also
unconvinced we want it across empty lines.

> +# [not specified]
> +# Do not align consecutive bit fields (supported in clang-format 11)
> +AlignConsecutiveBitFields: None
> +
> +# [not specified]
> +# Do not align values of consecutive declarations
> +# (supported in clang-format 3.8)
> +AlignConsecutiveDeclarations: None
> +
> +# [not specified]
> +# Align values of consecutive macros (supported in clang-format 9)
> +AlignConsecutiveMacros:
> +  Enabled: true
> +  AcrossEmptyLines: true
> +  AcrossComments: true

This also looks to aggressive to me.

And I guess I'll stop here. What is the plan wrt discussing which
aspects we want to require and which we want to permit but not
require? Or is there alternatively a way to leave unconfigured
(and hence unaltered) anything that's not already spelled out in
./CODING_STYLE?

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.