Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/rump/net/lib/libvirtif A simple (void) is apparently too...



details:   https://anonhg.NetBSD.org/src/rev/4109ae938dc7
branches:  trunk
changeset: 787959:4109ae938dc7
user:      pooka <pooka%NetBSD.org@localhost>
date:      Tue Jul 16 21:14:42 2013 +0000

description:
A simple (void) is apparently too easy and traditional to make
Wunused-result STFU, so let's invent something a bit more verbose to
try to achieve the desired result of "ccg xnaht I really don't care if
you think I should check the return value".

diffstat:

 sys/rump/net/lib/libvirtif/rumpcomp_user.c |  16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r 31d6650a1813 -r 4109ae938dc7 sys/rump/net/lib/libvirtif/rumpcomp_user.c
--- a/sys/rump/net/lib/libvirtif/rumpcomp_user.c        Tue Jul 16 21:01:03 2013 +0000
+++ b/sys/rump/net/lib/libvirtif/rumpcomp_user.c        Tue Jul 16 21:14:42 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpcomp_user.c,v 1.9 2013/07/16 19:44:31 pooka Exp $  */
+/*     $NetBSD: rumpcomp_user.c,v 1.10 2013/07/16 21:14:42 pooka Exp $ */
 
 /*
  * Copyright (c) 2013 Antti Kantee.  All Rights Reserved.
@@ -132,9 +132,19 @@
        struct iovec *iov, size_t iovlen)
 {
        void *cookie = rumpuser_component_unschedule();
+       ssize_t idontcare __attribute__((__unused__));
 
-       /* no need to check for return value; packets may be dropped */
-       (void)writev(viu->viu_fd, iov, iovlen);
+       /*
+        * no need to check for return value; packets may be dropped
+        *
+        * ... sorry, I spoke too soon.  We need to check it because
+        * apparently gcc reinvented const poisoning and it's very
+        * hard to say "thanks, I know I'm not using the result,
+        * but please STFU and let's get on with something useful".
+        * So let's trick gcc into letting us share the compiler
+        * experience.
+        */
+       idontcare = writev(viu->viu_fd, iov, iovlen);
 
        rumpuser_component_schedule(cookie);
 }



Home | Main Index | Thread Index | Old Index