[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: Thu, 10 Aug 2023 08:38:04 +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=cO2tgQkAdBjGa/uthO+eyDrq7JXwsMYpicKrL8pKHco=; b=efdxFPQ281aX4z+XXvsXlSp1Of6Tq/vLIJNCqQb17jhgTUDzmfJ5c/DFT4wC7JAYoQQlZrzJVgJRkh3tW+6I7n9ZYpgJUUt7CmZbWKH5Sz0DOhNhfbW6NDusTcgt6MyllanEqg6F0wgGRZJpmRVigSQcQXY3hXEZaLIi59ThGSbYJc2XlYvd/OqEH97oGTyUEHKYtc9GW02rjf5eA6k8Mmhdv5eNzx46DzqMlSg8EVmxnOAg35dNE1ubXD6q9eAZxQlzZEvFNzYQY7+40m2IB6vBs+BlEJaSYn4rNJrIeyqJf7DGlKQ5QsnHmCpOngVzxhpjztEO2aRNvV518lxwtQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AsYySa/g7NuGGbb77CoT8DD6CF4ZNSNBf1SKGOnTKfmOol8FSuU8ZAYg58AGclpv+kbN1l8bkb/wrBPT74s6EynaYlrhJn6ToxYfOulex9cknroj4+rI4qavrsS5IBbHRFHJBBx/VrJDyfOIusuWaUz8UADYS4Sf66/QhSUhHpOaQ2Qsv5mFVc/oHj7I70Mbjd6/hgY8hN5WW71BL8VjfB0LIrmvHFGpKnE+2Yo0oE4JDUDa6ZiNeYsJcUtXFJrlK9E3pLbbMcJf392K6J55zNTrXWa0AcXZLaM68TMJsU/7/tVuhHJeJCKuAy3QDPGHRmcNFBeu3HVqbY5USwj9gg==
  • 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: Thu, 10 Aug 2023 08:38:42 +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/iL4wAgAAIMgCAAQm9gIAACB2A
  • Thread-topic: [RFC PATCH 5/5] xen: Add clang-format configuration


> On 10 Aug 2023, at 09:08, Jan Beulich <jbeulich@xxxxxxxx> wrote:
> 
> On 09.08.2023 18:18, Luca Fancellu wrote:
>>> 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.
> 
> My understanding is that the above aims at (only)
> 
> unsigned long function(unsigned long first_long_argument,
>                       unsigned long second_long_argument);
> 
> when we also permit
> 
> unsigned long function(
>    unsigned long first_long_argument,
>    unsigned long second_long_argument);

Ohh ok now I see what you meant!

I did try this, ok sure it will format it as:

unsigned long function(unsigned long first_long_argument,
                                     unsigned long second_long_argument);

Because it sees that it will fit the 80 chars.

At some point I think we need to overcome the uncertainty and chose a side, only
from there we can benefit from an automatic checker and we can get rid of style 
issues (most of them).

Unfortunately most of the time we can’t say to the tool: we permit this style 
but also this style, 
only one can be allowed and just few discrepancy might be deviated if properly 
justified (in-code comments).

I guess this is the only way to:
1) have a formalised coding style
2) have an automatic checker
3) unify the hypervisor codebase style, that will diverge (more than now) very 
quickly with the introduction
    of new arch and features

Cheers,
Luca

 


Rackspace

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