Hi all,
I'm using i686-w64-mingw32-gcc from Debian:
COLLECT_GCC=i686-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-w64-mingw32/4.6/lto-wrapper
Target: i686-w64-mingw32
Configured with: ../../src/configure --build=x86_64-linux-gnu
--prefix=/usr --includedir='/usr/include' --mandir='/usr/share/man'
--infodir='/usr/share/info' --sysconfdir=/etc --localstatedir=/var
--libexecdir='/usr/lib/gcc-mingw-w64' --disable-maintainer-mode
--disable-dependency-tracking --prefix=/usr --enable-shared
--enable-static --disable-multilib --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--libdir=/usr/lib --enable-libstdcxx-time=yes --with-tune=generic
--enable-version-specific-runtime-libs --enable-threads=win32
--enable-fully-dynamic-string --enable-sjlj-exceptions
--enable-languages=c,c++,fortran,ada --enable-lto --with-plugin-ld
--target=i686-w64-mingw32 --with-gxx-include-dir=/usr/include/c++/4.6
--with-as=/usr/bin/i686-w64-mingw32-as
--with-ld=/usr/bin/i686-w64-mingw32-ld
Thread model: win32
gcc version 4.6.1 (GCC)
I have a 32 line test program included below and I'm compiling it with:
$ i686-w64-mingw32-gcc -std=gnu99 -Wall -Wextra -Werror test.c -o test
test.c: In function 'main':
test.c:33:2: error: unknown conversion type character 'l' in format
[-Werror=format]
test.c:33:2: error: too many arguments for format
[-Werror=format-extra-args]
cc1: all warnings being treated as errors
The problem seems to be that -Wforamt printf checking is not correct when
using <stdarg.h> with __USE_MINGW_ANSI_STDIO defined to 1.
If any one has access to the current SVN version of this compiler then I'd
appreciate it if they could try this test program and see if this problem
exists in HEAD.
For the moment, I will disable printf format string checking when
__USE_MINGW_ANSI_STDIO is set, but it would be nice to have format printf
checking working in this configuration.
Cheers,
Erik
#define __USE_MINGW_ANSI_STDIO 1
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdarg.h>
#include <inttypes.h>
#if __GNUC__
static inline void
exit_if_true (int test, const char *format, ...)
__attribute__ ((format (printf, 2, 3))) ;
#endif
static inline void
exit_if_true (int test, const char *format, ...)
{ if (test)
{ va_list argptr ;
va_start (argptr, format) ;
vprintf (format, argptr) ;
va_end (argptr) ;
exit (1) ;
} ;
}
int
main (int argc, char ** argv)
{ int64_t x = 0 ;
exit_if_true (argc > 1, "%s : x = %" PRId64 "\n", argv [0], x) ;
return 0 ;
}
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public