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

As of gcc 4.6, there are new warnings from -Wattributes along the lines of:

	warning: ‘_notmuch_messages’ declared with greater visibility
	than the type of its field ‘_notmuch_messages::iterator’
	[-Wattributes]

To squelch these, we decorate all such containing structs with
__attribute__((visibility("default"))). We take care to let only the
C++ compiler see this, (since the C compiler would otherwise warn
about ignored visibility attributes on types).
This commit is contained in:
Carl Worth 2011-05-11 13:23:13 -07:00
parent 2f3a76c569
commit d5523ead90
4 changed files with 10 additions and 4 deletions

View file

@ -25,7 +25,7 @@
#include <gmime/gmime.h> #include <gmime/gmime.h>
struct _notmuch_message { struct visible _notmuch_message {
notmuch_database_t *notmuch; notmuch_database_t *notmuch;
Xapian::docid doc_id; Xapian::docid doc_id;
int frozen; int frozen;

View file

@ -81,6 +81,12 @@ _internal_error (const char *format, ...) PRINTF_ATTRIBUTE (1, 2);
#define unused(x) x __attribute__ ((unused)) #define unused(x) x __attribute__ ((unused))
#ifdef __cplusplus
# define visible __attribute__((visibility("default")))
#else
# define visible
#endif
/* Thanks to Andrew Tridgell's (SAMBA's) talloc for this definition of /* Thanks to Andrew Tridgell's (SAMBA's) talloc for this definition of
* unlikely. The talloc source code comes to us via the GNU LGPL v. 3. * unlikely. The talloc source code comes to us via the GNU LGPL v. 3.
*/ */
@ -405,7 +411,7 @@ typedef struct _notmuch_message_list {
* somewhere with some nasty C++ objects in it. We'll try to maintain * somewhere with some nasty C++ objects in it. We'll try to maintain
* ignorance of that here. (See notmuch_mset_messages_t in query.cc) * ignorance of that here. (See notmuch_mset_messages_t in query.cc)
*/ */
struct _notmuch_messages { struct visible _notmuch_messages {
notmuch_bool_t is_of_list_type; notmuch_bool_t is_of_list_type;
notmuch_message_node_t *iterator; notmuch_message_node_t *iterator;
}; };

View file

@ -44,7 +44,7 @@ struct _notmuch_doc_id_set {
#define DOCIDSET_WORD(bit) ((bit) / sizeof (unsigned int)) #define DOCIDSET_WORD(bit) ((bit) / sizeof (unsigned int))
#define DOCIDSET_BIT(bit) ((bit) % sizeof (unsigned int)) #define DOCIDSET_BIT(bit) ((bit) % sizeof (unsigned int))
struct _notmuch_threads { struct visible _notmuch_threads {
notmuch_query_t *query; notmuch_query_t *query;
/* The ordered list of doc ids matched by the query. */ /* The ordered list of doc ids matched by the query. */

View file

@ -24,7 +24,7 @@
#include <gmime/gmime.h> #include <gmime/gmime.h>
#include <glib.h> /* GHashTable */ #include <glib.h> /* GHashTable */
struct _notmuch_thread { struct visible _notmuch_thread {
notmuch_database_t *notmuch; notmuch_database_t *notmuch;
char *thread_id; char *thread_id;
char *subject; char *subject;