[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:57:39 +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=91kmgh05WO/MQ+6qanLkX98vKIokRWJqu/BtHo4wXic=; b=F5FGr635EKCDWk+XuUozOm4TPPclgb1o2/UNFuKlG+t6gwL0gYgfCcKIruvqFXPXU5tkYomt2EDr73f1XRluAMEWmtCOGdP8wd8552JQNy0R30PC4mEseoXgucGvREbe1BLGyBY5TZkooNC99EuU/ljqwv8zMsmebkLb9VB1A7sPKHMFi2KQSLTyU5VKrqvTa/NU58j+FIedet5GlZzQbArXYnvd+6zmxLkvvTGiwcflHn/rEBZMoigs9yUe48d67bGfUx9hvp1X4C+QEK8F/HtwgVPth1BZtohoMEeUZOImIGIhFKM9JoVqJLP6AIs/cZ8JG5T10k1NQ6XrNxHaIA==
  • 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=91kmgh05WO/MQ+6qanLkX98vKIokRWJqu/BtHo4wXic=; b=dWjs4uGzzozBgw24vcQg6BdYITsA8dyAZG1qr54FUm+Ivw0vptcK9YKlPhseiG+685ygpS6Al8P38olDL5+V+jgojQpejXs/RuzV2KwQa/jxUrQWMi8fHp4HvHYAk/YNSbrjaBQM/STgIovQU8qDvQOAPw+9aeXxrFQ1JP2aT28IuU6+vdzpw7dJF7Z9YaMep2+/jzCnBPspNNSyB+BVMNMFPpJorzGzbOM8v/4BYtqicneQ4Dpy0vu77sIDUElTm+u64NmVMLFiKezHp9cDDqkncLv/ALehLjSklwWSGZ9zpRQlEBbPVyTFa4h/Y/WVbEHg25STVJ+kPgcPacCyNA==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=izw7FWhg7q5nDSFr7X0650SQvlOlV1Tneh9ppLAcEgZydk9N9dDx9FtUsC3gcUyLASq5C+JkAAUL9NsuVQrMwfYaAfmpLe5Qeml3erDLoAqdx2uMH0jxoP6aCXUCo42wM7yz5Kh66cpPMz3cPcDpIjmq7v6Yz3dQbE70W3wt2a6vsK1BzW5Q6uZFNn6bZw+yrnr6ezL1i2fwR5AcF2B+aNfItblukM+rLSZUHnJArzuqgM6zOZKjEVcX8f8aEawSAXMq0pvYJ5WZvpXpIjl43pcsI8G6CJOcBCqwj6ghpWg151q76ydQJBRrwWlt/YgJS0h8GN+98PETmpqHoLwTuw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JeumLFkTJTTNSd3i1hktqTHdUp27+p6DQvSvmqSF9W8XoQt+SYHVaGpIkk1xKJ4f+ZuGUc/P69jp3+dN26LxjrAQO5YOZk4RVTjpeU+jFwpNvvsQvsdGpOJWghl6qMpqJIjmBr14B1secHl16uKjaDyigvoCaXJhcEPGupRgbKYRxd2V1C06CPKGU+vQN3j6gTP2FP7wcot29HDtVSOBPHu9LTpAY/QC17B3Jx7uytCRZ1Ll6qW1K5PHu8Oe9aO9RsUWKHwEdY5qJgd04pnNj+h2g/xP3m1zLAjcgzLGAXtQTuUFTf/KhVBq+c67I80Am6jOFsA2ludXm1ygqxDHUA==
  • 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:58:07 +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/0AgAAEPICAAAbTgIAABQ2AgAAAhAA=
  • Thread-topic: Clang-format configuration discussion - pt 2


> On 27 Nov 2023, at 15:55, Jan Beulich <jbeulich@xxxxxxxx> wrote:
> 
> On 27.11.2023 16:37, Luca Fancellu wrote:
>> 
>> 
>>> 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 the example above _again_ does not have the two arguments aligned.
> I would have suspected a mail UI issue, but
> https://lists.xen.org/archives/html/xen-devel/2023-11/msg02366.html
> similarly shows way too many indenting blanks on the 2nd line.

Mmm... before sending the arguments were aligned, argument2 under argument1,
I’m using “mail” from Mac OS, don’t know what is going on...


> 
> Jan


 


Rackspace

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