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

[Xen-devel] [PATCH] CODING_STYLE: clarify function argument indentation


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Wed, 31 Jul 2019 16:24:36 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=epam.com;dmarc=pass action=none header.from=epam.com;dkim=pass header.d=epam.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-SenderADCheck; bh=a4Icszp+qMBGi4WXCocZNRIFeB0s66xmS2xeoK537P4=; b=VydJ4MjIUidSyI7oHJ8h1RxCz44LKUX2qZTB5IDCJonUJxb9dGe7fOM58eNcIEMSogkcEZu+eXCmujdVczlHNIKYBjQYROBSOJECdQxUmdphCMDZE2esC52x2yIhH2lRbfXOxG3My6VkJjFxTKN3vmFJ4/2GeuDSce/af6y+R0QHrUzjQJnzq7lT2uDxuU4+UgHiCauNkTZktYHZCzvpDtC1kbSqyRG/EJJCIjXriOopMeMZvbYv58iogP4JRsaORKJrNR/wti9N+xP04ksieWXNu/4xQ11fCc0RwCN7pm2i982slkKRcgY0iJWv4UYkbC/49LDZoTbQ0fSD1jZfUQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mI0svGeEjyH5LQFvZCmXchnl3Xj0+tvAleEOO1XVtHfGQPAFzwxVuhL8swVYXwUQwVcbj9M/82XI+/HSTDFQ8n5LMvCAELsH77cwSUJI3xezvjMhOrz/bL/5XLpnz6MHDBrB7nDrQm3SY1WhAsdSv/bbCYScKugB2XhDNyuxAk0m3m5tzE81a1fm/2ZjF5mji6XP9LQU28B1P4f8UxIiwN9Mh9Bg6kdQwhca7+GV84gfoih0JGvBOYXibBjJ7S+xyaVhQdx4z0OWBh9nMpngMLVj1zW/EqVZv0UK1z/v+j+c0oPOXO+m2YuZeoLZHNfF1OjjgQDv3ghltkA4dzlu4w==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Volodymyr_Babchuk@xxxxxxxx;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, George Dunlap <George.Dunlap@xxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Ian Jackson <ian.jackson@xxxxxxxxxxxxx>, Tim Deegan <tim@xxxxxxx>, Julien Grall <julien.grall@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, "viktor.mitin.19@xxxxxxxxx" <viktor.mitin.19@xxxxxxxxx>
  • Delivery-date: Wed, 31 Jul 2019 16:24:42 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHVR7xxvb8iYZ/UOE68NI2ovvNVUw==
  • Thread-topic: [PATCH] CODING_STYLE: clarify function argument indentation

There are coding style rules that are widely accepted by community,
but newer were formalized in the document. Notable example is the
question on how function arguments and parameters should be indented
when they do not fit into one line.

This question was raised multiple times lately, mostly because of
ongoing efforts to create Xen coding style formatting tool and because
of new community members, who are not aware of such unwritten rules.

Actually, this rule is already implicitly defined in the document by
defining emacs coding style: 'c-file-style: "BSD"'. In this mode emacs
lines up function arguments under the first argument. Naturally, most
of Xen code is written in this style.

So, lets state the obvious and fix this rule explicitly.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
---
 CODING_STYLE | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/CODING_STYLE b/CODING_STYLE
index 6cc5b774cf..6479215a15 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -53,6 +53,20 @@ Line Length
 Lines should be less than 80 characters in length.  Long lines should
 be split at sensible places and the trailing portions indented.
 
+For multiline function declaration and call each new line should be
+aligned with the first the parameter or argument. e.g.:
+
+void my_function_with_long_name(struct lengthy_struct_name *struct1,
+                                struct lengthy_struct_name *struct2,
+                                struct lengthy_struct_name *struct3);
+
+or
+
+function_with_so_many_params(wordy_parameter1, wordy_parameter2,
+                             wordy_parameter3, wordy_parameter4);
+
+The same applies for macros.
+
 User visible strings (e.g., printk() messages) should not be split so
 they can searched for more easily.
 
-- 
2.22.0

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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