[PATCH 5/8] lib: iterator API for message properties
[notmuch-archives.git] / 3d / 04d2995232255de5ff5883bb0b25840b3f7cb5
1 Return-Path: <tomi.ollila@iki.fi>\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 42511431FAF\r
6         for <notmuch@notmuchmail.org>; Sat, 22 Sep 2012 13:03:37 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 KHrDBtxqfPtx for <notmuch@notmuchmail.org>;\r
16         Sat, 22 Sep 2012 13:03:36 -0700 (PDT)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id 33198431FAE\r
19         for <notmuch@notmuchmail.org>; Sat, 22 Sep 2012 13:03:36 -0700 (PDT)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id 9E0E310014F;\r
22         Sat, 22 Sep 2012 23:03:40 +0300 (EEST)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: Austin Clements <amdragon@MIT.EDU>,\r
25         Justus Winter <4winter@informatik.uni-hamburg.de>\r
26 Subject: Re: [PATCH 1/2] Annotate internal_error with the attribute noreturn\r
27 In-Reply-To: <20120922161256.GE26662@mit.edu>\r
28 References:\r
29  <1348231837-21700-1-git-send-email-4winter@informatik.uni-hamburg.de>\r
30         <20120922161256.GE26662@mit.edu>\r
31 User-Agent: Notmuch/0.13.2+177~g6720ee8 (http://notmuchmail.org) Emacs/24.2.1\r
32         (x86_64-unknown-linux-gnu)\r
33 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
34         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
35         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
36 Date: Sat, 22 Sep 2012 23:03:40 +0300\r
37 Message-ID: <m2a9whlt9f.fsf@guru.guru-group.fi>\r
38 MIME-Version: 1.0\r
39 Content-Type: text/plain\r
40 Cc: notmuch@notmuchmail.org\r
41 X-BeenThere: notmuch@notmuchmail.org\r
42 X-Mailman-Version: 2.1.13\r
43 Precedence: list\r
44 List-Id: "Use and development of the notmuch mail system."\r
45         <notmuch.notmuchmail.org>\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
49 List-Post: <mailto:notmuch@notmuchmail.org>\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
53 X-List-Received-Date: Sat, 22 Sep 2012 20:03:37 -0000\r
54 \r
55 On Sat, Sep 22 2012, Austin Clements wrote:\r
56 \r
57 > LGTM, though I agree with David that this should return void now, if\r
58 > that's possible.\r
59 >\r
60 > Do we want to wrap the __attribute__((noreturn)) in an #ifdef __GNUC__\r
61 > (or provide a PRINTF_ATTRIBUTE-like macro) or is that already a lost\r
62 > cause?\r
63 \r
64 Good point -- this should be NORETURN_ATTRIBUTE instead...\r
65 \r
66 Also, http://gcc.gnu.org/onlinedocs/gcc-4.3.2//gcc/Function-Attributes.html states:\r
67 \r
68 "It does not make sense for a noreturn function to have a return type other\r
69 than void."\r
70 \r
71 (I think that hasn't changed since :)\r
72 \r
73 Tomi\r
74 \r
75 >\r
76 > Quoth Justus Winter on Sep 21 at  2:50 pm:\r
77 >> Annotating functions that do not return with the noreturn attribute\r
78 >> (which is understood by both gcc and clang) prevents static analyzers\r
79 >> from generating false positives (internal_error is used to terminate\r
80 >> the process and is used extensively in error handling code paths).\r
81 >> \r
82 >> Remove the return statement that was placed there to appease the\r
83 >> compiler. Functions annotated with noreturn are not supposed to return\r
84 >> any values.\r
85 >> \r
86 >> Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>\r
87 >> ---\r
88 >>  util/error_util.c |    2 --\r
89 >>  util/error_util.h |    2 +-\r
90 >>  2 files changed, 1 insertion(+), 3 deletions(-)\r
91 >> \r
92 >> diff --git a/util/error_util.c b/util/error_util.c\r
93 >> index 630d228..3cf353a 100644\r
94 >> --- a/util/error_util.c\r
95 >> +++ b/util/error_util.c\r
96 >> @@ -35,7 +35,5 @@ _internal_error (const char *format, ...)\r
97 >>      vfprintf (stderr, format, va_args);\r
98 >>  \r
99 >>      exit (1);\r
100 >> -\r
101 >> -    return 1;\r
102 >>  }\r
103 >>  \r
104 >> diff --git a/util/error_util.h b/util/error_util.h\r
105 >> index bb15822..24a644b 100644\r
106 >> --- a/util/error_util.h\r
107 >> +++ b/util/error_util.h\r
108 >> @@ -30,7 +30,7 @@\r
109 >>   * Note that PRINTF_ATTRIBUTE comes from talloc.h\r
110 >>   */\r
111 >>  int\r
112 >> -_internal_error (const char *format, ...) PRINTF_ATTRIBUTE (1, 2);\r
113 >> +_internal_error (const char *format, ...) PRINTF_ATTRIBUTE (1, 2) __attribute__ ((noreturn));\r
114 >>  \r
115 >>  /* There's no point in continuing when we've detected that we've done\r
116 >>   * something wrong internally (as opposed to the user passing in a\r
117 > _______________________________________________\r
118 > notmuch mailing list\r
119 > notmuch@notmuchmail.org\r
120 > http://notmuchmail.org/mailman/listinfo/notmuch\r