Revision de5071c5

b/configure
1602 1602
    libs_softmmu="-lutil $libs_softmmu"
1603 1603
fi
1604 1604

  
1605
##########################################
1606
# check if the compiler defines offsetof
1607

  
1608
need_offsetof=yes
1609
cat > $TMPC << EOF
1610
#include <stddef.h>
1611
int main(void) { struct s { int f; }; return offsetof(struct s, f); }
1612
EOF
1613
if compile_prog "" "" ; then
1614
    need_offsetof=no
1615
fi
1616

  
1605 1617
# End of CC checks
1606 1618
# After here, no more $cc or $ld runs
1607 1619

  
......
1901 1913
if test "$fdt" = "yes" ; then
1902 1914
  echo "CONFIG_FDT=y" >> $config_host_mak
1903 1915
fi
1916
if test "$need_offsetof" = "yes" ; then
1917
  echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
1918
fi
1904 1919

  
1905 1920
# XXX: suppress that
1906 1921
if [ "$bsd" = "yes" ] ; then
b/osdep.h
2 2
#define QEMU_OSDEP_H
3 3

  
4 4
#include <stdarg.h>
5
#include <stddef.h>
5 6
#ifdef __OpenBSD__
6 7
#include <sys/types.h>
7 8
#include <sys/signal.h>
......
27 28
#define unlikely(x)   __builtin_expect(!!(x), 0)
28 29
#endif
29 30

  
30
#ifndef offsetof
31
#ifdef CONFIG_NEED_OFFSETOF
31 32
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER)
32 33
#endif
33 34
#ifndef container_of

Also available in: Unified diff