mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Joe Perches <joe@perches.com>
Cc: Srikrishan Malik <srikrishanmalik@gmail.com>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	greg@kroah.com, andreas.dilger@intel.com, oleg.drokin@intel.com,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	Julia Lawall <julia.lawall@lip6.fr>,
	Himangi Saraogi <himangi774@gmail.com>
Subject: Re: [PATCH 10/12] staging: lustre: Fix misplaced opening brace warnings
Date: Mon, 11 Aug 2014 16:21:23 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.10.1408111619510.2518@hadrien> (raw)
In-Reply-To: <1407757007.20795.18.camel@joe-AO725>



On Mon, 11 Aug 2014, Joe Perches wrote:

> On Mon, 2014-08-11 at 16:27 +0530, Srikrishan Malik wrote:
> > On Thu, Aug 07, 2014 at 09:35:43AM -0700, Joe Perches wrote:
> > > On Thu, 2014-08-07 at 19:01 +0300, Dan Carpenter wrote:
> > > > On Thu, Aug 07, 2014 at 09:01:36PM +0530, Srikrishan Malik wrote:
> > > > > On Wed, Aug 06, 2014 at 11:18:13PM +0300, Dan Carpenter wrote:
> > > > > > That looks silly before and after.  Everything is indented in a funny
> > > > > > way.
> > > > >
> > > > > Is this better:
> > > > >
> > > > > 	static const ldlm_policy_data_t lookup_policy = {
> > > > > 				.l_inodebits = { MDS_INODELOCK_LOOKUP }
> > > > > 	};
> > > > >
> > > >
> > > > That is indented too far.
> > > >
> > > > Honestly, I think it looks best on one line but in terms of real life we
> > > > can't ignore checkpatch warnings because eventually someone else will
> > > > try to "fix" it to not be on one line.
> []
> > > I think it looks odd to mix named and unnamed
> > > initializers for the typedef and its members.
> > >
> > > ldlm_policy_data_t is a union and it could be
> > > explicit instead of a typedef.
> > >
> > > Perhaps:
> > > 	static const union ldlm_policy_data lookup_policy = {
> > > 		.l_inodebits = {
> > > 			.bits = MDS_INODELOCK_LOOKUP,
> > > 		},
> > > 	};
> > >
> > > or maybe use another DECLARE_<foo> macro indirection.
> > >
> >
> > This patch set is aimed at removing checkpatch issues from files in
> > lustre/lustre/mdc.
>
> I think eliminating checkpatch identified issues should
> not be the primary goal but a secondary one to the
> overall goal of code style uniformity.
>
> Julia Lawall and Himangi Saraogi from coccinelle fame
> have created a "detypedef" script that is useful for
> structs, perhaps you could extend it for unions and
> run it over this lustre code.
>
> For instance:
> https://lkml.org/lkml/2014/8/9/104

The complete semantic patch is below.  It is in two parts: first for the
case where there is a name for the struct and the second for the case
where there is not.  The code could be extended to automatically drop the
_t's that are commonly put on typedefs.

julia

@tn@
identifier i;
type td;
@@

-typedef
 struct i { ... }
-td
 ;

@@
type tn.td;
identifier tn.i;
@@

-td
+ struct i

// ----------------------------------------------------------------------
// No name case

@tn1@
type td;
@@

typedef struct { ... } td;

@script:python tf@
td << tn1.td;
tdres;
@@

coccinelle.tdres = td

@@
type tn1.td;
identifier tf.tdres;
@@

-typedef
 struct
+  tdres
   { ... }
-td
 ;

@@
type tn1.td;
identifier tf.tdres;
@@

-td
+ struct tdres

  reply	other threads:[~2014-08-11 14:21 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-06 17:12 [PATCH 01/12] staging: lustre: remove space between function name and and open parenthesis Srikrishan Malik
2014-08-06 17:12 ` [PATCH 02/12] staging: lustre: remove spaces from start of line Srikrishan Malik
2014-08-06 17:12 ` [PATCH 03/12] staging: lustre: move open brace to next line after functions Srikrishan Malik
2014-08-06 17:12 ` [PATCH 04/12] staging: lustre: fix lines over 80 chars Srikrishan Malik
2014-08-06 17:12 ` [PATCH 05/12] staging: lustre: Add missing spaces around operators and braces Srikrishan Malik
2014-08-06 20:13   ` Dan Carpenter
2014-08-06 20:31     ` Joe Perches
2014-08-06 20:45       ` Dan Carpenter
2014-08-06 21:26         ` Joe Perches
2014-08-06 17:12 ` [PATCH 06/12] staging: lustre: replace c99 style comments with C89 Srikrishan Malik
2014-08-06 20:15   ` Dan Carpenter
2014-08-06 17:12 ` [PATCH 07/12] staging: lustre: add blank lines after declarations Srikrishan Malik
2014-08-06 17:12 ` [PATCH 08/12] staging: lustre: fix multi line strings Srikrishan Malik
2014-08-06 17:12 ` [PATCH 09/12] staging: lustre: Added space between type name and * Srikrishan Malik
2014-08-06 17:13 ` [PATCH 10/12] staging: lustre: Fix misplaced opening brace warnings Srikrishan Malik
2014-08-06 20:18   ` Dan Carpenter
2014-08-07 15:31     ` Srikrishan Malik
2014-08-07 16:01       ` Dan Carpenter
2014-08-07 16:35         ` Joe Perches
2014-08-11 10:57           ` Srikrishan Malik
2014-08-11 11:36             ` Joe Perches
2014-08-11 14:21               ` Julia Lawall [this message]
2014-08-11 12:54             ` Dan Carpenter
2014-08-06 17:13 ` [PATCH 11/12] staging: lustre: move else on the same line as closing brace Srikrishan Malik
2014-08-06 17:13 ` [PATCH 12/12] staging: lustre: remove parentheses usage with return Srikrishan Malik
2014-08-10  4:32 ` [PATCH 01/12] staging: lustre: remove space between function name and and open parenthesis Greg KH
2014-08-10 14:43   ` Srikrishan Malik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.10.1408111619510.2518@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=andreas.dilger@intel.com \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=greg@kroah.com \
    --cc=himangi774@gmail.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg.drokin@intel.com \
    --cc=srikrishanmalik@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®