This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
[PATCH]: Fix printf positional arguments breakage
- From: nwourms at netscape dot net (Nicholas Wourms)
- To: newlib at sources dot redhat dot com (Newlib List)
- Date: Mon, 21 Mar 2005 10:19:47 -0500
- Subject: [PATCH]: Fix printf positional arguments breakage
Hi,
It looks like the move of certain defines from the command line (-DXXXX) to newlib.h has resulted in postional argument support being disabled even when it is explicitly enabled. The problem is that vprintf.c is expecting that _WANT_IO_POS_ARGS would be defined on the command line, thus it put the #ifdef test before including newlib.h. IMHO, I find the usage of preprocessor conditionals in newlib to be excessive, almost to the point of being gratuitous. I also think that putting conditionals before includes is a bad idea, in general. Be that as it may, I have attached a fix which rectifies the issue at hand. In addition, I removed a redundant include of reent.h. However, it might be a good idea to review the other defines moved from the command line to newlib.h, to be sure that this problem isn't silently manifesting itself elsewhere.
Cheers,
Nicholas
__________________________________________________________________
Switch to Netscape Internet Service.
As low as $9.95 a month -- Sign up today at http://isp.netscape.com/register
Netscape. Just the Net You Need.
New! Netscape Toolbar for Internet Explorer
Search from anywhere on the Web and block those annoying pop-ups.
Download now at http://channels.netscape.com/ns/search/install.jsp
2005-03-21 Nicholas Wourms <nwourms@netscape.net>
* libc/stdio/vfprintf.c: Move newlib.h before _WANT_IO_POS_ARGS test,
since _WANT_IO_POS_ARGS is now defined in there. Remove duplicate
reent.h include.
Index: libc/stdio/vfprintf.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/vfprintf.c,v
retrieving revision 1.38
diff -u -p -r1.38 vfprintf.c
--- libc/stdio/vfprintf.c 8 Feb 2005 01:33:17 -0000 1.38
+++ libc/stdio/vfprintf.c 21 Mar 2005 14:57:47 -0000
@@ -157,6 +157,7 @@ static char *rcsid = "$Id: vfprintf.c,v
*
* This code is large and complicated...
*/
+#include <newlib.h>
#ifdef INTEGER_ONLY
#define VFPRINTF vfiprintf
@@ -176,8 +177,6 @@ static char *rcsid = "$Id: vfprintf.c,v
#include <_ansi.h>
#include <reent.h>
-#include <newlib.h>
-#include <reent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>