All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC Patch] kbuild: remove -Wdeclaration-after-statement
@ 2009-09-23  9:38 Amerigo Wang
  2009-09-23 10:19 ` Mikael Pettersson
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Amerigo Wang @ 2009-09-23  9:38 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, Amerigo Wang, Sam Ravnborg


I got lots of "ISO C90 forbids mixed declarations and code" warnings
during compile today's kernel.

I think we can remove the gcc option '-Wdeclaration-after-statement'
now, since we already have C99 for 10 years. :)

Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: Sam Ravnborg <sam@ravnborg.org>

---
diff --git a/Makefile b/Makefile
index 433493a..038bda2 100644
--- a/Makefile
+++ b/Makefile
@@ -559,9 +559,6 @@ endif
 NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
 CHECKFLAGS     += $(NOSTDINC_FLAGS)
 
-# warn about C99 declaration after statement
-KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
-
 # disable pointer signed / unsigned warnings in gcc 4.0
 KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)
 

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

* Re: [RFC Patch] kbuild: remove -Wdeclaration-after-statement
  2009-09-23  9:38 [RFC Patch] kbuild: remove -Wdeclaration-after-statement Amerigo Wang
@ 2009-09-23 10:19 ` Mikael Pettersson
  2009-09-23 10:41 ` Johannes Weiner
  2009-09-23 10:51 ` Sam Ravnborg
  2 siblings, 0 replies; 7+ messages in thread
From: Mikael Pettersson @ 2009-09-23 10:19 UTC (permalink / raw)
  To: Amerigo Wang; +Cc: linux-kernel, akpm, Sam Ravnborg

Amerigo Wang writes:
 > 
 > I got lots of "ISO C90 forbids mixed declarations and code" warnings
 > during compile today's kernel.
 > 
 > I think we can remove the gcc option '-Wdeclaration-after-statement'
 > now, since we already have C99 for 10 years. :)
 > 
 > Signed-off-by: WANG Cong <amwang@redhat.com>
 > Cc: Sam Ravnborg <sam@ravnborg.org>
 > 
 > ---
 > diff --git a/Makefile b/Makefile
 > index 433493a..038bda2 100644
 > --- a/Makefile
 > +++ b/Makefile
 > @@ -559,9 +559,6 @@ endif
 >  NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
 >  CHECKFLAGS     += $(NOSTDINC_FLAGS)
 >  
 > -# warn about C99 declaration after statement
 > -KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
 > -
 >  # disable pointer signed / unsigned warnings in gcc 4.0
 >  KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)

This is more a matter of coding-style policy than C technicalities.

I happen to hate declarations at random places in the code, so I'd
prefer the offending code to be fixed instead.

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

* Re: [RFC Patch] kbuild: remove -Wdeclaration-after-statement
  2009-09-23  9:38 [RFC Patch] kbuild: remove -Wdeclaration-after-statement Amerigo Wang
  2009-09-23 10:19 ` Mikael Pettersson
@ 2009-09-23 10:41 ` Johannes Weiner
  2009-09-23 10:51 ` Sam Ravnborg
  2 siblings, 0 replies; 7+ messages in thread
From: Johannes Weiner @ 2009-09-23 10:41 UTC (permalink / raw)
  To: Amerigo Wang; +Cc: linux-kernel, akpm, Sam Ravnborg

Hi,

On Wed, Sep 23, 2009 at 05:38:01AM -0400, Amerigo Wang wrote:
> 
> I got lots of "ISO C90 forbids mixed declarations and code" warnings
> during compile today's kernel.

Yeah, see http://lkml.org/lkml/2009/9/22/585 .

> I think we can remove the gcc option '-Wdeclaration-after-statement'
> now, since we already have C99 for 10 years. :)

It's still ugly and uncommon to have variable declarations appear
randomly in block bodies, please keep the warning.

> Signed-off-by: WANG Cong <amwang@redhat.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> 
> ---
> diff --git a/Makefile b/Makefile
> index 433493a..038bda2 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -559,9 +559,6 @@ endif
>  NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
>  CHECKFLAGS     += $(NOSTDINC_FLAGS)
>  
> -# warn about C99 declaration after statement
> -KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
> -
>  # disable pointer signed / unsigned warnings in gcc 4.0
>  KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)

	Hannes

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

* Re: [RFC Patch] kbuild: remove -Wdeclaration-after-statement
  2009-09-23  9:38 [RFC Patch] kbuild: remove -Wdeclaration-after-statement Amerigo Wang
  2009-09-23 10:19 ` Mikael Pettersson
  2009-09-23 10:41 ` Johannes Weiner
@ 2009-09-23 10:51 ` Sam Ravnborg
  2009-09-25 20:18   ` Randy Dunlap
  2009-09-26  1:06   ` Amerigo Wang
  2 siblings, 2 replies; 7+ messages in thread
From: Sam Ravnborg @ 2009-09-23 10:51 UTC (permalink / raw)
  To: Amerigo Wang; +Cc: linux-kernel, akpm

On Wed, Sep 23, 2009 at 05:38:01AM -0400, Amerigo Wang wrote:
> 
> I got lots of "ISO C90 forbids mixed declarations and code" warnings
> during compile today's kernel.
> 
> I think we can remove the gcc option '-Wdeclaration-after-statement'
> now, since we already have C99 for 10 years. :)

This is a matter of style more than what C99 allows.
Kernel style is to fobid this(*) so we keep the warning.

(*) Based on reading several threads where this has
been mentioned - I have no specific references to CodingStyle.

	Sam

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

* Re: [RFC Patch] kbuild: remove -Wdeclaration-after-statement
  2009-09-23 10:51 ` Sam Ravnborg
@ 2009-09-25 20:18   ` Randy Dunlap
  2009-09-25 20:52     ` Sam Ravnborg
  2009-09-26  1:06   ` Amerigo Wang
  1 sibling, 1 reply; 7+ messages in thread
From: Randy Dunlap @ 2009-09-25 20:18 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Amerigo Wang, linux-kernel, akpm

Sam Ravnborg wrote:
> On Wed, Sep 23, 2009 at 05:38:01AM -0400, Amerigo Wang wrote:
>> I got lots of "ISO C90 forbids mixed declarations and code" warnings
>> during compile today's kernel.
>>
>> I think we can remove the gcc option '-Wdeclaration-after-statement'
>> now, since we already have C99 for 10 years. :)
> 
> This is a matter of style more than what C99 allows.
> Kernel style is to fobid this(*) so we keep the warning.

Agreed.

> (*) Based on reading several threads where this has
> been mentioned - I have no specific references to CodingStyle.

I've avoided making updates to CodingStyle lately.
Is this one needed?

Thanks,
~Randy

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

* Re: [RFC Patch] kbuild: remove -Wdeclaration-after-statement
  2009-09-25 20:18   ` Randy Dunlap
@ 2009-09-25 20:52     ` Sam Ravnborg
  0 siblings, 0 replies; 7+ messages in thread
From: Sam Ravnborg @ 2009-09-25 20:52 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Amerigo Wang, linux-kernel, akpm

On Fri, Sep 25, 2009 at 01:18:52PM -0700, Randy Dunlap wrote:
> Sam Ravnborg wrote:
> > On Wed, Sep 23, 2009 at 05:38:01AM -0400, Amerigo Wang wrote:
> >> I got lots of "ISO C90 forbids mixed declarations and code" warnings
> >> during compile today's kernel.
> >>
> >> I think we can remove the gcc option '-Wdeclaration-after-statement'
> >> now, since we already have C99 for 10 years. :)
> > 
> > This is a matter of style more than what C99 allows.
> > Kernel style is to fobid this(*) so we keep the warning.
> 
> Agreed.
> 
> > (*) Based on reading several threads where this has
> > been mentioned - I have no specific references to CodingStyle.
> 
> I've avoided making updates to CodingStyle lately.
> Is this one needed?
No - CodingStyle should be general stuff.

	Sam

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

* Re: [RFC Patch] kbuild: remove -Wdeclaration-after-statement
  2009-09-23 10:51 ` Sam Ravnborg
  2009-09-25 20:18   ` Randy Dunlap
@ 2009-09-26  1:06   ` Amerigo Wang
  1 sibling, 0 replies; 7+ messages in thread
From: Amerigo Wang @ 2009-09-26  1:06 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: linux-kernel, akpm

Sam Ravnborg wrote:
> On Wed, Sep 23, 2009 at 05:38:01AM -0400, Amerigo Wang wrote:
>> I got lots of "ISO C90 forbids mixed declarations and code" warnings
>> during compile today's kernel.
>>
>> I think we can remove the gcc option '-Wdeclaration-after-statement'
>> now, since we already have C99 for 10 years. :)
> 
> This is a matter of style more than what C99 allows.
> Kernel style is to fobid this(*) so we keep the warning.
> 
> (*) Based on reading several threads where this has
> been mentioned - I have no specific references to CodingStyle.

Ah, Ok, no problem.

Thanks, everyone!

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

end of thread, other threads:[~2009-09-26  1:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-23  9:38 [RFC Patch] kbuild: remove -Wdeclaration-after-statement Amerigo Wang
2009-09-23 10:19 ` Mikael Pettersson
2009-09-23 10:41 ` Johannes Weiner
2009-09-23 10:51 ` Sam Ravnborg
2009-09-25 20:18   ` Randy Dunlap
2009-09-25 20:52     ` Sam Ravnborg
2009-09-26  1:06   ` Amerigo Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.