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

Re: Clang-format configuration discussion - pt 2


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Mon, 27 Nov 2023 15:37:43 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • 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=2; 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=TvWSAQNKX1G5wd2oakkCR2kHpeUYVezXHZ16eLXaOE0=; b=iRed0VC2cPYmKM9oBI34je0+gKZ5rJenlXt5ovNqidHYv1J8RMrPS7S/s8fDFzLcjW1EXwNklFuwozT6EzPgdCPFAS9aBoFyWRvppzvPZA+J9qbRro/gKoKJDmzWyrN6Z45uMzaEZmy89wPnHwR5nTSAC4dh4zKBs2ralQhRmWyYV0onuB26scdYpHG7kyzhd3ISZar/GcUNSnkER4EU+5/iUB0dg5xNDoDTqPvAD9rLTfPMWDEjCddn1GcdIG31+5ubeI+fcbHfMDj2w5dG/iJC5k7qtOeNo0hjz9NxJfoD6RundMhLPfMi25TIx1VPfxF473K/CGhDDXwlD0hq9w==
  • 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=TvWSAQNKX1G5wd2oakkCR2kHpeUYVezXHZ16eLXaOE0=; b=MPHQAjECyPw/7gtbAepeDLScZitAY8uMfNCbbGz6JQttXYDuzy/X8/sFIZRK1+dqZbJlfLgbudlIsseR1vTiqko1uAr3VvcstkUvu3ReNgsxXFlcr+XtWWkOnUkQzYNYvTkbXlGRQhSMCiWRjH17EIyH2PrDzkCuSP28vRhM3VIruTUn3WKzJiD4Cwrxd913iD88KC5AphsoONIHBLYyzbyBPsn59nQKGqOMePIRelXP6M0wRv2P5Ssf20Aoe8TnRH8TkVh4QSdoYiTKKM2QPHjwX+a/LG6dd+kA8ZlKacbCt3fOtm9y4xaRxzuX9eG6m6kAhHYefBciQ9GIiqBWdw==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=m9AWpTWpfYp3CeVjzqdO2EPMH1D2Lhu/wFAqLXOtEKB3cqxMo9MS4/rMucjfXQQT9mqG77kQi0fYapuiSyUlPuKlMgIYH3U27RciX55mnBCHTX5e7ajwxoERc55RUcnuL1JtNH03bPHUgpOVzWTn9ZmkxcekVw1YLvx8gDc9URnBdAlGO02uJm/Z7uirtyclT/C7S94Jvffo1J1Woa+uBohYEbg+KXnmWOp64DlqBcaIolOjLlu0t5PBQxn8fDl2tG0+9Es8IY3zvbecrjRA38E01XKBJi6ol4xXTyb3xOQz4JoDWRoXN9fOIXos+x1Nrx+Xfe4c0U+RpVRr4rEs1w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OswIkPJrhOEMgsxqxDIA8DxKHID1wF3llDfytiNHgXGIPC/xstkpUntpjC8F123Kz9XOPTbPLyRZThlg9XrkVcNjZGBJYkWsJk5aOJQ4aq5KORXhDdDKPxRUJHphDWVueJDytw6pQ7Bnv0Rtw1aaKXcihWaS72hysh9eJGvScWaEenCLtZVc41suomqk/QjV4GNcnga2kg44YK4CfJBP+P1mZyHL9W4w/Vkwo6J965uPOhE9Dw5MrahVQmyriBoAcun2vnJzSYZiKiNCkUEzecPGs+dce5VtBrt79fMHtoq7WfClHkaN6uqYAbuBHJLn7h8dM6L5jryh1n1ZCgXZFA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Michal Orzel <Michal.Orzel@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 27 Nov 2023 15:38:19 +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: AQHaHhwDfni7SbjBtk6S7YLD/w4HebCJbICAgAAi9QCABIyNgIAAK/0AgAAEPICAAAbTgA==
  • Thread-topic: Clang-format configuration discussion - pt 2


> On 27 Nov 2023, at 15:13, Jan Beulich <jbeulich@xxxxxxxx> wrote:
> 
> On 27.11.2023 15:58, Luca Fancellu wrote:
>>> On 27 Nov 2023, at 12:20, Jan Beulich <jbeulich@xxxxxxxx> wrote:
>>> On 24.11.2023 15:52, Luca Fancellu wrote:
>>>>> On 24 Nov 2023, at 12:47, Jan Beulich <jbeulich@xxxxxxxx> wrote:
>>>>> On 23.11.2023 15:47, Luca Fancellu wrote:
>>>>>> Let’s continue the discussion about clang-format configuration, this is 
>>>>>> part 2, previous discussions are:
>>>>>> 
>>>>>> - 
>>>>>> https://lists.xenproject.org/archives/html/xen-devel/2023-11/msg00498.html
>>>>>> 
>>>>>> You can find the serie introducing clang-format here:
>>>>>> https://patchwork.kernel.org/project/xen-devel/cover/20231031132304.2573924-1-luca.fancellu@xxxxxxx/
>>>>>> and there is also a patch linked to my gitlab account where you can find 
>>>>>> the output for the hypervisor code.
>>>>>> 
>>>>>> For a full list of configurables and to find the possible values for 
>>>>>> them, please refer to this page:
>>>>>> https://clang.llvm.org/docs/ClangFormatStyleOptions.html
>>>>>> 
>>>>>> --------------------------------------------------------------------------------------------------------------------------------------------------
>>>>>> 
>>>>>> Our coding style doesn’t mention anything about alignment, shall we add 
>>>>>> a new section?
>>>>>> I can send patches when we reach agreement on each of these rules.
>>>>>> 
>>>>>> 
>>>>>> QualifierAlignment: Custom
>>>>>> QualifierOrder: ['static', 'inline', 'const', 'volatile', 'type']
>>>>>> 
>>>>>> ---
>>>>>> For “QualifierAlignment” I chose Custom in order to apply in 
>>>>>> “QualifierOrder” an order for the
>>>>>> qualifiers that match the current codebase, we could specify also 
>>>>>> “Leave” in order to keep
>>>>>> them as they are.
>>>>> 
>>>>> Where do attributes go in this sequence?
>>>> 
>>>> I think function declaration/definition and variables.
>>> 
>>> How does this relate to my question? I asked about the sequence of elements
>>> listed for QualifierOrder:, where attributes don't appear at all right now.
>> 
>> Sorry, I misread your question, attributes are like invisible for the tool, 
>> they can be placed wherever between
>> each of the QualifierOrder items.
> 
> Hoho, one thing where various options are tolerated.
> 
>>>>>> --------------------------------------------------------------------------------------------------------------------------------------------------
>>>>>> 
>>>>>> AlignAfterOpenBracket: Align
>>>>>> 
>>>>>> ---
>>>>>> This one is to align function parameters that overflows the line length, 
>>>>>> I chose to align them
>>>>>> to the open bracket to match the current codebase (hopefully)
>>>>>> 
>>>>>> e.g.:
>>>>>> someLongFunction(argument1,
>>>>>>                              argument2);
>>>>> 
>>>>> The above matches neither of the two generally permitted styles:
>>>>> 
>>>>>  someLongFunction(argument1,
>>>>>                   argument2);
>>>>> 
>>>>>  someLongFunction(
>>>>>      argument1,
>>>>>      argument2);
>>>>> 
>>>>> Then again from its name I would infer this isn't just about function
>>>>> arguments?
>>>> 
>>>> I think it applies to parameters and arguments of functions and macro, 
>>>> given the description in the docs.
>>>> 
>>>> I see your two snippets above but I’ve always found at least on arm a 
>>>> predominance of
>>>> the style above for functions, so arguments aligned after the opening 
>>>> bracket, for macros
>>>> there is a mix.
>>> 
>>> The latter "above" refers to which form exactly? The one you originally
>>> spelled out, or the former of what my reply had?
>> 
>> In my reply I was referring to the one I originally spelled out.
> 
> But that's properly malformed, for not aligning argument2 with argument1.
> Where are such constructs commonly used? I just took one example (cpuerrata.c)
> and only found my first form of wrapping.

I had to go back to the thread to realise there was some style issue, the 
snippet I thought
I sent already had argument2 aligned under argument1, like this:

e.g.:
someLongFunction(argument1,
                                argument2);

Even my wording was not really accurate, as I meant:
“This one is to align function parameters that overflows the line length, I 
chose to align them
*after* the open bracket to match the current codebase (hopefully)”

So to summarize, this value formats the code to have overflowing args/param 
aligned after
the open braket.

But I understand that having only one format is not desirable.

> 
> Jan
> 


 


Rackspace

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