kbuild: remove -Wdeclaration-after-statement
RFC PATCH 1/1 kbuild: remove -Wdeclaration-after-statement
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. :)
---
Makefile +0 -3
@@ -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,)
Quoted 16 lines · Amerigo Wang
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 <[email protected]>Cc Sam Ravnborg <[email protected]>---
Makefile +0
-0
Makefile endif · line 563
Quoted 8 lines
Makefile +0
-3@@ -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.
Hi,
Quoted 3 lines · Amerigo Wang
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 .
Quoted 2 lines
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.
Quoted 9 lines
Signed-off-by WANG Cong <[email protected]>Cc Sam Ravnborg <[email protected]>---
Makefile +0
-0
Makefile endif · line 563
Quoted 8 lines
Makefile +0
-3@@ -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
Quoted 6 lines · Amerigo Wang
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
Quoted 9 lines · Sam Ravnborg
Quoted 5 lines · Amerigo Wang
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.
Quoted 2 lines
(*) 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
Quoted 11 lines · Randy Dunlap
Quoted 9 lines · Sam Ravnborg
Quoted 5 lines · Amerigo Wang
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.
Quoted 7 lines
Agreed.
Quoted 2 lines
(*) 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
Quoted 4 lines · Sam Ravnborg
Quoted 3 lines · Amerigo Wang
I got lots of "ISO C90 forbids mixed declarations and code" warnings during compile today's kernel.
Quoted 8 lines
Quoted 2 lines
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!