From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:48755) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJVoz-0004wf-F6 for qemu-devel@nongnu.org; Wed, 03 Oct 2012 16:45:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJVox-0005aG-Si for qemu-devel@nongnu.org; Wed, 03 Oct 2012 16:45:33 -0400 Received: from v220110690675601.yourvserver.net ([78.47.199.172]:38782) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJVox-0005Yj-J0 for qemu-devel@nongnu.org; Wed, 03 Oct 2012 16:45:31 -0400 Message-ID: <506CA3E4.1010009@weilnetz.de> Date: Wed, 03 Oct 2012 22:45:24 +0200 From: Stefan Weil MIME-Version: 1.0 References: <1349287498-10475-1-git-send-email-sandmann@cs.au.dk> <506C81B8.908@weilnetz.de> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] Fix compilation on GCC 4.5 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?U8O4cmVuIFNhbmRtYW5u?= Cc: qemu-devel@nongnu.org Am 03.10.2012 21:49, schrieb S=C3=B8ren Sandmann: > Stefan Weil writes: > >> I don't see any warnings with gcc Debian 4.4.5-8. >> >> Could you please provide more information on your environment >> and the warnings which you get? >> >> Here is a macro which simplifies the version check: >> >> #if QEMU_GNUC_PREREQ(4, 6) >> >> Regards >> >> Stefan Weil > > With this compiler: > > dhcp-100-3-184:~/vertigo/qemu% gcc -v > Using built-in specs. > COLLECT_GCC=3D/usr/bin/gcc > COLLECT_LTO_WRAPPER=3D/usr/libexec/gcc/x86_64-redhat-linux/4.5.1/l= to-wrapper > Target: x86_64-redhat-linux > Configured with: ../configure --prefix=3D/usr --mandir=3D/usr/shar= e/man > --infodir=3D/usr/share/info > --with-bugurl=3Dhttp://bugzilla.redhat.com/bugzilla --enable-boots= trap > --enable-shared --enable-threads=3Dposix --enable-checking=3Drelea= se > --with-system-zlib --enable-__cxa_atexit --disable-libunwind-excep= tions > --enable-gnu-unique-object --enable-linker-build-id > --enable-languages=3Dc,c++,objc,obj-c++,java,fortran,ada,lto > --enable-plugin --enable-java-awt=3Dgtk --disable-dssi > --with-java-home=3D/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre > --enable-libgcj-multifile --enable-java-maintainer-mode > --with-ecj-jar=3D/usr/share/java/eclipse-ecj.jar > --disable-libjava-multilib --with-ppl --with-cloog --with-tune=3Dg= eneric > --with-arch_32=3Di686 --build=3Dx86_64-redhat-linux > Thread model: posix > gcc version 4.5.1 20100924 (Red Hat 4.5.1-4) (GCC) > > This is the error I get: > > make BUILD_DIR=3D/home/ssp/vertigo/qemu -C i386-softmmu V=3D"1" > TARGET_DIR=3D"i386-softmmu/" all > make[1]: Entering directory `/home/ssp/vertigo/qemu/i386-softmmu' > gcc -I/home/ssp/vertigo/qemu/slirp -I. -I/home/ssp/vertigo/qemu > -I/home/ssp/vertigo/qemu/fpu -I/home/ssp/vertigo/qemu/libcacard > -I/home/ssp/vertigo/qemu/linux-headers -I/home/ssp/vertigo/qemu/tc= g > -I/home/ssp/vertigo/qemu/tcg/i386 -Werror -fPIE -DPIE -m64 > -D_GNU_SOURCE -D_FILE_OFFSET_BITS=3D64 -D_LARGEFILE_SOURCE > -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-string= s > -Wmissing-prototypes -fno-strict-aliasing -fstack-protector-all > -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-extern= s > -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers > -Wold-style-declaration -Wold-style-definition -Wtype-limits > -I/usr/include/libpng12 -I/usr/include/spice-server > -I/usr/include/pixman-1 -I/usr/include/spice-1 -I/usr/include/ns= s3 > -I/usr/include/nspr4 -pthread -I/usr/include/glib-2.0 > -I/usr/lib64/glib-2.0/include -DHAS_AUDIO -DHAS_AUDIO_CHOICE > -DTARGET_PHYS_ADDR_BITS=3D64 -I../linux-headers > -I.. -I/home/ssp/vertigo/qemu/target-i386 -DNEED_CPU_H > -I/home/ssp/vertigo/qemu/include -I/usr/include/libpng12 -pth= read > -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -MMD -MP -= MT > hw/vfio_pci.o -MF hw/vfio_pci.d -O2 -D_FORTIFY_SOURCE=3D2 -g -c -= o > hw/vfio_pci.o /home/ssp/vertigo/qemu/hw/vfio_pci.c > cc1: warnings being treated as errors > /home/ssp/vertigo/qemu/hw/vfio_pci.c: In function =E2=80=98vfio_ba= r_write=E2=80=99: > /home/ssp/vertigo/qemu/hw/vfio_pci.c:604:84: error: value computed= is not used > /home/ssp/vertigo/qemu/hw/vfio_pci.c: In function =E2=80=98vfio_ba= r_read=E2=80=99: > /home/ssp/vertigo/qemu/hw/vfio_pci.c:644:84: error: value computed= is > not used > make[1]: *** [hw/vfio_pci.o] Error 1 > make[1]: Leaving directory `/home/ssp/vertigo/qemu/i386-softmmu' > make: *** [subdir-i386-softmmu] Error 2 That's strange. The lines which cause compiler errors look like this: vfio_eoi(DO_UPCAST(VFIODevice, bars[bar->nr], bar)); There are more uses of DO_UPCAST without any compiler error: VFIODevice *vdev =3D DO_UPCAST(VFIODevice, pdev, pdev); Neither of both lines creates a compiler error with any of my compilers (gcc 4.4 up to latest gcc, Linux and MinGW hosts). When I compile with gcc option -save-temps, I get this code for the first line: vfio_eoi(( __extension__ ( { char __attribute__((unused))=20 offset_must_be_zero[ -__builtin_offsetof (VFIODevice, bars[bar->nr])];=20 ({ const typeof(((VFIODevice *) 0)->bars[bar->nr]) *__mptr =3D (bar);=20 (VFIODevice *) ((char *) __mptr - __builtin_offsetof (VFIODevice,=20 bars[bar->nr]));});}))); Could you please replace the first line by that code and try your compile= r? If it remains silent, I suspect a bad offsetof macro. Do you compile on Linux? Which distribution or which C library do you use= ? Regards Stefan Weil