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

Re: Clang-format configuration discussion - pt 2


  • To: George Dunlap <george.dunlap@xxxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Fri, 24 Nov 2023 11:59:01 +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=cdCCZbIeGHEQ9y1LwUZvXHWLTf7cMQ95NVDeLP7055U=; b=bOBBhhUeRw5xf9xItGeZ2iya+2y/HWc1hfpV2ANQv4ggG7Ynpcrf0ExpqHvxwnt0yTzJvhWr+QuN666wJifhTitarH+0o/8kw7ve3C6sFZZMzaUKO6+8EXhBhIXhiKao11UgpEMLjzurzZhmZo7Cdq0LspRp5oDy/lvcedmuIjT+pHdHRnr0ziZT04Du1oM63mcfSMMJPt808JYSniWVHjz4E/199suaHltpJZBj/o8zyYZAwo2P3IpY/VEjtsc+TBTSbjGhkTOcvxMno/nPCczgYt99cnUhUl7wuV75kPgp7kvgDm+PGSSvGZXmukSIyK5VI2RPxjMtjTicEm/wPQ==
  • 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=cdCCZbIeGHEQ9y1LwUZvXHWLTf7cMQ95NVDeLP7055U=; b=h4+A4+Uj/tRp/gkSL3BML3Bc65An+eqpq/tmULyuAJsGhJneVwX1ioN3EMuxmqFf6Ex2xaJ+mwr7RoktwGWh1yYVubwA7RpJxWK86ajR3ZJ5O3ZRpVdcEXxNmi1QKQThz4Hl6aDBa0JePku0Vg/CSLbvWTPD9RnxHNklH38mYJCADQ0fARNyBpujeX52I1jI+DEOZhkRAiKVvGjtYgBjvfATMAOnrKe60C22mYW/sBr2v42jVZA9FOrbPMaNmoYylshmtlLuzghJ9yI+nhMYqo37DbY6sOyqi+T7PpdV94aIMG+Cbei02oj1BQc8mhlXgF7Ss5AtDnwFtDHp3E21jA==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=VGwKj084OJRahDg3chNGRUpRqioHqFpKLRzDmXjsZ7EAwInhj4YgYRJdmT1O426QIb0RSiavTQWJpHwZOfjAkvSoykZyB5jIYeKV3KGyBmuqTR6JuOuKxa1cAyHNYvlnmOflM8JSb9zEhs1N2/a0c+XoA/rUQaQ5zj9LM1n7chpp9VzGjCe3ephC2S+Wr40CgSYzJ65ANCtrsgb/mi86+CZvte+69qqVPQMQOuX2BysISAAFJdGM3IEl7KNXuGNv4N/D1vpnQN8vtn8GZ7/Sep1zCIRCKsw3eE+fRau7Jutxs4Agoa+6LH4kCd1SwevZCL+BKTDgbNGTgM74ppi4GA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TCjgikWeFvCYCR09VdqvXoj7BiwyW2mT/KIJ+X95X1pMu7Z/wyKyIpWlXH0y65y+MfJhlSQ4IwC9ujAVBo6UltjKzZvzYeaC7ZV0YLS+xJSjC3mjSt6agu+QGzFkNtLljwcVFCDNA8gw+zL35l4GEHIkkshZqTQCeybkBXYGRZ0uP7tuvIEuS6toomLRYEfMHjb+HZQgO6ylGDvX63X5LHxVf7PAegPjlWmFMH7fXKI2m+211Yq6Bu+9AvArerfpkYFpkPCRra3h5GM4JAmD0eskKzzqurIvkBTR9/4qzxtwJ2Bx9gTZqeH9EeTRGsHsFIdhJYuLP5RIhlg/m2j7tg==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, 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>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Fri, 24 Nov 2023 11:59:43 +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/w4HebCJUeoAgAANCgA=
  • Thread-topic: Clang-format configuration discussion - pt 2


> On 24 Nov 2023, at 11:12, George Dunlap <george.dunlap@xxxxxxxxx> wrote:
> 
> On Thu, Nov 23, 2023 at 2:48 PM Luca Fancellu <Luca.Fancellu@xxxxxxx> wrote:
>> AlignConsecutiveAssignments: None
>> 
>> ---
>> This one is disabled because of feedbacks from Stefano and Alejandro about 
>> some weird behaviour on our
>> codebase.
>> 
>> This one could be phased along this line: “Consecutive assignments don't 
>> need to be aligned.”, the issue is
>> that in this way it seems that it’s optional, but clang-format is going to 
>> remove the alignment anyway for
>> assignment that are consecutive and aligned.
> 
> It's hard to agree on this one without seeing some of the examples of
> what it does, some examples of the "weird behavior" Stefano &
> Allejandro found,

I think there was a comment from Stefano for the RFC v1:
https://patchwork.kernel.org/project/xen-devel/cover/20230728081144.4124309-1-luca.fancellu@xxxxxxx/#25447625

> and some examples of places where it's going to
> remove the alignment.

Hi George,

You are right, with an example is better, so I’ve checked into the output:
https://gitlab.com/luca.fancellu/xen-clang/-/commit/8938bf2196be66b05693a48752ebbdf363e8d8e1.patch

And for this one, you can see here on line 6186 of that patch:

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 49792dd590..c229318450 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c

[...]

@@ -3333,19 +3318,18 @@ static int __init alloc_domain_evtchn(struct 
dt_device_node *node)
rc = evtchn_alloc_unbound(&alloc_unbound, domU1_port);
if ( rc < 0 )
{
- printk(XENLOG_ERR
- "evtchn_alloc_unbound() failure (Error %d) \n", rc);
+ printk(XENLOG_ERR "evtchn_alloc_unbound() failure (Error %d) \n", rc);
return rc;
}
- bind_interdomain.remote_dom = d1->domain_id;
+ bind_interdomain.remote_dom = d1->domain_id;
bind_interdomain.remote_port = domU1_port;
rc = evtchn_bind_interdomain(&bind_interdomain, d2, domU2_port);
if ( rc < 0 )
{

Assignment of bind_interdomain.remote_dom was aligned with the following line, 
but since the value
of this configurable is “None”, clang-format is modifying that to use only one 
space before the assignment
operator.



One example related to macros can be found on line 1663:

diff --git a/xen/arch/arm/arm32/insn.c b/xen/arch/arm/arm32/insn.c
index 49953a042a..1635c4b6d1 100644
--- a/xen/arch/arm/arm32/insn.c
+++ b/xen/arch/arm/arm32/insn.c
@@ -19,9 +19,9 @@
#include <asm/insn.h>
/* Mask of branch instructions' immediate. */
-#define BRANCH_INSN_IMM_MASK GENMASK(23, 0)
+#define BRANCH_INSN_IMM_MASK GENMASK(23, 0)
/* Shift of branch instructions' immediate. */
-#define BRANCH_INSN_IMM_SHIFT 0
+#define BRANCH_INSN_IMM_SHIFT 0

Clang format sees the comment between BRANCH_INSN_IMM_MASK and 
BRANCH_INSN_IMM_SHIFT and
even if before the value of the macros were aligned, it applies the rule of one 
space between the macro name
and the value.

> 
> I had tried to apply your series before and didn't get very far with
> it for some reason ISTR.

If you reach me we can see what issue you are facing, I think staging went 
ahead since my last push,
but I’ve put a SHA in the cover letter, anyway I can help on that if you want.


>  One way to see the effect of individual
> features would be:
> 
> 1. Make a branch with one big patch applying clang-format for a given style
> 
> 2. Change just one style line, re-run clang format, and create a new
> patch from that
> 
> Then it would be easy to see the difference between the two.  It might
> actually be easier for individual reviewers to do that on their own
> trees, rather than to ask you to try to generate and post such patches
> somewhere.
> 
> -George


 


Rackspace

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