]> git.tuebingen.mpg.de Git - osl.git/commitdiff
Always compile with -fvisibility=hidden.
authorAndre Noll <maan@systemlinux.org>
Thu, 29 May 2008 20:39:16 +0000 (22:39 +0200)
committerAndre Noll <maan@systemlinux.org>
Thu, 29 May 2008 20:39:16 +0000 (22:39 +0200)
And explicitly mark exported functions with
__attribute__((visibility("default"))). This only works with gcc-4,
but hey, let's just require gcc-4.

Makefile
gcc-compat.h
osl.c

index 55c5922a26e05c3dfb893f950112ff38467005f6..70b83c70f9055846cd07aa7ddcc331fbf62e9497 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -45,6 +45,7 @@ CPPFLAGS += -Wmissing-format-attribute
 CPPFLAGS += -Wunused-macros
 CPPFLAGS += -Wbad-function-cast
 CPPFLAGS += -fPIC
 CPPFLAGS += -Wunused-macros
 CPPFLAGS += -Wbad-function-cast
 CPPFLAGS += -fPIC
+CPPFLAGS += -fvisibility=hidden
 
 Makefile.deps: $(wildcard *.c *.h)
        gcc -MM -MG *.c > $@
 
 Makefile.deps: $(wildcard *.c *.h)
        gcc -MM -MG *.c > $@
index 61c3c88d1c4551a965aaa22c626ddf8fabec31ba..5d905ed11a73dfd3027d3a770a383f90c5b5a859 100644 (file)
@@ -4,6 +4,8 @@
 # define __a_unused    __attribute__ ((unused))
 # define likely(x)     __builtin_expect (!!(x), 1)
 # define unlikely(x)   __builtin_expect (!!(x), 0)
 # define __a_unused    __attribute__ ((unused))
 # define likely(x)     __builtin_expect (!!(x), 1)
 # define unlikely(x)   __builtin_expect (!!(x), 0)
+# define __must_check  __attribute__ ((warn_unused_result))
+# define __export __attribute__((visibility("default")))
 /* 
  * p is the number of the "format string" parameter, and q is 
  * the number of the first variadic parameter 
 /* 
  * p is the number of the "format string" parameter, and q is 
  * the number of the first variadic parameter 
 #define  __printf_1_2 __printf(1,2)
 #define  __printf_2_3 __printf(2,3)
 
 #define  __printf_1_2 __printf(1,2)
 #define  __printf_2_3 __printf(2,3)
 
-# if __GNUC__ > 3  || (__GNUC__ == 3 && __GNUC_MINOR__ > 3)
-# define __must_check  __attribute__ ((warn_unused_result))
-# else
-# define __must_check  /* no warn_unused_result */
-# endif
-
 #define _static_inline_ static inline
 #define _static_inline_ static inline
diff --git a/osl.c b/osl.c
index 6369ceb5093d9ee5566e015d64a68049f6faa09a..3ec2f549e2d3ed916d1c300455f81519dc6f9544 100644 (file)
--- a/osl.c
+++ b/osl.c
@@ -661,7 +661,7 @@ static int create_table_index(struct osl_table *t)
  *
  * \return Standard.
  */
  *
  * \return Standard.
  */
-int osl_create_table(const struct osl_table_description *desc)
+__export int osl_create_table(const struct osl_table_description *desc)
 {
        const struct osl_column_description *cd;
        char *table_dir = NULL, *filename;
 {
        const struct osl_column_description *cd;
        char *table_dir = NULL, *filename;
@@ -1112,7 +1112,7 @@ void clear_rbtrees(struct osl_table *t)
  *
  * \sa osl_open_table(), unmap_table().
  */
  *
  * \sa osl_open_table(), unmap_table().
  */
-int osl_close_table(struct osl_table *t, enum osl_close_flags flags)
+__export int osl_close_table(struct osl_table *t, enum osl_close_flags flags)
 {
        int ret;
 
 {
        int ret;
 
@@ -1223,7 +1223,7 @@ int init_rbtrees(struct osl_table *t)
  *
  * \return Standard.
  */
  *
  * \return Standard.
  */
-int osl_open_table(const struct osl_table_description *table_desc,
+__export int osl_open_table(const struct osl_table_description *table_desc,
                struct osl_table **result)
 {
        int i, ret;
                struct osl_table **result)
 {
        int i, ret;
@@ -1429,7 +1429,7 @@ static int delete_disk_storage_file(const struct osl_table *t, unsigned col_num,
  *
  * \sa struct osl_table_description, osl_compare_func, osl_add_row().
  */
  *
  * \sa struct osl_table_description, osl_compare_func, osl_add_row().
  */
-int osl_add_and_get_row(struct osl_table *t, struct osl_object *objects,
+__export int osl_add_and_get_row(struct osl_table *t, struct osl_object *objects,
                struct osl_row **row)
 {
        int i, ret;
                struct osl_row **row)
 {
        int i, ret;
@@ -1581,7 +1581,7 @@ out:
  *
  * This is equivalent to osl_add_and_get_row(t, objects, NULL).
  */
  *
  * This is equivalent to osl_add_and_get_row(t, objects, NULL).
  */
-int osl_add_row(struct osl_table *t, struct osl_object *objects)
+__export int osl_add_row(struct osl_table *t, struct osl_object *objects)
 {
        return osl_add_and_get_row(t, objects, NULL);
 }
 {
        return osl_add_and_get_row(t, objects, NULL);
 }
@@ -1603,7 +1603,7 @@ int osl_add_row(struct osl_table *t, struct osl_object *objects)
  *
  * \sa osl_storage_type, osl_open_disk_object().
  */
  *
  * \sa osl_storage_type, osl_open_disk_object().
  */
-int osl_get_object(const struct osl_table *t, const struct osl_row *r,
+__export int osl_get_object(const struct osl_table *t, const struct osl_row *r,
        unsigned col_num, struct osl_object *object)
 {
        const struct osl_column_description *cd;
        unsigned col_num, struct osl_object *object)
 {
        const struct osl_column_description *cd;
@@ -1650,7 +1650,7 @@ static int mark_mapped_object_invalid(const struct osl_table *t,
  * \return Positive on success, negative on errors. Possible errors include:
  * \p E_BAD_TABLE, errors returned by osl_get_object().
  */
  * \return Positive on success, negative on errors. Possible errors include:
  * \p E_BAD_TABLE, errors returned by osl_get_object().
  */
-int osl_del_row(struct osl_table *t, struct osl_row *row)
+__export int osl_del_row(struct osl_table *t, struct osl_row *row)
 {
        struct osl_row *r = row;
        int i, ret;
 {
        struct osl_row *r = row;
        int i, ret;
@@ -1724,7 +1724,7 @@ static int check_rbtree_col(const struct osl_table *t, unsigned col_num,
  *
  * \sa osl_storage_flags
  */
  *
  * \sa osl_storage_flags
  */
-int osl_get_row(const struct osl_table *t, unsigned col_num,
+__export int osl_get_row(const struct osl_table *t, unsigned col_num,
                const struct osl_object *obj, struct osl_row **result)
 {
        int ret;
                const struct osl_object *obj, struct osl_row **result)
 {
        int ret;
@@ -1802,7 +1802,7 @@ static int rbtree_loop_reverse(struct osl_column *col,  void *private_data,
  *
  * \sa osl_storage_flags, osl_rbtree_loop_reverse(), osl_compare_func.
  */
  *
  * \sa osl_storage_flags, osl_rbtree_loop_reverse(), osl_compare_func.
  */
-int osl_rbtree_loop(const struct osl_table *t, unsigned col_num,
+__export int osl_rbtree_loop(const struct osl_table *t, unsigned col_num,
        void *private_data, osl_rbtree_loop_func *func)
 {
        struct osl_column *col;
        void *private_data, osl_rbtree_loop_func *func)
 {
        struct osl_column *col;
@@ -1828,7 +1828,7 @@ int osl_rbtree_loop(const struct osl_table *t, unsigned col_num,
  *
  * \sa osl_rbtree_loop().
  */
  *
  * \sa osl_rbtree_loop().
  */
-int osl_rbtree_loop_reverse(const struct osl_table *t, unsigned col_num,
+__export int osl_rbtree_loop_reverse(const struct osl_table *t, unsigned col_num,
        void *private_data, osl_rbtree_loop_func *func)
 {
        struct osl_column *col;
        void *private_data, osl_rbtree_loop_func *func)
 {
        struct osl_column *col;
@@ -1901,7 +1901,7 @@ out:
  *
  * \return Standard
  */
  *
  * \return Standard
  */
-int osl_update_object(struct osl_table *t, const struct osl_row *r,
+__export int osl_update_object(struct osl_table *t, const struct osl_row *r,
                unsigned col_num, struct osl_object *obj)
 {
        struct osl_column *col;
                unsigned col_num, struct osl_object *obj)
 {
        struct osl_column *col;
@@ -2002,7 +2002,7 @@ int osl_update_object(struct osl_table *t, const struct osl_row *r,
  *
  * \sa osl_get_object(), osl_storage_type, osl_close_disk_object().
  */
  *
  * \sa osl_get_object(), osl_storage_type, osl_close_disk_object().
  */
-int osl_open_disk_object(const struct osl_table *t, const struct osl_row *r,
+__export int osl_open_disk_object(const struct osl_table *t, const struct osl_row *r,
                unsigned col_num, struct osl_object *obj)
 {
        const struct osl_column_description *cd;
                unsigned col_num, struct osl_object *obj)
 {
        const struct osl_column_description *cd;
@@ -2037,7 +2037,7 @@ int osl_open_disk_object(const struct osl_table *t, const struct osl_row *r,
  *
  * \sa para_munmap().
  */
  *
  * \sa para_munmap().
  */
-int osl_close_disk_object(struct osl_object *obj)
+__export int osl_close_disk_object(struct osl_object *obj)
 {
        return para_munmap(obj->data, obj->size);
 }
 {
        return para_munmap(obj->data, obj->size);
 }
@@ -2052,7 +2052,7 @@ int osl_close_disk_object(struct osl_object *obj)
  *
  * \return Positive on success, \p -E_BAD_TABLE if \a t is \p NULL.
  */
  *
  * \return Positive on success, \p -E_BAD_TABLE if \a t is \p NULL.
  */
-int osl_get_num_rows(const struct osl_table *t, unsigned *num_rows)
+__export int osl_get_num_rows(const struct osl_table *t, unsigned *num_rows)
 {
        if (!t)
                return -E_BAD_TABLE;
 {
        if (!t)
                return -E_BAD_TABLE;
@@ -2077,7 +2077,7 @@ int osl_get_num_rows(const struct osl_table *t, unsigned *num_rows)
  *
  * \sa osl_get_nth_row().
  */
  *
  * \sa osl_get_nth_row().
  */
-int osl_get_rank(const struct osl_table *t, struct osl_row *r,
+__export int osl_get_rank(const struct osl_table *t, struct osl_row *r,
                unsigned col_num, unsigned *rank)
 {
        struct osl_object obj;
                unsigned col_num, unsigned *rank)
 {
        struct osl_object obj;
@@ -2119,7 +2119,7 @@ int osl_get_rank(const struct osl_table *t, struct osl_row *r,
  * \sa osl_storage_flags, osl_compare_func, osl_get_row(),
  * osl_rbtree_last_row(), osl_rbtree_first_row(), osl_get_rank().
  */
  * \sa osl_storage_flags, osl_compare_func, osl_get_row(),
  * osl_rbtree_last_row(), osl_rbtree_first_row(), osl_get_rank().
  */
-int osl_get_nth_row(const struct osl_table *t, unsigned col_num,
+__export int osl_get_nth_row(const struct osl_table *t, unsigned col_num,
                unsigned n, struct osl_row **result)
 {
        struct osl_column *col;
                unsigned n, struct osl_row **result)
 {
        struct osl_column *col;
@@ -2160,7 +2160,7 @@ int osl_get_nth_row(const struct osl_table *t, unsigned col_num,
  *
  * \sa osl_get_nth_row(), osl_rbtree_last_row().
  */
  *
  * \sa osl_get_nth_row(), osl_rbtree_last_row().
  */
-int osl_rbtree_first_row(const struct osl_table *t, unsigned col_num,
+__export int osl_rbtree_first_row(const struct osl_table *t, unsigned col_num,
                struct osl_row **result)
 {
        return osl_get_nth_row(t, col_num, 1, result);
                struct osl_row **result)
 {
        return osl_get_nth_row(t, col_num, 1, result);
@@ -2181,7 +2181,7 @@ int osl_rbtree_first_row(const struct osl_table *t, unsigned col_num,
  *
  * \sa osl_get_nth_row(), osl_rbtree_first_row().
  */
  *
  * \sa osl_get_nth_row(), osl_rbtree_first_row().
  */
-int osl_rbtree_last_row(const struct osl_table *t, unsigned col_num,
+__export int osl_rbtree_last_row(const struct osl_table *t, unsigned col_num,
                struct osl_row **result)
 {
        unsigned num_rows;
                struct osl_row **result)
 {
        unsigned num_rows;