Message ID | 20230320134219.22489-1-philmd@linaro.org |
---|---|
Headers | show |
Series | bulk: Do not declare function prototypes using 'extern' keyword | expand |
On Mon, Mar 20, 2023 at 02:42:18PM +0100, Philippe Mathieu-Daudé wrote: > By default, C function prototypes declared in headers are visible, > so there is no need to declare them as 'extern' functions. > Remove this redundancy in a single bulk commit; do not modify: > > - meson.build (used to check function availability at runtime) > - pc-bios > - libdecnumber > - *.c > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > block/dmg.h | 8 +++---- > bsd-user/bsd-file.h | 6 ++--- > crypto/hmacpriv.h | 13 +++++------ > hw/xen/xen_pt.h | 8 +++---- > include/crypto/secret_common.h | 14 +++++------- > include/exec/page-vary.h | 4 ++-- > include/hw/misc/aspeed_scu.h | 2 +- > include/hw/nvram/npcm7xx_otp.h | 4 ++-- > include/hw/qdev-core.h | 4 ++-- > include/qemu/crc-ccitt.h | 4 ++-- > include/qemu/osdep.h | 2 +- > include/qemu/rcu.h | 14 ++++++------ > include/qemu/sys_membarrier.h | 4 ++-- > include/qemu/uri.h | 6 ++--- > include/sysemu/accel-blocker.h | 14 ++++++------ > include/sysemu/os-win32.h | 4 ++-- > include/user/safe-syscall.h | 4 ++-- > target/i386/sev.h | 6 ++--- > target/mips/cpu.h | 4 ++-- > tcg/tcg-internal.h | 4 ++-- > tests/tcg/minilib/minilib.h | 2 +- > include/exec/memory_ldst.h.inc | 42 +++++++++++++++++----------------- > roms/seabios | 2 +- Accidental submodule commit., > 23 files changed, 84 insertions(+), 91 deletions(-) > > diff --git a/block/dmg.h b/block/dmg.h > index e488601b62..ed209b5dec 100644 > --- a/block/dmg.h > +++ b/block/dmg.h > @@ -51,10 +51,10 @@ typedef struct BDRVDMGState { > z_stream zstream; > } BDRVDMGState; > > -extern int (*dmg_uncompress_bz2)(char *next_in, unsigned int avail_in, > - char *next_out, unsigned int avail_out); > +int (*dmg_uncompress_bz2)(char *next_in, unsigned int avail_in, > + char *next_out, unsigned int avail_out); > > -extern int (*dmg_uncompress_lzfse)(char *next_in, unsigned int avail_in, > - char *next_out, unsigned int avail_out); > +int (*dmg_uncompress_lzfse)(char *next_in, unsigned int avail_in, > + char *next_out, unsigned int avail_out); These are variable declarations, so with this change you'll get multiple copies of the variable if this header is included from multiple source files. IOW, the 'extern' usage is correct. > diff --git a/roms/seabios b/roms/seabios > index ea1b7a0733..3208b098f5 160000 > --- a/roms/seabios > +++ b/roms/seabios > @@ -1 +1 @@ > -Subproject commit ea1b7a0733906b8425d948ae94fba63c32b1d425 > +Subproject commit 3208b098f51a9ef96d0dfa71d5ec3a3eaec88f0a Nope ! With regards, Daniel
On 20/3/23 14:48, Daniel P. Berrangé wrote: > On Mon, Mar 20, 2023 at 02:42:18PM +0100, Philippe Mathieu-Daudé wrote: >> By default, C function prototypes declared in headers are visible, >> so there is no need to declare them as 'extern' functions. >> Remove this redundancy in a single bulk commit; do not modify: >> >> - meson.build (used to check function availability at runtime) >> - pc-bios >> - libdecnumber >> - *.c >> >> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> >> --- >> block/dmg.h | 8 +++---- >> bsd-user/bsd-file.h | 6 ++--- >> crypto/hmacpriv.h | 13 +++++------ >> hw/xen/xen_pt.h | 8 +++---- >> include/crypto/secret_common.h | 14 +++++------- >> include/exec/page-vary.h | 4 ++-- >> include/hw/misc/aspeed_scu.h | 2 +- >> include/hw/nvram/npcm7xx_otp.h | 4 ++-- >> include/hw/qdev-core.h | 4 ++-- >> include/qemu/crc-ccitt.h | 4 ++-- >> include/qemu/osdep.h | 2 +- >> include/qemu/rcu.h | 14 ++++++------ >> include/qemu/sys_membarrier.h | 4 ++-- >> include/qemu/uri.h | 6 ++--- >> include/sysemu/accel-blocker.h | 14 ++++++------ >> include/sysemu/os-win32.h | 4 ++-- >> include/user/safe-syscall.h | 4 ++-- >> target/i386/sev.h | 6 ++--- >> target/mips/cpu.h | 4 ++-- >> tcg/tcg-internal.h | 4 ++-- >> tests/tcg/minilib/minilib.h | 2 +- >> include/exec/memory_ldst.h.inc | 42 +++++++++++++++++----------------- >> roms/seabios | 2 +- > > Accidental submodule commit., > >> 23 files changed, 84 insertions(+), 91 deletions(-) >> >> diff --git a/block/dmg.h b/block/dmg.h >> index e488601b62..ed209b5dec 100644 >> --- a/block/dmg.h >> +++ b/block/dmg.h >> @@ -51,10 +51,10 @@ typedef struct BDRVDMGState { >> z_stream zstream; >> } BDRVDMGState; >> >> -extern int (*dmg_uncompress_bz2)(char *next_in, unsigned int avail_in, >> - char *next_out, unsigned int avail_out); >> +int (*dmg_uncompress_bz2)(char *next_in, unsigned int avail_in, >> + char *next_out, unsigned int avail_out); >> >> -extern int (*dmg_uncompress_lzfse)(char *next_in, unsigned int avail_in, >> - char *next_out, unsigned int avail_out); >> +int (*dmg_uncompress_lzfse)(char *next_in, unsigned int avail_in, >> + char *next_out, unsigned int avail_out); > > These are variable declarations, so with this change you'll get multiple > copies of the variable if this header is included from multiple source > files. IOW, the 'extern' usage is correct. Doh indeed, good catch, thanks. >> diff --git a/roms/seabios b/roms/seabios >> index ea1b7a0733..3208b098f5 160000 >> --- a/roms/seabios >> +++ b/roms/seabios >> @@ -1 +1 @@ >> -Subproject commit ea1b7a0733906b8425d948ae94fba63c32b1d425 >> +Subproject commit 3208b098f51a9ef96d0dfa71d5ec3a3eaec88f0a > > Nope ! Oops...