From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: [PATCH kvm-unit-tests] libcflat: add support for %zd and %td Date: Fri, 12 May 2017 17:42:48 +0200 Message-ID: <20170512154248.23450-1-pbonzini@redhat.com> Cc: rkrcmar@redhat.com To: kvm@vger.kernel.org Return-path: Received: from mail-wr0-f193.google.com ([209.85.128.193]:35630 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932609AbdELPmx (ORCPT ); Fri, 12 May 2017 11:42:53 -0400 Received: by mail-wr0-f193.google.com with SMTP id g12so8031787wrg.2 for ; Fri, 12 May 2017 08:42:52 -0700 (PDT) Sender: kvm-owner@vger.kernel.org List-ID: These are useful to avoid warnings from the compiler. Signed-off-by: Paolo Bonzini --- lib/printf.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/printf.c b/lib/printf.c index 063a1ed..a96faee 100644 --- a/lib/printf.c +++ b/lib/printf.c @@ -176,6 +176,15 @@ int vsnprintf(char *buf, int size, const char *fmt, va_list va) case 'l': ++nlong; goto morefmt; + case 't': + case 'z': + /* Here we only care that sizeof(size_t) == sizeof(long). + * On a 32-bit platform it doesn't matter that size_t is + * typedef'ed to int or long; va_arg will work either way. + * Same for ptrdiff_t (%td). + */ + nlong = 1; + goto morefmt; case 'd': switch (nlong) { case 0: -- 2.12.2