externs in .c files

Ralph Loader (loader@maths.ox.ac.uk)
Fri, 29 Nov 1996 14:00:59 GMT


Hi,

include/linux/pci.h declares pci_init as:

extern unsigned long pci_init (unsigned long mem_start, unsigned long mem_end);

while in init/main.c it's declared as:

extern long pci_init(long, long);

In this case the mistake is trivial and shouldn't effect the operation of
the kernel, but there's scope for introducing subtle bugs in this
way---e.g., a function `int foo (char *)' being declared `extern int foo
(const char *)' elsewhere.

The quick fix in this case is the patch below. But in the long term,
wouldn't the best thing to do be replace all of those `extern foo()'
declarations in .c files with `#include's of the appropriate .h files?

Ralph.

--- init/main.c~ Sun Nov 24 07:39:41 1996
+++ init/main.c Fri Nov 29 12:24:57 1996
@@ -65,7 +65,7 @@
extern long console_init(long, long);
extern long kmalloc_init(long,long);
extern void sock_init(void);
-extern long pci_init(long, long);
+extern unsigned long pci_init(unsigned long, unsigned long);
extern void sysctl_init(void);

extern void no_scroll(char *str, int *ints);