notmuch/lib
Jani Nikula db465e443f lib: fix clang build
Long story short, fix build on recent (3.2+) clang.

The long story for posterity follows.

gcc 4.6 added new warnings about structs with greater visibility than
their fields. The warnings were silenced by adjusting visibility in

commit d5523ead90
Author: Carl Worth <cworth@cworth.org>
Date:   Wed May 11 13:23:13 2011 -0700

    Mark some structures in the library interface with visibility=default attribute.

Later on,

commit 3b76adf9e2
Author: Austin Clements <amdragon@MIT.EDU>
Date:   Sat Jan 14 19:17:33 2012 -0500

    lib: Add support for automatically excluding tags from queries

changed visibility of struct _notmuch_string_list for the same reason, and

commit 1a53f9f116
Author: Mark Walters <markwalters1009@gmail.com>
Date:   Thu Mar 1 22:30:38 2012 +0000

    lib: Add the exclude flag to notmuch_query_search_threads

split the struct _notmuch_string_list and its typedef
notmuch_string_list_t as a way to make a forward declaration for
_notmuch_thread_create().

The subtle difference was that the struct definition now had 'visible'
in it, while the typedef didn't, and it was within the #pragma GCC
visibility push(hidden) block. This went unnoticed, as the then common
versions of clang didn't care about this.

A later change in clang (I did not dig into when this change was
introduced) caused the following error:

CXX  -O2 lib/database.o
In file included from lib/database.cc:21:
In file included from ./lib/database-private.h:33:
./lib/notmuch-private.h:479:8: error: visibility does not match previous declaration
struct visible _notmuch_string_list {
       ^
./lib/notmuch-private.h:67:33: note: expanded from macro 'visible'
                                ^
./lib/notmuch-private.h:52:13: note: previous attribute is here
            ^
1 error generated.
make: *** [lib/database.o] Error 1

This is slightly misleading due to the reference to the #pragma. The
real culprit is the typedef within the #pragma.

We could just add 'visible' to the typedef, or move the typedef
outside of the #pragma, and be done with it, but juggle the
declarations a bit to accommodate moving the typedef back with the
struct, and keep the visibility attribute in one place.

The problem was originally reported by Simonas Kazlauskas
<s@kazlauskas.me> in id:20130418102507.GA23688@godbox but I was only
able to reproduce and investigate now that I upgraded clang.
2013-09-01 07:06:54 -03:00
..
database-private.h lib: add date range query support 2012-10-31 16:55:32 -03:00
database.cc cli: Guard deprecated g_type_init calls 2013-06-08 20:42:33 -03:00
directory.cc lib: Perform the same transformation to _notmuch_database_find_directory_id 2012-05-23 22:30:32 -03:00
filenames.c lib: fix NULL checks for filenames iterators 2012-09-01 23:03:11 -03:00
gen-version-script.sh lib/gen-version-script.h: add getline and getdelim to notmuch.sym if needed 2011-09-05 07:44:14 -03:00
index.cc _notmuch_message_index_file: unref (free) address lists from gmime. 2012-12-24 19:02:22 -04:00
libsha1.c fix sum moar typos [comments in source code] 2011-06-23 15:58:39 -07:00
libsha1.h fix sum moar typos [comments in source code] 2011-06-23 15:58:39 -07:00
Makefile fix sum moar typos [build scripts, Makefiles] 2011-06-23 15:44:59 -07:00
Makefile.local lib/Makefile.local: depend on libs we are linking with 2013-01-22 08:59:33 -04:00
message-file.c lib/message-file.c: use g_malloc () & g_free () in hash table values 2012-12-24 19:02:05 -04:00
message.cc lib/message.cc: stale pointer bug (v3) 2013-05-03 21:17:56 -03:00
messages.c lib: Eliminate _notmuch_message_list_append 2013-02-18 20:20:38 -04:00
notmuch-private.h lib: fix clang build 2013-09-01 07:06:54 -03:00
notmuch.h lib: Document which strings are returned in UTF-8 2013-08-13 17:43:34 +02:00
parse-time-vrp.cc lib: add date range query support 2012-10-31 16:55:32 -03:00
parse-time-vrp.h lib: add date range query support 2012-10-31 16:55:32 -03:00
query.cc lib: add NOTMUCH_EXCLUDE_FLAG to notmuch_exclude_t 2013-06-24 22:53:16 -07:00
sha1.c Typsos 2009-11-18 03:21:36 -08:00
string-list.c Fixup string list author 2011-03-21 02:45:18 -04:00
tags.c lib: fix warnings when building with clang 2012-12-01 08:10:32 -04:00
thread.cc lib: add NOTMUCH_EXCLUDE_FLAG to notmuch_exclude_t 2013-06-24 22:53:16 -07:00