linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steve Dickson <steved@redhat.com>
To: Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Subject: [PATCH 4/7] Removed format=2 warnings
Date: Tue, 20 Feb 2018 13:50:31 -0500	[thread overview]
Message-ID: <20180220185034.26301-5-steved@redhat.com> (raw)
In-Reply-To: <20180220185034.26301-1-steved@redhat.com>

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 <steved@redhat.com>
---
 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) {
-- 
2.14.3


  parent reply	other threads:[~2018-02-20 18:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-20 18:50 [PATCH 0/7] nfs-utils: Use -Werror warning flags to clean up the code Steve Dickson
2018-02-20 18:50 ` [PATCH 1/7] configure.ac: clean up Steve Dickson
2018-02-20 18:50 ` [PATCH 2/7] Removed missing-prototypes warnings Steve Dickson
2018-02-20 18:50 ` [PATCH 3/7] Removed format-overflow=2 warnings Steve Dickson
2018-02-20 18:50 ` Steve Dickson [this message]
2018-02-20 18:50 ` [PATCH 5/7] Removed undef warnings Steve Dickson
2018-02-20 18:50 ` [PATCH 6/7] Removed missing-include-dirs warnings Steve Dickson
2018-02-20 18:50 ` [PATCH 7/7] Added more -Werror= warning flags Steve Dickson
2018-02-23 14:21 ` [PATCH 0/7] nfs-utils: Use -Werror warning flags to clean up the code Steve Dickson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180220185034.26301-5-steved@redhat.com \
    --to=steved@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).