[PATCH] Replace %z in format strings with configure-time determined printf length modifier

Jason Evans jasone at canonware.com
Wed Apr 11 09:42:33 PDT 2012


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?

Thanks,
Jason


More information about the jemalloc-discuss mailing list