[PATCH 08/11] cli: add thread recipients to search output
[notmuch-archives.git] / d4 / 827d6c167ca553a0cfb03f63cb6b973506d449
1 Return-Path: <amthrax@drake.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 59374431FBF\r
6         for <notmuch@notmuchmail.org>; Wed, 18 Jan 2012 16:40:20 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \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 JrosXgVSNRvt for <notmuch@notmuchmail.org>;\r
16         Wed, 18 Jan 2012 16:40:19 -0800 (PST)\r
17 Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU\r
18         [18.7.68.35])\r
19         by olra.theworths.org (Postfix) with ESMTP id A2BEE431FAF\r
20         for <notmuch@notmuchmail.org>; Wed, 18 Jan 2012 16:40:19 -0800 (PST)\r
21 X-AuditID: 12074423-b7f9c6d0000008c3-21-4f17667354b3\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
23         by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id A9.AE.02243.376671F4; Wed, 18 Jan 2012 19:40:19 -0500 (EST)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q0J0eIa7000782; \r
27         Wed, 18 Jan 2012 19:40:18 -0500\r
28 Received: from drake.mit.edu\r
29         (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
30         [209.6.116.242]) (authenticated bits=0)\r
31         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
32         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q0J0eHMA016741\r
33         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
34         Wed, 18 Jan 2012 19:40:18 -0500 (EST)\r
35 Received: from amthrax by drake.mit.edu with local (Exim 4.77)\r
36         (envelope-from <amthrax@drake.mit.edu>)\r
37         id 1Rng36-0004Ys-TE; Wed, 18 Jan 2012 19:40:16 -0500\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: notmuch@notmuchmail.org\r
40 Subject: [PATCH 2/2] Silence buildbot warnings about unused results\r
41 Date: Wed, 18 Jan 2012 19:40:11 -0500\r
42 Message-Id: <1326933611-16898-3-git-send-email-amdragon@mit.edu>\r
43 X-Mailer: git-send-email 1.7.7.3\r
44 In-Reply-To: <1326933611-16898-1-git-send-email-amdragon@mit.edu>\r
45 References: <1326933611-16898-1-git-send-email-amdragon@mit.edu>\r
46 X-Brightmail-Tracker:\r
47  H4sIAAAAAAAAA+NgFtrIIsWRmVeSWpSXmKPExsUixCmqrFucJu5v8KeL2+L6zZnMDowez1bd\r
48         Yg5gjOKySUnNySxLLdK3S+DKmNsYWrBRsGJD7162BsaTvF2MnBwSAiYSv0+1sEPYYhIX7q1n\r
49         62Lk4hAS2McosWHZOUYIZwOjxPPmZywQzn0mib9nJrNCOPMZJf5s+84E0s8moCGxbf9yRhBb\r
50         REBaYufd2UBFHBzMAmoSf7pUQExhAWeJfU8NQCpYBFQlZnTNBdvMK+AgMfPmQlaIKxQkzq0+\r
51         BxbnFHCUuPrlKNh0IaCaDZdWsExg5F/AyLCKUTYlt0o3NzEzpzg1Wbc4OTEvL7VI10wvN7NE\r
52         LzWldBMjKGTYXZR3MP45qHSIUYCDUYmHN0JE3F+INbGsuDL3EKMkB5OSKO+jVKAQX1J+SmVG\r
53         YnFGfFFpTmrxIUYJDmYlEd6dJkA53pTEyqrUonyYlDQHi5I4r4bWOz8hgfTEktTs1NSC1CKY\r
54         rAwHh5IErxIwNoQEi1LTUyvSMnNKENJMHJwgw3mAhnOB1PAWFyTmFmemQ+RPMSpKifN+B7lI\r
55         ACSRUZoH1wuL6VeM4kCvCPMKgbTzANMBXPcroMFMQIM9msRABpckIqSkGhi3WFy57iaW+J7n\r
56         ZRSbbjPbml2vbzc5fC5oOCjA37Tt5GHFct69P2Mlqw4rRh8t8Vyz7M+dXuHQbla9NyIztDq8\r
57         8yJWbxWeNGfO6s9+Wn+nvjhcKSDP8obH5c2artaQ2qz/uW0vF5nbaQplS7I+uNS2+ntZa/7y\r
58         a0Ea7Rrr6kyb9hxa1r39qacSS3FGoqEWc1FxIgD0/MMpxAIAAA==\r
59 X-BeenThere: notmuch@notmuchmail.org\r
60 X-Mailman-Version: 2.1.13\r
61 Precedence: list\r
62 List-Id: "Use and development of the notmuch mail system."\r
63         <notmuch.notmuchmail.org>\r
64 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
65         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
66 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
67 List-Post: <mailto:notmuch@notmuchmail.org>\r
68 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
69 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
70         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
71 X-List-Received-Date: Thu, 19 Jan 2012 00:40:20 -0000\r
72 \r
73 This ignores the results of the two writes in sigint handlers even\r
74 harder than before.\r
75 \r
76 While my libc lacks the declarations that trigger these warnings, this\r
77 can be tested by adding the following to notmuch.h:\r
78 \r
79 __attribute__((warn_unused_result))\r
80 ssize_t write(int fd, const void *buf, size_t count);\r
81 ---\r
82  compat/compat.h |    8 ++++++++\r
83  notmuch-new.c   |    6 +++++-\r
84  notmuch-tag.c   |    5 ++++-\r
85  3 files changed, 17 insertions(+), 2 deletions(-)\r
86 \r
87 diff --git a/compat/compat.h b/compat/compat.h\r
88 index 7767fe8..b2e2736 100644\r
89 --- a/compat/compat.h\r
90 +++ b/compat/compat.h\r
91 @@ -46,6 +46,14 @@ getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp);\r
92  char* strcasestr(const char *haystack, const char *needle);\r
93  #endif /* !HAVE_STRCASESTR */\r
94  \r
95 +/* Silence gcc warnings about unused results.  These warnings exist\r
96 + * for a reason; any use of this needs to be justified. */\r
97 +#ifdef __GNUC__\r
98 +#define IGNORE_RESULT(x) ({ __typeof__(x) __z = (x); (void)(__z = __z); })\r
99 +#else /* !__GNUC__ */\r
100 +#define IGNORE_RESULT(x) x\r
101 +#endif /* __GNUC__ */\r
102 +\r
103  #ifdef __cplusplus\r
104  }\r
105  #endif\r
106 diff --git a/notmuch-new.c b/notmuch-new.c\r
107 index 3512de7..a569a54 100644\r
108 --- a/notmuch-new.c\r
109 +++ b/notmuch-new.c\r
110 @@ -67,7 +67,11 @@ handle_sigint (unused (int sig))\r
111  {\r
112      static char msg[] = "Stopping...         \n";\r
113  \r
114 -    (void) write(2, msg, sizeof(msg)-1);\r
115 +    /* This write is "opportunistic", so it's okay to ignore the\r
116 +     * result.  It is not required for correctness, and if it does\r
117 +     * fail or produce a short write, we want to get out of the signal\r
118 +     * handler as quickly as possible, not retry it. */\r
119 +    IGNORE_RESULT (write (2, msg, sizeof(msg)-1));\r
120      interrupted = 1;\r
121  }\r
122  \r
123 diff --git a/notmuch-tag.c b/notmuch-tag.c\r
124 index 292c5da..1564182 100644\r
125 --- a/notmuch-tag.c\r
126 +++ b/notmuch-tag.c\r
127 @@ -26,7 +26,10 @@ static void\r
128  handle_sigint (unused (int sig))\r
129  {\r
130      static char msg[] = "Stopping...         \n";\r
131 -    (void) write(2, msg, sizeof(msg)-1);\r
132 +\r
133 +    /* See handle_sigint in notmuch-new.c for the justification for\r
134 +     * ignoring write's result. */\r
135 +    IGNORE_RESULT (write (2, msg, sizeof(msg)-1));\r
136      interrupted = 1;\r
137  }\r
138  \r
139 -- \r
140 1.7.7.3\r
141 \r