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 <[email protected]>
---
 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


_______________________________________________
Xenomai mailing list
[email protected]
http://www.xenomai.org/mailman/listinfo/xenomai

Reply via email to