Clang-format configuration discussion - pt 2
Hi all,
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/[email protected]/
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.
Depending on how the discussion goes on this one, it could be an entry in our coding style
--------------------------------------------------------------------------------------------------------------------------------------------------
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);
This one can be a candidate for an entry in our coding style
--------------------------------------------------------------------------------------------------------------------------------------------------
AlignArrayOfStructures: Left
---
“When using initialization for an array of structs aligns the fields into columns." It’s important to say that even if we specify “None”, it is going to format the data structure anyway, I choose left, but clearly I’m open to suggestions.
I don’t know how to phrase this one in our coding style
--------------------------------------------------------------------------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------------------------------------------------------------------------
AlignConsecutiveBitFields: None
---
Same thing as AlignConsecutiveAssignments, but for bitfields.
--------------------------------------------------------------------------------------------------------------------------------------------------
AlignConsecutiveDeclarations: None
---
This aligns declarations names, same considerations as AlignConsecutiveAssignments.
--------------------------------------------------------------------------------------------------------------------------------------------------
Ok this is it for now, let me know your thoughts about them, ideally if I don’t get any reply in two weeks (7th of December), I will consider that we have an agreement on these configuration.
Cheers,
Luca
Quoted 9 lines · Luca Fancellu
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, and some examples of places where it's going to remove the alignment.
I had tried to apply your series before and didn't get very far with it for some reason ISTR. 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
Quoted 11 lines · George Dunlap
Quoted 6 lines · Luca Fancellu
AlignConsecutiveAssignments: None
---
This one is disabled because of feedbacks from Stefano and Alejandro about some weird behaviour on our codebase.
Quoted 7 lines
Quoted 3 lines
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/[email protected]/#25447625
Quoted 2 lines
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:
xen/arch/arm/domain_build.c +0 -0
[...]
@@ -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:
xen/arch/arm/arm32/insn.c +0 -0
@@ -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.
Quoted 3 lines
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.
Quoted 14 lines
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
Quoted 16 lines · Luca Fancellu
(quoted diff) +2
-3@@ -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 ) {
Quoted 3 lines
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.
Neither here nor ...
Quoted 15 lines
One example related to macros can be found on line 1663:
xen/arch/arm/arm32/insn.c +2
-2@@ -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
Quoted 3 lines
Clang format sees the comment between
BRANCH_INSN_IMM_MASKandBRANCH_INSN_IMM_SHIFTand even if before the value of the macros were aligned, it applies the rule of one space between the macro name and the value.
... here there is any change in the formatting on the lines in question. I was first suspecting a possible issue with my mail UI, but
https://lists.xen.org/archives/html/xen-devel/2023-11/msg02132.html
looks to confirm the issue to more likely be on your end (apparently also resulting in leading whitespace having been dropped).
Jan
Quoted 42 lines · Jan Beulich
Quoted 16 lines · Luca Fancellu
(quoted diff) +2
-3@@ -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 ) {Quoted 3 lines
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.
Neither here nor ...
Quoted 15 lines
One example related to macros can be found on line 1663:
xen/arch/arm/arm32/insn.c +2
-2@@ -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
Quoted 9 lines
Quoted 3 lines
Clang format sees the comment between
BRANCH_INSN_IMM_MASKandBRANCH_INSN_IMM_SHIFTand even if before the value of the macros were aligned, it applies the rule of one space between the macro name and the value.... here there is any change in the formatting on the lines in question. I was first suspecting a possible issue with my mail UI, but
https://lists.xen.org/archives/html/xen-devel/2023-11/msg02132.html
looks to confirm the issue to more likely be on your end (apparently also resulting in leading whitespace having been dropped).
Yes indeed, it seems that copy paste removed the original formatting, but these snippets can be checked in the patch file I linked, I’ve added a line number.
Sorry for the inconvenience.
Cheers,
Luca
Quoted 19 lines · Luca Fancellu
Hi all,
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/[email protected]/
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.
Quoted 7 lines
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?
Quoted 6 lines
Depending on how the discussion goes on this one, it could be an entry in our coding style
--------------------------------------------------------------------------------------------------------------------------------------------------
AlignAfterOpenBracket: Align
Quoted 7 lines
---
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?
Quoted 10 lines
This one can be a candidate for an entry in our coding style
--------------------------------------------------------------------------------------------------------------------------------------------------
AlignArrayOfStructures: Left
---
“When using initialization for an array of structs aligns the fields into columns." It’s important to say that even if we specify “None”, it is going to format the data structure anyway, I choose left, but clearly I’m open to suggestions.
You don't say in which way it re-formats such constructs.
Quoted 6 lines
I don’t know how to phrase this one in our coding style
--------------------------------------------------------------------------------------------------------------------------------------------------
AlignConsecutiveAssignments: None
Quoted 7 lines
---
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.
Like below if there's no way to say "leave alone", then I don't consider this usable. Imo we want to permit people to align when they think it helps, but we don't want to demand them doing so.
Jan
Quoted 21 lines
--------------------------------------------------------------------------------------------------------------------------------------------------
AlignConsecutiveBitFields: None
---
Same thing as AlignConsecutiveAssignments, but for bitfields.--------------------------------------------------------------------------------------------------------------------------------------------------
AlignConsecutiveDeclarations: None
---
This aligns declarations names, same considerations as AlignConsecutiveAssignments.--------------------------------------------------------------------------------------------------------------------------------------------------
Ok this is it for now, let me know your thoughts about them, ideally if I don’t get any reply in two weeks (7th of December), I will consider that we have an agreement on these configuration.
Cheers,
Luca
Quoted 27 lines · Jan Beulich
Quoted 22 lines · Luca Fancellu
Hi all,
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/[email protected]/
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']
Quoted 6 lines
Quoted 4 lines
---
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.
Quoted 24 lines
Quoted 7 lines
Depending on how the discussion goes on this one, it could be an entry in our coding style
--------------------------------------------------------------------------------------------------------------------------------------------------
AlignAfterOpenBracket: Align
Quoted 7 lines
---
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);
Quoted 2 lines
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.
I might be wrong though and so another opinion from another maintainer would help.
In any case we can choose among many value: https://clang.llvm.org/docs/ClangFormatStyleOptions.html#alignafteropenbracket,
but when we do so, we need to stick to one permitted style only, the tool don’t allow to specify more than one.
Quoted 5 lines
Quoted 5 lines
This one can be a candidate for an entry in our coding style
--------------------------------------------------------------------------------------------------------------------------------------------------
Quoted 8 lines
Quoted 6 lines
AlignArrayOfStructures: Left
---
“When using initialization for an array of structs aligns the fields into columns." It’s important to say that even if we specify “None”, it is going to format the data structure anyway, I choose left, but clearly I’m open to suggestions.You don't say in which way it re-formats such constructs.
Sure, taking as example an array of structure, xen/drivers/video/modelines.h,
With AlignArrayOfStructures: None we have this below.
xen/drivers/video/modelines.h +30 -30
@@ -42,36 +42,36 @@ struct modeline { };struct modeline __initdata videomodes[] = { - {"640x480@60" ,25175 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,31 }, - {"640x480@72" ,31500 ,640 ,24 ,40 ,128 ,480 ,9 ,3 ,28 }, - {"640x480@75" ,31500 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,32 }, - {"640x480@85" ,36000 ,640 ,32 ,48 ,112 ,480 ,1 ,3 ,25 }, - {"800x600@56" ,38100 ,800 ,32 ,128 ,128 ,600 ,1 ,4 ,14 }, - {"800x600@60" ,40000 ,800 ,40 ,128 ,88 ,600 ,1 ,4 ,23 }, - {"800x600@72" ,50000 ,800 ,56 ,120 ,64 ,600 ,37 ,6 ,23 }, - {"800x600@75" ,49500 ,800 ,16 ,80 ,160 ,600 ,1 ,2 ,21 }, - {"800x600@85" ,56250 ,800 ,32 ,64 ,152 ,600 ,1 ,3 ,27 }, - {"1024x768@60" ,65000 ,1024 ,24 ,136 ,160 ,768 ,3 ,6 ,29 }, - {"1024x768@70" ,75000 ,1024 ,24 ,136 ,144 ,768 ,3 ,6 ,29 }, - {"1024x768@75" ,78750 ,1024 ,16 ,96 ,176 ,768 ,1 ,3 ,28 }, - {"1024x768@85" ,94500 ,1024 ,48 ,96 ,208 ,768 ,1 ,3 ,36 }, - {"1280x1024@60" ,108000 ,1280 ,48 ,112 ,248 ,1024 ,1 ,3 ,38 }, - {"1280x1024@75" ,135000 ,1280 ,16 ,144 ,248 ,1024 ,1 ,3 ,38 }, - {"1280x1024@85" ,157500 ,1280 ,64 ,160 ,224 ,1024 ,1 ,3 ,44 }, - {"1400x1050@60" ,122610 ,1400 ,88 ,152 ,240 ,1050 ,1 ,3 ,33 }, - {"1400x1050@75" ,155850 ,1400 ,96 ,152 ,248 ,1050 ,1 ,3 ,42 }, - {"1600x1200@60" ,162000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@65" ,175500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@70" ,189000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@75" ,202500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@85" ,229500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1792x1344@60" ,204800 ,1792 ,128 ,200 ,328 ,1344 ,1 ,3 ,46 }, - {"1792x1344@75" ,261000 ,1792 ,96 ,216 ,352 ,1344 ,1 ,3 ,69 }, - {"1856x1392@60" ,218300 ,1856 ,96 ,224 ,352 ,1392 ,1 ,3 ,43 }, - {"1856x1392@75" ,288000 ,1856 ,128 ,224 ,352 ,1392 ,1 ,3 ,104 }, - {"1920x1200@75" ,193160 ,1920 ,128 ,208 ,336 ,1200 ,1 ,3 ,38 }, - {"1920x1440@60" ,234000 ,1920 ,128 ,208 ,344 ,1440 ,1 ,3 ,56 }, - {"1920x1440@75" ,297000 ,1920 ,144 ,224 ,352 ,1440 ,1 ,3 ,56 }, + {"640x480@60" ,25175 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,31 }, + {"640x480@72" ,31500 ,640 ,24 ,40 ,128 ,480 ,9 ,3 ,28 }, + {"640x480@75" ,31500 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,32 }, + {"640x480@85" ,36000 ,640 ,32 ,48 ,112 ,480 ,1 ,3 ,25 }, + {"800x600@56" ,38100 ,800 ,32 ,128 ,128 ,600 ,1 ,4 ,14 }, + {"800x600@60" ,40000 ,800 ,40 ,128 ,88 ,600 ,1 ,4 ,23 }, + {"800x600@72" ,50000 ,800 ,56 ,120 ,64 ,600 ,37 ,6 ,23 }, + {"800x600@75" ,49500 ,800 ,16 ,80 ,160 ,600 ,1 ,2 ,21 }, + {"800x600@85" ,56250 ,800 ,32 ,64 ,152 ,600 ,1 ,3 ,27 }, + {"1024x768@60" ,65000 ,1024 ,24 ,136 ,160 ,768 ,3 ,6 ,29 }, + {"1024x768@70" ,75000 ,1024 ,24 ,136 ,144 ,768 ,3 ,6 ,29 }, + {"1024x768@75" ,78750 ,1024 ,16 ,96 ,176 ,768 ,1 ,3 ,28 }, + {"1024x768@85" ,94500 ,1024 ,48 ,96 ,208 ,768 ,1 ,3 ,36 }, + {"1280x1024@60" ,108000 ,1280 ,48 ,112 ,248 ,1024 ,1 ,3 ,38 }, + {"1280x1024@75" ,135000 ,1280 ,16 ,144 ,248 ,1024 ,1 ,3 ,38 }, + {"1280x1024@85" ,157500 ,1280 ,64 ,160 ,224 ,1024 ,1 ,3 ,44 }, + {"1400x1050@60" ,122610 ,1400 ,88 ,152 ,240 ,1050 ,1 ,3 ,33 }, + {"1400x1050@75" ,155850 ,1400 ,96 ,152 ,248 ,1050 ,1 ,3 ,42 }, + {"1600x1200@60" ,162000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@65" ,175500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@70" ,189000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@75" ,202500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@85" ,229500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1792x1344@60" ,204800 ,1792 ,128 ,200 ,328 ,1344 ,1 ,3 ,46 }, + {"1792x1344@75" ,261000 ,1792 ,96 ,216 ,352 ,1344 ,1 ,3 ,69 }, + {"1856x1392@60" ,218300 ,1856 ,96 ,224 ,352 ,1392 ,1 ,3 ,43 }, + {"1856x1392@75" ,288000 ,1856 ,128 ,224 ,352 ,1392 ,1 ,3 ,104 }, + {"1920x1200@75" ,193160 ,1920 ,128 ,208 ,336 ,1200 ,1 ,3 ,38 }, + {"1920x1440@60" ,234000 ,1920 ,128 ,208 ,344 ,1440 ,1 ,3 ,56 }, + {"1920x1440@75" ,297000 ,1920 ,144 ,224 ,352 ,1440 ,1 ,3 ,56 }, };#endif
With AlignArrayOfStructures: Left we have (I noticed there might be a small bug in clang-format since the first entry has no space after the opening curly bracket):
xen/drivers/video/modelines.h +30 -30
66 lines not on this page · raw message
With AlignArrayOfStructures: Right we have:
xen/drivers/video/modelines.h +30 -30
66 lines not on this page · raw message
Quoted 11 lines
Quoted 11 lines
I don’t know how to phrase this one in our coding style
--------------------------------------------------------------------------------------------------------------------------------------------------
AlignConsecutiveAssignments: None
---
This one is disabled because of feedbacks from Stefano and Alejandro about some weird behaviour on our codebase.
Quoted 7 lines
Quoted 3 lines
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.
Like below if there's no way to say "leave alone", then I don't consider this usable. Imo we want to permit people to align when they think it helps, but we don't want to demand them doing so.
Yes I understand, unfortunately the tool doesn’t allow that and if we don’t specify this configurable, it will take the default one which is disabled (and so would remove the formatting from already aligned assignments that it would eventually find).
This most of the configurable, when not specified, they apply their default to the code anyway.
Quoted 25 lines
Jan
Quoted 21 lines
--------------------------------------------------------------------------------------------------------------------------------------------------
AlignConsecutiveBitFields: None
---
Same thing as AlignConsecutiveAssignments, but for bitfields.--------------------------------------------------------------------------------------------------------------------------------------------------
AlignConsecutiveDeclarations: None
---
This aligns declarations names, same considerations as AlignConsecutiveAssignments.--------------------------------------------------------------------------------------------------------------------------------------------------
Ok this is it for now, let me know your thoughts about them, ideally if I don’t get any reply in two weeks (7th of December), I will consider that we have an agreement on these configuration.
Cheers,
Luca
Quoted 22 lines · Luca Fancellu
Quoted 22 lines · Jan Beulich
Quoted 20 lines · Luca Fancellu
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/[email protected]/
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']
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
---
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.
Quoted 21 lines
Quoted 21 lines
Quoted 11 lines
--------------------------------------------------------------------------------------------------------------------------------------------------
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);
Quoted 8 lines
Quoted 2 lines
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?
Quoted 4 lines
I might be wrong though and so another opinion from another maintainer would help.
In any case we can choose among many value: https://clang.llvm.org/docs/ClangFormatStyleOptions.html#alignafteropenbracket,
but when we do so, we need to stick to one permitted style only, the tool don’t allow to specify more than one.
On top of my earlier reply yet another reason perhaps that this tool then won't really fit our intended use.
Quoted 225 lines
Quoted 10 lines
Quoted 8 lines
--------------------------------------------------------------------------------------------------------------------------------------------------
AlignArrayOfStructures: Left
---
“When using initialization for an array of structs aligns the fields into columns." It’s important to say that even if we specify “None”, it is going to format the data structure anyway, I choose left, but clearly I’m open to suggestions.You don't say in which way it re-formats such constructs.
Sure, taking as example an array of structure,
xen/drivers/video/modelines.h,With AlignArrayOfStructures: None we have this below.
xen/drivers/video/modelines.h +30
-30@@ -42,36 +42,36 @@ struct modeline { };struct modeline __initdata videomodes[] = { - {"640x480@60" ,25175 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,31 }, - {"640x480@72" ,31500 ,640 ,24 ,40 ,128 ,480 ,9 ,3 ,28 }, - {"640x480@75" ,31500 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,32 }, - {"640x480@85" ,36000 ,640 ,32 ,48 ,112 ,480 ,1 ,3 ,25 }, - {"800x600@56" ,38100 ,800 ,32 ,128 ,128 ,600 ,1 ,4 ,14 }, - {"800x600@60" ,40000 ,800 ,40 ,128 ,88 ,600 ,1 ,4 ,23 }, - {"800x600@72" ,50000 ,800 ,56 ,120 ,64 ,600 ,37 ,6 ,23 }, - {"800x600@75" ,49500 ,800 ,16 ,80 ,160 ,600 ,1 ,2 ,21 }, - {"800x600@85" ,56250 ,800 ,32 ,64 ,152 ,600 ,1 ,3 ,27 }, - {"1024x768@60" ,65000 ,1024 ,24 ,136 ,160 ,768 ,3 ,6 ,29 }, - {"1024x768@70" ,75000 ,1024 ,24 ,136 ,144 ,768 ,3 ,6 ,29 }, - {"1024x768@75" ,78750 ,1024 ,16 ,96 ,176 ,768 ,1 ,3 ,28 }, - {"1024x768@85" ,94500 ,1024 ,48 ,96 ,208 ,768 ,1 ,3 ,36 }, - {"1280x1024@60" ,108000 ,1280 ,48 ,112 ,248 ,1024 ,1 ,3 ,38 }, - {"1280x1024@75" ,135000 ,1280 ,16 ,144 ,248 ,1024 ,1 ,3 ,38 }, - {"1280x1024@85" ,157500 ,1280 ,64 ,160 ,224 ,1024 ,1 ,3 ,44 }, - {"1400x1050@60" ,122610 ,1400 ,88 ,152 ,240 ,1050 ,1 ,3 ,33 }, - {"1400x1050@75" ,155850 ,1400 ,96 ,152 ,248 ,1050 ,1 ,3 ,42 }, - {"1600x1200@60" ,162000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@65" ,175500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@70" ,189000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@75" ,202500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@85" ,229500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1792x1344@60" ,204800 ,1792 ,128 ,200 ,328 ,1344 ,1 ,3 ,46 }, - {"1792x1344@75" ,261000 ,1792 ,96 ,216 ,352 ,1344 ,1 ,3 ,69 }, - {"1856x1392@60" ,218300 ,1856 ,96 ,224 ,352 ,1392 ,1 ,3 ,43 }, - {"1856x1392@75" ,288000 ,1856 ,128 ,224 ,352 ,1392 ,1 ,3 ,104 }, - {"1920x1200@75" ,193160 ,1920 ,128 ,208 ,336 ,1200 ,1 ,3 ,38 }, - {"1920x1440@60" ,234000 ,1920 ,128 ,208 ,344 ,1440 ,1 ,3 ,56 }, - {"1920x1440@75" ,297000 ,1920 ,144 ,224 ,352 ,1440 ,1 ,3 ,56 }, + {"640x480@60" ,25175 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,31 }, + {"640x480@72" ,31500 ,640 ,24 ,40 ,128 ,480 ,9 ,3 ,28 }, + {"640x480@75" ,31500 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,32 }, + {"640x480@85" ,36000 ,640 ,32 ,48 ,112 ,480 ,1 ,3 ,25 }, + {"800x600@56" ,38100 ,800 ,32 ,128 ,128 ,600 ,1 ,4 ,14 }, + {"800x600@60" ,40000 ,800 ,40 ,128 ,88 ,600 ,1 ,4 ,23 }, + {"800x600@72" ,50000 ,800 ,56 ,120 ,64 ,600 ,37 ,6 ,23 }, + {"800x600@75" ,49500 ,800 ,16 ,80 ,160 ,600 ,1 ,2 ,21 }, + {"800x600@85" ,56250 ,800 ,32 ,64 ,152 ,600 ,1 ,3 ,27 }, + {"1024x768@60" ,65000 ,1024 ,24 ,136 ,160 ,768 ,3 ,6 ,29 }, + {"1024x768@70" ,75000 ,1024 ,24 ,136 ,144 ,768 ,3 ,6 ,29 }, + {"1024x768@75" ,78750 ,1024 ,16 ,96 ,176 ,768 ,1 ,3 ,28 }, + {"1024x768@85" ,94500 ,1024 ,48 ,96 ,208 ,768 ,1 ,3 ,36 }, + {"1280x1024@60" ,108000 ,1280 ,48 ,112 ,248 ,1024 ,1 ,3 ,38 }, + {"1280x1024@75" ,135000 ,1280 ,16 ,144 ,248 ,1024 ,1 ,3 ,38 }, + {"1280x1024@85" ,157500 ,1280 ,64 ,160 ,224 ,1024 ,1 ,3 ,44 }, + {"1400x1050@60" ,122610 ,1400 ,88 ,152 ,240 ,1050 ,1 ,3 ,33 }, + {"1400x1050@75" ,155850 ,1400 ,96 ,152 ,248 ,1050 ,1 ,3 ,42 }, + {"1600x1200@60" ,162000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@65" ,175500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@70" ,189000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@75" ,202500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@85" ,229500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1792x1344@60" ,204800 ,1792 ,128 ,200 ,328 ,1344 ,1 ,3 ,46 }, + {"1792x1344@75" ,261000 ,1792 ,96 ,216 ,352 ,1344 ,1 ,3 ,69 }, + {"1856x1392@60" ,218300 ,1856 ,96 ,224 ,352 ,1392 ,1 ,3 ,43 }, + {"1856x1392@75" ,288000 ,1856 ,128 ,224 ,352 ,1392 ,1 ,3 ,104 }, + {"1920x1200@75" ,193160 ,1920 ,128 ,208 ,336 ,1200 ,1 ,3 ,38 }, + {"1920x1440@60" ,234000 ,1920 ,128 ,208 ,344 ,1440 ,1 ,3 ,56 }, + {"1920x1440@75" ,297000 ,1920 ,144 ,224 ,352 ,1440 ,1 ,3 ,56 }, };#endif With AlignArrayOfStructures: Left we have (I noticed there might be a small bug in clang-format since the first entry has no space after the opening curly bracket):
xen/drivers/video/modelines.h +30
-30@@ -42,36 +42,36 @@ struct modeline { };struct modeline __initdata videomodes[] = { - {"640x480@60" ,25175 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,31 }, - {"640x480@72" ,31500 ,640 ,24 ,40 ,128 ,480 ,9 ,3 ,28 }, - {"640x480@75" ,31500 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,32 }, - {"640x480@85" ,36000 ,640 ,32 ,48 ,112 ,480 ,1 ,3 ,25 }, - {"800x600@56" ,38100 ,800 ,32 ,128 ,128 ,600 ,1 ,4 ,14 }, - {"800x600@60" ,40000 ,800 ,40 ,128 ,88 ,600 ,1 ,4 ,23 }, - {"800x600@72" ,50000 ,800 ,56 ,120 ,64 ,600 ,37 ,6 ,23 }, - {"800x600@75" ,49500 ,800 ,16 ,80 ,160 ,600 ,1 ,2 ,21 }, - {"800x600@85" ,56250 ,800 ,32 ,64 ,152 ,600 ,1 ,3 ,27 }, - {"1024x768@60" ,65000 ,1024 ,24 ,136 ,160 ,768 ,3 ,6 ,29 }, - {"1024x768@70" ,75000 ,1024 ,24 ,136 ,144 ,768 ,3 ,6 ,29 }, - {"1024x768@75" ,78750 ,1024 ,16 ,96 ,176 ,768 ,1 ,3 ,28 }, - {"1024x768@85" ,94500 ,1024 ,48 ,96 ,208 ,768 ,1 ,3 ,36 }, - {"1280x1024@60" ,108000 ,1280 ,48 ,112 ,248 ,1024 ,1 ,3 ,38 }, - {"1280x1024@75" ,135000 ,1280 ,16 ,144 ,248 ,1024 ,1 ,3 ,38 }, - {"1280x1024@85" ,157500 ,1280 ,64 ,160 ,224 ,1024 ,1 ,3 ,44 }, - {"1400x1050@60" ,122610 ,1400 ,88 ,152 ,240 ,1050 ,1 ,3 ,33 }, - {"1400x1050@75" ,155850 ,1400 ,96 ,152 ,248 ,1050 ,1 ,3 ,42 }, - {"1600x1200@60" ,162000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@65" ,175500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@70" ,189000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@75" ,202500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@85" ,229500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1792x1344@60" ,204800 ,1792 ,128 ,200 ,328 ,1344 ,1 ,3 ,46 }, - {"1792x1344@75" ,261000 ,1792 ,96 ,216 ,352 ,1344 ,1 ,3 ,69 }, - {"1856x1392@60" ,218300 ,1856 ,96 ,224 ,352 ,1392 ,1 ,3 ,43 }, - {"1856x1392@75" ,288000 ,1856 ,128 ,224 ,352 ,1392 ,1 ,3 ,104 }, - {"1920x1200@75" ,193160 ,1920 ,128 ,208 ,336 ,1200 ,1 ,3 ,38 }, - {"1920x1440@60" ,234000 ,1920 ,128 ,208 ,344 ,1440 ,1 ,3 ,56 }, - {"1920x1440@75" ,297000 ,1920 ,144 ,224 ,352 ,1440 ,1 ,3 ,56 }, + {"640x480@60" ,25175 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,31 }, + {"640x480@72" ,31500 ,640 ,24 ,40 ,128 ,480 ,9 ,3 ,28 }, + {"640x480@75" ,31500 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,32 }, + {"640x480@85" ,36000 ,640 ,32 ,48 ,112 ,480 ,1 ,3 ,25 }, + {"800x600@56" ,38100 ,800 ,32 ,128 ,128 ,600 ,1 ,4 ,14 }, + {"800x600@60" ,40000 ,800 ,40 ,128 ,88 ,600 ,1 ,4 ,23 }, + {"800x600@72" ,50000 ,800 ,56 ,120 ,64 ,600 ,37 ,6 ,23 }, + {"800x600@75" ,49500 ,800 ,16 ,80 ,160 ,600 ,1 ,2 ,21 }, + {"800x600@85" ,56250 ,800 ,32 ,64 ,152 ,600 ,1 ,3 ,27 }, + {"1024x768@60" ,65000 ,1024 ,24 ,136 ,160 ,768 ,3 ,6 ,29 }, + {"1024x768@70" ,75000 ,1024 ,24 ,136 ,144 ,768 ,3 ,6 ,29 }, + {"1024x768@75" ,78750 ,1024 ,16 ,96 ,176 ,768 ,1 ,3 ,28 }, + {"1024x768@85" ,94500 ,1024 ,48 ,96 ,208 ,768 ,1 ,3 ,36 }, + {"1280x1024@60" ,108000 ,1280 ,48 ,112 ,248 ,1024 ,1 ,3 ,38 }, + {"1280x1024@75" ,135000 ,1280 ,16 ,144 ,248 ,1024 ,1 ,3 ,38 }, + {"1280x1024@85" ,157500 ,1280 ,64 ,160 ,224 ,1024 ,1 ,3 ,44 }, + {"1400x1050@60" ,122610 ,1400 ,88 ,152 ,240 ,1050 ,1 ,3 ,33 }, + {"1400x1050@75" ,155850 ,1400 ,96 ,152 ,248 ,1050 ,1 ,3 ,42 }, + {"1600x1200@60" ,162000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@65" ,175500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@70" ,189000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@75" ,202500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@85" ,229500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1792x1344@60" ,204800 ,1792 ,128 ,200 ,328 ,1344 ,1 ,3 ,46 }, + {"1792x1344@75" ,261000 ,1792 ,96 ,216 ,352 ,1344 ,1 ,3 ,69 }, + {"1856x1392@60" ,218300 ,1856 ,96 ,224 ,352 ,1392 ,1 ,3 ,43 }, + {"1856x1392@75" ,288000 ,1856 ,128 ,224 ,352 ,1392 ,1 ,3 ,104 }, + {"1920x1200@75" ,193160 ,1920 ,128 ,208 ,336 ,1200 ,1 ,3 ,38 }, + {"1920x1440@60" ,234000 ,1920 ,128 ,208 ,344 ,1440 ,1 ,3 ,56 }, + {"1920x1440@75" ,297000 ,1920 ,144 ,224 ,352 ,1440 ,1 ,3 ,56 }, };#endif With AlignArrayOfStructures: Right we have:
xen/drivers/video/modelines.h +23
-30@@ -42,36 +42,36 @@ struct modeline { };struct modeline __initdata videomodes[] = { - {"640x480@60" ,25175 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,31 }, - {"640x480@72" ,31500 ,640 ,24 ,40 ,128 ,480 ,9 ,3 ,28 }, - {"640x480@75" ,31500 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,32 }, - {"640x480@85" ,36000 ,640 ,32 ,48 ,112 ,480 ,1 ,3 ,25 }, - {"800x600@56" ,38100 ,800 ,32 ,128 ,128 ,600 ,1 ,4 ,14 }, - {"800x600@60" ,40000 ,800 ,40 ,128 ,88 ,600 ,1 ,4 ,23 }, - {"800x600@72" ,50000 ,800 ,56 ,120 ,64 ,600 ,37 ,6 ,23 }, - {"800x600@75" ,49500 ,800 ,16 ,80 ,160 ,600 ,1 ,2 ,21 }, - {"800x600@85" ,56250 ,800 ,32 ,64 ,152 ,600 ,1 ,3 ,27 }, - {"1024x768@60" ,65000 ,1024 ,24 ,136 ,160 ,768 ,3 ,6 ,29 }, - {"1024x768@70" ,75000 ,1024 ,24 ,136 ,144 ,768 ,3 ,6 ,29 }, - {"1024x768@75" ,78750 ,1024 ,16 ,96 ,176 ,768 ,1 ,3 ,28 }, - {"1024x768@85" ,94500 ,1024 ,48 ,96 ,208 ,768 ,1 ,3 ,36 }, - {"1280x1024@60" ,108000 ,1280 ,48 ,112 ,248 ,1024 ,1 ,3 ,38 }, - {"1280x1024@75" ,135000 ,1280 ,16 ,144 ,248 ,1024 ,1 ,3 ,38 }, - {"1280x1024@85" ,157500 ,1280 ,64 ,160 ,224 ,1024 ,1 ,3 ,44 }, - {"1400x1050@60" ,122610 ,1400 ,88 ,152 ,240 ,1050 ,1 ,3 ,33 }, - {"1400x1050@75" ,155850 ,1400 ,96 ,152 ,248 ,1050 ,1 ,3 ,42 }, - {"1600x1200@60" ,162000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@65" ,175500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@70" ,189000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@75" ,202500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@85" ,229500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1792x1344@60" ,204800 ,1792 ,128 ,200 ,328 ,1344 ,1 ,3 ,46 }, - {"1792x1344@75" ,261000 ,1792 ,96 ,216 ,352 ,1344 ,1 ,3 ,69 }, - {"1856x1392@60" ,218300 ,1856 ,96 ,224 ,352 ,1392 ,1 ,3 ,43 }, - {"1856x1392@75" ,288000 ,1856 ,128 ,224 ,352 ,1392 ,1 ,3 ,104 }, - {"1920x1200@75" ,193160 ,1920 ,128 ,208 ,336 ,1200 ,1 ,3 ,38 }, - {"1920x1440@60" ,234000 ,1920 ,128 ,208 ,344 ,1440 ,1 ,3 ,56 }, - {"1920x1440@75" ,297000 ,1920 ,144 ,224 ,352 ,1440 ,1 ,3 ,56 }, + {"640x480@60" ,25175 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,31 }, + {"640x480@72" ,31500 ,640 ,24 ,40 ,128 ,480 ,9 ,3 ,28 }, + {"640x480@75" ,31500 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,32 }, + {"640x480@85" ,36000 ,640 ,32 ,48 ,112 ,480 ,1 ,3 ,25 }, + {"800x600@56" ,38100 ,800 ,32 ,128 ,128 ,600 ,1 ,4 ,14 }, + {"800x600@60" ,40000 ,800 ,40 ,128 ,88 ,600 ,1 ,4 ,23 }, + {"800x600@72" ,50000 ,800 ,56 ,120 ,64 ,600 ,37 ,6 ,23 }, + {"800x600@75" ,49500 ,800 ,16 ,80 ,160 ,600 ,1 ,2 ,21 }, + {"800x600@85" ,56250 ,800 ,32 ,64 ,152 ,600 ,1 ,3 ,27 }, + {"1024x768@60" ,65000 ,1024 ,24 ,136 ,160 ,768 ,3 ,6 ,29 }, + {"1024x768@70" ,75000 ,1024 ,24 ,136 ,144 ,768 ,3 ,6 ,29 }, + {"1024x768@75" ,78750 ,1024 ,16 ,96 ,176 ,768 ,1 ,3 ,28 }, + {"1024x768@85" ,94500 ,1024 ,48 ,96 ,208 ,768 ,1 ,3 ,36 }, + {"1280x1024@60" ,108000 ,1280 ,48 ,112 ,248 ,1024 ,1 ,3 ,38 }, + {"1280x1024@75" ,135000 ,1280 ,16 ,144 ,248 ,1024 ,1 ,3 ,38 }, + {"1280x1024@85" ,157500 ,1280 ,64 ,160 ,224 ,1024 ,1 ,3 ,44 }, + {"1400x1050@60" ,122610 ,1400 ,88 ,152 ,240 ,1050 ,1 ,3 ,33 }, + {"1400x1050@75" ,155850 ,1400 ,96 ,152 ,248 ,1050 ,1 ,3 ,42 }, + {"1600x1200@60" ,162000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@65" ,175500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@70" ,189000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@75" ,202500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@85" ,229500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 },
xen/drivers/video/modelines.h struct modeline { · line 77
Quoted 10 lines
xen/drivers/video/modelines.h +7
-0+ {"1792x1344@60", 204800, 1792, 128, 200, 328, 1344, 1, 3, 46}, + {"1792x1344@75", 261000, 1792, 96, 216, 352, 1344, 1, 3, 69}, + {"1856x1392@60", 218300, 1856, 96, 224, 352, 1392, 1, 3, 43}, + {"1856x1392@75", 288000, 1856, 128, 224, 352, 1392, 1, 3, 104}, + {"1920x1200@75", 193160, 1920, 128, 208, 336, 1200, 1, 3, 38}, + {"1920x1440@60", 234000, 1920, 128, 208, 344, 1440, 1, 3, 56}, + {"1920x1440@75", 297000, 1920, 144, 224, 352, 1440, 1, 3, 56}, }; #endif
None of which improve what we have at present, imo. Yet another reason not to use this tool then, I would say.
Jan
Quoted 32 lines · Jan Beulich
Quoted 27 lines · Luca Fancellu
Quoted 27 lines · Jan Beulich
Quoted 24 lines · Luca Fancellu
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/[email protected]/
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.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
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.
Quoted 25 lines
Quoted 25 lines
Quoted 24 lines
Quoted 5 lines
--------------------------------------------------------------------------------------------------------------------------------------------------
AlignAfterOpenBracket: Align
Quoted 7 lines
---
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?
Quoted 8 lines
Quoted 5 lines
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.
Quoted 8 lines
Quoted 5 lines
I might be wrong though and so another opinion from another maintainer would help.
In any case we can choose among many value: https://clang.llvm.org/docs/ClangFormatStyleOptions.html#alignafteropenbracket,
but when we do so, we need to stick to one permitted style only, the tool don’t allow to specify more than one.On top of my earlier reply yet another reason perhaps that this tool then won't really fit our intended use.
ok
Quoted 235 lines
Quoted 235 lines
Quoted 11 lines
Quoted 9 lines
--------------------------------------------------------------------------------------------------------------------------------------------------
AlignArrayOfStructures: Left
---
“When using initialization for an array of structs aligns the fields into columns." It’s important to say that even if we specify “None”, it is going to format the data structure anyway, I choose left, but clearly I’m open to suggestions.You don't say in which way it re-formats such constructs.
Sure, taking as example an array of structure,
xen/drivers/video/modelines.h,With AlignArrayOfStructures: None we have this below.
xen/drivers/video/modelines.h +30
-30@@ -42,36 +42,36 @@ struct modeline { };struct modeline __initdata videomodes[] = { - {"640x480@60" ,25175 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,31 }, - {"640x480@72" ,31500 ,640 ,24 ,40 ,128 ,480 ,9 ,3 ,28 }, - {"640x480@75" ,31500 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,32 }, - {"640x480@85" ,36000 ,640 ,32 ,48 ,112 ,480 ,1 ,3 ,25 }, - {"800x600@56" ,38100 ,800 ,32 ,128 ,128 ,600 ,1 ,4 ,14 }, - {"800x600@60" ,40000 ,800 ,40 ,128 ,88 ,600 ,1 ,4 ,23 }, - {"800x600@72" ,50000 ,800 ,56 ,120 ,64 ,600 ,37 ,6 ,23 }, - {"800x600@75" ,49500 ,800 ,16 ,80 ,160 ,600 ,1 ,2 ,21 }, - {"800x600@85" ,56250 ,800 ,32 ,64 ,152 ,600 ,1 ,3 ,27 }, - {"1024x768@60" ,65000 ,1024 ,24 ,136 ,160 ,768 ,3 ,6 ,29 }, - {"1024x768@70" ,75000 ,1024 ,24 ,136 ,144 ,768 ,3 ,6 ,29 }, - {"1024x768@75" ,78750 ,1024 ,16 ,96 ,176 ,768 ,1 ,3 ,28 }, - {"1024x768@85" ,94500 ,1024 ,48 ,96 ,208 ,768 ,1 ,3 ,36 }, - {"1280x1024@60" ,108000 ,1280 ,48 ,112 ,248 ,1024 ,1 ,3 ,38 }, - {"1280x1024@75" ,135000 ,1280 ,16 ,144 ,248 ,1024 ,1 ,3 ,38 }, - {"1280x1024@85" ,157500 ,1280 ,64 ,160 ,224 ,1024 ,1 ,3 ,44 }, - {"1400x1050@60" ,122610 ,1400 ,88 ,152 ,240 ,1050 ,1 ,3 ,33 }, - {"1400x1050@75" ,155850 ,1400 ,96 ,152 ,248 ,1050 ,1 ,3 ,42 }, - {"1600x1200@60" ,162000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@65" ,175500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@70" ,189000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@75" ,202500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@85" ,229500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1792x1344@60" ,204800 ,1792 ,128 ,200 ,328 ,1344 ,1 ,3 ,46 }, - {"1792x1344@75" ,261000 ,1792 ,96 ,216 ,352 ,1344 ,1 ,3 ,69 }, - {"1856x1392@60" ,218300 ,1856 ,96 ,224 ,352 ,1392 ,1 ,3 ,43 }, - {"1856x1392@75" ,288000 ,1856 ,128 ,224 ,352 ,1392 ,1 ,3 ,104 }, - {"1920x1200@75" ,193160 ,1920 ,128 ,208 ,336 ,1200 ,1 ,3 ,38 }, - {"1920x1440@60" ,234000 ,1920 ,128 ,208 ,344 ,1440 ,1 ,3 ,56 }, - {"1920x1440@75" ,297000 ,1920 ,144 ,224 ,352 ,1440 ,1 ,3 ,56 }, + {"640x480@60" ,25175 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,31 }, + {"640x480@72" ,31500 ,640 ,24 ,40 ,128 ,480 ,9 ,3 ,28 }, + {"640x480@75" ,31500 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,32 }, + {"640x480@85" ,36000 ,640 ,32 ,48 ,112 ,480 ,1 ,3 ,25 }, + {"800x600@56" ,38100 ,800 ,32 ,128 ,128 ,600 ,1 ,4 ,14 }, + {"800x600@60" ,40000 ,800 ,40 ,128 ,88 ,600 ,1 ,4 ,23 }, + {"800x600@72" ,50000 ,800 ,56 ,120 ,64 ,600 ,37 ,6 ,23 }, + {"800x600@75" ,49500 ,800 ,16 ,80 ,160 ,600 ,1 ,2 ,21 }, + {"800x600@85" ,56250 ,800 ,32 ,64 ,152 ,600 ,1 ,3 ,27 }, + {"1024x768@60" ,65000 ,1024 ,24 ,136 ,160 ,768 ,3 ,6 ,29 }, + {"1024x768@70" ,75000 ,1024 ,24 ,136 ,144 ,768 ,3 ,6 ,29 }, + {"1024x768@75" ,78750 ,1024 ,16 ,96 ,176 ,768 ,1 ,3 ,28 }, + {"1024x768@85" ,94500 ,1024 ,48 ,96 ,208 ,768 ,1 ,3 ,36 }, + {"1280x1024@60" ,108000 ,1280 ,48 ,112 ,248 ,1024 ,1 ,3 ,38 }, + {"1280x1024@75" ,135000 ,1280 ,16 ,144 ,248 ,1024 ,1 ,3 ,38 }, + {"1280x1024@85" ,157500 ,1280 ,64 ,160 ,224 ,1024 ,1 ,3 ,44 }, + {"1400x1050@60" ,122610 ,1400 ,88 ,152 ,240 ,1050 ,1 ,3 ,33 }, + {"1400x1050@75" ,155850 ,1400 ,96 ,152 ,248 ,1050 ,1 ,3 ,42 }, + {"1600x1200@60" ,162000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@65" ,175500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@70" ,189000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@75" ,202500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@85" ,229500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1792x1344@60" ,204800 ,1792 ,128 ,200 ,328 ,1344 ,1 ,3 ,46 }, + {"1792x1344@75" ,261000 ,1792 ,96 ,216 ,352 ,1344 ,1 ,3 ,69 }, + {"1856x1392@60" ,218300 ,1856 ,96 ,224 ,352 ,1392 ,1 ,3 ,43 }, + {"1856x1392@75" ,288000 ,1856 ,128 ,224 ,352 ,1392 ,1 ,3 ,104 }, + {"1920x1200@75" ,193160 ,1920 ,128 ,208 ,336 ,1200 ,1 ,3 ,38 }, + {"1920x1440@60" ,234000 ,1920 ,128 ,208 ,344 ,1440 ,1 ,3 ,56 }, + {"1920x1440@75" ,297000 ,1920 ,144 ,224 ,352 ,1440 ,1 ,3 ,56 }, };#endif With AlignArrayOfStructures: Left we have (I noticed there might be a small bug in clang-format since the first entry has no space after the opening curly bracket):
xen/drivers/video/modelines.h +30
-30@@ -42,36 +42,36 @@ struct modeline { };struct modeline __initdata videomodes[] = { - {"640x480@60" ,25175 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,31 }, - {"640x480@72" ,31500 ,640 ,24 ,40 ,128 ,480 ,9 ,3 ,28 }, - {"640x480@75" ,31500 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,32 }, - {"640x480@85" ,36000 ,640 ,32 ,48 ,112 ,480 ,1 ,3 ,25 }, - {"800x600@56" ,38100 ,800 ,32 ,128 ,128 ,600 ,1 ,4 ,14 }, - {"800x600@60" ,40000 ,800 ,40 ,128 ,88 ,600 ,1 ,4 ,23 }, - {"800x600@72" ,50000 ,800 ,56 ,120 ,64 ,600 ,37 ,6 ,23 }, - {"800x600@75" ,49500 ,800 ,16 ,80 ,160 ,600 ,1 ,2 ,21 }, - {"800x600@85" ,56250 ,800 ,32 ,64 ,152 ,600 ,1 ,3 ,27 }, - {"1024x768@60" ,65000 ,1024 ,24 ,136 ,160 ,768 ,3 ,6 ,29 }, - {"1024x768@70" ,75000 ,1024 ,24 ,136 ,144 ,768 ,3 ,6 ,29 }, - {"1024x768@75" ,78750 ,1024 ,16 ,96 ,176 ,768 ,1 ,3 ,28 }, - {"1024x768@85" ,94500 ,1024 ,48 ,96 ,208 ,768 ,1 ,3 ,36 }, - {"1280x1024@60" ,108000 ,1280 ,48 ,112 ,248 ,1024 ,1 ,3 ,38 }, - {"1280x1024@75" ,135000 ,1280 ,16 ,144 ,248 ,1024 ,1 ,3 ,38 }, - {"1280x1024@85" ,157500 ,1280 ,64 ,160 ,224 ,1024 ,1 ,3 ,44 }, - {"1400x1050@60" ,122610 ,1400 ,88 ,152 ,240 ,1050 ,1 ,3 ,33 }, - {"1400x1050@75" ,155850 ,1400 ,96 ,152 ,248 ,1050 ,1 ,3 ,42 }, - {"1600x1200@60" ,162000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@65" ,175500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@70" ,189000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@75" ,202500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@85" ,229500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1792x1344@60" ,204800 ,1792 ,128 ,200 ,328 ,1344 ,1 ,3 ,46 }, - {"1792x1344@75" ,261000 ,1792 ,96 ,216 ,352 ,1344 ,1 ,3 ,69 }, - {"1856x1392@60" ,218300 ,1856 ,96 ,224 ,352 ,1392 ,1 ,3 ,43 }, - {"1856x1392@75" ,288000 ,1856 ,128 ,224 ,352 ,1392 ,1 ,3 ,104 }, - {"1920x1200@75" ,193160 ,1920 ,128 ,208 ,336 ,1200 ,1 ,3 ,38 }, - {"1920x1440@60" ,234000 ,1920 ,128 ,208 ,344 ,1440 ,1 ,3 ,56 }, - {"1920x1440@75" ,297000 ,1920 ,144 ,224 ,352 ,1440 ,1 ,3 ,56 }, + {"640x480@60" ,25175 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,31 }, + {"640x480@72" ,31500 ,640 ,24 ,40 ,128 ,480 ,9 ,3 ,28 }, + {"640x480@75" ,31500 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,32 }, + {"640x480@85" ,36000 ,640 ,32 ,48 ,112 ,480 ,1 ,3 ,25 }, + {"800x600@56" ,38100 ,800 ,32 ,128 ,128 ,600 ,1 ,4 ,14 }, + {"800x600@60" ,40000 ,800 ,40 ,128 ,88 ,600 ,1 ,4 ,23 }, + {"800x600@72" ,50000 ,800 ,56 ,120 ,64 ,600 ,37 ,6 ,23 }, + {"800x600@75" ,49500 ,800 ,16 ,80 ,160 ,600 ,1 ,2 ,21 }, + {"800x600@85" ,56250 ,800 ,32 ,64 ,152 ,600 ,1 ,3 ,27 }, + {"1024x768@60" ,65000 ,1024 ,24 ,136 ,160 ,768 ,3 ,6 ,29 }, + {"1024x768@70" ,75000 ,1024 ,24 ,136 ,144 ,768 ,3 ,6 ,29 }, + {"1024x768@75" ,78750 ,1024 ,16 ,96 ,176 ,768 ,1 ,3 ,28 }, + {"1024x768@85" ,94500 ,1024 ,48 ,96 ,208 ,768 ,1 ,3 ,36 }, + {"1280x1024@60" ,108000 ,1280 ,48 ,112 ,248 ,1024 ,1 ,3 ,38 }, + {"1280x1024@75" ,135000 ,1280 ,16 ,144 ,248 ,1024 ,1 ,3 ,38 }, + {"1280x1024@85" ,157500 ,1280 ,64 ,160 ,224 ,1024 ,1 ,3 ,44 }, + {"1400x1050@60" ,122610 ,1400 ,88 ,152 ,240 ,1050 ,1 ,3 ,33 }, + {"1400x1050@75" ,155850 ,1400 ,96 ,152 ,248 ,1050 ,1 ,3 ,42 }, + {"1600x1200@60" ,162000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@65" ,175500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@70" ,189000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@75" ,202500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@85" ,229500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1792x1344@60" ,204800 ,1792 ,128 ,200 ,328 ,1344 ,1 ,3 ,46 }, + {"1792x1344@75" ,261000 ,1792 ,96 ,216 ,352 ,1344 ,1 ,3 ,69 }, + {"1856x1392@60" ,218300 ,1856 ,96 ,224 ,352 ,1392 ,1 ,3 ,43 }, + {"1856x1392@75" ,288000 ,1856 ,128 ,224 ,352 ,1392 ,1 ,3 ,104 }, + {"1920x1200@75" ,193160 ,1920 ,128 ,208 ,336 ,1200 ,1 ,3 ,38 }, + {"1920x1440@60" ,234000 ,1920 ,128 ,208 ,344 ,1440 ,1 ,3 ,56 }, + {"1920x1440@75" ,297000 ,1920 ,144 ,224 ,352 ,1440 ,1 ,3 ,56 }, };#endif With AlignArrayOfStructures: Right we have:
xen/drivers/video/modelines.h +30
-30@@ -42,36 +42,36 @@ struct modeline { };struct modeline __initdata videomodes[] = { - {"640x480@60" ,25175 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,31 }, - {"640x480@72" ,31500 ,640 ,24 ,40 ,128 ,480 ,9 ,3 ,28 }, - {"640x480@75" ,31500 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,32 }, - {"640x480@85" ,36000 ,640 ,32 ,48 ,112 ,480 ,1 ,3 ,25 }, - {"800x600@56" ,38100 ,800 ,32 ,128 ,128 ,600 ,1 ,4 ,14 }, - {"800x600@60" ,40000 ,800 ,40 ,128 ,88 ,600 ,1 ,4 ,23 }, - {"800x600@72" ,50000 ,800 ,56 ,120 ,64 ,600 ,37 ,6 ,23 }, - {"800x600@75" ,49500 ,800 ,16 ,80 ,160 ,600 ,1 ,2 ,21 }, - {"800x600@85" ,56250 ,800 ,32 ,64 ,152 ,600 ,1 ,3 ,27 }, - {"1024x768@60" ,65000 ,1024 ,24 ,136 ,160 ,768 ,3 ,6 ,29 }, - {"1024x768@70" ,75000 ,1024 ,24 ,136 ,144 ,768 ,3 ,6 ,29 }, - {"1024x768@75" ,78750 ,1024 ,16 ,96 ,176 ,768 ,1 ,3 ,28 }, - {"1024x768@85" ,94500 ,1024 ,48 ,96 ,208 ,768 ,1 ,3 ,36 }, - {"1280x1024@60" ,108000 ,1280 ,48 ,112 ,248 ,1024 ,1 ,3 ,38 }, - {"1280x1024@75" ,135000 ,1280 ,16 ,144 ,248 ,1024 ,1 ,3 ,38 }, - {"1280x1024@85" ,157500 ,1280 ,64 ,160 ,224 ,1024 ,1 ,3 ,44 }, - {"1400x1050@60" ,122610 ,1400 ,88 ,152 ,240 ,1050 ,1 ,3 ,33 }, - {"1400x1050@75" ,155850 ,1400 ,96 ,152 ,248 ,1050 ,1 ,3 ,42 }, - {"1600x1200@60" ,162000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@65" ,175500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@70" ,189000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@75" ,202500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1600x1200@85" ,229500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, - {"1792x1344@60" ,204800 ,1792 ,128 ,200 ,328 ,1344 ,1 ,3 ,46 }, - {"1792x1344@75" ,261000 ,1792 ,96 ,216 ,352 ,1344 ,1 ,3 ,69 }, - {"1856x1392@60" ,218300 ,1856 ,96 ,224 ,352 ,1392 ,1 ,3 ,43 }, - {"1856x1392@75" ,288000 ,1856 ,128 ,224 ,352 ,1392 ,1 ,3 ,104 }, - {"1920x1200@75" ,193160 ,1920 ,128 ,208 ,336 ,1200 ,1 ,3 ,38 }, - {"1920x1440@60" ,234000 ,1920 ,128 ,208 ,344 ,1440 ,1 ,3 ,56 }, - {"1920x1440@75" ,297000 ,1920 ,144 ,224 ,352 ,1440 ,1 ,3 ,56 }, + {"640x480@60" ,25175 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,31 }, + {"640x480@72" ,31500 ,640 ,24 ,40 ,128 ,480 ,9 ,3 ,28 }, + {"640x480@75" ,31500 ,640 ,16 ,96 ,48 ,480 ,11 ,2 ,32 }, + {"640x480@85" ,36000 ,640 ,32 ,48 ,112 ,480 ,1 ,3 ,25 }, + {"800x600@56" ,38100 ,800 ,32 ,128 ,128 ,600 ,1 ,4 ,14 }, + {"800x600@60" ,40000 ,800 ,40 ,128 ,88 ,600 ,1 ,4 ,23 }, + {"800x600@72" ,50000 ,800 ,56 ,120 ,64 ,600 ,37 ,6 ,23 }, + {"800x600@75" ,49500 ,800 ,16 ,80 ,160 ,600 ,1 ,2 ,21 }, + {"800x600@85" ,56250 ,800 ,32 ,64 ,152 ,600 ,1 ,3 ,27 }, + {"1024x768@60" ,65000 ,1024 ,24 ,136 ,160 ,768 ,3 ,6 ,29 }, + {"1024x768@70" ,75000 ,1024 ,24 ,136 ,144 ,768 ,3 ,6 ,29 }, + {"1024x768@75" ,78750 ,1024 ,16 ,96 ,176 ,768 ,1 ,3 ,28 }, + {"1024x768@85" ,94500 ,1024 ,48 ,96 ,208 ,768 ,1 ,3 ,36 }, + {"1280x1024@60" ,108000 ,1280 ,48 ,112 ,248 ,1024 ,1 ,3 ,38 }, + {"1280x1024@75" ,135000 ,1280 ,16 ,144 ,248 ,1024 ,1 ,3 ,38 }, + {"1280x1024@85" ,157500 ,1280 ,64 ,160 ,224 ,1024 ,1 ,3 ,44 }, + {"1400x1050@60" ,122610 ,1400 ,88 ,152 ,240 ,1050 ,1 ,3 ,33 }, + {"1400x1050@75" ,155850 ,1400 ,96 ,152 ,248 ,1050 ,1 ,3 ,42 }, + {"1600x1200@60" ,162000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@65" ,175500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@70" ,189000 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@75" ,202500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1600x1200@85" ,229500 ,1600 ,64 ,192 ,304 ,1200 ,1 ,3 ,46 }, + {"1792x1344@60" ,204800 ,1792 ,128 ,200 ,328 ,1344 ,1 ,3 ,46 }, + {"1792x1344@75" ,261000 ,1792 ,96 ,216 ,352 ,1344 ,1 ,3 ,69 }, + {"1856x1392@60" ,218300 ,1856 ,96 ,224 ,352 ,1392 ,1 ,3 ,43 }, + {"1856x1392@75" ,288000 ,1856 ,128 ,224 ,352 ,1392 ,1 ,3 ,104 }, + {"1920x1200@75" ,193160 ,1920 ,128 ,208 ,336 ,1200 ,1 ,3 ,38 }, + {"1920x1440@60" ,234000 ,1920 ,128 ,208 ,344 ,1440 ,1 ,3 ,56 }, + {"1920x1440@75" ,297000 ,1920 ,144 ,224 ,352 ,1440 ,1 ,3 ,56 }, };
Quoted 4 lines
xen/drivers/video/modelines.h struct modeline { · line 77
Quoted 1 line
xen/drivers/video/modelines.h +0
-0#endif None of which improve what we have at present, imo. Yet another reason not to use this tool then, I would say.
Ok
Quoted 2 lines
Jan
Quoted 31 lines · Luca Fancellu
Quoted 31 lines · Jan Beulich
Quoted 29 lines · Luca Fancellu
Quoted 28 lines · Jan Beulich
Quoted 17 lines · Luca Fancellu
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/[email protected]/
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.
Quoted 7 lines
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?
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
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.
Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
Quoted 15 lines
Quoted 11 lines
--------------------------------------------------------------------------------------------------------------------------------------------------
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,
Quoted 8 lines
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.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
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.
Jan
Quoted 76 lines · Jan Beulich
Quoted 31 lines · Luca Fancellu
Quoted 31 lines · Jan Beulich
Quoted 29 lines · Luca Fancellu
Quoted 28 lines · Jan Beulich
Quoted 17 lines · Luca Fancellu
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/[email protected]/
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.
Quoted 7 lines
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?
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
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.
Quoted 30 lines
Quoted 30 lines
Quoted 29 lines
Quoted 15 lines
Quoted 11 lines
--------------------------------------------------------------------------------------------------------------------------------------------------
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,
Quoted 8 lines
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.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
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.
Quoted 3 lines
Jan
Quoted 90 lines · Luca Fancellu
Quoted 76 lines · Jan Beulich
Quoted 31 lines · Luca Fancellu
Quoted 31 lines · Jan Beulich
Quoted 29 lines · Luca Fancellu
Quoted 28 lines · Jan Beulich
Quoted 17 lines · Luca Fancellu
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/[email protected]/
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.
Quoted 7 lines
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?
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
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.
Quoted 30 lines
Quoted 30 lines
Quoted 29 lines
Quoted 15 lines
Quoted 11 lines
--------------------------------------------------------------------------------------------------------------------------------------------------
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,
Quoted 8 lines
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.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
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,
Quoted 8 lines
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.
Jan
Quoted 101 lines · Jan Beulich
Quoted 96 lines · Luca Fancellu
Quoted 76 lines · Jan Beulich
Quoted 31 lines · Luca Fancellu
Quoted 31 lines · Jan Beulich
Quoted 29 lines · Luca Fancellu
Quoted 28 lines · Jan Beulich
Quoted 17 lines · Luca Fancellu
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/[email protected]/
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.
Quoted 7 lines
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?
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
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.
Quoted 30 lines
Quoted 30 lines
Quoted 29 lines
Quoted 15 lines
Quoted 11 lines
--------------------------------------------------------------------------------------------------------------------------------------------------
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,
Quoted 8 lines
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.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
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)”
Quoted 7 lines
Quoted 2 lines
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...
Quoted 2 lines
Jan
Quoted 42 lines · Luca Fancellu
Quoted 39 lines · Jan Beulich
Quoted 33 lines · Luca Fancellu
Quoted 33 lines · Jan Beulich
Quoted 30 lines · Luca Fancellu
Quoted 22 lines · Jan Beulich
Quoted 20 lines · Luca Fancellu
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/[email protected]/
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']Quoted 6 lines
Quoted 4 lines
---
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.
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
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.
I realise now that my answer above is not fully correct, I wanted to say that the attributes are like invisible for the tool only when dealing with this rule about ordering of the qualifiers.
On the other hand, yes, if the QualifierAlignment is “Leave”, clang-format won’t touch them.
Cheers,
Luca
Quoted 48 lines · Luca Fancellu
Quoted 48 lines · Luca Fancellu
Quoted 45 lines · Jan Beulich
Quoted 38 lines · Luca Fancellu
Quoted 29 lines · Jan Beulich
Quoted 27 lines · Luca Fancellu
Quoted 27 lines · Jan Beulich
Quoted 24 lines · Luca Fancellu
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/[email protected]/
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.Quoted 6 lines
Quoted 3 lines
Quoted 1 line
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.
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Hoho, one thing where various options are tolerated.
I realise now that my answer above is not fully correct, I wanted to say that the attributes are like invisible for the tool only when dealing with this rule about ordering of the qualifiers.
On the other hand, yes, if the QualifierAlignment is “Leave”, clang-format won’t touch them.
Hmm - gets me back to wondering what "Alignment" in the name is about, when order of syntactical elements is affected.
Jan
Quoted 55 lines · Jan Beulich
Quoted 50 lines · Luca Fancellu
Quoted 49 lines · Luca Fancellu
Quoted 46 lines · Jan Beulich
Quoted 31 lines · Luca Fancellu
Quoted 31 lines · Jan Beulich
Quoted 29 lines · Luca Fancellu
Quoted 28 lines · Jan Beulich
Quoted 17 lines · Luca Fancellu
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/[email protected]/
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.
Quoted 7 lines
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?
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
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.
Quoted 7 lines
Quoted 4 lines
I realise now that my answer above is not fully correct, I wanted to say that the attributes are like invisible for the tool only when dealing with this rule about ordering of the qualifiers.
On the other hand, yes, if the QualifierAlignment is “Leave”, clang-format won’t touch them.
Hmm - gets me back to wondering what "Alignment" in the name is about, when order of syntactical elements is affected.
Yes, probably QualifierAlignment is not the best name.
Quoted 2 lines
Jan
Quoted 19 lines · Luca Fancellu
Hi all,
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/[email protected]/
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--------------------------------------------------------------------------------------------------------------------------------------------------
[...]
Quoted 49 lines
--------------------------------------------------------------------------------------------------------------------------------------------------
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);This one can be a candidate for an entry in our coding style
--------------------------------------------------------------------------------------------------------------------------------------------------
AlignArrayOfStructures: Left
---
“When using initialization for an array of structs aligns the fields into columns." It’s important to say that even if we specify “None”, it is going to format the data structure anyway, I choose left, but clearly I’m open to suggestions.I don’t know how to phrase this one in our coding style
--------------------------------------------------------------------------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------------------------------------------------------------------------
AlignConsecutiveBitFields: None
---
Same thing as AlignConsecutiveAssignments, but for bitfields.--------------------------------------------------------------------------------------------------------------------------------------------------
AlignConsecutiveDeclarations: None
Quoted 7 lines
---
This aligns declarations names, same considerations as AlignConsecutiveAssignments.--------------------------------------------------------------------------------------------------------------------------------------------------
Ok this is it for now, let me know your thoughts about them, ideally if I don’t get any reply in two weeks (7th of December), I will consider that we have an agreement on these configuration.
Hi all,
Just a ping for who wants to say his thoughts about this, Jan already made clear his concerns about the lack of flexibility of the tool, which would provide a default formatting without leaving the option to leave the code as it is, making the tool not fit in his opinion to the use on our codebase.
In my opinion, I don’t know of any tool that can address all the flexibility the Xen codestyle allows, yet the use of automatic checkers would improve the review time, allow more new contributors to approach the community without being put down by the amount of code-style comments, consolidate the style across the codebase.
So, please maintainers, let me know your thoughts on that or please say clearly that we are not ready yet to use an Automatic code style checker.
Cheers,
Luca
Quoted 3 lines · Luca Fancellu
In my opinion, I don’t know of any tool that can address all the flexibility the Xen codestyle allows, yet the use of automatic checkers would improve the review time, allow more new contributors to approach the community without being put down by the amount of code-style comments,
Since this argument is being repeated: I find it odd. No-one needs to even fear any amount of style comments if they simply follow the written down policy plus a tiny bit of common sense. According to my observation, (some) newcomers don't even care to look at what is being said about our style. It's not like you and I haven't been through this. When I started working with GNU toolchain, I had to adopt to their style. When I later started to work with Linux, I had to also adopt there. And then for Xen. And all of that already past closed source projects I had been working on before.
Jan
Quoted 1 line
consolidate the style across the codebase.
Quoted 6 lines · Jan Beulich
Quoted 3 lines · Luca Fancellu
In my opinion, I don’t know of any tool that can address all the flexibility the Xen codestyle allows, yet the use of automatic checkers would improve the review time, allow more new contributors to approach the community without being put down by the amount of code-style comments,
Quoted 8 lines
Since this argument is being repeated: I find it odd. No-one needs to even fear any amount of style comments if they simply follow the written down policy plus a tiny bit of common sense. According to my observation, (some) newcomers don't even care to look at what is being said about our style. It's not like you and I haven't been through this. When I started working with GNU toolchain, I had to adopt to their style. When I later started to work with Linux, I had to also adopt there. And then for Xen. And all of that already past closed source projects I had been working on before.
Most modern languages, including golang (and I think rust) have built-in style correctors (go fmt is go's official one). If you haven't worked with an automatic style checker / fixer, you don't know how much time, hassle, and emotional energy you're saving. I don't think I know anyone who, after using one, wants to go back to not using one any more.
In general, I'm in favor of making changes to our style such that we can make clang's style checker official. The only reason I would vote against it is if one of the style requirements was really intolerable; but I find that pretty unlikely.
And as I've said before, the main reservation I have going forward with this discussion is that I can't see clearly what it is that I'm agreeing to.
-George
Quoted 7 lines · George Dunlap
Quoted 6 lines · Jan Beulich
Quoted 3 lines · Luca Fancellu
In my opinion, I don’t know of any tool that can address all the flexibility the Xen codestyle allows, yet the use of automatic checkers would improve the review time, allow more new contributors to approach the community without being put down by the amount of code-style comments,
Quoted 8 lines
Quoted 8 lines
Since this argument is being repeated: I find it odd. No-one needs to even fear any amount of style comments if they simply follow the written down policy plus a tiny bit of common sense. According to my observation, (some) newcomers don't even care to look at what is being said about our style. It's not like you and I haven't been through this. When I started working with GNU toolchain, I had to adopt to their style. When I later started to work with Linux, I had to also adopt there. And then for Xen. And all of that already past closed source projects I had been working on before.
I am not sure I get the point. With this argument, we are not only putting load on the contributors but also on the reviewers because we have to check the style manually while reviewing the code.
Do you really think this is a good use of our time? Personally I don't think so and definitely there are more unwritten rule than you let transpire above.
A good example is the "_" vs "-". If even a maintainer can't guess it, then how can a contributor know it?
Quoted 8 lines
Most modern languages, including golang (and I think rust) have built-in style correctors (
go fmtis go's official one). If you haven't worked with an automatic style checker / fixer, you don't know how much time, hassle, and emotional energy you're saving. I don't think I know anyone who, after using one, wants to go back to not using one any more.
Quoted 4 lines
In general, I'm in favor of making changes to our style such that we can make clang's style checker official. The only reason I would vote against it is if one of the style requirements was really intolerable; but I find that pretty unlikely.
+1
Quoted 4 lines
And as I've said before, the main reservation I have going forward with this discussion is that I can't see clearly what it is that I'm agreeing to.
+1
I found the way we dealt with MISRA rules quite helpful. We had a weekly meeting to discuss some of the rules and then the outcome was posted on the ML. Maybe we should do the same here? Any other suggestion how to move?
Cheers,
Signature · 1 line
Julien Grall
Quoted 20 lines · Julien Grall
Quoted 6 lines · George Dunlap
Quoted 5 lines · Jan Beulich
Quoted 3 lines · Luca Fancellu
In my opinion, I don’t know of any tool that can address all the flexibility the Xen codestyle allows, yet the use of automatic checkers would improve the review time, allow more new contributors to approach the community without being put down by the amount of code-style comments,
Quoted 8 lines
Quoted 8 lines
Since this argument is being repeated: I find it odd. No-one needs to even fear any amount of style comments if they simply follow the written down policy plus a tiny bit of common sense. According to my observation, (some) newcomers don't even care to look at what is being said about our style. It's not like you and I haven't been through this. When I started working with GNU toolchain, I had to adopt to their style. When I later started to work with Linux, I had to also adopt there. And then for Xen. And all of that already past closed source projects I had been working on before.
I am not sure I get the point. With this argument, we are not only putting load on the contributors but also on the reviewers because we have to check the style manually while reviewing the code.
Quoted 6 lines
Do you really think this is a good use of our time? Personally I don't think so and definitely there are more unwritten rule than you let transpire above.
A good example is the "_" vs "-". If even a maintainer can't guess it, then how can a contributor know it?
I didn't even hint at anything unwritten, did I? I certainly agree that things would better be written down.
Quoted 19 lines
Quoted 11 lines
Most modern languages, including golang (and I think rust) have built-in style correctors (
go fmtis go's official one). If you haven't worked with an automatic style checker / fixer, you don't know how much time, hassle, and emotional energy you're saving. I don't think I know anyone who, after using one, wants to go back to not using one any more.In general, I'm in favor of making changes to our style such that we can make clang's style checker official. The only reason I would vote against it is if one of the style requirements was really intolerable; but I find that pretty unlikely.
+1
Quoted 4 lines
And as I've said before, the main reservation I have going forward with this discussion is that I can't see clearly what it is that I'm agreeing to.
Quoted 5 lines
+1
I found the way we dealt with MISRA rules quite helpful. We had a weekly meeting to discuss some of the rules and then the outcome was posted on the ML. Maybe we should do the same here? Any other suggestion how to move?
I have mixed feelings with meetings like the Misra ones. That's probably unavoidable because of it being a goal to move fast. I'm not sure the same applies here. But first of all - see also what George said - there needs to be a coherent proposal of what aspects of style to change in which way. The more heavy the changes, the harder it may be for long time contributors to adapt; whether that's a worthwhile price to pay is yet to be determined.
Jan
Hi,
Quoted 21 lines · Jan Beulich
Quoted 20 lines · Julien Grall
Quoted 6 lines · George Dunlap
Quoted 5 lines · Jan Beulich
Quoted 3 lines · Luca Fancellu
In my opinion, I don’t know of any tool that can address all the flexibility the Xen codestyle allows, yet the use of automatic checkers would improve the review time, allow more new contributors to approach the community without being put down by the amount of code-style comments,
Quoted 8 lines
Quoted 8 lines
Since this argument is being repeated: I find it odd. No-one needs to even fear any amount of style comments if they simply follow the written down policy plus a tiny bit of common sense. According to my observation, (some) newcomers don't even care to look at what is being said about our style. It's not like you and I haven't been through this. When I started working with GNU toolchain, I had to adopt to their style. When I later started to work with Linux, I had to also adopt there. And then for Xen. And all of that already past closed source projects I had been working on before.
I am not sure I get the point. With this argument, we are not only putting load on the contributors but also on the reviewers because we have to check the style manually while reviewing the code.
Quoted 8 lines
Quoted 6 lines
Do you really think this is a good use of our time? Personally I don't think so and definitely there are more unwritten rule than you let transpire above.
A good example is the "_" vs "-". If even a maintainer can't guess it, then how can a contributor know it?
I didn't even hint at anything unwritten, did I?
You didn't and that was my point. I don't think we can put the unwritten rules aside when arguing about how easy it is to follow our coding style. They are usually the ones that tends to be the most contentious and trigger the most debate everytime they come up...
Quoted 21 lines
Quoted 21 lines
Quoted 11 lines
Most modern languages, including golang (and I think rust) have built-in style correctors (
go fmtis go's official one). If you haven't worked with an automatic style checker / fixer, you don't know how much time, hassle, and emotional energy you're saving. I don't think I know anyone who, after using one, wants to go back to not using one any more.In general, I'm in favor of making changes to our style such that we can make clang's style checker official. The only reason I would vote against it is if one of the style requirements was really intolerable; but I find that pretty unlikely.
+1
Quoted 4 lines
And as I've said before, the main reservation I have going forward with this discussion is that I can't see clearly what it is that I'm agreeing to.
+1
Quoted 7 lines
Quoted 3 lines
I found the way we dealt with MISRA rules quite helpful. We had a weekly meeting to discuss some of the rules and then the outcome was posted on the ML. Maybe we should do the same here? Any other suggestion how to move?
I have mixed feelings with meetings like the Misra ones. That's probably unavoidable because of it being a goal to move fast. I'm not sure the same applies here.
I think in this situation is less about moving fast but more about making a closure of the 3 years+ discussion about the coding style.
We had several persons (including maintainers) expressing there frustration about the coding style [1]. And this is not really going better...
We have a couple of solutions:
1. Properly codify our coding style
2. Pick an existing one close enough to Xen
The first one would require the less change in Xen but given nobody really agree on changes to CODING_STYLE, I feer it is going to take a very long time to retrofit. From the discussion here, it also seems like we will not be able to get the automatic checker doing what we want.
For the second one, this may have an impact on Xen. But it would help to use an automatic checker. I also don't expect many contributors been able to sink a lot of time trying to come to a conclusion with the coding style. So I would chose the least path of resistance which is 2. I believe this is what Luca is attempting.
Quoted 4 lines
But first of all - see also what George said - there
needs to be a coherent proposal of what aspects of style to change in which way. The more heavy the changes, the harder it may be for long time contributors to adapt;
The whole point of having an automatic coding-style checker/formatting is you don't need to worry about it anymore.
Obviously if you intend to avoid the coding style checker, then it will be more difficult...
Cheers,
[1] https://lore.kernel.org/all/CABfawhnaDS=nGn3+NqoY_nWXvu0cfsAmpYjiv9VqkT6C0Ow1FA@mail.gmail.com/
Signature · 1 line
Julien Grall
Quoted 29 lines · Julien Grall
Quoted 28 lines · Jan Beulich
Quoted 26 lines · Julien Grall
Quoted 6 lines · George Dunlap
Quoted 5 lines · Jan Beulich
Quoted 3 lines · Luca Fancellu
In my opinion, I don’t know of any tool that can address all the flexibility the Xen codestyle allows, yet the use of automatic checkers would improve the review time, allow more new contributors to approach the community without being put down by the amount of code-style comments,
Quoted 8 lines
Quoted 8 lines
Since this argument is being repeated: I find it odd. No-one needs to even fear any amount of style comments if they simply follow the written down policy plus a tiny bit of common sense. According to my observation, (some) newcomers don't even care to look at what is being said about our style. It's not like you and I haven't been through this. When I started working with GNU toolchain, I had to adopt to their style. When I later started to work with Linux, I had to also adopt there. And then for Xen. And all of that already past closed source projects I had been working on before.
I am not sure I get the point. With this argument, we are not only putting load on the contributors but also on the reviewers because we have to check the style manually while reviewing the code.
Do you really think this is a good use of our time? Personally I don't think so and definitely there are more unwritten rule than you let transpire above.
A good example is the "_" vs "-". If even a maintainer can't guess it, then how can a contributor know it?
Quoted 6 lines
Quoted 1 line
I didn't even hint at anything unwritten, did I?
You didn't and that was my point. I don't think we can put the unwritten rules aside when arguing about how easy it is to follow our coding style. They are usually the ones that tends to be the most contentious and trigger the most debate everytime they come up...
Hmm, I see how you received my comment. It wasn't meant that way, though. Instead I was trying to convey that even the little that is written down is largely ignored. Writing down more isn't going to help. But yes, an automatic checker would likely help in that direction. I'm specifically not ...
Quoted 2 lines
Obviously if you intend to avoid the coding style checker, then it will be more difficult...
... trying to avoid a checker. What I'm trying to avoid are perhaps yet more intrusive changes to the entire code base than we're already seeing with Misra work.
Jan
Quoted 7 lines · Julien Grall
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Most modern languages, including golang (and I think rust) have built-in style correctors (
go fmtis go's official one). If you haven't worked with an automatic style checker / fixer, you don't know how much time, hassle, and emotional energy you're saving. I don't think I know anyone who, after using one, wants to go back to not using one any more.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
In general, I'm in favor of making changes to our style such that we can make clang's style checker official. The only reason I would vote against it is if one of the style requirements was really intolerable; but I find that pretty unlikely.
+1
+1
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
And as I've said before, the main reservation I have going forward with this discussion is that I can't see clearly what it is that I'm agreeing to.
+1
+1
Quoted 11 lines
Quoted 8 lines
Quoted 4 lines
I found the way we dealt with MISRA rules quite helpful. We had a weekly meeting to discuss some of the rules and then the outcome was posted on the ML. Maybe we should do the same here? Any other suggestion how to move?
I have mixed feelings with meetings like the Misra ones. That's probably unavoidable because of it being a goal to move fast. I'm not sure the same applies here.
I think in this situation is less about moving fast but more about making a closure of the 3 years+ discussion about the coding style.
Exactly. The meeting is useful to find alignment in a more fruitful way.
We don't have many MISRA rules left to discuss anyway. We could discuss the codestyle changes after MISRA or in parallel.
Quoted 12 lines
We had several persons (including maintainers) expressing there frustration about the coding style [1]. And this is not really going better...
We have a couple of solutions:
1. Properly codify our coding style
2. Pick an existing one close enough to XenThe first one would require the less change in Xen but given nobody really agree on changes to
CODING_STYLE, I feer it is going to take a very long time to retrofit. From the discussion here, it also seems like we will not be able to get the automatic checker doing what we want.
Quoted 5 lines
For the second one, this may have an impact on Xen. But it would help to use an automatic checker. I also don't expect many contributors been able to sink a lot of time trying to come to a conclusion with the coding style. So I would chose the least path of resistance which is 2. I believe this is what Luca is attempting.
I also think we need an automatic checker and 2. seems like the best way forward.
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 5 lines
I found the way we dealt with MISRA rules quite helpful. We had a weekly meeting to discuss some of the rules and then the outcome was posted on the ML. Maybe we should do the same here? Any other suggestion how to move?
I have mixed feelings with meetings like the Misra ones. That's probably unavoidable because of it being a goal to move fast. I'm not sure the same applies here.
Quoted 7 lines
Quoted 2 lines
I think in this situation is less about moving fast but more about making a closure of the 3 years+ discussion about the coding style.
Exactly. The meeting is useful to find alignment in a more fruitful way.
We don't have many MISRA rules left to discuss anyway. We could discuss the codestyle changes after MISRA or in parallel.
Hi Stefano,
this is a very good idea, discussing that in a meeting would ease a lot the explanation for the clang-format configurable.
Cheers,
Luca