public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "Gabriel F. T. Gomes" <gftg@linux.vnet.ibm.com>
To: fweimer@redhat.com
Cc: libc-alpha@sourceware.org
Subject: [PATCH v2] Fix warning caused by unused-result in bug-atexit3-lib.cc
Date: Fri, 28 Oct 2016 17:58:00 -0000	[thread overview]
Message-ID: <1477677435-21029-1-git-send-email-gftg@linux.vnet.ibm.com> (raw)
In-Reply-To: <46c460c8-f171-2f05-5af5-850782196316@redhat.com>

Changes since v1:
  - Copy write_message from test-skeleton.c to dlfcn/bug-atexit3-lib.cc.
  - Replace calls to write with calls to write_message.

---8<---
The test case dlfcn/bug-atexit3-lib.cc calls write and doesn't check the
result.  When building with GCC 6.2, this generates a warning in 'make
check', which is treated as an error.  This patch replaces the call to
write with a call to write_message.

Tested for powerpc64le.

2016-10-28  Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>

	* dlfcn/bug-atexit3-lib.cc (write_message): New function, copied
	from test-skeleton.c.
	(statclass): Replace calls to write with calls to write_message.
---
 dlfcn/bug-atexit3-lib.cc | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/dlfcn/bug-atexit3-lib.cc b/dlfcn/bug-atexit3-lib.cc
index 3d01ea8..aba7720 100644
--- a/dlfcn/bug-atexit3-lib.cc
+++ b/dlfcn/bug-atexit3-lib.cc
@@ -1,14 +1,22 @@
 #include <unistd.h>
+#include <string.h>
+
+static void
+write_message (const char *message)
+{
+  ssize_t unused __attribute__ ((unused));
+  unused = write (STDOUT_FILENO, message, strlen (message));
+}
 
 struct statclass
 {
   statclass()
   {
-    write (1, "statclass\n", 10);
+    write_message ("statclass\n");
   }
   ~statclass()
   {
-    write (1, "~statclass\n", 11);
+    write_message ("~statclass\n");
   }
 };
 
-- 
2.4.11

  reply	other threads:[~2016-10-28 17:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-28 13:01 [PATCH] " Gabriel F. T. Gomes
2016-10-28 13:04 ` Florian Weimer
2016-10-28 13:33   ` Gabriel F. T. Gomes
2016-10-28 13:35     ` Florian Weimer
2016-10-28 17:58       ` Gabriel F. T. Gomes [this message]
2016-10-28 20:38         ` [PATCH v2] " Florian Weimer
2016-10-28 21:47           ` Gabriel F. T. Gomes

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=1477677435-21029-1-git-send-email-gftg@linux.vnet.ibm.com \
    --to=gftg@linux.vnet.ibm.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).