This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch/mingw32] Remove printf format warning in mingw32 libgfortran build


Danny Smith wrote:
On mingw32 builds of libgfortran, we currently get:

In file included from ../../../src/libgfortran/io/write.c:42:
../../../src/libgfortran/io/write_float.def: In function 'write_float':
../../../src/libgfortran/io/write_float.def:838: warning: unknown
conversion type character 'L' in format
../../../src/libgfortran/io/write_float.def:838: warning: too many
arguments for format

The problem is that for mingw32, the default printf formating
specification is msvc_printf, and msvc_printf does not support long
double. __mingw_snprintf does and should be qualified with the format
(gnu_printf,...) attribute.

Tested on i686-pc-mingw32. OK for trunk?


2008-11-22 Danny Smith <dannysmith@users.sourceforge.net>


	ligfortran.h (__mingw_snprintf): Declare with gnu_printf format
	attribute

Index: libgfortran.h
===================================================================
--- libgfortran.h	(revision 142082)
+++ libgfortran.h	(working copy)
@@ -113,7 +113,7 @@
    __mingw_snprintf(), because the mingw headers currently don't have one.  */
 #if HAVE_MINGW_SNPRINTF
 extern int __mingw_snprintf (char *, size_t, const char *, ...)
-     __attribute__ ((format (printf, 3, 4)));
+     __attribute__ ((format (gnu_printf, 3, 4)));
 #undef snprintf
 #define snprintf __mingw_snprintf
 #endif

OK, thanks.

Jerry


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]