This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[Patch/mingw32] Remove printf format warning in mingw32 libgfortran build
- From: "Danny Smith" <dansmister at gmail dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>, fortran at gcc dot gnu dot org
- Date: Sat, 22 Nov 2008 20:49:10 +1300
- Subject: [Patch/mingw32] Remove printf format warning in mingw32 libgfortran build
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=inH4OJbfBU/JM2MWeji/7TUyh8RWhm4aMovUKzqrbyM=; b=J0SyhdH77WMJookJaMnwvmA71sSINGTLlQML4a/g99xUldG6FvNBPTGIeIB/PIDCk4 JN67IOp43eGzWc17xA5WjcIlcMcKeYQcL6YxJMyxMK96Uk7DvD4VxqQXFgRoGFGsquhR hjpSkgqGZbYQRX0eqHwScfFoYhUxDTgwrgInA=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=NAP1GE2TZmjfdGSn7XAzsx9fkG+GK26uobHeRnI/WzMf+DdS4FolMRm6SLr/HC1dkK TODhOWotDB+8BFAGVzllnx+rQ2S0In4DZVsnoLAYPx/tWPaF0fakoYtgNEfKMpn+yXjF 0h+0GupYd7/gE2d69xeTELCJKWggxrnoURbvI=
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