Patchwork [1/2] Delete useless 'extern' qualifiers for functions

login
register
mail settings
Submitter Blue Swirl
Date Nov. 13, 2010, 12:49 p.m.
Message ID <AANLkTimhiFCb7Zhm1NPikKzVsdVWaHTweZRFy6wr=pDi@mail.gmail.com>
Download mbox | patch
Permalink /patch/71050/
State New
Headers show

Comments

Blue Swirl - Nov. 13, 2010, 12:49 p.m.
'extern' qualifier is useless for function declarations. Delete
them.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 cache-utils.h                   |    2 +-
 cmd.h                           |   36 ++++++++--------
 darwin-user/commpage.c          |    2 +-
 darwin-user/syscall.c           |   24 +++++-----
 dis-asm.h                       |   85 +++++++++++++++++++--------------------
 envlist.h                       |   14 +++---
 exec-all.h                      |    2 +-
 fpu/softfloat-native.c          |    4 +-
 fsdev/qemu-fsdev.h              |    6 +-
 hw/file-op-9p.h                 |    2 +-
 hw/hw.h                         |   21 +++++-----
 hw/mips.h                       |    2 +-
 hw/s390-virtio-bus.h            |   16 +++----
 hw/virtio-9p-xattr.h            |   17 ++++----
 hw/virtio-9p.h                  |    4 +-
 hw/watchdog.h                   |    8 ++--
 linux-user/arm/nwfpe/fpa11.h    |    6 +-
 linux-user/arm/nwfpe/fpopcode.h |    4 +-
 linux-user/syscall.c            |   10 ++--
 m68k-dis.c                      |   11 ++---
 osdep.c                         |    2 +-
 qemu-common.h                   |    2 +-
 slirp/slirp.h                   |   10 ++--
 target-s390x/cpu.h              |    6 +-
 tests/cris/sys.h                |    4 +-
 tests/runcom.c                  |    4 +-
 ui/cocoa.m                      |    6 +-
 ui/d3des.h                      |    8 ++--
 ui/x_keymap.h                   |    4 +-
 29 files changed, 158 insertions(+), 164 deletions(-)
Stefan Weil - Nov. 13, 2010, 1:25 p.m.
Am 13.11.2010 13:49, schrieb Blue Swirl:
> 'extern' qualifier is useless for function declarations. Delete
> them.
>
> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
> ---
> cache-utils.h | 2 +-
> cmd.h | 36 ++++++++--------
> darwin-user/commpage.c | 2 +-
> darwin-user/syscall.c | 24 +++++-----
> dis-asm.h | 85 +++++++++++++++++++--------------------
> envlist.h | 14 +++---
> exec-all.h | 2 +-
> fpu/softfloat-native.c | 4 +-
> fsdev/qemu-fsdev.h | 6 +-
> hw/file-op-9p.h | 2 +-
> hw/hw.h | 21 +++++-----
> hw/mips.h | 2 +-
> hw/s390-virtio-bus.h | 16 +++----
> hw/virtio-9p-xattr.h | 17 ++++----
> hw/virtio-9p.h | 4 +-
> hw/watchdog.h | 8 ++--
> linux-user/arm/nwfpe/fpa11.h | 6 +-
> linux-user/arm/nwfpe/fpopcode.h | 4 +-
> linux-user/syscall.c | 10 ++--
> m68k-dis.c | 11 ++---
> osdep.c | 2 +-
> qemu-common.h | 2 +-
> slirp/slirp.h | 10 ++--
> target-s390x/cpu.h | 6 +-
> tests/cris/sys.h | 4 +-
> tests/runcom.c | 4 +-
> ui/cocoa.m | 6 +-
> ui/d3des.h | 8 ++--
> ui/x_keymap.h | 4 +-
> 29 files changed, 158 insertions(+), 164 deletions(-)

extern qualifiers in *.c files are very useful:

They should be replaced by include statements
(this makes it possible to check whether declaration
and implementation match). Without 'extern', they are
difficult to detect, with 'extern' this is easy.

So either replace those extern declarations by an
include statement (best solution), or don't touch the
'extern' there, or add a comment which can be easily
found (XXX or TODO).

Regards
Stefan

Patch

diff --git a/cache-utils.h b/cache-utils.h
index b45fde4..0b65907 100644
--- a/cache-utils.h
+++ b/cache-utils.h
@@ -9,7 +9,7 @@  struct qemu_cache_conf {

 extern struct qemu_cache_conf qemu_cache_conf;

-extern void qemu_cache_utils_init(char **envp);
+void qemu_cache_utils_init(char **envp);

 /* mildly adjusted code from tcg-dyngen.c */
 static inline void flush_icache_range(unsigned long start, unsigned long stop)
diff --git a/cmd.h b/cmd.h
index cbe9549..b763b19 100644
--- a/cmd.h
+++ b/cmd.h
@@ -38,33 +38,33 @@  typedef struct cmdinfo {
 extern cmdinfo_t	*cmdtab;
 extern int		ncmds;

-extern void		help_init(void);
-extern void		quit_init(void);
+void help_init(void);
+void quit_init(void);

 typedef int (*argsfunc_t)(int index);
 typedef int (*checkfunc_t)(const cmdinfo_t *ci);

-extern void		add_command(const cmdinfo_t *ci);
-extern void		add_user_command(char *optarg);
-extern void		add_args_command(argsfunc_t af);
-extern void		add_check_command(checkfunc_t cf);
+void add_command(const cmdinfo_t *ci);
+void add_user_command(char *optarg);
+void add_args_command(argsfunc_t af);
+void add_check_command(checkfunc_t cf);

-extern const cmdinfo_t	*find_command(const char *cmd);
+const cmdinfo_t *find_command(const char *cmd);

-extern void		command_loop(void);
-extern int		command_usage(const cmdinfo_t *ci);
-extern int		command(const cmdinfo_t *ci, int argc, char **argv);
+void command_loop(void);
+int command_usage(const cmdinfo_t *ci);
+int command(const cmdinfo_t *ci, int argc, char **argv);

 /* from input.h */
-extern char	**breakline(char *input, int *count);
-extern void	doneline(char *input, char **vec);
-extern char	*fetchline(void);
+char **breakline(char *input, int *count);
+void doneline(char *input, char **vec);
+char *fetchline(void);

-extern long long cvtnum(char *s);
-extern void	cvtstr(double value, char *str, size_t sz);
+long long cvtnum(char *s);
+void cvtstr(double value, char *str, size_t sz);

-extern struct timeval tsub(struct timeval t1, struct timeval t2);
-extern double	tdiv(double value, struct timeval tv);
+struct timeval tsub(struct timeval t1, struct timeval t2);
+double tdiv(double value, struct timeval tv);

 enum {
 	DEFAULT_TIME		= 0x0,
@@ -72,7 +72,7 @@  enum {
 	VERBOSE_FIXED_TIME	= 0x2
 };

-extern void	timestr(struct timeval *tv, char *str, size_t sz, int flags);
+void timestr(struct timeval *tv, char *str, size_t sz, int flags);

 extern char *progname;

diff --git a/darwin-user/commpage.c b/darwin-user/commpage.c
index f6aa71e..2b3a3b3 100644
--- a/darwin-user/commpage.c
+++ b/darwin-user/commpage.c
@@ -279,7 +279,7 @@  void do_add_atomic_word32(void *cpu_env, int num)
 void do_cgettimeofday(void *cpu_env, int num, uint32_t arg1)
 {
 #ifdef TARGET_I386
-    extern int __commpage_gettimeofday(struct timeval *);
+    int __commpage_gettimeofday(struct timeval *);
     DPRINTF("commpage: gettimeofday(0x%x)\n", arg1);
     struct timeval *time = (struct timeval *)arg1;
     int ret = __commpage_gettimeofday(time);
diff --git a/darwin-user/syscall.c b/darwin-user/syscall.c
index 060acc8..d173ef0 100644
--- a/darwin-user/syscall.c
+++ b/darwin-user/syscall.c
@@ -309,9 +309,9 @@  static inline uint32_t target_mach_msg_trap(
         mach_msg_header_t *hdr, uint32_t options, uint32_t send_size,
         uint32_t rcv_size, uint32_t rcv_name, uint32_t time_out,
uint32_t notify)
 {
-    extern int mach_msg_trap(mach_msg_header_t *, mach_msg_option_t,
-          mach_msg_size_t, mach_msg_size_t, mach_port_t,
-          mach_msg_timeout_t, mach_port_t);
+    int mach_msg_trap(mach_msg_header_t *, mach_msg_option_t,
+                      mach_msg_size_t, mach_msg_size_t, mach_port_t,
+                      mach_msg_timeout_t, mach_port_t);
     mach_msg_audit_trailer_t *trailer;
     mach_msg_id_t msg_id;
     uint32_t ret = 0;
@@ -416,7 +416,7 @@  long do_mach_syscall(void *cpu_env, int num,
uint32_t arg1, uint32_t arg2, uint3
                 uint32_t arg4, uint32_t arg5, uint32_t arg6, uint32_t arg7,
                 uint32_t arg8)
 {
-    extern uint32_t mach_reply_port(void);
+    uint32_t mach_reply_port(void);

     long ret = 0;

@@ -471,7 +471,7 @@  long do_mach_syscall(void *cpu_env, int num,
uint32_t arg1, uint32_t arg2, uint3
 #endif
     case -36:
         DPRINTF("semaphore_wait_trap(0x%x)\n", arg1);
-        extern int semaphore_wait_trap(int); // XXX: is there any
header for that?
+        int semaphore_wait_trap(int); // XXX: is there any header for that?
         ret = semaphore_wait_trap(arg1);
         break;
 /* may need more translation if target arch is different from host */
@@ -508,27 +508,27 @@  long do_mach_syscall(void *cpu_env, int num,
uint32_t arg1, uint32_t arg2, uint3
         break;
     case -90:
         DPRINTF("mach_wait_until()\n");
-        extern int mach_wait_until(uint64_t); // XXX: is there any
header for that?
+        int mach_wait_until(uint64_t); // XXX: is there any header for that?
         ret = mach_wait_until(((uint64_t)arg2<<32) | (uint64_t)arg1);
         break;
     case -91:
         DPRINTF("mk_timer_create()\n");
-        extern int mk_timer_create(); // XXX: is there any header for that?
+        int mk_timer_create(); // XXX: is there any header for that?
         ret = mk_timer_create();
         break;
     case -92:
         DPRINTF("mk_timer_destroy()\n");
-        extern int mk_timer_destroy(int); // XXX: is there any header for that?
+        int mk_timer_destroy(int); // XXX: is there any header for that?
         ret = mk_timer_destroy(arg1);
         break;
     case -93:
         DPRINTF("mk_timer_create()\n");
-        extern int mk_timer_arm(int, uint64_t); // XXX: is there any
header for that?
+        int mk_timer_arm(int, uint64_t); // XXX: is there any header for that?
         ret = mk_timer_arm(arg1, ((uint64_t)arg3<<32) | (uint64_t)arg2);
         break;
     case -94:
         DPRINTF("mk_timer_cancel()\n");
-        extern int mk_timer_cancel(int, uint64_t *); // XXX: is there
any header for that?
+        int mk_timer_cancel(int, uint64_t *); // XXX: is there any
header for that?
         ret = mk_timer_cancel(arg1, (uint64_t *)arg2);
         if((!is_error(ret)) && arg2)
             tswap64s((uint64_t *)arg2);
@@ -549,8 +549,8 @@  long do_thread_syscall(void *cpu_env, int num,
uint32_t arg1, uint32_t arg2, uin
                 uint32_t arg4, uint32_t arg5, uint32_t arg6, uint32_t arg7,
                 uint32_t arg8)
 {
-    extern uint32_t cthread_set_self(uint32_t);
-    extern uint32_t processor_facilities_used(void);
+    uint32_t cthread_set_self(uint32_t);
+    uint32_t processor_facilities_used(void);
     long ret = 0;

     arg1 = tswap32(arg1);
diff --git a/dis-asm.h b/dis-asm.h
index 9b9657e..791b0f8 100644
--- a/dis-asm.h
+++ b/dis-asm.h
@@ -368,47 +368,47 @@  typedef struct disassemble_info {
    target address.  Return number of bytes processed.  */
 typedef int (*disassembler_ftype) (bfd_vma, disassemble_info *);

-extern int print_insn_big_mips		(bfd_vma, disassemble_info*);
-extern int print_insn_little_mips	(bfd_vma, disassemble_info*);
-extern int print_insn_i386		(bfd_vma, disassemble_info*);
-extern int print_insn_m68k		(bfd_vma, disassemble_info*);
-extern int print_insn_z8001		(bfd_vma, disassemble_info*);
-extern int print_insn_z8002		(bfd_vma, disassemble_info*);
-extern int print_insn_h8300		(bfd_vma, disassemble_info*);
-extern int print_insn_h8300h		(bfd_vma, disassemble_info*);
-extern int print_insn_h8300s		(bfd_vma, disassemble_info*);
-extern int print_insn_h8500		(bfd_vma, disassemble_info*);
-extern int print_insn_alpha		(bfd_vma, disassemble_info*);
-extern disassembler_ftype arc_get_disassembler (int, int);
-extern int print_insn_arm		(bfd_vma, disassemble_info*);
-extern int print_insn_sparc		(bfd_vma, disassemble_info*);
-extern int print_insn_big_a29k		(bfd_vma, disassemble_info*);
-extern int print_insn_little_a29k	(bfd_vma, disassemble_info*);
-extern int print_insn_i960		(bfd_vma, disassemble_info*);
-extern int print_insn_sh		(bfd_vma, disassemble_info*);
-extern int print_insn_shl		(bfd_vma, disassemble_info*);
-extern int print_insn_hppa		(bfd_vma, disassemble_info*);
-extern int print_insn_m32r		(bfd_vma, disassemble_info*);
-extern int print_insn_m88k		(bfd_vma, disassemble_info*);
-extern int print_insn_mn10200		(bfd_vma, disassemble_info*);
-extern int print_insn_mn10300		(bfd_vma, disassemble_info*);
-extern int print_insn_ns32k		(bfd_vma, disassemble_info*);
-extern int print_insn_big_powerpc	(bfd_vma, disassemble_info*);
-extern int print_insn_little_powerpc	(bfd_vma, disassemble_info*);
-extern int print_insn_rs6000		(bfd_vma, disassemble_info*);
-extern int print_insn_w65		(bfd_vma, disassemble_info*);
-extern int print_insn_d10v		(bfd_vma, disassemble_info*);
-extern int print_insn_v850		(bfd_vma, disassemble_info*);
-extern int print_insn_tic30		(bfd_vma, disassemble_info*);
-extern int print_insn_ppc		(bfd_vma, disassemble_info*);
-extern int print_insn_s390		(bfd_vma, disassemble_info*);
-extern int print_insn_crisv32           (bfd_vma, disassemble_info*);
-extern int print_insn_microblaze        (bfd_vma, disassemble_info*);
-extern int print_insn_ia64              (bfd_vma, disassemble_info*);
+int print_insn_big_mips	(bfd_vma, disassemble_info*);
+int print_insn_little_mips(bfd_vma, disassemble_info*);
+int print_insn_i386(bfd_vma, disassemble_info*);
+int print_insn_m68k(bfd_vma, disassemble_info*);
+int print_insn_z8001(bfd_vma, disassemble_info*);
+int print_insn_z8002(bfd_vma, disassemble_info*);
+int print_insn_h8300(bfd_vma, disassemble_info*);
+int print_insn_h8300h(bfd_vma, disassemble_info*);
+int print_insn_h8300s(bfd_vma, disassemble_info*);
+int print_insn_h8500(bfd_vma, disassemble_info*);
+int print_insn_alpha(bfd_vma, disassemble_info*);
+disassembler_ftype arc_get_disassembler(int, int);
+int print_insn_arm(bfd_vma, disassemble_info*);
+int print_insn_sparc(bfd_vma, disassemble_info*);
+int print_insn_big_a29k(bfd_vma, disassemble_info*);
+int print_insn_little_a29k(bfd_vma, disassemble_info*);
+int print_insn_i960(bfd_vma, disassemble_info*);
+int print_insn_sh(bfd_vma, disassemble_info*);
+int print_insn_shl(bfd_vma, disassemble_info*);
+int print_insn_hppa(bfd_vma, disassemble_info*);
+int print_insn_m32r(bfd_vma, disassemble_info*);
+int print_insn_m88k(bfd_vma, disassemble_info*);
+int print_insn_mn10200(bfd_vma, disassemble_info*);
+int print_insn_mn10300(bfd_vma, disassemble_info*);
+int print_insn_ns32k(bfd_vma, disassemble_info*);
+int print_insn_big_powerpc(bfd_vma, disassemble_info*);
+int print_insn_little_powerpc(bfd_vma, disassemble_info*);
+int print_insn_rs6000(bfd_vma, disassemble_info*);
+int print_insn_w65(bfd_vma, disassemble_info*);
+int print_insn_d10v(bfd_vma, disassemble_info*);
+int print_insn_v850(bfd_vma, disassemble_info*);
+int print_insn_tic30(bfd_vma, disassemble_info*);
+int print_insn_ppc(bfd_vma, disassemble_info*);
+int print_insn_s390(bfd_vma, disassemble_info*);
+int print_insn_crisv32(bfd_vma, disassemble_info*);
+int print_insn_microblaze(bfd_vma, disassemble_info*);
+int print_insn_ia64(bfd_vma, disassemble_info*);

 #if 0
 /* Fetch the disassembler for a given BFD, if that support is available.  */
-extern disassembler_ftype disassembler	(bfd *);
+disassembler_ftype disassembler(bfd *);
 #endif

 
@@ -417,21 +417,20 @@  extern disassembler_ftype disassembler	(bfd *);

 /* Here is a function which callers may wish to use for read_memory_func.
    It gets bytes from a buffer.  */
-extern int buffer_read_memory
-  (bfd_vma, bfd_byte *, int, struct disassemble_info *);
+int buffer_read_memory(bfd_vma, bfd_byte *, int, struct disassemble_info *);

 /* This function goes with buffer_read_memory.
    It prints a message using info->fprintf_func and info->stream.  */
-extern void perror_memory (int, bfd_vma, struct disassemble_info *);
+void perror_memory(int, bfd_vma, struct disassemble_info *);


 /* Just print the address in hex.  This is included for completeness even
    though both GDB and objdump provide their own (to print symbolic
    addresses).  */
-extern void generic_print_address (bfd_vma, struct disassemble_info *);
+void generic_print_address(bfd_vma, struct disassemble_info *);

 /* Always true.  */
-extern int generic_symbol_at_address (bfd_vma, struct disassemble_info *);
+int generic_symbol_at_address(bfd_vma, struct disassemble_info *);

 /* Macro to initialize a disassemble_info struct.  This should be called
    by all applications creating such a struct.  */
diff --git a/envlist.h b/envlist.h
index e76d4a1..b9addcc 100644
--- a/envlist.h
+++ b/envlist.h
@@ -7,13 +7,13 @@  extern "C" {

 typedef struct envlist envlist_t;

-extern	envlist_t *envlist_create(void);
-extern	void envlist_free(envlist_t *);
-extern	int envlist_setenv(envlist_t *, const char *);
-extern	int envlist_unsetenv(envlist_t *, const char *);
-extern	int envlist_parse_set(envlist_t *, const char *);
-extern	int envlist_parse_unset(envlist_t *, const char *);
-extern	char **envlist_to_environ(const envlist_t *, size_t *);
+envlist_t *envlist_create(void);
+void envlist_free(envlist_t *);
+int envlist_setenv(envlist_t *, const char *);
+int envlist_unsetenv(envlist_t *, const char *);
+int envlist_parse_set(envlist_t *, const char *);
+int envlist_parse_unset(envlist_t *, const char *);
+char **envlist_to_environ(const envlist_t *, size_t *);

 #ifdef __cplusplus
 }
diff --git a/exec-all.h b/exec-all.h
index c457058..8528fcb 100644
--- a/exec-all.h
+++ b/exec-all.h
@@ -192,7 +192,7 @@  extern TranslationBlock
*tb_phys_hash[CODE_GEN_PHYS_HASH_SIZE];
 #if defined(USE_DIRECT_JUMP)

 #if defined(_ARCH_PPC)
-extern void ppc_tb_set_jmp_target(unsigned long jmp_addr, unsigned long addr);
+void ppc_tb_set_jmp_target(unsigned long jmp_addr, unsigned long addr);
 #define tb_set_jmp_target1 ppc_tb_set_jmp_target
 #elif defined(__i386__) || defined(__x86_64__)
 static inline void tb_set_jmp_target1(unsigned long jmp_addr,
unsigned long addr)
diff --git a/fpu/softfloat-native.c b/fpu/softfloat-native.c
index 049c830..0e7b8c3 100644
--- a/fpu/softfloat-native.c
+++ b/fpu/softfloat-native.c
@@ -35,8 +35,8 @@  void set_floatx80_rounding_precision(int val STATUS_PARAM)
 #define rintf(f)		((float)rint(f))
 #if !defined(__sparc__) && \
     (defined(CONFIG_SOLARIS) && CONFIG_SOLARIS_VERSION < 10)
-extern long double rintl(long double);
-extern long double scalbnl(long double, int);
+long double rintl(long double);
+long double scalbnl(long double, int);

 long long
 llrintl(long double x) {
diff --git a/fsdev/qemu-fsdev.h b/fsdev/qemu-fsdev.h
index 6c27881..f416440 100644
--- a/fsdev/qemu-fsdev.h
+++ b/fsdev/qemu-fsdev.h
@@ -49,7 +49,7 @@  typedef struct FsTypeListEntry {
     QTAILQ_ENTRY(FsTypeListEntry) next;
 } FsTypeListEntry;

-extern int qemu_fsdev_add(QemuOpts *opts);
-extern FsTypeEntry *get_fsdev_fsentry(char *id);
-extern FileOperations local_ops;
+int qemu_fsdev_add(QemuOpts *opts);
+FsTypeEntry *get_fsdev_fsentry(char *id);
+FileOperations local_ops;
 #endif
diff --git a/hw/file-op-9p.h b/hw/file-op-9p.h
index 21d60b5..f9fcfc9 100644
--- a/hw/file-op-9p.h
+++ b/hw/file-op-9p.h
@@ -57,7 +57,7 @@  typedef struct FsContext
     struct xattr_operations **xops;
 } FsContext;

-extern void cred_init(FsCred *);
+void cred_init(FsCred *);

 typedef struct FileOperations
 {
diff --git a/hw/hw.h b/hw/hw.h
index 9d2cfc2..d21443b 100644
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -785,17 +785,16 @@  extern const VMStateDescription vmstate_i2c_slave;
 #define VMSTATE_END_OF_LIST()                                         \
     {}

-extern int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
-                              void *opaque, int version_id);
-extern void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
-                               void *opaque);
-extern int vmstate_register(DeviceState *dev, int instance_id,
-                            const VMStateDescription *vmsd, void *base);
-extern int vmstate_register_with_alias_id(DeviceState *dev,
-                                          int instance_id,
-                                          const VMStateDescription *vmsd,
-                                          void *base, int alias_id,
-                                          int required_for_version);
+int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
+                       void *opaque, int version_id);
+void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
+                        void *opaque);
+int vmstate_register(DeviceState *dev, int instance_id,
+                     const VMStateDescription *vmsd, void *base);
+int vmstate_register_with_alias_id(DeviceState *dev, int instance_id,
+                                   const VMStateDescription *vmsd,
+                                   void *base, int alias_id,
+                                   int required_for_version);
 void vmstate_unregister(DeviceState *dev, const VMStateDescription *vmsd,
                         void *opaque);
 #endif
diff --git a/hw/mips.h b/hw/mips.h
index 617ea10..f4de9d9 100644
--- a/hw/mips.h
+++ b/hw/mips.h
@@ -21,7 +21,7 @@  int g364fb_mm_init(target_phys_addr_t vram_base,
 void mipsnet_init(int base, qemu_irq irq, NICInfo *nd);

 /* jazz_led.c */
-extern void jazz_led_init(target_phys_addr_t base);
+void jazz_led_init(target_phys_addr_t base);

 /* rc4030.c */
 typedef struct rc4030DMAState *rc4030_dma;
diff --git a/hw/s390-virtio-bus.h b/hw/s390-virtio-bus.h
index 41558c9..f82b782 100644
--- a/hw/s390-virtio-bus.h
+++ b/hw/s390-virtio-bus.h
@@ -56,14 +56,12 @@  typedef struct VirtIOS390Bus {
 } VirtIOS390Bus;


-extern void s390_virtio_device_update_status(VirtIOS390Device *dev);
+void s390_virtio_device_update_status(VirtIOS390Device *dev);

-extern VirtIOS390Device *s390_virtio_bus_console(VirtIOS390Bus *bus);
-extern VirtIOS390Bus *s390_virtio_bus_init(ram_addr_t *ram_size);
+VirtIOS390Device *s390_virtio_bus_console(VirtIOS390Bus *bus);
+VirtIOS390Bus *s390_virtio_bus_init(ram_addr_t *ram_size);

-extern VirtIOS390Device *s390_virtio_bus_find_vring(VirtIOS390Bus *bus,
-                                                    ram_addr_t mem,
-                                                    int *vq_num);
-extern VirtIOS390Device *s390_virtio_bus_find_mem(VirtIOS390Bus *bus,
-                                                  ram_addr_t mem);
-extern void s390_virtio_device_sync(VirtIOS390Device *dev);
+VirtIOS390Device *s390_virtio_bus_find_vring(VirtIOS390Bus *bus,
+                                             ram_addr_t mem, int *vq_num);
+VirtIOS390Device *s390_virtio_bus_find_mem(VirtIOS390Bus *bus, ram_addr_t mem);
+void s390_virtio_device_sync(VirtIOS390Device *dev);
diff --git a/hw/virtio-9p-xattr.h b/hw/virtio-9p-xattr.h
index a6e31a1..2bbae2d 100644
--- a/hw/virtio-9p-xattr.h
+++ b/hw/virtio-9p-xattr.h
@@ -41,16 +41,15 @@  extern XattrOperations *mapped_xattr_ops[];
 extern XattrOperations *passthrough_xattr_ops[];
 extern XattrOperations *none_xattr_ops[];

-extern ssize_t v9fs_get_xattr(FsContext *ctx, const char *path,
-                              const char *name, void *value, size_t size);
-extern ssize_t v9fs_list_xattr(FsContext *ctx, const char *path,
-                               void *value, size_t vsize);
-extern int v9fs_set_xattr(FsContext *ctx, const char *path, const char *name,
+ssize_t v9fs_get_xattr(FsContext *ctx, const char *path, const char *name,
+                       void *value, size_t size);
+ssize_t v9fs_list_xattr(FsContext *ctx, const char *path, void *value,
+                        size_t vsize);
+int v9fs_set_xattr(FsContext *ctx, const char *path, const char *name,
                           void *value, size_t size, int flags);
-extern int v9fs_remove_xattr(FsContext *ctx,
-                             const char *path, const char *name);
-extern ssize_t pt_listxattr(FsContext *ctx, const char *path,
-                            char *name, void *value, size_t size);
+int v9fs_remove_xattr(FsContext *ctx, const char *path, const char *name);
+ssize_t pt_listxattr(FsContext *ctx, const char *path, char *name, void *value,
+                     size_t size);

 static inline ssize_t pt_getxattr(FsContext *ctx, const char *path,
                                   const char *name, void *value, size_t size)
diff --git a/hw/virtio-9p.h b/hw/virtio-9p.h
index 6c23319..2ae4ce7 100644
--- a/hw/virtio-9p.h
+++ b/hw/virtio-9p.h
@@ -495,8 +495,8 @@  typedef struct V9fsReadLinkState
     V9fsString target;
 } V9fsReadLinkState;

-extern size_t pdu_packunpack(void *addr, struct iovec *sg, int sg_count,
-                            size_t offset, size_t size, int pack);
+size_t pdu_packunpack(void *addr, struct iovec *sg, int sg_count,
+                      size_t offset, size_t size, int pack);

 static inline size_t do_pdu_unpack(void *dst, struct iovec *sg, int sg_count,
                         size_t offset, size_t size)
diff --git a/hw/watchdog.h b/hw/watchdog.h
index 8fd32c3..c12a293 100644
--- a/hw/watchdog.h
+++ b/hw/watchdog.h
@@ -35,9 +35,9 @@  struct WatchdogTimerModel {
 typedef struct WatchdogTimerModel WatchdogTimerModel;

 /* in hw/watchdog.c */
-extern int select_watchdog(const char *p);
-extern int select_watchdog_action(const char *action);
-extern void watchdog_add_model(WatchdogTimerModel *model);
-extern void watchdog_perform_action(void);
+int select_watchdog(const char *p);
+int select_watchdog_action(const char *action);
+void watchdog_add_model(WatchdogTimerModel *model);
+void watchdog_perform_action(void);

 #endif /* QEMU_WATCHDOG_H */
diff --git a/linux-user/arm/nwfpe/fpa11.h b/linux-user/arm/nwfpe/fpa11.h
index 07419e2..f17647b 100644
--- a/linux-user/arm/nwfpe/fpa11.h
+++ b/linux-user/arm/nwfpe/fpa11.h
@@ -89,9 +89,9 @@  typedef struct tagFPA11 {

 extern FPA11* qemufpa;

-extern void resetFPA11(void);
-extern void SetRoundingMode(const unsigned int);
-extern void SetRoundingPrecision(const unsigned int);
+void resetFPA11(void);
+void SetRoundingMode(const unsigned int);
+void SetRoundingPrecision(const unsigned int);

 static inline unsigned int readRegister(unsigned int reg)
 {
diff --git a/linux-user/arm/nwfpe/fpopcode.h b/linux-user/arm/nwfpe/fpopcode.h
index 16fa34a..e7d1009 100644
--- a/linux-user/arm/nwfpe/fpopcode.h
+++ b/linux-user/arm/nwfpe/fpopcode.h
@@ -384,7 +384,7 @@  static inline float32 getSingleConstant(const
unsigned int nIndex)
    return float32Constant[nIndex];
 }

-extern unsigned int getRegisterCount(const unsigned int opcode);
-extern unsigned int getDestinationSize(const unsigned int opcode);
+unsigned int getRegisterCount(const unsigned int opcode);
+unsigned int getDestinationSize(const unsigned int opcode);

 #endif
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index d44f512..2fdee5c 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -527,11 +527,11 @@  static int sys_inotify_init1(int flags)
 #endif /* CONFIG_INOTIFY  */


-extern int personality(int);
-extern int flock(int, int);
-extern int setfsuid(int);
-extern int setfsgid(int);
-extern int setgroups(int, gid_t *);
+int personality(int);
+int flock(int, int);
+int setfsuid(int);
+int setfsgid(int);
+int setgroups(int, gid_t *);

 #define ERRNO_TABLE_SIZE 1200

diff --git a/m68k-dis.c b/m68k-dis.c
index d93943e..1725e77 100644
--- a/m68k-dis.c
+++ b/m68k-dis.c
@@ -124,19 +124,18 @@  extern const struct floatformat
floatformat_ia64_quad_little;
    FROM is the address of the extended float.
    Store the double in *TO.  */

-extern void
-floatformat_to_double (const struct floatformat *, const char *, double *);
+void floatformat_to_double (const struct floatformat *, const char *,
+                            double *);

 /* The converse: convert the double *FROM to FMT
    and store where TO points.  */

-extern void
-floatformat_from_double (const struct floatformat *, const double *, char *);
+void floatformat_from_double (const struct floatformat *, const double *,
+                              char *);

 /* Return non-zero iff the data at FROM is a valid number in format FMT.  */

-extern int
-floatformat_is_valid (const struct floatformat *fmt, const char *from);
+int floatformat_is_valid (const struct floatformat *fmt, const char *from);

 #endif	/* defined (FLOATFORMAT_H) */
 /* **** End of floatformat.h */
diff --git a/osdep.c b/osdep.c
index 327583b..06ff8d7 100644
--- a/osdep.c
+++ b/osdep.c
@@ -41,7 +41,7 @@ 
 #include <sys/statvfs.h>
 /* See MySQL bug #7156 (http://bugs.mysql.com/bug.php?id=7156) for
    discussion about Solaris header problems */
-extern int madvise(caddr_t, size_t, int);
+int madvise(caddr_t, size_t, int);
 #endif

 #include "qemu-common.h"
diff --git a/qemu-common.h b/qemu-common.h
index b3957f1..406d267 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -87,7 +87,7 @@  typedef int (*fprintf_function)(FILE *f, const char *fmt, ...)
 #ifdef _WIN32
 #define fsync _commit
 #define lseek _lseeki64
-extern int qemu_ftruncate64(int, int64_t);
+int qemu_ftruncate64(int, int64_t);
 #define ftruncate qemu_ftruncate64

 static inline char *realpath(const char *path, char *resolved_path)
diff --git a/slirp/slirp.h b/slirp/slirp.h
index 462292d..5d10499 100644
--- a/slirp/slirp.h
+++ b/slirp/slirp.h
@@ -240,19 +240,19 @@  void if_start(struct ttys *);
 #ifdef BAD_SPRINTF
 # define vsprintf vsprintf_len
 # define sprintf sprintf_len
- extern int vsprintf_len(char *, const char *, va_list);
- extern int sprintf_len(char *, const char *, ...);
+ int vsprintf_len(char *, const char *, va_list);
+ int sprintf_len(char *, const char *, ...);
 #endif

 #ifdef DECLARE_SPRINTF
 # ifndef BAD_SPRINTF
- extern int vsprintf(char *, const char *, va_list);
+ int vsprintf(char *, const char *, va_list);
 # endif
- extern int vfprintf(FILE *, const char *, va_list);
+ int vfprintf(FILE *, const char *, va_list);
 #endif

 #ifndef HAVE_STRERROR
- extern char *strerror(int error);
+ char *strerror(int error);
 #endif

 #ifndef HAVE_INDEX
diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h
index 8d73fad..e47c372 100644
--- a/target-s390x/cpu.h
+++ b/target-s390x/cpu.h
@@ -105,9 +105,9 @@  int cpu_s390x_handle_mmu_fault (CPUS390XState
*env, target_ulong address, int rw
 #define TARGET_VIRT_ADDR_SPACE_BITS 32

 #ifndef CONFIG_USER_ONLY
-extern int s390_virtio_hypercall(CPUState *env);
-extern void kvm_s390_virtio_irq(CPUState *env, int config_change,
uint64_t token);
-extern CPUState *s390_cpu_addr2state(uint16_t cpu_addr);
+int s390_virtio_hypercall(CPUState *env);
+void kvm_s390_virtio_irq(CPUState *env, int config_change, uint64_t token);
+CPUState *s390_cpu_addr2state(uint16_t cpu_addr);
 #endif


diff --git a/tests/cris/sys.h b/tests/cris/sys.h
index d2ed4ce..c5f88e1 100644
--- a/tests/cris/sys.h
+++ b/tests/cris/sys.h
@@ -12,5 +12,5 @@ 

 #define mb() asm volatile ("" : : : "memory")

-extern void pass(void);
-extern void _fail(char *reason);
+void pass(void);
+void _fail(char *reason);
diff --git a/tests/runcom.c b/tests/runcom.c
index d60342b..bc5d458 100644
--- a/tests/runcom.c
+++ b/tests/runcom.c
@@ -13,8 +13,8 @@ 
 #include <linux/unistd.h>
 #include <asm/vm86.h>

-extern int vm86 (unsigned long int subfunction,
-		 struct vm86plus_struct *info);
+int vm86 (unsigned long int subfunction,
+          struct vm86plus_struct *info);

 #define VIF_MASK                0x00080000

diff --git a/ui/cocoa.m b/ui/cocoa.m
index 56c789a..20f91bc 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -852,9 +852,9 @@  typedef struct CPSProcessSerNum
         UInt32                hi;
 } CPSProcessSerNum;

-extern OSErr    CPSGetCurrentProcess( CPSProcessSerNum *psn);
-extern OSErr    CPSEnableForegroundOperation( CPSProcessSerNum *psn,
UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
-extern OSErr    CPSSetFrontProcess( CPSProcessSerNum *psn);
+OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn);
+OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32
_arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
+OSErr CPSSetFrontProcess( CPSProcessSerNum *psn);

 int main (int argc, const char * argv[]) {

diff --git a/ui/d3des.h b/ui/d3des.h
index ea3da44..78d546f 100644
--- a/ui/d3des.h
+++ b/ui/d3des.h
@@ -22,25 +22,25 @@ 
 #define EN0	0	/* MODE == encrypt */
 #define DE1	1	/* MODE == decrypt */

-extern void deskey(unsigned char *, int);
+void deskey(unsigned char *, int);
 /*		      hexkey[8]     MODE
  * Sets the internal key register according to the hexadecimal
  * key contained in the 8 bytes of hexkey, according to the DES,
  * for encryption or decryption according to MODE.
  */

-extern void usekey(unsigned long *);
+void usekey(unsigned long *);
 /*		    cookedkey[32]
  * Loads the internal key register with the data in cookedkey.
  */

-extern void cpkey(unsigned long *);
+void cpkey(unsigned long *);
 /*		   cookedkey[32]
  * Copies the contents of the internal key register into the storage
  * located at &cookedkey[0].
  */

-extern void des(unsigned char *, unsigned char *);
+void des(unsigned char *, unsigned char *);
 /*		    from[8]	      to[8]
  * Encrypts/Decrypts (according to the key currently loaded in the
  * internal key register) one block of eight bytes at address 'from'
diff --git a/ui/x_keymap.h b/ui/x_keymap.h
index 2042ce0..afde2e9 100644
--- a/ui/x_keymap.h
+++ b/ui/x_keymap.h
@@ -25,8 +25,8 @@ 
 #ifndef QEMU_X_KEYMAP_H
 #define QEMU_X_KEYMAP_H

-extern uint8_t translate_xfree86_keycode(const int key);
+uint8_t translate_xfree86_keycode(const int key);

-extern uint8_t translate_evdev_keycode(const int key);
+uint8_t translate_evdev_keycode(const int key);

 #endif