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 2019E421163
\r
6 for <notmuch@notmuchmail.org>; Sun, 18 Aug 2013 11:39:05 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\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 728nWLq3xUFk for <notmuch@notmuchmail.org>;
\r
16 Sun, 18 Aug 2013 11:39:00 -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 49D47431FDB
\r
19 for <notmuch@notmuchmail.org>; Sun, 18 Aug 2013 11:39:00 -0700 (PDT)
\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])
\r
21 by guru.guru-group.fi (Postfix) with ESMTP id E5515100086;
\r
22 Sun, 18 Aug 2013 21:38:55 +0300 (EEST)
\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
24 To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org
\r
25 Subject: Re: [PATCH] lib: fix clang build
\r
26 In-Reply-To: <1376775001-16528-1-git-send-email-jani@nikula.org>
\r
27 References: <1376775001-16528-1-git-send-email-jani@nikula.org>
\r
28 User-Agent: Notmuch/0.16+3~g340c058 (http://notmuchmail.org) Emacs/24.3.1
\r
29 (x86_64-unknown-linux-gnu)
\r
30 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL
\r
31 $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F
\r
32 !)g;OY^,BjTbr)Np:%c_o'jj,Z
\r
33 Date: Sun, 18 Aug 2013 21:38:55 +0300
\r
34 Message-ID: <m2txim7sjk.fsf@guru.guru-group.fi>
\r
36 Content-Type: text/plain
\r
37 Cc: Simonas Kazlauskas <s@kazlauskas.me>
\r
38 X-BeenThere: notmuch@notmuchmail.org
\r
39 X-Mailman-Version: 2.1.13
\r
41 List-Id: "Use and development of the notmuch mail system."
\r
42 <notmuch.notmuchmail.org>
\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
44 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
46 List-Post: <mailto:notmuch@notmuchmail.org>
\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
49 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
50 X-List-Received-Date: Sun, 18 Aug 2013 18:39:05 -0000
\r
52 On Sun, Aug 18 2013, Jani Nikula <jani@nikula.org> wrote:
\r
54 > Long story short, fix build on recent (3.2+) clang.
\r
56 > The long story for posterity follows.
\r
58 > gcc 4.6 added new warnings about structs with greater visibility than
\r
59 > their fields. The warnings were silenced by adjusting visibility in
\r
61 > commit d5523ead90b6be2b07d4af745b8ed9b980a6b9f1
\r
62 > Author: Carl Worth <cworth@cworth.org>
\r
63 > Date: Wed May 11 13:23:13 2011 -0700
\r
65 > Mark some structures in the library interface with visibility=default attribute.
\r
69 > commit 3b76adf9e2c026dd03b820f4c6eab50e25444113
\r
70 > Author: Austin Clements <amdragon@MIT.EDU>
\r
71 > Date: Sat Jan 14 19:17:33 2012 -0500
\r
73 > lib: Add support for automatically excluding tags from queries
\r
75 > changed visibility of struct _notmuch_string_list for the same reason, and
\r
77 > commit 1a53f9f116fa7c460cda3df532be921baaafb082
\r
78 > Author: Mark Walters <markwalters1009@gmail.com>
\r
79 > Date: Thu Mar 1 22:30:38 2012 +0000
\r
81 > lib: Add the exclude flag to notmuch_query_search_threads
\r
83 > split the struct _notmuch_string_list and its typedef
\r
84 > notmuch_string_list_t as a way to make a forward declaration for
\r
85 > _notmuch_thread_create().
\r
87 > The subtle difference was that the struct definition now had 'visible'
\r
88 > in it, while the typedef didn't, and it was within the #pragma GCC
\r
89 > visibility push(hidden) block. This went unnoticed, as the then common
\r
90 > versions of clang didn't care about this.
\r
92 > A later change in clang (I did not dig into when this change was
\r
93 > introduced) caused the following error:
\r
95 > CXX -O2 lib/database.o
\r
96 > In file included from lib/database.cc:21:
\r
97 > In file included from ./lib/database-private.h:33:
\r
98 > ./lib/notmuch-private.h:479:8: error: visibility does not match previous declaration
\r
99 > struct visible _notmuch_string_list {
\r
101 > ./lib/notmuch-private.h:67:33: note: expanded from macro 'visible'
\r
103 > ./lib/notmuch-private.h:52:13: note: previous attribute is here
\r
105 > 1 error generated.
\r
106 > make: *** [lib/database.o] Error 1
\r
108 > This is slightly misleading due to the reference to the #pragma. The
\r
109 > real culprit is the typedef within the #pragma.
\r
111 > We could just add 'visible' to the typedef, or move the typedef
\r
112 > outside of the #pragma, and be done with it, but juggle the
\r
113 > declarations a bit to accommodate moving the typedef back with the
\r
114 > struct, and keep the visibility attribute in one place.
\r
116 > The problem was originally reported by Simonas Kazlauskas
\r
117 > <s@kazlauskas.me> in id:20130418102507.GA23688@godbox but I was only
\r
118 > able to reproduce and investigate now that I upgraded clang.
\r
120 > lib/notmuch-private.h | 28 +++++++++++++---------------
\r
121 > 1 file changed, 13 insertions(+), 15 deletions(-)
\r
123 > diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
\r
124 > index eced03e..af185c7 100644
\r
125 > --- a/lib/notmuch-private.h
\r
126 > +++ b/lib/notmuch-private.h
\r
127 > @@ -162,8 +162,6 @@ typedef enum _notmuch_find_flags {
\r
129 > typedef struct _notmuch_doc_id_set notmuch_doc_id_set_t;
\r
131 Looks good to me (except log message is a bit excessive (?) maybe
\r
132 it is reasonable to have it, though (TL;DR ;)...
\r
134 > -typedef struct _notmuch_string_list notmuch_string_list_t;
\r
139 typedef struct visible _notmuch_string_list notmuch_string_list_t;
\r
141 have helped here (if yes is your resolution nicer ?? :D )
\r
146 > /* database.cc */
\r
148 > /* Lookup a prefix value by name.
\r
149 > @@ -228,17 +226,6 @@ _notmuch_directory_create (notmuch_database_t *notmuch,
\r
151 > _notmuch_directory_get_document_id (notmuch_directory_t *directory);
\r
155 > -notmuch_thread_t *
\r
156 > -_notmuch_thread_create (void *ctx,
\r
157 > - notmuch_database_t *notmuch,
\r
158 > - unsigned int seed_doc_id,
\r
159 > - notmuch_doc_id_set_t *match_set,
\r
160 > - notmuch_string_list_t *excluded_terms,
\r
161 > - notmuch_exclude_t omit_exclude,
\r
162 > - notmuch_sort_t sort);
\r
166 > notmuch_message_t *
\r
167 > @@ -476,11 +463,11 @@ typedef struct _notmuch_string_node {
\r
168 > struct _notmuch_string_node *next;
\r
169 > } notmuch_string_node_t;
\r
171 > -struct visible _notmuch_string_list {
\r
172 > +typedef struct visible _notmuch_string_list {
\r
174 > notmuch_string_node_t *head;
\r
175 > notmuch_string_node_t **tail;
\r
177 > +} notmuch_string_list_t;
\r
179 > notmuch_string_list_t *
\r
180 > _notmuch_string_list_create (const void *ctx);
\r
181 > @@ -509,6 +496,17 @@ notmuch_filenames_t *
\r
182 > _notmuch_filenames_create (const void *ctx,
\r
183 > notmuch_string_list_t *list);
\r
187 > +notmuch_thread_t *
\r
188 > +_notmuch_thread_create (void *ctx,
\r
189 > + notmuch_database_t *notmuch,
\r
190 > + unsigned int seed_doc_id,
\r
191 > + notmuch_doc_id_set_t *match_set,
\r
192 > + notmuch_string_list_t *excluded_terms,
\r
193 > + notmuch_exclude_t omit_exclude,
\r
194 > + notmuch_sort_t sort);
\r
196 > NOTMUCH_END_DECLS
\r
198 > #ifdef __cplusplus
\r
202 > _______________________________________________
\r
203 > notmuch mailing list
\r
204 > notmuch@notmuchmail.org
\r
205 > http://notmuchmail.org/mailman/listinfo/notmuch
\r