remove unnecessary extern "C" blocks
PATCH 1/1 remove unnecessary extern "C" blocks
A handful of header files in QEMU are wrapped with extern "C" blocks. These are not necessary: there are C++ source files anymore in QEMU, and even where there were some, they did not include most of these files anyway.
Remove them for consistency.
--- include/disas/dis-asm.h | 8 -------- include/qemu/bswap.h | 8 -------- include/qemu/envlist.h | 8 -------- include/qemu/rcu.h | 8 -------- include/qemu/rcu_queue.h | 8 -------- include/qemu/uri.h | 7 ------- include/sysemu/os-posix.h | 8 -------- include/sysemu/os-win32.h | 8 -------- 8 files changed, 63 deletions(-)
include/disas/dis-asm.h +0 -8
@@ -11,10 +11,6 @@#include "qemu/bswap.h" -#ifdef __cplusplus -extern "C" { -#endif -typedef void *PTR ;typedef uint64_t bfd_vma ;typedef int64_t bfd_signed_vma ;
@@ -506,8 +502,4 @@ static inline bfd_vma bfd_getb16(const bfd_byte *addr)typedef bool bfd_boolean ; -#ifdef __cplusplus -} -#endif -#endif /* DISAS_DIS_ASM_H */
include/qemu/bswap.h +0 -8
@@ -15,10 +15,6 @@#define BSWAP_FROM_FALLBACKS #endif /* ! CONFIG_MACHINE_BSWAP_H */ -#ifdef __cplusplus -extern "C" { -#endif -#ifdef BSWAP_FROM_BYTESWAP static inline uint16_t bswap16 (uint16_t x) {
@@ -448,8 +444,4 @@ DO_STN_LDN_P(be)#undef le_bswaps#undef be_bswaps -#ifdef __cplusplus -} -#endif -#endif /* BSWAP_H */
include/qemu/envlist.h +0 -8
@@ -1,10 +1,6 @@#ifndef ENVLIST_H #define ENVLIST_H -#ifdef __cplusplus -extern "C" { -#endif -typedef struct envlist envlist_t ;envlist_t *envlist_create (void );
@@ -15,8 +11,4 @@ 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 -} -#endif -#endif /* ENVLIST_H */
include/qemu/rcu.h +0 -8
@@ -31,10 +31,6 @@#include "qemu/sys_membarrier.h" #include "qemu/coroutine-tls.h" -#ifdef __cplusplus -extern "C" { -#endif -/* * Important ! *
@@ -196,8 +192,4 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(RCUReadAuto, rcu_read_auto_unlock)void rcu_add_force_rcu_notifier (Notifier *n);void rcu_remove_force_rcu_notifier (Notifier *n); -#ifdef __cplusplus -} -#endif -#endif /* QEMU_RCU_H */
include/qemu/rcu_queue.h +0 -8
@@ -28,11 +28,6 @@#include "qemu/queue.h" #include "qemu/atomic.h" -#ifdef __cplusplus -extern "C" { -#endif - -/* * List access methods. */
@@ -311,7 +306,4 @@ extern "C" { (var) && ((next) =qatomic_rcu_read (&(var)->field.sle_next),1 ); \ (var) = (next)) -#ifdef __cplusplus -} -#endif #endif /* QEMU_RCU_QUEUE_H */
include/qemu/uri.h +0 -7
@@ -53,10 +53,6 @@#ifndef QEMU_URI_H #define QEMU_URI_H -#ifdef __cplusplus -extern "C" { -#endif -/** * URI: *
@@ -105,7 +101,4 @@ struct QueryParams *query_params_new (int init_alloc);extern QueryParams *query_params_parse (const char *query);extern void query_params_free (QueryParams *ps); -#ifdef __cplusplus -} -#endif #endif /* QEMU_URI_H */
include/sysemu/os-posix.h +0 -8
@@ -38,10 +38,6 @@#include <sys/sysmacros.h> #endif -#ifdef __cplusplus -extern "C" { -#endif -int os_parse_cmd_args (int index,const char *optarg);void os_set_line_buffering (void );void os_setup_early_signal_handling (void );
@@ -96,8 +92,4 @@ static inline void qemu_funlockfile(FILE *f) funlockfile(f); } -#ifdef __cplusplus -} -#endif -#endif
include/sysemu/os-win32.h +0 -8
@@ -47,10 +47,6 @@ typedef struct sockaddr_un {#define SIO_AF_UNIX_GETPEERPID _WSAIOR(IOC_VENDOR, 256)#endif -#ifdef __cplusplus -extern "C" { -#endif -#if defined(_WIN64)/* On w64, setjmp is implemented by _setjmp which needs a second parameter. * If this parameter is NULL, longjump does no stack unwinding.
@@ -221,8 +217,4 @@ ssize_t qemu_recv_wrap(int sockfd, void *buf, size_t len, int flags);ssize_t qemu_recvfrom_wrap (int sockfd,void *buf,size_t len,int flags,struct sockaddr *addr,socklen_t *addrlen); -#ifdef __cplusplus -} -#endif -#endif
Signature · 1 line
2.38.1
Quoted 2 lines · Paolo Bonzini
A handful of header files in QEMU are wrapped with extern "C" blocks. These are not necessary: there are C++ source files anymore in QEMU,
s/are/are no/
Quoted 6 lines
and even where there were some, they did not include most of these files anyway.
Remove them for consistency.
Signed-off-by Paolo Bonzini <[email protected]>
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 5 lines · Paolo Bonzini
A handful of header files in QEMU are wrapped with extern "C" blocks. These are not necessary: there are C++ source files anymore in QEMU, and even where there were some, they did not include most of these files anyway.
Any reason not to also take out the extern "C" block in osdep.h and the uses of QEMU_EXTERN_C ?
thanks
-- PMM
Quoted 9 lines · Peter Maydell
Quoted 5 lines · Paolo Bonzini
A handful of header files in QEMU are wrapped with extern "C" blocks. These are not necessary: there are C++ source files anymore in QEMU, and even where there were some, they did not include most of these files anyway.
Any reason not to also take out the extern "C" block in
osdep.hand the uses ofQEMU_EXTERN_C?
qemu/osdep.h is still included by the C++ sources in qga/vss-win32.
Paolo
Quoted 9 lines · Paolo Bonzini
Quoted 7 lines · Peter Maydell
Quoted 5 lines · Paolo Bonzini
A handful of header files in QEMU are wrapped with extern "C" blocks. These are not necessary: there are C++ source files anymore in QEMU, and even where there were some, they did not include most of these files anyway.
Quoted 4 lines
Quoted 2 lines
Any reason not to also take out the extern "C" block in
osdep.hand the uses ofQEMU_EXTERN_C?
qemu/osdep.his still included by the C++ sources in qga/vss-win32.
If anything C++ still includes osdep.h then you can't remove the handling of this from os-win32.h and os-posix.h, because those files are included from osdep.h.
thanks
-- PMM
Quoted 7 lines · Peter Maydell
Quoted 6 lines · Paolo Bonzini
Quoted 5 lines · Peter Maydell
Quoted 4 lines · Paolo Bonzini
A handful of header files in QEMU are wrapped with extern "C" blocks. These are not necessary: there are C++ source files anymore in QEMU, and even where there were some, they did not include most of these files anyway.
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines
Any reason not to also take out the extern "C" block in
osdep.hand the uses ofQEMU_EXTERN_C?
qemu/osdep.his still included by the C++ sources in qga/vss-win32.If anything C++ still includes
osdep.hthen you can't remove the handling of this fromos-win32.handos-posix.h, because those files are included fromosdep.h.
Oh, I was confused by them being in sysemu/. I'll revert those two.
Paolo
Quoted 6 lines · Paolo Bonzini
A handful of header files in QEMU are wrapped with extern "C" blocks. These are not necessary: there are C++ source files anymore in QEMU, and even where there were some, they did not include most of these files anyway.
Remove them for consistency.
Are we allowed C++ in qemu?
I ask because we have a full single-tenant implementation of XenStore lying around, designed to be VMM-internal... that just happens to be written in C++.
Quoted 10 lines · David Woodhouse
Quoted 6 lines · Paolo Bonzini
A handful of header files in QEMU are wrapped with extern "C" blocks. These are not necessary: there are C++ source files anymore in QEMU, and even where there were some, they did not include most of these files anyway.
Remove them for consistency.
Are we allowed C++ in qemu?
No; we've just managed to removed a couple of minor optional things that we'd allowed in, and removed the configure/build machinery for supporting having an optional C++ compiler. The only remaining bit of C++ is the Windows guest agent.
thanks
-- PMM
Quoted 10 lines · David Woodhouse
Quoted 6 lines · Paolo Bonzini
A handful of header files in QEMU are wrapped with extern "C" blocks. These are not necessary: there are C++ source files anymore in QEMU, and even where there were some, they did not include most of these files anyway.
Remove them for consistency.
Are we allowed C++ in qemu?
Not any more, we've just made an effort to eliminate the last part of QEMU emulator related code that was C++. All that's left is one part of the Windows installer for the guest agent.
Quoted 3 lines
I ask because we have a full single-tenant implementation of XenStore lying around, designed to be VMM-internal... that just happens to be written in C++.
That's unfortunate :-(
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|