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

Re: [RFC PATCH 0/5] clang-format for Xen


  • To: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 28 Jul 2023 13:36:02 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ktfLmxlXK57bO+MJWojIhxJvX7c3Pcq7960V1SSpI80=; b=ZiOJsUo0MQy9cgq52dZvnw5eOyRuxw5FWrerURdpHSW0fNV/FL3WW3CNiJ2Ad33NnXKUl5xsdL9s0kj/1hOjxGElLcMxvEJRD2QcR191FMsoCwQJvkVnsQAmNEULV+cHD+HLGb9XG9aGNZ47QXP9o9EthCjO3tv+kKAHrjlJwGIa487U4kcVGGv2VIcCHIihcLLG9nekeyoy6FWl6CFTF1MlfkOgn+LXR+d6cN9fcSUGbSPVUTDowKrB78Dd9IrNMyfb1zHrlu8/L0DIUAKyNMP98z8KaxAX4sHOyJGq9r90d/XNtfYr/KaAubUnAqdW1yPuT8HcEJniheDEvoTbcQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NjpN5HRaxRAZ09QcjMibceZpKljDkOvSWWO25z8wnndoXBzI6a+2N+V/w0jSV+bWRY7WzjKJzPZqNsQuf5bm5TA9n2KUyLfPMm66bqHs6+LTm6Z32pHzUqCMBhs/ucf2YXhuaW0xEvQGEtCu0fZzjhb7g5RBaRIZDoRCDEicjJrBYhOvnZe52c0Ft5vEIjldOKCloHmEZnEwGl9Ctk74aSAW5WaCtPO1sRrXAS1tMYEMaoW5Ah9X+8tfTKnLqhjegBKpxiwMM6Q3p8Fc08QNpWLVj6mQn48s0R/QeK0jy0HmMmJl6aRyhKOV4jmZVH0PESrKT/Tr8m8A+zXmUS2CLQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 28 Jul 2023 11:36:28 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 28.07.2023 12:50, Luca Fancellu wrote:
> 
> 
>> On 28 Jul 2023, at 11:12, Jan Beulich <jbeulich@xxxxxxxx> 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



 


Rackspace

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