From: Gernot Hillier <gernot.hillier@siemens.com>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai] [Xenomai-forge] [PATCH v2] Silence unused_result warning from write()
Date: Tue, 14 Jan 2014 13:28:16 +0100 [thread overview]
Message-ID: <52D52D60.9030500@siemens.com> (raw)
In-Reply-To: <527D1E27.3030708@xenomai.org>
Some glibc versions mark write() with attribute warn_unused_result (found in
Ubuntu 12.04 / eglibc 2.15 / gcc 4.6.3), so we need to silence this warning,
especially because we're building with -Werror.
Signed-off-by: Gernot Hillier <gernot.hillier@siemens.com>
---
lib/cobalt/init.c | 3 ++-
testsuite/latency/latency.c | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
Sorry for late self follow-up, but I was a bit offline due to parental
leave...
This is a friendly reminder to v2 of the patch (already posted on
2013-11-11), adressing your comments from 2013-11-08, Gilles. I also
rebased patch to today's master.
The "attribute unused" style was adopted from
testsuite/latency/latency.c. We still think fixing the warning in the
source code is better than in the configure command line.
diff --git a/lib/cobalt/init.c b/lib/cobalt/init.c
index 0c2b29a..c3086a9 100644
--- a/lib/cobalt/init.c
+++ b/lib/cobalt/init.c
@@ -54,7 +54,8 @@ int __rtdm_fd_start = INT_MAX;
static void sigill_handler(int sig)
{
const char m[] = "no Xenomai support in kernel?\n";
- write(2, m, sizeof(m) - 1);
+ ssize_t rc __attribute__ ((unused));
+ rc = write(2, m, sizeof(m) - 1);
exit(EXIT_FAILURE);
}
diff --git a/testsuite/latency/latency.c b/testsuite/latency/latency.c
index 6325672..12b90a9 100644
--- a/testsuite/latency/latency.c
+++ b/testsuite/latency/latency.c
@@ -507,7 +507,7 @@ static void sigdebug(int sig, siginfo_t *si, void *context)
case SIGDEBUG_WATCHDOG:
n = snprintf(buffer, sizeof(buffer), "%s\n",
reason_str[reason]);
- write(STDERR_FILENO, buffer, n);
+ n = write(STDERR_FILENO, buffer, n);
exit(EXIT_FAILURE);
}
--
1.8.4
prev parent reply other threads:[~2014-01-14 12:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-07 9:22 [Xenomai] [Xenomai-forge] [PATCH] Silence unused_result warning from write() Gernot Hillier
2013-11-07 18:01 ` Gilles Chanteperdrix
2013-11-08 5:55 ` Gernot Hillier
2013-11-08 17:23 ` Gilles Chanteperdrix
2013-11-08 18:18 ` Jan Kiszka
2013-11-11 8:36 ` dietmar.schindler
2013-11-11 10:00 ` Gernot Hillier
2014-01-14 12:28 ` Gernot Hillier [this message]
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=52D52D60.9030500@siemens.com \
--to=gernot.hillier@siemens.com \
--cc=gilles.chanteperdrix@xenomai.org \
--cc=xenomai@xenomai.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.