This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Fix warning caused by unused-result in bug-atexit3-lib.cc
- From: "Gabriel F. T. Gomes" <gftg at linux dot vnet dot ibm dot com>
- To: libc-alpha at sourceware dot org
- Date: Fri, 28 Oct 2016 11:00:53 -0200
- Subject: [PATCH] Fix warning caused by unused-result in bug-atexit3-lib.cc
- Authentication-results: sourceware.org; auth=none
The test case dlfcn/bug-atexit3-lib.cc calls write and doesn't check the
result. When building with GCC 6.2 from IBM's branch, this generates a
warning in 'make check', which is treated as an error. This patch adds a
return variable to get rid of the warning and of the error.
Tested for powerpc64le.
2016-10-28 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
* dlfcn/bug-atexit3-lib.cc (statclass): Assign return of call to
write (defined with __wur) to unused variable.
---
dlfcn/bug-atexit3-lib.cc | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlfcn/bug-atexit3-lib.cc b/dlfcn/bug-atexit3-lib.cc
index 3d01ea8..5a7c454 100644
--- a/dlfcn/bug-atexit3-lib.cc
+++ b/dlfcn/bug-atexit3-lib.cc
@@ -4,11 +4,15 @@ struct statclass
{
statclass()
{
- write (1, "statclass\n", 10);
+ size_t unused_ret;
+ (void) unused_ret;
+ unused_ret = write (1, "statclass\n", 10);
}
~statclass()
{
- write (1, "~statclass\n", 11);
+ size_t unused_ret;
+ (void) unused_ret;
+ unused_ret = write (1, "~statclass\n", 11);
}
};
--
2.4.11