Skip to contentSkip to conversation

add -Werror-implicit-function-declaration to CFLAGS

PATCH In review Adrian Bunk 2 participants 5 messages Nov 23, 2005 – Nov 24, 2005

Subsystems (2)
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 nasty runtime error if the prototype of the function is different from what gcc guessed.

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

There will be some compile errors in cases where compilation previously worked because the undefined function wasn't called due to gcc dead code elimination, but in these cases a proper fix doesnt harm.

This patch also removes some unneeded spaces between two tabs in the following line and a now no longer required -Werror-implicit-function-declaration from drivers/input/joystick/iforce/Makefile.

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__
 
drivers/input/joystick/iforce/Makefile renamed from drivers/input/joystick/iforce/Makefile.old +0 -1
@@ -17,4 +17,3 @@
 	iforce-objs += iforce-usb.o
 endif
 
-EXTRA_CFLAGS = -Werror-implicit-function-declaration
#1 lore raw
Quoted 7 lines · Adrian Bunk

Currently, using an undeclared function gives a compile warning, but it can lead to a nasty runtime error if the prototype of the function is different from what gcc guessed.

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

Where "we" == "me". This patch means I get to fix all the errors which I encounter. No fair. This should be the last patch, not the first.

#2 lore raw
Quoted 11 lines · Andrew Morton
Quoted 7 lines · Adrian Bunk

Currently, using an undeclared function gives a compile warning, but it can lead to a nasty runtime error if the prototype of the function is different from what gcc guessed.

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

Where "we" == "me". This patch means I get to fix all the errors which I encounter. No fair. This should be the last patch, not the first.

Is it my fault that you applied neither Al Viro's patches to remove the usages of the ISA legacy functions nor my patch to mark virt_to_bus/bus_to_virt as __deprecated on i386?

cu
Adrian

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
Quoted 8 lines · Adrian Bunk
Quoted 6 lines · Andrew Morton
Quoted 5 lines · Adrian Bunk

Currently, using an undeclared function gives a compile warning, but it can lead to a nasty runtime error if the prototype of the function is different from what gcc guessed.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

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

Where "we" == "me". This patch means I get to fix all the errors which I encounter. No fair. This should be the last patch, not the first.

Is it my fault that you applied neither Al Viro's patches to remove the usages of the ISA legacy functions

Never saw them.

Quoted 2 lines

nor my patch to mark
virt_to_bus/bus_to_virt as __deprecated on i386?

That won't make powerpc compile.

Plus there are various other unfixed functions around the tree with various .configs.

It took about four releases to teach people that the jsm driver won't compile. I don't want to go adding things to -mm which break it in this way - that causes us to lose testers.

The patch is a good one, but it should come last.

#4 lore raw
Quoted 12 lines · Andrew Morton
Quoted 11 lines · Adrian Bunk
Quoted 9 lines · Andrew Morton
Quoted 7 lines · Adrian Bunk

Currently, using an undeclared function gives a compile warning, but it can lead to a nasty runtime error if the prototype of the function is different from what gcc guessed.

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

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Where "we" == "me". This patch means I get to fix all the errors which I encounter. No fair. This should be the last patch, not the first.

Is it my fault that you applied neither Al Viro's patches to remove the usages of the ISA legacy functions

Never saw them.

It's the patch series starting with
http://www.ussg.iu.edu/hypermail/linux/kernel/0511.1/2685.html

Quoted 4 lines
Quoted 2 lines

nor my patch to mark
virt_to_bus/bus_to_virt as __deprecated on i386?

That won't make powerpc compile.

Judging from the feedback when I sent this patch first, there are people who might notice and actually fix these issues.

Quoted 2 lines

Plus there are various other unfixed functions around the tree with various .configs.

And it's my job to fix every single such bug before you'd accept -Werror-implicit-function-declaration in the CFLAGS?

Yes, these are bugs.
And yes, they do already generate warnings.

Quoted 3 lines

It took about four releases to teach people that the jsm driver won't compile. I don't want to go adding things to -mm which break it in this way - that causes us to lose testers.

-Werror-implicit-function-declaration helps us to avoid a class of hard to find _runtime_ errors.

I'm already sending patches to fix all the warnings with -Wmissing-prototypes (which is roughly spoken the other side of the implicit-function-declaration issue) at least on i386 before I'm proposing to add this flag to the global CFLAGS, and while doing this I've already found and fixed three _runtime_ errors.

But judging from your comments you might then reject -Wmissing-prototypes because it causes warnings on other architectures...

IMHO reducing the number of hard to find runtime errors is more important than to get allmodconfig compiling in every -mm on all architectures.

Quoted 1 line

The patch is a good one, but it should come last.

Instead of telling me that I have to fix compile breakages with all possible .config's on all architectures before you would accept my patch, couldn't you be honest and simply tell me to fuck off?

cu
Adrian

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