xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-connectivity/nfs-utils/nfs-utils/clang-warnings.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From 1ab0c326405c6daa06f1a7eb4b0b60bf4e0584c2 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 31 Dec 2019 08:15:34 -0800
4Subject: [PATCH] Detect warning options during configure
5
6Certain options maybe compiler specific therefore its better
7to detect them before use.
8
9nfs_error copies the format string and appends newline to it
10but compiler can forget that it was format string since its not
11same fmt string that was passed. Ignore the warning
12
13Wdiscarded-qualifiers is gcc specific and this is no longer needed
14
15Upstream-Status: Pending
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17
18---
19 support/nfs/xcommon.c | 3 +++
20 1 file changed, 3 insertions(+)
21
22diff --git a/support/nfs/xcommon.c b/support/nfs/xcommon.c
23index 3989f0b..e080423 100644
24--- a/support/nfs/xcommon.c
25+++ b/support/nfs/xcommon.c
26@@ -98,7 +98,10 @@ nfs_error (const char *fmt, ...) {
27
28      fmt2 = xstrconcat2 (fmt, "\n");
29      va_start (args, fmt);
30+#pragma GCC diagnostic push
31+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
32      vfprintf (stderr, fmt2, args);
33+#pragma GCC diagnostic pop
34      va_end (args);
35      free (fmt2);
36 }
37