Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752374AbdLGJGy (ORCPT ); Thu, 7 Dec 2017 04:06:54 -0500 Received: from mail-oi0-f46.google.com ([209.85.218.46]:45310 "EHLO mail-oi0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750857AbdLGJGw (ORCPT ); Thu, 7 Dec 2017 04:06:52 -0500 X-Google-Smtp-Source: AGs4zMYgvRuSh1P/xOY77aLFQJYOf3nmKfIs9WyWCvIoSLx8yv/0IVpwUOEOJVNmrmGseMBXMfylOcyFrZ8kvTqvHLs= MIME-Version: 1.0 In-Reply-To: References: <20171206141844.788362-1-arnd@arndb.de> From: Arnd Bergmann Date: Thu, 7 Dec 2017 10:06:50 +0100 X-Google-Sender-Auth: d9_sldAFaZB0MX7Y7MpBDpmVoXQ Message-ID: Subject: Re: [PATCH] btrfs: tree-checker: use %zu format string for size_t To: Qu Wenruo Cc: Chris Mason , Josef Bacik , David Sterba , Qu Wenruo , Su Yue , Nikolay Borisov , linux-btrfs , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id vB7970fw009664 Content-Length: 1009 Lines: 29 On Thu, Dec 7, 2017 at 1:32 AM, Qu Wenruo wrote: > > > On 2017年12月06日 22:18, Arnd Bergmann wrote: >> The return value of sizeof() is of type size_t, so we must print it >> using the %z format modifier rather than %l to avoid this warning >> on some architectures: >> >> fs/btrfs/tree-checker.c: In function 'check_dir_item': >> fs/btrfs/tree-checker.c:273:50: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'u32' {aka 'unsigned int'} [-Werror=format=] > > Any idea about which architecture will cause such warning? > On x86_64 I always fail to get such warning. I think all 32-bit architectures: #ifndef __kernel_size_t #if __BITS_PER_LONG != 64 typedef unsigned int __kernel_size_t; typedef int __kernel_ssize_t; typedef int __kernel_ptrdiff_t; #else typedef __kernel_ulong_t __kernel_size_t; typedef __kernel_long_t __kernel_ssize_t; typedef __kernel_long_t __kernel_ptrdiff_t; #endif #endif Arnd