Skip to contentSkip to conversation

add -Werror-implicit-function-declaration to CFLAGS

PATCH In review Adrian Bunk 4 participants 6 messages Jul 30, 2005 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add -Werror-implicit-function-declaration to CFLAGS

Currently, using an undeclared function gives a compile warning, but it can lead to a link or even a runtime error.

With -Werror-implicit-function-declaration, we are getting an immediate compile error instead.

This patch also removes some unneeded spaces between two tabs in the following line.

Makefile renamed from Makefile.old +2 -1
@@ -351,7 +351,8 @@
 CPPFLAGS        := -D__KERNEL__ $(LINUXINCLUDE)
 
 CFLAGS 		:= -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-	  	   -fno-strict-aliasing -fno-common \
+		   -Werror-implicit-function-declaration \
+		   -fno-strict-aliasing -fno-common \
 		   -ffreestanding
 AFLAGS		:= -D__ASSEMBLY__
 
#1 lore raw
Quoted 16 lines · Adrian Bunk

Currently, using an undeclared function gives a compile warning, but it can lead to a link or even a runtime error.

With -Werror-implicit-function-declaration, we are getting an immediate compile error instead.

This patch also removes some unneeded spaces between two tabs in the following line.

Makefile line 358

Quoted 9 lines
Makefile renamed from Makefile.old +2 -1
@@ -351,7 +351,8 @@
 CPPFLAGS        := -D__KERNEL__ $(LINUXINCLUDE)
 
 CFLAGS 		:= -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-	  	   -fno-strict-aliasing -fno-common \
+		   -Werror-implicit-function-declaration \
+		   -fno-strict-aliasing -fno-common \
 		   -ffreestanding
 AFLAGS		:= -D__ASSEMBLY__
 

heh. Nice idea, but if I merge this I'll have tons of monkey work to do to get ppc64, ia64 and others compiling :(

umm, so what to do? I'm inclined to just slam it in post-2.6.13 then take a week off or something.

#2 lore raw
Quoted 19 lines · Andrew Morton
Quoted 18 lines · Adrian Bunk

Currently, using an undeclared function gives a compile warning, but it can lead to a link or even a runtime error.

With -Werror-implicit-function-declaration, we are getting an immediate compile error instead.

This patch also removes some unneeded spaces between two tabs in the following line.

Makefile renamed from Makefile.old +0 -0
@@ -351,7 +351,8 @@
 CPPFLAGS        := -D__KERNEL__ $(LINUXINCLUDE)
 
Quoted 10 lines

Makefile line 358

Quoted 7 lines
Makefile renamed from Makefile.old +2 -1
 CFLAGS 		:= -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-	  	   -fno-strict-aliasing -fno-common \
+		   -Werror-implicit-function-declaration \
+		   -fno-strict-aliasing -fno-common \
 		   -ffreestanding
 AFLAGS		:= -D__ASSEMBLY__
 

heh. Nice idea, but if I merge this I'll have tons of monkey work to do to get ppc64, ia64 and others compiling :(

Looking at Jan's defconfig builds [1], I don't see this.

Quoted 2 lines

umm, so what to do? I'm inclined to just slam it in post-2.6.13 then take a week off or something.

cu
Adrian

[1] http://l4x.org/k/

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#3 lore raw
In reply to Adrian Bunk
Quoted 5 lines · Adrian Bunk

Currently, using an undeclared function gives a compile warning, but it can lead to a link or even a runtime error.

With -Werror-implicit-function-declaration, we are getting an immediate compile error instead.

For i386 this is pretty OK.
But what about other architectures?

Before applying this change I want to know the result on a few archs, and anyway using a CONFIG option may be a safer choice for a while.

Quoted 3 lines

This patch also removes some unneeded spaces between two tabs in the following line.

Please - use tabs for indention, not for alignment.
The below would look rather messy with tabs=4.
Almost everywhere tabs are used in Makefiles it is plina wrong. Tabs are brillient for indention but you cannot just assume 8 spaces = a tab. Not even at the beginning of the line.

If you have a nested if or something tabs are there to be used.

Sam

#4 lore raw
Quoted 5 lines · Sam Ravnborg

Please - use tabs for indention, not for alignment.
The below would look rather messy with tabs=4.
Almost everywhere tabs are used in Makefiles it is plina wrong. Tabs are brillient for indention but you cannot just assume 8 spaces = a tab. Not even at the beginning of the line.

as far as working on the kernel, yes you can assume that.

#5 lore raw
Quoted 8 lines · Christoph Hellwig
Quoted 5 lines · Sam Ravnborg

Please - use tabs for indention, not for alignment.
The below would look rather messy with tabs=4.
Almost everywhere tabs are used in Makefiles it is plina wrong. Tabs are brillient for indention but you cannot just assume 8 spaces = a tab. Not even at the beginning of the line.

as far as working on the kernel, yes you can assume that.

A bad assumption in several cases.
But if one never ever never use tabs != 8 they do not see the horror, and so they probarly do not care.

For the Makefiles you will continue to see spaces used for alignmnet.

PS. Last word on this issue - I do not wan't to spend my linux time on a sapce / versus tabs flamefest.

Sam