From patchwork Tue Feb 20 18:50:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 10230725 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 34289602A7 for ; Tue, 20 Feb 2018 18:50:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 265A32889B for ; Tue, 20 Feb 2018 18:50:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 24A8228861; Tue, 20 Feb 2018 18:50:41 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 BF603288A3 for ; Tue, 20 Feb 2018 18:50:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751922AbeBTSui (ORCPT ); Tue, 20 Feb 2018 13:50:38 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:43406 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751832AbeBTSug (ORCPT ); Tue, 20 Feb 2018 13:50:36 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1F7717C6A0 for ; Tue, 20 Feb 2018 18:50:36 +0000 (UTC) Received: from steved.boston.devel.redhat.com (steved.boston.devel.redhat.com [10.19.60.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id 05BA810A9DE7 for ; Tue, 20 Feb 2018 18:50:35 +0000 (UTC) From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH 4/7] Removed format=2 warnings Date: Tue, 20 Feb 2018 13:50:31 -0500 Message-Id: <20180220185034.26301-5-steved@redhat.com> In-Reply-To: <20180220185034.26301-1-steved@redhat.com> References: <20180220185034.26301-1-steved@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 20 Feb 2018 18:50:36 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 20 Feb 2018 18:50:36 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'steved@redhat.com' RCPT:'' Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Added the -Werror=format=2 warning flag and added couple pragma statments to ignore the warning where it could not be avoided. Signed-off-by: Steve Dickson --- configure.ac | 1 + utils/mount/stropts.c | 2 ++ utils/nfsstat/nfsstat.c | 2 ++ 3 files changed, 5 insertions(+) diff --git a/configure.ac b/configure.ac index 4f9d8c4..11b994b 100644 --- a/configure.ac +++ b/configure.ac @@ -551,6 +551,7 @@ my_am_cflags="\ -Werror=missing-prototypes \ -Werror=missing-declarations \ -Werror=format-overflow=2 \ + -Werror=format=2 \ " AC_SUBST([AM_CFLAGS], ["$my_am_cflags"]) diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index 1217823..777de39 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -761,9 +761,11 @@ static int nfs_do_mount_v4(struct nfsmount_info *mi, fmt = "vers=%lu.%lu"; break; } +#pragma GCC diagnostic ignored "-Wformat-nonliteral" snprintf(version_opt, sizeof(version_opt) - 1, fmt, mi->version.major, mi->version.minor); +#pragma GCC diagnostic warning "-Wformat-nonliteral" if (po_append(options, version_opt) == PO_FAILED) { errno = EINVAL; diff --git a/utils/nfsstat/nfsstat.c b/utils/nfsstat/nfsstat.c index 43fe0a8..c779053 100644 --- a/utils/nfsstat/nfsstat.c +++ b/utils/nfsstat/nfsstat.c @@ -980,8 +980,10 @@ more_stats: } bufp = buf; for (; curindex < numvals; curindex++) { +#pragma GCC diagnostic ignored "-Wformat-nonliteral" n = sscanf(bufp, fmt, &ip->valptr[curindex], &numconsumed); +#pragma GCC diagnostic warning "-Wformat-nonliteral" if (n != 1) break; if (is_proc) {