1 Return-Path: <amdragon@mit.edu>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id E9697431FD0
\r
6 for <notmuch@notmuchmail.org>; Wed, 21 Dec 2011 23:02:43 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id y1retHeD3LpJ for <notmuch@notmuchmail.org>;
\r
16 Wed, 21 Dec 2011 23:02:43 -0800 (PST)
\r
17 Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 606EA431FB6
\r
20 for <notmuch@notmuchmail.org>; Wed, 21 Dec 2011 23:02:43 -0800 (PST)
\r
21 X-AuditID: 1209190c-b7fad6d000000920-72-4ef2d6129922
\r
22 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])
\r
23 by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id 52.3D.02336.216D2FE4; Thu, 22 Dec 2011 02:02:42 -0500 (EST)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id pBM72fAs014255;
\r
27 Thu, 22 Dec 2011 02:02:41 -0500
\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])
\r
29 (authenticated bits=0)
\r
30 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
31 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id pBM72d1U010181
\r
32 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
33 Thu, 22 Dec 2011 02:02:40 -0500 (EST)
\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)
\r
35 (envelope-from <amdragon@mit.edu>)
\r
36 id 1Rdcgr-0007Cz-Oy; Thu, 22 Dec 2011 02:03:45 -0500
\r
37 Date: Thu, 22 Dec 2011 02:03:45 -0500
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: David Edmondson <dme@dme.org>
\r
40 Subject: Re: [RFC][PATCH] notmuch: Workaround to allow ignoring non-void
\r
42 Message-ID: <20111222070345.GI10376@mit.edu>
\r
43 References: <1324503532-5799-1-git-send-email-dme@dme.org>
\r
45 Content-Type: text/plain; charset=us-ascii
\r
46 Content-Disposition: inline
\r
47 In-Reply-To: <1324503532-5799-1-git-send-email-dme@dme.org>
\r
48 User-Agent: Mutt/1.5.21 (2010-09-15)
\r
49 X-Brightmail-Tracker:
\r
50 H4sIAAAAAAAAA+NgFmpgleLIzCtJLcpLzFFi42IRYrdT0RW69snPYOoLbYt9d7YwWVy/OZPZ
\r
51 gclj1/O/TB7PVt1iDmCK4rJJSc3JLEst0rdL4MqYO72oYL9gxaYFRg2Ma3m7GDk5JARMJPpe
\r
52 3mWDsMUkLtxbD2YLCexjlPi0saaLkQvI3sAo0TZtDyOEc5JJYtarj8wQVUsYJW71+oLYLAKq
\r
53 Ek+nrgaLswloSGzbv5wRxBYRUJT4/20FO4jNLCAt8e13MxOILSwQLXH1x3EWEJtXQEdi0se9
\r
54 TBAzrST+/1vLBBEXlDg58wkLRK+WxI1/L4HiHGBzlv/jAAlzClhLdHVcAztaVEBFYsrJbWwT
\r
55 GIVmIemehaR7FkL3AkbmVYyyKblVurmJmTnFqcm6xcmJeXmpRbqGermZJXqpKaWbGEEBzSnJ
\r
56 s4PxzUGlQ4wCHIxKPLwvhT75CbEmlhVX5h5ilORgUhLlzb8KFOJLyk+pzEgszogvKs1JLT7E
\r
57 KMHBrCTC+ygGKMebklhZlVqUD5OS5mBREudV0XrnJySQnliSmp2aWpBaBJOV4eBQkuAtARkq
\r
58 WJSanlqRlplTgpBm4uAEGc4DNDwbpIa3uCAxtzgzHSJ/ilFRSpy3HiQhAJLIKM2D64UlnFeM
\r
59 4kCvCPPmglTxAJMVXPcroMFMQIO3OX8AGVySiJCSamAMvHdH686f8wdPWaTP7HK4kv/ufGwN
\r
60 w/ofF0RPOBXJyL9+YfXEYi3TOb6vGjMWHFuTI+Jm+2nm4xU/Kq8sZXp8Sfu9dMgsVlHlJsXi
\r
61 wN/F9fvzn51MYlx3rjqp8sPEIibLcxwH3wi2rfjzaJ3/uqmmzvlhdvP/L6j4c25l8uFX0YLT
\r
62 knUbf99vVmIpzkg01GIuKk4EAERB7WITAwAA
\r
63 Cc: notmuch@notmuchmail.org
\r
64 X-BeenThere: notmuch@notmuchmail.org
\r
65 X-Mailman-Version: 2.1.13
\r
67 List-Id: "Use and development of the notmuch mail system."
\r
68 <notmuch.notmuchmail.org>
\r
69 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
70 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
71 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
72 List-Post: <mailto:notmuch@notmuchmail.org>
\r
73 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
74 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
75 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
76 X-List-Received-Date: Thu, 22 Dec 2011 07:02:44 -0000
\r
78 I must admit I haven't been following the warnings problem very
\r
79 closely, but perhaps we shouldn't be ignoring these return codes?
\r
81 Quoth David Edmondson on Dec 21 at 9:38 pm:
\r
84 > The mechanism used here works for me in an isolated test case and no
\r
85 > warnings appear when using it as below, but I'm unsure why the
\r
86 > original warning that it is intended to address didn't appear when I
\r
87 > build. Any thoughts?
\r
89 > compat/compat.h | 6 ++++++
\r
90 > notmuch-new.c | 2 +-
\r
91 > notmuch-show.c | 2 +-
\r
92 > notmuch-tag.c | 2 +-
\r
93 > 4 files changed, 9 insertions(+), 3 deletions(-)
\r
95 > diff --git a/compat/compat.h b/compat/compat.h
\r
96 > index 7767fe8..1160301 100644
\r
97 > --- a/compat/compat.h
\r
98 > +++ b/compat/compat.h
\r
99 > @@ -30,6 +30,12 @@
\r
104 > +#define ignore_result(x) ({ __typeof__(x) z = x; (void) sizeof (z); })
\r
105 > +#else /* !__GNUC__ */
\r
106 > +#define ignore_result(x) x
\r
107 > +#endif /* __GNUC__ */
\r
109 > #if !HAVE_GETLINE
\r
110 > #include <stdio.h>
\r
111 > #include <unistd.h>
\r
112 > diff --git a/notmuch-new.c b/notmuch-new.c
\r
113 > index 3512de7..0ac04cc 100644
\r
114 > --- a/notmuch-new.c
\r
115 > +++ b/notmuch-new.c
\r
116 > @@ -67,7 +67,7 @@ handle_sigint (unused (int sig))
\r
118 > static char msg[] = "Stopping... \n";
\r
120 > - (void) write(2, msg, sizeof(msg)-1);
\r
121 > + ignore_result(write(STDERR_FILENO, msg, sizeof(msg)-1));
\r
125 > diff --git a/notmuch-show.c b/notmuch-show.c
\r
126 > index 19fb49f..681f778 100644
\r
127 > --- a/notmuch-show.c
\r
128 > +++ b/notmuch-show.c
\r
129 > @@ -866,7 +866,7 @@ do_show_single (void *ctx,
\r
131 > while (!feof (file)) {
\r
132 > size = fread (buf, 1, sizeof (buf), file);
\r
133 > - (void) fwrite (buf, size, 1, stdout);
\r
134 > + ignore_result(fwrite (buf, size, 1, stdout));
\r
138 > diff --git a/notmuch-tag.c b/notmuch-tag.c
\r
139 > index 292c5da..2cbfdc3 100644
\r
140 > --- a/notmuch-tag.c
\r
141 > +++ b/notmuch-tag.c
\r
142 > @@ -26,7 +26,7 @@ static void
\r
143 > handle_sigint (unused (int sig))
\r
145 > static char msg[] = "Stopping... \n";
\r
146 > - (void) write(2, msg, sizeof(msg)-1);
\r
147 > + ignore_result(write(STDERR_FILENO, msg, sizeof(msg)-1));
\r