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

Clang-format configuration discussion - pt 2


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Thu, 23 Nov 2023 14:47:42 +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=ZZ0zgDCn8eQF4rU0QE+NkK9BmnpHegiSC+oKlV5yA5k=; b=U9oWVqkCCmXvwdyxPxZk5Ns2yMhA+kMWzi3h1ykM91dE9tM0gt+XMwUKDljCCthM67J4xKUHeeYSgfRX6jNcW3at5o/PzlsT8eZ8EumpIr/3GLU9ZSlALJ6Rr8mP3J0NHWANjW7nwBoqIfR5iVw82XJQ/chLleU3+7mbIWYVF+u7g/9VVnp3ZBueZjL7wphqXDf8yjK7wqePUqnYdt3dnI07CcNjG3H2jWtBXx8/5BAH8ZYw4Kvlf6hyyss/lvNt5+qIO/dnqdvr7EwU2g1fJMlM2MfQOj4OajERFIMDCNN3JdpJHpOkSdwrPcWkUe04MI9V/3uqVyYvXCghsgqoLQ==
  • 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=ZZ0zgDCn8eQF4rU0QE+NkK9BmnpHegiSC+oKlV5yA5k=; b=Sv9hBSym8zWFgGEHMcDaNo0ZnArLQbGpMp+X1B5/thhrrFrWy1n/pRcvO/cE8r1JXk7qxlFwZA3m5DnsXBcHVl3rQWz0zTrgtZKO1Mp3bMD4+9aUdUGs5YUfozPa9ouK6sqB57DdHH+Bb/V2QW4Eai39lUyOfesCi4beSc/Q45qvba4C2rlrw9M76qAyQuVvU3Y1lt0FcJjHufU3S242W6aL/9enEH+iAl6VBv0qMxwPeKuVrk9gJFME8YbsA0poKf9jnDkTXfdW5sk1VdJm8Jaw6h0+mtr69HgTQQ2LZ4RL2mX1c/3il+sKBkdwt/XTUYnG4Ms7reKgmlZY7lopXw==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=K8f32XnnSauqGwtOheR7PUuPH1A3JtDQnW3PE9ST9YwdTAbVHXHmHgX3RefnpySQbVlWACvUZZyWJ+igklAhVa/zDt9Dj7wiZiDZAWT85mPtRFQnzKvr5f66erYuHk0+9nq9qM6Yc8c6J9ohCk81g/hWk+GNERTloWF2QtMixD+YL+YOt8J6645oZovNK20zVBtAVxW0c/AhZ7PcpG9s8pCwZ6ShoiUyFLaXkG2uyfQxgCmjrbqlL0/6Hngf38eGqGB1IQbwkcJRN3EL63ny0CG47eAxwa/zcBESjRkUK+Ve6UVPSwABPWwfh47Z49UXp5ttD3PYdxA+5c+z2jAhhQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dlYHXYMLgsmakNON73FA0Dzz/NDSlkaHqv7XvuSb4LY4cGmh+4ckPEPatXanGBhNNsS+squB+tAN/TnsSdKrGPIrNggnCnwSueG50oeR5utInXBelACTuez5n4+9Ng+2BQfg8608sM/OloiXcKEUdzvPiGW0c4us6WJqibUGwURcO/rmH/uPlSfN8FvvsmXEfY1ZVRNocldqyEyk08TS+nrEJS+SoaG3Jw4ZX6rjHmxkenZ9LXgGoDR8aqC5iPle4Gy06tLXfLrwjjg1gOajuGPFYbkXeSa6I1FKIwoA69zSDqKD1/Cq7FkJkWoBBrUIIxKmsNfU6zdBWjemrMNfBA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Jan Beulich <jbeulich@xxxxxxxx>, 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>
  • Delivery-date: Thu, 23 Nov 2023 14:48:21 +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: AQHaHhwDr0vektcMC0qRjv52uM1DKA==
  • Thread-topic: 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/20231031132304.2573924-1-luca.fancellu@xxxxxxx/
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

 


Rackspace

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