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

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


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Wed, 9 Aug 2023 16:18:01 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.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=zBKXN+jwBubVhY7AIfbvFgtfcMtXef2QqdlWUYThVzc=; b=Um+4Z65No66MTWsK34U4U5s9d+1aXUmv0S885h64bbCyQOA+tLOJd8Q4mW9MOT9T1mgiJvVYVUSXE3HnYtj/+srSX9VO/7gekqTiogND/qPiiAPYGR8M/iKMJFM/xQI6Jha1GjV+wRA36MhV+9sqEuDoGFmTENjwgP1fqtyLev1NzL3O5CPWhkramO+hwMlU4VbbDMQ3ujIpJyIfLSTjvbv9fJWXiwL9Hpg6JJLmeZ5RJf2S0GXSA8OP4Rw86VifFG13cnrM/PYaKQYfEs635LTsj9BlOnV2qrnQVT8n52laO5RCFlgJN5Djh2zDrWhhQM7mGBc4vmJQueLbJZDAKg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=brXqi8EaHCOVHlaj0BqHIhaGvlqs1zD25l+ZILj/aQJc7pdWI5Yzx8dHGVArvNZNm69m0Y526lz7XdLp+lBidG+ohDZr/mS5GZYdUqLNThvF0t+Tm4WBh9UFGeav1hk4LvCRZQoUo9aOJwQMrJ9KSgxErJv7OzUNrIOuF7D4bT8DpXc1zY4S+5d3jhgN2cGqf/YHJJwX9aHxu6dxkni9K3mjXSmoyTb64omzKCfs1AzxlP36335M7sKd6J9qsh5zi43bE2xoKYd4HoeIvEy/486ys6ePucpU6ROXNSMGQoJYlzk3Z4Uebo+BB3bT0HB8bK+88gyD/DjvSycT4bKMpQ==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Wei Chen <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" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 09 Aug 2023 16:18:58 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHZwStJjnl5s/6RqkyuxqTMVBpDCK/iL4wAgAAIMgA=
  • Thread-topic: [RFC PATCH 5/5] xen: Add clang-format configuration


> On 9 Aug 2023, at 16:48, Jan Beulich <jbeulich@xxxxxxxx> wrote:
> 
> 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 sure I understand, I think this is the current behaviour in the codebase 
now.

> 
>> +# [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.

ok

> 
>> +# (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.

This was pointed out by Alejandro and Stefano, we can disable this by
passing 'None'

> 
>> +# [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.

It can be, but it can lead to a nice format. Anyway can be customised.

> 
> 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?

I think I did create a configuration specifying only what was spelled out
in CODING_STYLE, but it was not really successful and led to many changes,
more than now.

I think we need to collect maintainers view on every [not specified] 
configurable
and see which one are agreed by the majority, and which one are more 
controversial.

I’ve pushed this serie also to make the community able to see the output and 
raise
issues or behaviour that are not right, to see if we can do something or if 
there is no
agreement and the tool would be put on hold.

Anyway I’m aware that we are going into a period that will be pretty busy 
between
annual leaves and the release, so I’m ok to ping this discussion after the 
release.

Cheers,
Luca

> 
> Jan


 


Rackspace

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