On 04/05/2012 04:10 AM, Bruno Haible wrote: > This patch will not help to fix Daniel Berrange's problem. In mingw > and mingw64, ssize_t is defined by <sys/types.h>, and gnulib will not > override it. > > Test program: > ==================== foo.c ================= > #include <sys/types.h> > size_t a; > ssize_t b; > ============================================ > > With mingw of 2009: > > $ gcc -mno-cygwin -c foo.c > $ gcc -mno-cygwin -E foo.c | grep size_t > typedef unsigned int size_t; > typedef long _ssize_t; > typedef _ssize_t ssize_t; > size_t a; > ssize_t b;
Broken, but a thing of the past. > > With mingw of 2011: > > $ i686-pc-mingw32-gcc -c foo.c > $ i686-pc-mingw32-gcc -E foo.c | grep size_t > typedef unsigned int size_t; > typedef int _ssize_t; > typedef _ssize_t ssize_t; > size_t a; > ssize_t b; Working. > > With mingw64 of 2011: > > $ i686-w64-mingw32-gcc -c foo.c > $ i686-w64-mingw32-gcc -E foo.c | grep size_t > typedef unsigned int size_t; > typedef int ssize_t; > size_t a; > ssize_t b; Working. You forgot to check one (64-bit mingw64): $ x86_64-w64-mingw32-gcc -E foo.c | grep size_t __extension__ typedef unsigned long long size_t; __extension__ typedef long long ssize_t; size_t a; ssize_t b; but apparently that is also working. Then how do I explain the compiler warning that Daniel was seeing under mingw64? Daniel, were you testing with x86_64-w64-mingw32-gcc or i686-w64-mingw32-gcc? Can you come up with a minimal test case that shows the issue you had? > > You cannot look at size_t to determine what ssize_t should be: On MSVC 9, > <sys/types.h> lacks both size_t and ssize_t. In which case we are okay as long as we choose the same size for each. > > In summary, I would not do something about it in gnulib. The proper place > for setting up size_t and ssize_t are GCC and <sys/types.h>. If gnulib > would override the definition, it would have side effects on C++ overloading. > For my feeling, that's not worth it. Simply ignore the GCC printf argument > size warnings on mingw. Look at them only on glibc systems. But my problem is that there _shouldn't_ be any GCC printf warnings on mingw, if mingw headers are correct. -- Eric Blake ebl...@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature