Re: [2.6 patch] add -Werror-implicit-function-declaration to CFLAGS

Adrian Bunk
2005-11-11T20:18:54Z

On Thu, Nov 10, 2005 at 06:24:43PM -0800, Andrew Morton wrote:
> Adrian Bunk <bunk@stusta.de> wrote:
> >
> > On Thu, Nov 10, 2005 at 04:28:57AM -0800, Andrew Morton wrote:
> > > Adrian Bunk <bunk@stusta.de> wrote:
> > > >
> > > > 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.
> > > >
> > >
> > > Sorry, I need to build allmodconfig kernels on wacky architectures (eg
> > > ppc64) and this patch is killing me.
> >
> > Can you send me the list of compile errors so that I can work on fixing
> > them?
> >
>
> No handily, sorry. Missing virt_to_bus() is the typical problem.
>

But in this case -Werror-implicit-function-declaration doesn't create
new compile errors, it only moves compile errors from compile time to
link or depmod time - which is IMHO not a bad change.

If you really want to keep the status quo, you can still steal the
following from sparc64:
extern unsigned long virt_to_bus_not_defined_use_pci_map(volatile void *addr);
#define virt_to_bus virt_to_bus_not_defined_use_pci_map
extern unsigned long bus_to_virt_not_defined_use_pci_map(volatile void *addr);
#define bus_to_virt bus_to_virt_not_defined_use_pci_map

Would a patch to mark the ISA legacy functions as __deprecated be OK?

This might give some motivation for people to convert drivers and would
avoid new code like the recently introduced kexec to use this obsolete
API.

> The cross-tools at http://developer.osdl.org/dev/plm/cross_compile/ are
> quite simple to install.

Thanks, I've tried it.

Other problems I found until I gave up on compiling:
- a problem in sk98lin indirectly corrected by my SkPciWriteCfgDWord()
patch
- drivers/net/wireless/tiacx/: missing #include <linux/vmalloc.h>'s
(see my patch) - this seems to be a real bug

cu
Adrian

--

"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