Re: Hi all
[notmuch-archives.git] / 24 / 3ec87824545a34b347e34ead406ce8b2c9a295
1 Return-Path: <jani@nikula.org>\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 ECC5E429E59\r
6         for <notmuch@notmuchmail.org>; Sun, 18 Aug 2013 11:58:00 -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.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 ToFk+A7toAv9 for <notmuch@notmuchmail.org>;\r
16         Sun, 18 Aug 2013 11:57:55 -0700 (PDT)\r
17 Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com\r
18         [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 12169431FDB\r
21         for <notmuch@notmuchmail.org>; Sun, 18 Aug 2013 11:57:54 -0700 (PDT)\r
22 Received: by mail-bk0-f53.google.com with SMTP id d7so1205213bkh.12\r
23         for <notmuch@notmuchmail.org>; Sun, 18 Aug 2013 11:57:53 -0700 (PDT)\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
25         d=google.com; s=20120113;\r
26         h=x-gm-message-state:from:to:cc:subject:in-reply-to:references\r
27         :user-agent:date:message-id:mime-version:content-type;\r
28         bh=O/tTDsO9B3j/dlFKE7Dhqe0FUvBArLs2gjWiXh8JYTA=;\r
29         b=APpURbZIoXe9MJDnYNNk1p+mATSph2hQSNCgBNRa8Lgn1jHhM+CgKtf0bfMzJyxlUH\r
30         L1RkjAX0DHH47amfPUfAV3JXHfeBV/UaGquDpvPoYQoxOhH9m/LlR00lIEWgOFtoCVCU\r
31         b9D97Uuh5NVzL0HQBqLQ75D4fglIo1ZJrGS0xtP3CdyTRUgwQGyPkAU3GJSPQXzIf8nC\r
32         OtF03MLW6F9bHQe9nuPOA2lHA9eZEJpRbfCsdBK7ifdtx+9jB4w0h17j4VLdQnKG63oa\r
33         RIdI2h0W/S7vknI2NNfUZ7CFtBMr+PrcFQUKB4sygqMWFdpLQGdlEzLIy4qId6nc9xzK\r
34         7t6Q==\r
35 X-Gm-Message-State:\r
36  ALoCoQmzxuV9WF2x2XKkPU9qsv7pUsrtf4ANfoThit/omK/Oul43iQ/ipBGOWKQ7zFAT8N/dlJ+F\r
37 X-Received: by 10.204.62.201 with SMTP id y9mr1546025bkh.23.1376852273669;\r
38         Sun, 18 Aug 2013 11:57:53 -0700 (PDT)\r
39 Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.\r
40         [88.195.111.91]) by mx.google.com with ESMTPSA id\r
41         if11sm1085185bkc.15.1969.12.31.16.00.00\r
42         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
43         Sun, 18 Aug 2013 11:57:52 -0700 (PDT)\r
44 From: Jani Nikula <jani@nikula.org>\r
45 To: Tomi Ollila <tomi.ollila@iki.fi>, notmuch@notmuchmail.org\r
46 Subject: Re: [PATCH] lib: fix clang build\r
47 In-Reply-To: <m2txim7sjk.fsf@guru.guru-group.fi>\r
48 References: <1376775001-16528-1-git-send-email-jani@nikula.org>\r
49         <m2txim7sjk.fsf@guru.guru-group.fi>\r
50 User-Agent: Notmuch/0.15.2+227~g40b2846 (http://notmuchmail.org) Emacs/24.3.1\r
51         (x86_64-pc-linux-gnu)\r
52 Date: Sun, 18 Aug 2013 21:57:52 +0300\r
53 Message-ID: <87r4dqesi7.fsf@nikula.org>\r
54 MIME-Version: 1.0\r
55 Content-Type: text/plain\r
56 Cc: Simonas Kazlauskas <s@kazlauskas.me>\r
57 X-BeenThere: notmuch@notmuchmail.org\r
58 X-Mailman-Version: 2.1.13\r
59 Precedence: list\r
60 List-Id: "Use and development of the notmuch mail system."\r
61         <notmuch.notmuchmail.org>\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
63         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
65 List-Post: <mailto:notmuch@notmuchmail.org>\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
68         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
69 X-List-Received-Date: Sun, 18 Aug 2013 18:58:01 -0000\r
70 \r
71 On Sun, 18 Aug 2013, Tomi Ollila <tomi.ollila@iki.fi> wrote:\r
72 > On Sun, Aug 18 2013, Jani Nikula <jani@nikula.org> wrote:\r
73 >\r
74 >> Long story short, fix build on recent (3.2+) clang.\r
75 >>\r
76 >> The long story for posterity follows.\r
77 >>\r
78 >> gcc 4.6 added new warnings about structs with greater visibility than\r
79 >> their fields. The warnings were silenced by adjusting visibility in\r
80 >>\r
81 >> commit d5523ead90b6be2b07d4af745b8ed9b980a6b9f1\r
82 >> Author: Carl Worth <cworth@cworth.org>\r
83 >> Date:   Wed May 11 13:23:13 2011 -0700\r
84 >>\r
85 >>     Mark some structures in the library interface with visibility=default attribute.\r
86 >>\r
87 >> Later on,\r
88 >>\r
89 >> commit 3b76adf9e2c026dd03b820f4c6eab50e25444113\r
90 >> Author: Austin Clements <amdragon@MIT.EDU>\r
91 >> Date:   Sat Jan 14 19:17:33 2012 -0500\r
92 >>\r
93 >>     lib: Add support for automatically excluding tags from queries\r
94 >>\r
95 >> changed visibility of struct _notmuch_string_list for the same reason, and\r
96 >>\r
97 >> commit 1a53f9f116fa7c460cda3df532be921baaafb082\r
98 >> Author: Mark Walters <markwalters1009@gmail.com>\r
99 >> Date:   Thu Mar 1 22:30:38 2012 +0000\r
100 >>\r
101 >>     lib: Add the exclude flag to notmuch_query_search_threads\r
102 >>\r
103 >> split the struct _notmuch_string_list and its typedef\r
104 >> notmuch_string_list_t as a way to make a forward declaration for\r
105 >> _notmuch_thread_create().\r
106 >>\r
107 >> The subtle difference was that the struct definition now had 'visible'\r
108 >> in it, while the typedef didn't, and it was within the #pragma GCC\r
109 >> visibility push(hidden) block. This went unnoticed, as the then common\r
110 >> versions of clang didn't care about this.\r
111 >>\r
112 >> A later change in clang (I did not dig into when this change was\r
113 >> introduced) caused the following error:\r
114 >>\r
115 >> CXX  -O2 lib/database.o\r
116 >> In file included from lib/database.cc:21:\r
117 >> In file included from ./lib/database-private.h:33:\r
118 >> ./lib/notmuch-private.h:479:8: error: visibility does not match previous declaration\r
119 >> struct visible _notmuch_string_list {\r
120 >>        ^\r
121 >> ./lib/notmuch-private.h:67:33: note: expanded from macro 'visible'\r
122 >>                                 ^\r
123 >> ./lib/notmuch-private.h:52:13: note: previous attribute is here\r
124 >>             ^\r
125 >> 1 error generated.\r
126 >> make: *** [lib/database.o] Error 1\r
127 >>\r
128 >> This is slightly misleading due to the reference to the #pragma. The\r
129 >> real culprit is the typedef within the #pragma.\r
130 >>\r
131 >> We could just add 'visible' to the typedef, or move the typedef\r
132 >> outside of the #pragma, and be done with it, but juggle the\r
133 >> declarations a bit to accommodate moving the typedef back with the\r
134 >> struct, and keep the visibility attribute in one place.\r
135 >>\r
136 >> The problem was originally reported by Simonas Kazlauskas\r
137 >> <s@kazlauskas.me> in id:20130418102507.GA23688@godbox but I was only\r
138 >> able to reproduce and investigate now that I upgraded clang.\r
139 >> ---\r
140 >>  lib/notmuch-private.h |   28 +++++++++++++---------------\r
141 >>  1 file changed, 13 insertions(+), 15 deletions(-)\r
142 >>\r
143 >> diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h\r
144 >> index eced03e..af185c7 100644\r
145 >> --- a/lib/notmuch-private.h\r
146 >> +++ b/lib/notmuch-private.h\r
147 >> @@ -162,8 +162,6 @@ typedef enum _notmuch_find_flags {\r
148 >>  \r
149 >>  typedef struct _notmuch_doc_id_set notmuch_doc_id_set_t;\r
150 >\r
151 > Looks good to me (except log message is a bit excessive (?) maybe\r
152 > it is reasonable to have it, though (TL;DR ;)...\r
153 >>  \r
154 >> -typedef struct _notmuch_string_list notmuch_string_list_t;\r
155 >> -\r
156 >\r
157 > anyway, would\r
158 >\r
159 > typedef struct visible _notmuch_string_list notmuch_string_list_t;\r
160 >\r
161 > have helped here (if yes is your resolution nicer ?? :D )\r
162 \r
163 Yes, it would have. Read the commit message! :p\r
164 \r
165 Jani.\r
166 \r
167 \r
168 >\r
169 > Tomi\r
170 >\r
171 >\r
172 >>  /* database.cc */\r
173 >>  \r
174 >>  /* Lookup a prefix value by name.\r
175 >> @@ -228,17 +226,6 @@ _notmuch_directory_create (notmuch_database_t *notmuch,\r
176 >>  unsigned int\r
177 >>  _notmuch_directory_get_document_id (notmuch_directory_t *directory);\r
178 >>  \r
179 >> -/* thread.cc */\r
180 >> -\r
181 >> -notmuch_thread_t *\r
182 >> -_notmuch_thread_create (void *ctx,\r
183 >> -                    notmuch_database_t *notmuch,\r
184 >> -                    unsigned int seed_doc_id,\r
185 >> -                    notmuch_doc_id_set_t *match_set,\r
186 >> -                    notmuch_string_list_t *excluded_terms,\r
187 >> -                    notmuch_exclude_t omit_exclude,\r
188 >> -                    notmuch_sort_t sort);\r
189 >> -\r
190 >>  /* message.cc */\r
191 >>  \r
192 >>  notmuch_message_t *\r
193 >> @@ -476,11 +463,11 @@ typedef struct _notmuch_string_node {\r
194 >>      struct _notmuch_string_node *next;\r
195 >>  } notmuch_string_node_t;\r
196 >>  \r
197 >> -struct visible _notmuch_string_list {\r
198 >> +typedef struct visible _notmuch_string_list {\r
199 >>      int length;\r
200 >>      notmuch_string_node_t *head;\r
201 >>      notmuch_string_node_t **tail;\r
202 >> -};\r
203 >> +} notmuch_string_list_t;\r
204 >>  \r
205 >>  notmuch_string_list_t *\r
206 >>  _notmuch_string_list_create (const void *ctx);\r
207 >> @@ -509,6 +496,17 @@ notmuch_filenames_t *\r
208 >>  _notmuch_filenames_create (const void *ctx,\r
209 >>                         notmuch_string_list_t *list);\r
210 >>  \r
211 >> +/* thread.cc */\r
212 >> +\r
213 >> +notmuch_thread_t *\r
214 >> +_notmuch_thread_create (void *ctx,\r
215 >> +                    notmuch_database_t *notmuch,\r
216 >> +                    unsigned int seed_doc_id,\r
217 >> +                    notmuch_doc_id_set_t *match_set,\r
218 >> +                    notmuch_string_list_t *excluded_terms,\r
219 >> +                    notmuch_exclude_t omit_exclude,\r
220 >> +                    notmuch_sort_t sort);\r
221 >> +\r
222 >>  NOTMUCH_END_DECLS\r
223 >>  \r
224 >>  #ifdef __cplusplus\r
225 >> -- \r
226 >> 1.7.10.4\r
227 >>\r
228 >> _______________________________________________\r
229 >> notmuch mailing list\r
230 >> notmuch@notmuchmail.org\r
231 >> http://notmuchmail.org/mailman/listinfo/notmuch\r