[PATCH] Replace %z in format strings with configure-time determined printf length modifier
Mike Hommey
mh+jemalloc at glandium.org
Wed Apr 11 09:57:42 PDT 2012
On Wed, Apr 11, 2012 at 09:42:33AM -0700, Jason Evans wrote:
> On Apr 11, 2012, at 5:33 AM, Mike Hommey wrote:
> > On Wed, Apr 11, 2012 at 02:27:27PM +0200, Mike Hommey wrote:
> >> From: Mike Hommey <mh at glandium.org>
> >>
> >> ---
> >> configure.ac | 14 +++++++++
> >> include/jemalloc/jemalloc_defs.h.in | 8 ++++++
> >> src/prof.c | 2 +-
> >> src/stats.c | 54 +++++++++++++++++------------------
> >> test/aligned_alloc.c | 14 ++++-----
> >> test/allocm.c | 22 +++++++-------
> >> test/mremap.c | 6 ++--
> >> test/posix_memalign.c | 14 ++++-----
> >> test/rallocm.c | 16 +++++------
> >> 9 files changed, 86 insertions(+), 64 deletions(-)
> >
> > Disclaimer: no effort has been made to wrap strings. It's merely the
> > result of a big sed (plus configure and preprocessed header glue).
> >
> > Note that this leads to compiler warnings with mingw64 (warning: unknown
> > conversion type character 'l' in format [-Wformat]), but I suspect this
> > is a bug in mingw64 (and as a matter of fact, the resulting printfs do
> > the right thing ; fwiw, I sent a message on the mingw64 list, but it's
> > awaiting moderation). MSVC is happy with %llu, too.
> >
> > The defines in jemalloc_defs.h mimic inttypes.h PRI* macros.
>
> What problem is this trying to solve? Is it purely a matter of
> compiler warnings due to lack of the 'z' modifier on Windows? If so,
> how about we just conditionally remove the format attributes on
> malloc_{sn,c,}printf() to silence the warnings?
I guess that would work for malloc_{sn,c,}printf(), but not for the
plain fprintfs in tests...
Mike
More information about the jemalloc-discuss
mailing list