From patchwork Thu Mar 15 15:08:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10284707 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B6C63602BD for ; Thu, 15 Mar 2018 15:08:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9D4B28A57 for ; Thu, 15 Mar 2018 15:08:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9DE4C28B1C; Thu, 15 Mar 2018 15:08:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 500A328A57 for ; Thu, 15 Mar 2018 15:08:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752777AbeCOPI3 (ORCPT ); Thu, 15 Mar 2018 11:08:29 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:4231 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752748AbeCOPI2 (ORCPT ); Thu, 15 Mar 2018 11:08:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1521127615; x=1552663615; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=yxOvI73dhM/mwJkOLc2qwoOkcJWBukMv0oHtfbbZmcA=; b=akPFfFAxy0neT6CJdzMNvageY+ocBOdPxOYESSoG/sbs2sA+i37jWzV5 f9t1GHraVk81Owa3rvyyEb20pYV57a/El/EITDmupzPm0so5xjtEDj0jg jzz0K5a6jqFX06Om+klc+GC4x92b/bJB/d9HeUPUTZ45J61FZhMnIPVNE lAzOlxJYS/B+/vTxFY8ai79FeiMl6MfGO7aDdkVfHX0LLALjILkJhQe7i zarAke0C170tovqbrXwU4aPb8rDNSkKUQ7Kia84gB1mwhhor+4IlVK/tm Mb/Q3sztd9+S5Ey2XEIJWwPag+Dtal8hPY29iR0owd567hPMJ62cXTbK1 w==; X-IronPort-AV: E=Sophos;i="5.47,471,1515427200"; d="scan'208";a="170233262" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 15 Mar 2018 23:26:35 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 15 Mar 2018 08:01:13 -0700 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO thinkpad-bart.int.fusionio.com) ([10.11.171.236]) by uls-op-cesaip02.wdc.com with ESMTP; 15 Mar 2018 08:08:15 -0700 From: Bart Van Assche To: Michael Lyle , Kent Overstreet , Coly Li Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche Subject: [PATCH 02/16] bcache: Add __printf annotation to __bch_check_keys() Date: Thu, 15 Mar 2018 08:08:00 -0700 Message-Id: <20180315150814.9412-3-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180315150814.9412-1-bart.vanassche@wdc.com> References: <20180315150814.9412-1-bart.vanassche@wdc.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Make it possible for the compiler to verify the consistency of the format string passed to __bch_check_keys() and the arguments that should be formatted according to that format string. Signed-off-by: Bart Van Assche --- drivers/md/bcache/bset.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/md/bcache/bset.h b/drivers/md/bcache/bset.h index fa506c1aa524..0c24280f3b98 100644 --- a/drivers/md/bcache/bset.h +++ b/drivers/md/bcache/bset.h @@ -531,14 +531,15 @@ int __bch_keylist_realloc(struct keylist *, unsigned); #ifdef CONFIG_BCACHE_DEBUG int __bch_count_data(struct btree_keys *); -void __bch_check_keys(struct btree_keys *, const char *, ...); +void __printf(2, 3) __bch_check_keys(struct btree_keys *, const char *, ...); void bch_dump_bset(struct btree_keys *, struct bset *, unsigned); void bch_dump_bucket(struct btree_keys *); #else static inline int __bch_count_data(struct btree_keys *b) { return -1; } -static inline void __bch_check_keys(struct btree_keys *b, const char *fmt, ...) {} +static inline void __printf(2, 3) + __bch_check_keys(struct btree_keys *b, const char *fmt, ...) {} static inline void bch_dump_bucket(struct btree_keys *b) {} void bch_dump_bset(struct btree_keys *, struct bset *, unsigned);