public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checkpatch.pl: add union and struct to the exceptions list
@ 2010-01-06 16:46 Stefani Seibold
  2010-01-11 22:42 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Stefani Seibold @ 2010-01-06 16:46 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton, apw, jschopp, davej

This patch add the struct and union keywords to the exceptions list of
the checkpatch.pl script, to prevent error message "Macros with multiple
statements should be enclosed in a do - while loop". Otherwise it is not
possible to build a struct or union with a macro. 

Signed-off-by: Stefani Seibold <stefani@seibold.net>
---
 checkpatch.pl |    2 ++
 1 file changed, 2 insertions(+)

--- linux-2.6.33-rc2.orig/scripts/checkpatch.pl	2009-12-03 04:51:21.000000000 +0100
+++ linux-2.6.33-rc2.new/scripts/checkpatch.pl	2010-01-06 17:35:29.747634447 +0100
@@ -2348,6 +2348,8 @@ sub process {
 				DECLARE_PER_CPU|
 				DEFINE_PER_CPU|
 				__typeof__\(|
+				union|
+				struct|
 				\.$Ident\s*=\s*|
 				^\"|\"$
 			}x;



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] checkpatch.pl: add union and struct to the exceptions list
  2010-01-06 16:46 [PATCH] checkpatch.pl: add union and struct to the exceptions list Stefani Seibold
@ 2010-01-11 22:42 ` Andrew Morton
  2010-01-12 21:44   ` Stefani Seibold
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2010-01-11 22:42 UTC (permalink / raw)
  To: Stefani Seibold; +Cc: linux-kernel, apw, jschopp, davej

On Wed, 06 Jan 2010 17:46:00 +0100
Stefani Seibold <stefani@seibold.net> wrote:

> This patch add the struct and union keywords to the exceptions list of
> the checkpatch.pl script, to prevent error message "Macros with multiple
> statements should be enclosed in a do - while loop". Otherwise it is not
> possible to build a struct or union with a macro. 
> 
> Signed-off-by: Stefani Seibold <stefani@seibold.net>
> ---
>  checkpatch.pl |    2 ++
>  1 file changed, 2 insertions(+)
> 
> --- linux-2.6.33-rc2.orig/scripts/checkpatch.pl	2009-12-03 04:51:21.000000000 +0100
> +++ linux-2.6.33-rc2.new/scripts/checkpatch.pl	2010-01-06 17:35:29.747634447 +0100
> @@ -2348,6 +2348,8 @@ sub process {
>  				DECLARE_PER_CPU|
>  				DEFINE_PER_CPU|
>  				__typeof__\(|
> +				union|
> +				struct|
>  				\.$Ident\s*=\s*|
>  				^\"|\"$
>  			}x;

hm.  Perhaps it would help if you could provide a snippet of code which
triggers the incorrect warning?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] checkpatch.pl: add union and struct to the exceptions list
  2010-01-11 22:42 ` Andrew Morton
@ 2010-01-12 21:44   ` Stefani Seibold
  0 siblings, 0 replies; 3+ messages in thread
From: Stefani Seibold @ 2010-01-12 21:44 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, apw, jschopp, davej

Am Montag, den 11.01.2010, 14:42 -0800 schrieb Andrew Morton:
> On Wed, 06 Jan 2010 17:46:00 +0100
> Stefani Seibold <stefani@seibold.net> wrote:
> 
> > This patch add the struct and union keywords to the exceptions list of
> > the checkpatch.pl script, to prevent error message "Macros with multiple
> > statements should be enclosed in a do - while loop". Otherwise it is not
> > possible to build a struct or union with a macro. 
> > 
> > Signed-off-by: Stefani Seibold <stefani@seibold.net>
> > ---
> >  checkpatch.pl |    2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > --- linux-2.6.33-rc2.orig/scripts/checkpatch.pl	2009-12-03 04:51:21.000000000 +0100
> > +++ linux-2.6.33-rc2.new/scripts/checkpatch.pl	2010-01-06 17:35:29.747634447 +0100
> > @@ -2348,6 +2348,8 @@ sub process {
> >  				DECLARE_PER_CPU|
> >  				DEFINE_PER_CPU|
> >  				__typeof__\(|
> > +				union|
> > +				struct|
> >  				\.$Ident\s*=\s*|
> >  				^\"|\"$
> >  			}x;
> 
> hm.  Perhaps it would help if you could provide a snippet of code which
> triggers the incorrect warning?
> 

Here is a small code snippet, which will be complained by the
checkpatch.pl:

#define __STRUCT_KFIFO_COMMON(recsize, ptrtype) \
	union { \
		struct { \
			unsigned int	in; \
			unsigned int	out; \
		}; \
		char		rectype[recsize]; \
		ptrtype		*ptr; \
		const ptrtype	*ptr_const; \
	};

This construct is legal an save, so checkpatch.pl should accept this. It
should be also true for struct defined in a macro.

Stefani



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-01-12 21:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-06 16:46 [PATCH] checkpatch.pl: add union and struct to the exceptions list Stefani Seibold
2010-01-11 22:42 ` Andrew Morton
2010-01-12 21:44   ` Stefani Seibold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox