slirp: Accommodate building under newer C++ compilers
This commit is contained in:
parent
ee45ae1a08
commit
9e60a8e783
2 changed files with 62 additions and 61 deletions
|
@ -314,7 +314,7 @@ void slirp_pollfds_fill(GArray *pollfds, uint32_t *timeout)
|
||||||
|
|
||||||
for (so = slirp->tcb.so_next; so != &slirp->tcb;
|
for (so = slirp->tcb.so_next; so != &slirp->tcb;
|
||||||
so = so_next) {
|
so = so_next) {
|
||||||
int events = 0;
|
gushort events = 0;
|
||||||
|
|
||||||
so_next = so->so_next;
|
so_next = so->so_next;
|
||||||
|
|
||||||
|
|
|
@ -1,63 +1,64 @@
|
||||||
/* public domain */
|
/* public domain */
|
||||||
|
|
||||||
#ifndef COMPILER_H
|
#ifndef COMPILER_H
|
||||||
#define COMPILER_H
|
#define COMPILER_H
|
||||||
|
|
||||||
#include "config-host.h"
|
#include "config-host.h"
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
| The macro QEMU_GNUC_PREREQ tests for minimum version of the GNU C compiler.
|
| The macro QEMU_GNUC_PREREQ tests for minimum version of the GNU C compiler.
|
||||||
| The code is a copy of SOFTFLOAT_GNUC_PREREQ, see softfloat-macros.h.
|
| The code is a copy of SOFTFLOAT_GNUC_PREREQ, see softfloat-macros.h.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
#if defined(__GNUC__) && defined(__GNUC_MINOR__)
|
#if defined(__GNUC__) && defined(__GNUC_MINOR__)
|
||||||
# define QEMU_GNUC_PREREQ(maj, min) \
|
# define QEMU_GNUC_PREREQ(maj, min) \
|
||||||
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
|
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
|
||||||
#else
|
#else
|
||||||
# define QEMU_GNUC_PREREQ(maj, min) 0
|
# define QEMU_GNUC_PREREQ(maj, min) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef container_of
|
#ifndef container_of
|
||||||
#define container_of(ptr, type, member) \
|
#define container_of(ptr, type, member) \
|
||||||
((type *) ((char *)(ptr) - offsetof(type, member)))
|
((type *) ((char *)(ptr) - offsetof(type, member)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef always_inline
|
#ifndef always_inline
|
||||||
#if !((__GNUC__ < 3) || defined(__APPLE__))
|
#if !((__GNUC__ < 3) || defined(__APPLE__))
|
||||||
#ifdef __OPTIMIZE__
|
#ifdef __OPTIMIZE__
|
||||||
#undef inline
|
#undef inline
|
||||||
#define inline __attribute__ (( always_inline )) __inline__
|
#define inline __attribute__ (( always_inline )) __inline__
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#undef inline
|
#undef inline
|
||||||
#define inline always_inline
|
#define inline always_inline
|
||||||
#endif
|
#endif
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#undef inline
|
#undef inline
|
||||||
#define inline __inline
|
#define inline __inline
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define register
|
||||||
#if defined __GNUC__
|
|
||||||
# if !QEMU_GNUC_PREREQ(4, 4)
|
#if defined __GNUC__
|
||||||
/* gcc versions before 4.4.x don't support gnu_printf, so use printf. */
|
# if !QEMU_GNUC_PREREQ(4, 4)
|
||||||
# define GCC_FMT_ATTR(n, m) __attribute__((format(printf, n, m)))
|
/* gcc versions before 4.4.x don't support gnu_printf, so use printf. */
|
||||||
# else
|
# define GCC_FMT_ATTR(n, m) __attribute__((format(printf, n, m)))
|
||||||
/* Use gnu_printf when supported (qemu uses standard format strings). */
|
# else
|
||||||
# define GCC_FMT_ATTR(n, m) __attribute__((format(gnu_printf, n, m)))
|
/* Use gnu_printf when supported (qemu uses standard format strings). */
|
||||||
# if defined(_WIN32)
|
# define GCC_FMT_ATTR(n, m) __attribute__((format(gnu_printf, n, m)))
|
||||||
/* Map __printf__ to __gnu_printf__ because we want standard format strings
|
# if defined(_WIN32)
|
||||||
* even when MinGW or GLib include files use __printf__. */
|
/* Map __printf__ to __gnu_printf__ because we want standard format strings
|
||||||
# define __printf__ __gnu_printf__
|
* even when MinGW or GLib include files use __printf__. */
|
||||||
# endif
|
# define __printf__ __gnu_printf__
|
||||||
# endif
|
# endif
|
||||||
#else
|
# endif
|
||||||
#define GCC_FMT_ATTR(n, m)
|
#else
|
||||||
#endif
|
#define GCC_FMT_ATTR(n, m)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined (__clang__)
|
#if defined (__clang__)
|
||||||
#pragma clang diagnostic ignored "-Wunknown-pragmas"
|
#pragma clang diagnostic ignored "-Wunknown-pragmas"
|
||||||
#pragma clang diagnostic ignored "-Waddress-of-packed-member"
|
#pragma clang diagnostic ignored "-Waddress-of-packed-member"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* COMPILER_H */
|
#endif /* COMPILER_H */
|
||||||
|
|
Loading…
Add table
Reference in a new issue