This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib 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]

[PATCH]: Enable positional arguments by default for Cygwin's printf


Hi All,

I posted a message to the Cygwin developers list asking if anyone had an
objection to doing this.  Since noone expressed any, I think we should enable
this since it will enhance our printf and improve compatibility w.r.t. sources
from other *nixes.  As mentioned before in my message to the devel list, it
also is specifed as a standard for Unix98.  However, I was required to fix what
appeared to be a typo in vfprintf.c for %n when the argument is a long long.
The pointer quad_ptr_t was already defined with the *, so the extra * after
quad_ptr_t is extraneous and causes the CPP concatination to fail when
positional args are enabled.

In any event, after fixing that up, I sucessfully compiled the Cygwin dll.  I
ran a few tests, including some portions of the glibc printf test.  The results
were as expected and confirmed that positional arguments were functioning
properly.  For reference, I have attached a small, working testcase to
demonstrate postional arguments and prove they work on Cygwin.  Also attached
is the patch adding -DWANT_IO_POS_ARGS to Cygwin's line in configure.host and
fixing the aforementioned problem in vfprintf.c.

Of course, this is up to Chris or Corinna to approve, so I await their
comments/criticism.

Cheers,
Nicholas

Attachment: cygwin-printf-positional-args.patch
Description: Text document

Attachment: testpos.c
Description: Text document


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