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

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


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Fri, 28 Jul 2023 10:50:43 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=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=LLvh/399TfxqLw/r1YIcBUvZrJB3hPib2duIufb/5mU=; b=QOjXsD+pa853ON7c1NfWi2IWDo0r9FEQaOwfXAbtcd+XSSq9Ib7kHtXTbw3LJPfSjnK/q/HHaT3X7H9LXHF4uZf1Oo1Y2kcAQQlYGoqc+R1WmJ/um0/CHKGkaVBvByM3i3qAvO+TwwA06BmAFahHSmEAgUDy078a+HiAgq27lXSt5Jd+wcLrcZYa5geyvmLULXf7Bgh/dxt9EDAkn+JaT09sO4pwynBps6t2+hSacMV4Yo9JpU5YckiB2NxQ+PUfiyGCC74H4+Jc1ZIkPrwP7obnrLG4ArXBoSkbGGhte75n9h6g0JePvVOofOI5eNqEC8AxtCR6wkANlil5LWa24g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QCd656koi/PpHEpyJRTuFQmB1+LgXOYCaS7gkCet8areQe32fLxBg7dN64tdy6V94qzcECCBmo+y+QGieg72Nm5D40e8jeFoec/a7q0RqK1IEW15LLBp1CXD4J47LCZGKz/DcIWH2wY6NmmY0RcERNYhkZo9yxCZKiUFcKaTFyEwhCamp2CvmoFHRVZW4UzmKt6eTU+xA0iEMHGntEaeVslt6V1RGh/NPOoyYB4lmhR6u35n6fohdMBnbkvM+x9V47EsgLIspR7gYmxrIqvOEg7fTQ8vDx2NPSaep8e6Fqm4oDBwpsLhcTA3jScnJie5M92mJfKD5n8EbMxTb1wIFQ==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.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 10:51:16 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHZwSsi+9CDC2ydc0GfW83JpXFIW6/O9bGAgAAKo4A=
  • Thread-topic: [RFC PATCH 0/5] clang-format for Xen


> 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 );

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

Cheers,
Luca

> 
> Jan




 


Rackspace

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