Temporarily workaround gcc warning

New gcc, new warnings:

../lib/str_error_r.c: In function ‘str_error_r’:
../lib/str_error_r.c:25:3: error: passing argument 1 to restrict-qualified parameter aliases with argument 5 [-Werror=restrict]
   snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, %p, %zd)=%d", errnum, buf, buflen, err);
   ^~~~~~~~
cc1: all warnings being treated as errors

Bring in a quick fix for now.
This commit is contained in:
Laura Abbott 2018-03-14 14:26:51 -07:00
parent d31ffa623b
commit 86e3b7659f
2 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,27 @@
From 991b5e95d4fe7778c8f5e7d7f478d01134d51ca7 Mon Sep 17 00:00:00 2001
From: Laura Abbott <labbott@redhat.com>
Date: Wed, 14 Mar 2018 14:20:02 -0700
Subject: [PATCH] Temporarily work around gcc aliasing warning/error
Signed-off-by: Laura Abbott <labbott@redhat.com>
---
tools/lib/str_error_r.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/lib/str_error_r.c b/tools/lib/str_error_r.c
index d6d65537b0d9..c0ede4f6adae 100644
--- a/tools/lib/str_error_r.c
+++ b/tools/lib/str_error_r.c
@@ -21,7 +21,8 @@
char *str_error_r(int errnum, char *buf, size_t buflen)
{
int err = strerror_r(errnum, buf, buflen);
+ void *temp = buf;
if (err)
- snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, %p, %zd)=%d", errnum, buf, buflen, err);
+ snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, %p, %zd)=%d", errnum, temp, buflen, err);
return buf;
}
--
2.16.2

View File

@ -506,6 +506,8 @@ Source5000: patch-4.%{base_sublevel}-git%{gitrev}.xz
# ongoing complaint, full discussion delayed until ksummit/plumbers
Patch002: 0001-iio-Use-event-header-from-kernel-tree.patch
# gcc -Werror=aliasing workaround
Patch003: 0001-Temporarily-work-around-gcc-aliasing-warning-error.patch
%if !%{nopatches}