From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id ECC5E429E59 for ; Sun, 18 Aug 2013 11:58:00 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ToFk+A7toAv9 for ; Sun, 18 Aug 2013 11:57:55 -0700 (PDT) Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 12169431FDB for ; Sun, 18 Aug 2013 11:57:54 -0700 (PDT) Received: by mail-bk0-f53.google.com with SMTP id d7so1205213bkh.12 for ; Sun, 18 Aug 2013 11:57:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-type; bh=O/tTDsO9B3j/dlFKE7Dhqe0FUvBArLs2gjWiXh8JYTA=; b=APpURbZIoXe9MJDnYNNk1p+mATSph2hQSNCgBNRa8Lgn1jHhM+CgKtf0bfMzJyxlUH L1RkjAX0DHH47amfPUfAV3JXHfeBV/UaGquDpvPoYQoxOhH9m/LlR00lIEWgOFtoCVCU b9D97Uuh5NVzL0HQBqLQ75D4fglIo1ZJrGS0xtP3CdyTRUgwQGyPkAU3GJSPQXzIf8nC OtF03MLW6F9bHQe9nuPOA2lHA9eZEJpRbfCsdBK7ifdtx+9jB4w0h17j4VLdQnKG63oa RIdI2h0W/S7vknI2NNfUZ7CFtBMr+PrcFQUKB4sygqMWFdpLQGdlEzLIy4qId6nc9xzK 7t6Q== X-Gm-Message-State: ALoCoQmzxuV9WF2x2XKkPU9qsv7pUsrtf4ANfoThit/omK/Oul43iQ/ipBGOWKQ7zFAT8N/dlJ+F X-Received: by 10.204.62.201 with SMTP id y9mr1546025bkh.23.1376852273669; Sun, 18 Aug 2013 11:57:53 -0700 (PDT) Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi. [88.195.111.91]) by mx.google.com with ESMTPSA id if11sm1085185bkc.15.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 18 Aug 2013 11:57:52 -0700 (PDT) From: Jani Nikula To: Tomi Ollila , notmuch@notmuchmail.org Subject: Re: [PATCH] lib: fix clang build In-Reply-To: References: <1376775001-16528-1-git-send-email-jani@nikula.org> User-Agent: Notmuch/0.15.2+227~g40b2846 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Sun, 18 Aug 2013 21:57:52 +0300 Message-ID: <87r4dqesi7.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain Cc: Simonas Kazlauskas X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2013 18:58:01 -0000 On Sun, 18 Aug 2013, Tomi Ollila wrote: > On Sun, Aug 18 2013, Jani Nikula wrote: > >> 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 d5523ead90b6be2b07d4af745b8ed9b980a6b9f1 >> Author: Carl Worth >> Date: Wed May 11 13:23:13 2011 -0700 >> >> Mark some structures in the library interface with visibility=default attribute. >> >> Later on, >> >> commit 3b76adf9e2c026dd03b820f4c6eab50e25444113 >> Author: Austin Clements >> 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 1a53f9f116fa7c460cda3df532be921baaafb082 >> Author: Mark Walters >> 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 >> in id:20130418102507.GA23688@godbox but I was only >> able to reproduce and investigate now that I upgraded clang. >> --- >> lib/notmuch-private.h | 28 +++++++++++++--------------- >> 1 file changed, 13 insertions(+), 15 deletions(-) >> >> diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h >> index eced03e..af185c7 100644 >> --- a/lib/notmuch-private.h >> +++ b/lib/notmuch-private.h >> @@ -162,8 +162,6 @@ typedef enum _notmuch_find_flags { >> >> typedef struct _notmuch_doc_id_set notmuch_doc_id_set_t; > > Looks good to me (except log message is a bit excessive (?) maybe > it is reasonable to have it, though (TL;DR ;)... >> >> -typedef struct _notmuch_string_list notmuch_string_list_t; >> - > > anyway, would > > typedef struct visible _notmuch_string_list notmuch_string_list_t; > > have helped here (if yes is your resolution nicer ?? :D ) Yes, it would have. Read the commit message! :p Jani. > > Tomi > > >> /* database.cc */ >> >> /* Lookup a prefix value by name. >> @@ -228,17 +226,6 @@ _notmuch_directory_create (notmuch_database_t *notmuch, >> unsigned int >> _notmuch_directory_get_document_id (notmuch_directory_t *directory); >> >> -/* thread.cc */ >> - >> -notmuch_thread_t * >> -_notmuch_thread_create (void *ctx, >> - notmuch_database_t *notmuch, >> - unsigned int seed_doc_id, >> - notmuch_doc_id_set_t *match_set, >> - notmuch_string_list_t *excluded_terms, >> - notmuch_exclude_t omit_exclude, >> - notmuch_sort_t sort); >> - >> /* message.cc */ >> >> notmuch_message_t * >> @@ -476,11 +463,11 @@ typedef struct _notmuch_string_node { >> struct _notmuch_string_node *next; >> } notmuch_string_node_t; >> >> -struct visible _notmuch_string_list { >> +typedef struct visible _notmuch_string_list { >> int length; >> notmuch_string_node_t *head; >> notmuch_string_node_t **tail; >> -}; >> +} notmuch_string_list_t; >> >> notmuch_string_list_t * >> _notmuch_string_list_create (const void *ctx); >> @@ -509,6 +496,17 @@ notmuch_filenames_t * >> _notmuch_filenames_create (const void *ctx, >> notmuch_string_list_t *list); >> >> +/* thread.cc */ >> + >> +notmuch_thread_t * >> +_notmuch_thread_create (void *ctx, >> + notmuch_database_t *notmuch, >> + unsigned int seed_doc_id, >> + notmuch_doc_id_set_t *match_set, >> + notmuch_string_list_t *excluded_terms, >> + notmuch_exclude_t omit_exclude, >> + notmuch_sort_t sort); >> + >> NOTMUCH_END_DECLS >> >> #ifdef __cplusplus >> -- >> 1.7.10.4 >> >> _______________________________________________ >> notmuch mailing list >> notmuch@notmuchmail.org >> http://notmuchmail.org/mailman/listinfo/notmuch