On 28.07.2023 12:50, Luca Fancellu wrote:
> 
> 
>> On 28 Jul 2023, at 11:12, Jan Beulich <jbeul...@suse.com> wrote:
>>
>> On 28.07.2023 10:11, Luca Fancellu wrote:
>>> I've read the past threads about the brave people who dared to try to 
>>> introduce
>>> clang-format for the xen codebase, some of them from 5 years ago, two points
>>> were clear: 1) goto label needs to be indented and 2) do-while loops have 
>>> the
>>> braket in the same line.
>>> While point 1) was quite a blocker, it seemd to me that point 2) was less
>>> controversial to be changed in the Xen codestyle, so the current wrapper 
>>> script
>>> handles only the point 1 (which is easy), the point 2 can be more tricky to
>>> handle.
>>
>> I'm afraid I view the do/while part pretty much as a blocker as well.
>> While placing the opening brace according to our style elsewhere would
>> be okay-ish (just a little wasteful to have two almost empty lines),
>> having the closing brace on a separate line is problematic: At least I
>> consider a block / scope to end at the line where the closing brace is.
>> So the farther do and while are apart, the more
>>
>>    do
>>    {
>>        ...;
>>    }
>>    while ( cond );
>>    ...;
>>
>> is going to be misleading. While normally we would write potentially
>> conflicting constructs this way
>>
>>    while ( cond )
>>        ;
>>
>> the alternative spelling still isn't outright wrong in our style (I
>> believe):
>>
>>    while ( cond );
> 
> Hi Jan,
> 
> Thank you for your feedback, I could maybe misunderstood your reply, so please
> tell me if I am wrong, the Xen coding style mandates this style for do-while 
> loops:
> 
> do {
> /* Do stuff. */
> } while ( condition );
> 
> Currently clang-format is able to do only this:
> 
> do
> {
> /* Do stuff. */
> } while ( condition );

Oh, I hadn't understood your description that way.

> So the issue is only in the opening brackets, not the closing one. Is it a 
> blocker too?

No. I don't like the longer form, but I could live with it.

Jan

Reply via email to