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

Re: Clang-format configuration discussion - pt 1


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Mon, 13 Nov 2023 15:20:53 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Z6I83BIHWLG7ukuBbIlY6vEQOV9lrGVifcZKKQH3w9I=; b=IGmKHtMsJT09FBtP8Gya0cmg6yjm8Pnk+71JF9mcY/MIul9otK/O4j1ecDW2llBzlQK3wZBlwG+tYf94FYcCjlcoBUGIJYGRSUGUse1kvm9iuN32HHYRufH+SZcoVldnVZMsBAjaBdh1k7HaMNkP+YVG5LRGvxEoNhvFM8iH4VGXLdO3LWeO5b6lqfUA3wWqjtSYFIH2maHRUDO+KdQ6ju4maiFT2JgpplOBNh2D9SAf0rZ0yPbaJYQo5mLkrGNrGmYYNY7qpKYoKLE4rnmSYgaAWSXnRZ1HozfJzaTwJzZ5w6j5AcPgH7AlVawF9mOwM2SEkr8DWrUsScbZB0CTRQ==
  • 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=Z6I83BIHWLG7ukuBbIlY6vEQOV9lrGVifcZKKQH3w9I=; b=SzgIIe46gI+XzP7u7kOT5pnHhGD5AVY0KATxpwPFoO96ErRbfrAos7BkkFCb+lgTXqoBHkQx5izLxLR3gUOwjvzDTduiouHprktJHzJJwAKY2k+51Z1Q/E/uiyy7jouURLHREvPIn8dCX9sQ2bLeGOFm8PuoyXb1uJuPc0ZbV4E1xAENxwLdE8U/DJEIDx9SB1Mj2lfotHLhZwGDwZXLjMPqDEf9cyrRyj7BKNPWGEsjTznwbYJ+3+lg5ZRdDNdr+scPtPClgUS/v5J9+CC4Z6n/OYYQ5J3SFPw9qIx9YvN7ppjcCEWK7NLyoNLkTem5XM3cQjBi8COmR+rb+ps2Yw==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=M8MbWkqCozhrPjGnLQSum6vvafaRqZIUerobW+il+wezpl1Vey76EPar1va8NxflWzaGCQkGxgmzYrRhmHhyweylOHwmTxiEPipoVgFR3MhApCqcaq8x8CsJj2Mrpdxk7dCR+ADEXg5d3HPPHsfrNCwxpjo9bI54DCtF3jf5VvYezx0L8FLpuh3PelCXrLW6P8ob6CW0x2jUDap/CDNnEkr+JyBhl4wQZvyRLq8n6oBm3TzTn6PGM72uuoNRC+e/7Xn4CHrsuqfYTrZbcZC4UpItcnVfXmyOmYdgqhV/YBaO1oMG82RSStWOWkkEHPSq9qMTpPvHPtcOXLyM6ymKMQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b+GJ/1ggJk1L3wza08LpAIlz0JAOEptAkopkajm/wRjmb8BNkzut/MIboxJ0UKiYm8tYautp6ZH1wP+xBmCA36BcTjouBxQmpWgFXtWAedHQq1/3RF1nhHoqMp8bprzle7+k8/xwruJkae39j+NDUTcE/sre8DHURII4BdREg0x6IfFXmwYzPbhy78owtDByuk6+YOPOSvrFu8Siq/5YUBJV8jTRFILfLkRAHNfi61H8NUVqqH1MMNLp86H2exlFeTIoAYNWRQP58Cdw3UbCNYiEXoZPsUlO4Lrqphkk+AG4cWM7vpZL1Q7bjgXmnyjf9KoI8J9Ugbl/THYGn6sOwA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Michal Orzel <Michal.Orzel@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 13 Nov 2023 15:21:24 +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: AQHaEild8psuTSSrb0SmQq+9AXKRR7B4JX+AgABAHYA=
  • Thread-topic: Clang-format configuration discussion - pt 1


> On 13 Nov 2023, at 11:31, Jan Beulich <jbeulich@xxxxxxxx> wrote:
> 
> On 08.11.2023 10:53, Luca Fancellu wrote:
> --------------------------------------------------------------------------------------------------------------------------------------------------------------
>> 
>> Standard: C++03
>> 
>> ---
>> From the documentation: Parse and format C++ constructs compatible with this 
>> standard.
> 
> Since I continue to be puzzled - iirc you said this is because of lack
> of availability of "C99" as a value here. What's entirely unclear to
> me is: How does this matter to a tool checking coding style (which is
> largely about formatting, not any lexical or syntactical aspects)?
> 
>> This value is used also in Linux.
> 
> Considering how different the two styles are, I don't think this is
> overly relevant.

Ok, maybe I understand your point, you are looking for a reason to declare this 
configurable instead
of not specifying it at all?

If it’s that, from what I understand clang-format will use the default value if 
we don’t specify anything
for this one, so it will take ‘Latest’. I think we should put a value for this 
one to fix it and don’t have
surprises if that behaviour changes and seeing that also in Linux that value is 
fixed increased my
confidence.

However, if you feel that we should not specify it, I’ve done a test and not 
specifying it is not changing
the current output. I can’t say that for a different clang-format version 
though or if changes happen in the
future.


> 
> --------------------------------------------------------------------------------------------------------------------------------------------------------------
>> 
>> AttributeMacros:
>>  - '__init'
>>  - '__exit'
>>  - '__initdata'
>>  - '__initconst'
>>  - '__initconstrel'
>>  - '__initdata_cf_clobber'
>>  - '__initconst_cf_clobber'
>>  - '__hwdom_init'
>>  - '__hwdom_initdata'
>>  - '__maybe_unused'
>>  - '__packed'
>>  - '__stdcall'
>>  - '__vfp_aligned'
>>  - '__alt_call_maybe_initdata'
>>  - '__cacheline_aligned'
>>  - '__ro_after_init'
>>  - 'always_inline'
>>  - 'noinline'
>>  - 'noreturn'
>>  - '__weak'
>>  - '__inline__'
>>  - '__attribute_const__'
>>  - '__transparent__'
>>  - '__used'
>>  - '__must_check'
>>  - '__kprobes'
>> 
>> ---
>> A vector of strings that should be interpreted as attributes/qualifiers 
>> instead of identifiers.
>> I’ve tried to list all the attributes I’ve found.
> 
> Like above, the significance of having this list and needing to keep it
> up-to-date is unclear to me. I guess the same also applies to a few
> further settings down from here.

From what I understand, we should give to the formatter tool all the hint 
possible to make it do a good
job, for example here we should maintain a list of our attributes so that 
clang-format doesn’t think the function
below is called __init instead of device_tree_node_matches.

static bool __init device_tree_node_matches(const void *fdt, int node, const 
char *match)
{ ... }

> 
> --------------------------------------------------------------------------------------------------------------------------------------------------------------
>> 
>> StatementMacros:
>>  - 'PROGRESS'
>>  - 'PROGRESS_VCPU'
>>  - 'bitop'
>>  - 'guest_bitop'
>>  - 'testop'
>>  - 'guest_testop'
>>  - 'DEFINE_XEN_GUEST_HANDLE'
>>  - '__DEFINE_XEN_GUEST_HANDLE'
>>  - '___DEFINE_XEN_GUEST_HANDLE'
>>  - 'presmp_initcall'
>>  - '__initcall'
>>  - '__exitcall'
>> 
>> ---
>> A vector of macros that should be interpreted as complete statements.
>> Typical macros are expressions, and require a semi-colon to be added; 
>> sometimes this is not the case, and this allows
>> to make clang-format aware of such cases.
>> 
>> While I was writing this, I’ve found that from ‘DEFINE_XEN_GUEST_HANDLE’ 
>> until the end of the list, probably I
>> shouldn’t list these entries because all of them end with semi-colon.
> 
> Ah, just wanted to ask. I agree that we'd better have here only items
> which truly require an exception.

Yes my mistake, I’ll fix the list.

> 
> Jan


 


Rackspace

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