[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Tue Nov 10 08:18:05 UTC 2020


The branch, master has been updated
       via  18fdfe8c102 winbind: alternatively use prama fini for destructors if supported
       via  f13e1ca54a2 talloc: alternatively use prama init for constructors if supported
       via  c32eb006108 waf: check for pragma init/fini support for constructors/destructors
       via  37b81f91168 util_net: fix a statement not reached warning
       via  c305ab07709 ldb_parse_test: studio compiler doesn't like empty struct definitions
       via  918317124ac ldb_key_value_test: studio compiler doesn't like empty struct definitions
       via  c862ad64aea ldb_kv_index: fix empty initializer compile warning
       via  e4f3354821a torture/sharemode: fix empty initializer compile warning
       via  aa8d6c779ca pidl: use unused attribute only if supported by feature macro
       via  3c1013caf4b tdb: fix studio compiler build
       via  268fcfdd5aa talloc/pytalloc: fix studio compler build
       via  6b855429b96 talloc: fix studio compiler build
       via  cce4e8012c5 auth_generic: fix empty initializer compile warning
       via  a4e90cfec49 http_conn.c: fix "void function cannot return value" error
       via  bbfd93f7b63 debug: remove a cast, which makes the Solaris Studio compiler unhappy
       via  a223c5b5b7f waf: use _POSIX_PTHREAD_SEMANTIC on Solaris
       via  104b3545e08 heimdal_build: silence warning: macro redefined
       via  edb1012536e replace: define BOOL_DEFINED to fix header yp_prot header check on Solaris
       via  b9e8959c3d5 waf/texpect: add required nsl dependency for Solaris
       via  96e2cf7905e replace/waf: fix libnsl checking on Solaris
      from  be03ce7d8bb manpages/vfs_glusterfs: Mention silent skipping of write-behind translator

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 18fdfe8c10291e04b6a54499d74a6ee15652f5db
Author: Björn Jacke <bj at sernet.de>
Date:   Fri Oct 30 12:59:06 2020 +0100

    winbind: alternatively use prama fini for destructors if supported
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Tue Nov 10 08:17:53 UTC 2020 on sn-devel-184

commit f13e1ca54a2a448dd87809496e4b6da5af1589e8
Author: Björn Jacke <bj at sernet.de>
Date:   Fri Oct 30 12:57:42 2020 +0100

    talloc: alternatively use prama init for constructors if supported
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit c32eb006108c69a99c651e11a0a4160359e52145
Author: Björn Jacke <bj at sernet.de>
Date:   Fri Oct 30 12:55:54 2020 +0100

    waf: check for pragma init/fini support for constructors/destructors
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 37b81f9116825e0fc0fcd62aa957655fe5c83f19
Author: Björn Jacke <bj at sernet.de>
Date:   Mon Oct 26 11:30:06 2020 +0100

    util_net: fix a statement not reached warning
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit c305ab07709bcb5eba11568ac2fd625410f441e2
Author: Björn Jacke <bj at sernet.de>
Date:   Mon Oct 26 12:49:05 2020 +0100

    ldb_parse_test: studio compiler doesn't like empty struct definitions
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 918317124acbb4b0f0d12eeeae79eafdfddaa49c
Author: Björn Jacke <bj at sernet.de>
Date:   Sun Oct 25 17:13:57 2020 +0100

    ldb_key_value_test: studio compiler doesn't like empty struct definitions
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit c862ad64aea31d1d5ec66385bb50d9b97e609071
Author: Björn Jacke <bj at sernet.de>
Date:   Mon Oct 19 02:39:46 2020 +0200

    ldb_kv_index: fix empty initializer compile warning
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit e4f3354821a919ec60eb3af55709e7055513cc24
Author: Björn Jacke <bj at sernet.de>
Date:   Mon Oct 19 02:35:02 2020 +0200

    torture/sharemode: fix empty initializer compile warning
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit aa8d6c779ca89d6be1c8b973d3ea60e6073bf899
Author: Björn Jacke <bj at sernet.de>
Date:   Mon Oct 19 02:03:02 2020 +0200

    pidl: use unused attribute only if supported by feature macro
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 3c1013caf4b57c6af5a5d210df232c08a1227a17
Author: Björn Jacke <bj at sernet.de>
Date:   Thu Mar 7 12:50:29 2019 +0100

    tdb: fix studio compiler build
    
    Solaris Studio compiler 12.4 is pedantic about prototypes in headers having
    the external visibility declarations too. It throws errors like:
    
    redeclaration must have the same or more restrictive linker scoping: ...
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 268fcfdd5aa3adbcd6486090ee56aad6e6902a12
Author: Björn Jacke <bj at sernet.de>
Date:   Sun Oct 18 21:55:22 2020 +0200

    talloc/pytalloc: fix studio compler build
    
    Solaris Studio compiler 12.4 is pedantic about prototypes in headers having
    the external visibility declarations too. It throws errors like:
    
    redeclaration must have the same or more restrictive linker scoping: ...
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 6b855429b969a1c30e7a57c3aa139c62abb7c98f
Author: Björn Jacke <bj at sernet.de>
Date:   Thu Mar 7 00:40:12 2019 +0100

    talloc: fix studio compiler build
    
    Solaris Studio compiler 12.4 is pedantic about prototypes in headers having
    the external visibility declarations too. It throws errors like:
    
    redeclaration must have the same or more restrictive linker scoping: ...
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit cce4e8012c5eafb6d98111b92923d748d72d077b
Author: Björn Jacke <bj at sernet.de>
Date:   Sun Oct 18 21:07:14 2020 +0200

    auth_generic: fix empty initializer compile warning
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit a4e90cfec4966b9cebcab65ae26ecbe6d85868c0
Author: Björn Jacke <bj at sernet.de>
Date:   Sun Oct 18 20:43:26 2020 +0200

    http_conn.c: fix "void function cannot return value" error
    
    this made the studio compiler build break
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit bbfd93f7b6322b41cb69a0bab4903d074f3c60b7
Author: Björn Jacke <bj at sernet.de>
Date:   Sun Oct 18 20:21:56 2020 +0200

    debug: remove a cast, which makes the Solaris Studio compiler unhappy
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14526
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit a223c5b5b7f6446d1e52065679c5c26d02b97ef6
Author: Björn Jacke <bj at sernet.de>
Date:   Sun Oct 18 20:15:36 2020 +0200

    waf: use _POSIX_PTHREAD_SEMANTIC on Solaris
    
    Solaris uses POSIX draft function calls by default for a number of functions,
    unless you set _POSIX_PTHREAD_SEMANTIC
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 104b3545e08bb79242c659c283bc8ee221dd66d8
Author: Björn Jacke <bj at sernet.de>
Date:   Sun Oct 18 19:18:34 2020 +0200

    heimdal_build: silence warning: macro redefined
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit edb1012536e46a1d2f022ef0f369ecc2cae733a2
Author: Björn Jacke <bj at sernet.de>
Date:   Sun Oct 18 16:24:08 2020 +0200

    replace: define BOOL_DEFINED to fix header yp_prot header check on Solaris
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit b9e8959c3d585467757ddd050550b0fcd3497157
Author: Björn Jacke <bj at sernet.de>
Date:   Sun Oct 18 16:22:55 2020 +0200

    waf/texpect: add required nsl dependency for Solaris
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 96e2cf7905e146a40f788899e4759691aac6c942
Author: Björn Jacke <bj at sernet.de>
Date:   Thu Mar 7 13:10:11 2019 +0100

    replace/waf: fix libnsl checking on Solaris
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13343
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 buildtools/wafsamba/wscript          |  44 ++++++++-
 lib/ldb/ldb_key_value/ldb_kv_index.c |   2 +-
 lib/ldb/tests/ldb_key_value_test.c   |   3 +-
 lib/ldb/tests/ldb_parse_test.c       |   4 +-
 lib/replace/wscript                  |   6 +-
 lib/talloc/pytalloc.h                |  32 +++---
 lib/talloc/talloc.c                  |   8 +-
 lib/talloc/talloc.h                  | 186 ++++++++++++++++++-----------------
 lib/tdb/common/lock.c                |   6 +-
 lib/tdb/include/tdb.h                | 138 +++++++++++++-------------
 lib/texpect/wscript                  |   2 +-
 lib/util/debug.c                     |   2 +-
 lib/util/util_net.c                  |   3 +-
 libcli/http/http_conn.c              |   3 +-
 nsswitch/wb_common.c                 |   2 +
 pidl/lib/Parse/Pidl/Samba4/Python.pm |   4 +-
 source3/auth/auth_generic.c          |   2 +-
 source4/heimdal_build/config.h       |   5 +
 source4/torture/smb2/sharemode.c     |   8 +-
 19 files changed, 262 insertions(+), 198 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index f0b679257b7..65cc8d3cd5e 100644
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -391,7 +391,26 @@ def configure(conf):
             strict=True,
             msg='Checking for library constructor support')
 
-        # check HAVE_DESTRUCTOR_ATTRIBUTE
+    # check HAVE_PRAGMA_INIT alternatively
+    if not conf.env.HAVE_CONSTRUCTOR_ATTRIBUTE:
+	    conf.CHECK_CODE('''
+                #pragma init (test_init)
+
+                void test_init(void)
+                {
+                    return;
+                }
+
+                int main(void) {
+                    return 0;
+                }
+                ''',
+                'HAVE_PRAGMA_INIT',
+                addmain=False,
+                strict=True,
+                msg='Checking for pragma init support')
+
+    # check HAVE_DESTRUCTOR_ATTRIBUTE
     conf.CHECK_CODE('''
             void test_destructor_attribute(void) __attribute__ ((destructor));
 
@@ -409,6 +428,25 @@ def configure(conf):
             strict=True,
             msg='Checking for library destructor support')
 
+    # check HAVE_PRAGMA_FINI alternatively
+    if not conf.env.HAVE_DESTRUCTOR_ATTRIBUTE:
+	    conf.CHECK_CODE('''
+                #pragma fini (test_fini)
+
+                void test_fini(void)
+                {
+                    return;
+                }
+
+                int main(void) {
+                    return 0;
+                }
+                ''',
+                'HAVE_PRAGMA_FINI',
+                addmain=False,
+                strict=True,
+                msg='Checking for pragma fini support')
+
     conf.CHECK_CODE('''
             void test_attribute(void) __attribute__ (());
 
@@ -426,6 +464,10 @@ def configure(conf):
             strict=True,
             msg='Checking for __attribute__')
 
+    # Solaris by defauls uses draft versions of some functions unless you set _POSIX_PTHREAD_SEMANTICS
+    if sys.platform.startswith('sunos'):
+        conf.DEFINE('_POSIX_PTHREAD_SEMANTICS', 1)
+
     if sys.platform.startswith('aix'):
         conf.DEFINE('_ALL_SOURCE', 1, add_to_cflags=True)
         # Might not be needed if ALL_SOURCE is defined
diff --git a/lib/ldb/ldb_key_value/ldb_kv_index.c b/lib/ldb/ldb_key_value/ldb_kv_index.c
index 9be7c5adcbe..1cc042aa84f 100644
--- a/lib/ldb/ldb_key_value/ldb_kv_index.c
+++ b/lib/ldb/ldb_key_value/ldb_kv_index.c
@@ -2267,7 +2267,7 @@ static int ldb_kv_index_filter(struct ldb_kv_private *ldb_kv,
 	struct ldb_message *filtered_msg;
 	unsigned int i;
 	unsigned int num_keys = 0;
-	uint8_t previous_guid_key[LDB_KV_GUID_KEY_SIZE] = {};
+	uint8_t previous_guid_key[LDB_KV_GUID_KEY_SIZE] = {0};
 	struct ldb_val *keys = NULL;
 
 	/*
diff --git a/lib/ldb/tests/ldb_key_value_test.c b/lib/ldb/tests/ldb_key_value_test.c
index 458452e5dc4..97f717b5ee0 100644
--- a/lib/ldb/tests/ldb_key_value_test.c
+++ b/lib/ldb/tests/ldb_key_value_test.c
@@ -76,8 +76,7 @@ int ldb_kv_increase_sequence_number(struct ldb_module *module) {
 	return LDB_SUCCESS;
 }
 
-struct test_ctx {
-};
+struct test_ctx { uint8_t dummy; };
 
 static int setup(void **state)
 {
diff --git a/lib/ldb/tests/ldb_parse_test.c b/lib/ldb/tests/ldb_parse_test.c
index d7442b954ea..b08c7b7680c 100644
--- a/lib/ldb/tests/ldb_parse_test.c
+++ b/lib/ldb/tests/ldb_parse_test.c
@@ -27,9 +27,7 @@
 
 #include "../include/ldb.h"
 
-struct test_ctx
-{
-};
+struct test_ctx { uint8_t dummy; };
 
 static int setup(void **state)
 {
diff --git a/lib/replace/wscript b/lib/replace/wscript
index 85bc11d2f01..2c856b61a0f 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -31,6 +31,7 @@ def configure(conf):
 
     conf.env.standalone_replace = conf.IN_LAUNCH_DIR()
 
+    conf.DEFINE('BOOL_DEFINED', 1)
     conf.DEFINE('HAVE_LIBREPLACE', 1)
     conf.DEFINE('LIBREPLACE_NETWORK_CHECKS', 1)
 
@@ -94,7 +95,8 @@ def configure(conf):
     if not conf.CONFIG_SET('HAVE_RPC_RPC_H'):
             Logs.warn('No rpc/rpc.h header found, tirpc or libntirpc missing?')
 
-    conf.SET_TARGET_TYPE('nsl', 'EMPTY')
+    if not conf.CHECK_LIB('nsl'):
+        conf.SET_TARGET_TYPE('nsl', 'EMPTY')
     conf.CHECK_HEADERS('rpc/rpc.h rpcsvc/yp_prot.h', lib='tirpc')
     if not conf.CONFIG_SET('HAVE_RPCSVC_YP_PROT_H'):
         if conf.CHECK_CFG(package='libnsl', args='--cflags --libs',
@@ -102,8 +104,6 @@ def configure(conf):
                           uselib_store='NSL'):
             conf.SET_TARGET_TYPE('nsl', 'SYSLIB')
             conf.CHECK_HEADERS('rpc/rpc.h rpcsvc/yp_prot.h', lib='tirpc nsl')
-        else:
-            conf.SET_TARGET_TYPE('nsl', 'SYSLIB')
     conf.CHECK_HEADERS('rpcsvc/nis.h rpcsvc/ypclnt.h', lib='tirpc nsl')
 
     # This file is decprecated with glibc >= 2.30 so we need to check if it
diff --git a/lib/talloc/pytalloc.h b/lib/talloc/pytalloc.h
index 8ab1e16fe47..9aeb121eb29 100644
--- a/lib/talloc/pytalloc.h
+++ b/lib/talloc/pytalloc.h
@@ -30,37 +30,37 @@ typedef struct {
 } pytalloc_Object;
 
 /* Return the PyTypeObject for pytalloc_Object. Returns a borrowed reference. */
-PyTypeObject *pytalloc_GetObjectType(void);
+_PUBLIC_ PyTypeObject *pytalloc_GetObjectType(void);
 
 /* Return the PyTypeObject for pytalloc_BaseObject. Returns a borrowed reference. */
-PyTypeObject *pytalloc_GetBaseObjectType(void);
+_PUBLIC_ PyTypeObject *pytalloc_GetBaseObjectType(void);
 
 /* Check whether a specific object is a talloc Object. */
-int pytalloc_Check(PyObject *);
+_PUBLIC_ int pytalloc_Check(PyObject *);
 
-int pytalloc_BaseObject_check(PyObject *);
+_PUBLIC_ int pytalloc_BaseObject_check(PyObject *);
 
-int _pytalloc_check_type(PyObject *py_obj, const char *type_name);
+_PUBLIC_ int _pytalloc_check_type(PyObject *py_obj, const char *type_name);
 #define pytalloc_check_type(py_obj, type) \
 	_pytalloc_check_type((PyObject *)(py_obj), #type)
 
 /* Retrieve the pointer for a pytalloc_object. Like talloc_get_type() 
  * but for pytalloc_Objects. */
-void *_pytalloc_get_type(PyObject *py_obj, const char *type_name);
+_PUBLIC_ void *_pytalloc_get_type(PyObject *py_obj, const char *type_name);
 #define pytalloc_get_type(py_obj, type) ((type *)_pytalloc_get_type((PyObject *)(py_obj), #type))
 
-void *_pytalloc_get_ptr(PyObject *py_obj);
+_PUBLIC_ void *_pytalloc_get_ptr(PyObject *py_obj);
 #define pytalloc_get_ptr(py_obj) _pytalloc_get_ptr((PyObject *)(py_obj))
-TALLOC_CTX *_pytalloc_get_mem_ctx(PyObject *py_obj);
+_PUBLIC_ TALLOC_CTX *_pytalloc_get_mem_ctx(PyObject *py_obj);
 #define pytalloc_get_mem_ctx(py_obj) _pytalloc_get_mem_ctx((PyObject *)(py_obj))
 
-const char *_pytalloc_get_name(PyObject *py_obj);
+_PUBLIC_ const char *_pytalloc_get_name(PyObject *py_obj);
 #define pytalloc_get_name(py_obj) _pytalloc_get_name((PyObject *)(py_obj))
 
 
-PyObject *pytalloc_steal_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void *ptr);
-PyObject *pytalloc_steal(PyTypeObject *py_type, void *ptr);
-PyObject *pytalloc_reference_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void *ptr);
+_PUBLIC_ PyObject *pytalloc_steal_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void *ptr);
+_PUBLIC_ PyObject *pytalloc_steal(PyTypeObject *py_type, void *ptr);
+_PUBLIC_ PyObject *pytalloc_reference_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void *ptr);
 #define pytalloc_reference(py_type, talloc_ptr) pytalloc_reference_ex(py_type, talloc_ptr, talloc_ptr)
 
 #define pytalloc_new(type, typeobj) pytalloc_steal(typeobj, talloc_zero(NULL, type))
@@ -69,15 +69,15 @@ PyObject *pytalloc_reference_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void
  * Wrap a generic talloc pointer into a talloc.GenericObject,
  * this is a subclass of talloc.BaseObject.
  */
-PyObject *pytalloc_GenericObject_steal_ex(TALLOC_CTX *mem_ctx, void *ptr);
+_PUBLIC_ PyObject *pytalloc_GenericObject_steal_ex(TALLOC_CTX *mem_ctx, void *ptr);
 #define pytalloc_GenericObject_steal(talloc_ptr) \
 	pytalloc_GenericObject_steal_ex(talloc_ptr, talloc_ptr)
-PyObject *pytalloc_GenericObject_reference_ex(TALLOC_CTX *mem_ctx, void *ptr);
+_PUBLIC_ PyObject *pytalloc_GenericObject_reference_ex(TALLOC_CTX *mem_ctx, void *ptr);
 #define pytalloc_GenericObject_reference(talloc_ptr) \
 	pytalloc_GenericObject_reference_ex(talloc_ptr, talloc_ptr)
 
-size_t pytalloc_BaseObject_size(void);
+_PUBLIC_ size_t pytalloc_BaseObject_size(void);
 
-int pytalloc_BaseObject_PyType_Ready(PyTypeObject *type);
+_PUBLIC_ int pytalloc_BaseObject_PyType_Ready(PyTypeObject *type);
 
 #endif /* _PYTALLOC_H_ */
diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c
index 078e58ca352..ef49429307a 100644
--- a/lib/talloc/talloc.c
+++ b/lib/talloc/talloc.c
@@ -392,7 +392,13 @@ _PUBLIC_ void talloc_set_log_fn(void (*log_fn)(const char *message))
 }
 
 #ifdef HAVE_CONSTRUCTOR_ATTRIBUTE
-void talloc_lib_init(void) __attribute__((constructor));
+#define CONSTRUCTOR __attribute__((constructor))
+#elif defined(HAVE_PRAGMA_INIT)
+#define CONSTRUCTOR
+#pragma init (talloc_lib_init)
+#endif
+#if defined(HAVE_CONSTRUCTOR_ATTRIBUTE) || defined(HAVE_PRAGMA_INIT)
+void talloc_lib_init(void) CONSTRUCTOR;
 void talloc_lib_init(void)
 {
 	uint32_t random_value;
diff --git a/lib/talloc/talloc.h b/lib/talloc/talloc.h
index afa0e85d195..06e81d7c999 100644
--- a/lib/talloc/talloc.h
+++ b/lib/talloc/talloc.h
@@ -33,6 +33,19 @@
 extern "C" {
 #endif
 
+/* for old gcc releases that don't have the feature test macro __has_attribute */
+#ifndef __has_attribute
+#define __has_attribute(x) 0
+#endif
+
+#ifndef _PUBLIC_
+#if __has_attribute(visibility)
+#define _PUBLIC_ __attribute__((visibility("default")))
+#else
+#define _PUBLIC_
+#endif
+#endif
+
 /**
  * @defgroup talloc The talloc API
  *
@@ -45,10 +58,10 @@ extern "C" {
 #define TALLOC_VERSION_MAJOR 2
 #define TALLOC_VERSION_MINOR 3
 
-int talloc_version_major(void);
-int talloc_version_minor(void);
+_PUBLIC_ int talloc_version_major(void);
+_PUBLIC_ int talloc_version_minor(void);
 /* This is mostly useful only for testing */
-int talloc_test_get_magic(void);
+_PUBLIC_ int talloc_test_get_magic(void);
 
 /**
  * @brief Define a talloc parent type
@@ -89,11 +102,6 @@ typedef void TALLOC_CTX;
 #define TALLOC_DEPRECATED 0
 #endif
 
-/* for old gcc releases that don't have the feature test macro __has_attribute */
-#ifndef __has_attribute
-#define __has_attribute(x) 0
-#endif
-
 #ifndef PRINTF_ATTRIBUTE
 #if __has_attribute(format) || (__GNUC__ >= 3)
 /** Use gcc attribute to check printf fns.  a1 is the 1-based index of
@@ -148,10 +156,10 @@ typedef void TALLOC_CTX;
  * @see talloc_steal
  * @see talloc_free
  */
-void *talloc(const void *ctx, #type);
+_PUBLIC_ void *talloc(const void *ctx, #type);
 #else
 #define talloc(ctx, type) (type *)talloc_named_const(ctx, sizeof(type), #type)
-void *_talloc(const void *context, size_t size);
+_PUBLIC_ void *_talloc(const void *context, size_t size);
 #endif
 
 /**
@@ -171,7 +179,7 @@ void *_talloc(const void *context, size_t size);
  *
  * @see talloc_named()
  */
-void *talloc_init(const char *fmt, ...) PRINTF_ATTRIBUTE(1,2);
+_PUBLIC_ void *talloc_init(const char *fmt, ...) PRINTF_ATTRIBUTE(1,2);
 
 #ifdef DOXYGEN
 /**
@@ -236,10 +244,10 @@ void *talloc_init(const char *fmt, ...) PRINTF_ATTRIBUTE(1,2);
  * @see talloc_set_destructor()
  * @see talloc_unlink()
  */
-int talloc_free(void *ptr);
+_PUBLIC_ int talloc_free(void *ptr);
 #else
 #define talloc_free(ctx) _talloc_free(ctx, __location__)
-int _talloc_free(void *ptr, const char *location);
+_PUBLIC_ int _talloc_free(void *ptr, const char *location);
 #endif
 
 /**
@@ -253,7 +261,7 @@ int _talloc_free(void *ptr, const char *location);
  * @param[in]  ptr      The chunk that you want to free the children of
  *                      (NULL is allowed too)
  */
-void talloc_free_children(void *ptr);
+_PUBLIC_ void talloc_free_children(void *ptr);
 
 #ifdef DOXYGEN
 /**
@@ -309,7 +317,7 @@ void talloc_free_children(void *ptr);
  * @see talloc()
  * @see talloc_free()
  */
-void talloc_set_destructor(const void *ptr, int (*destructor)(void *));
+_PUBLIC_ void talloc_set_destructor(const void *ptr, int (*destructor)(void *));
 
 /**
  * @brief Change a talloc chunk's parent.
@@ -349,7 +357,7 @@ void talloc_set_destructor(const void *ptr, int (*destructor)(void *));
  * if you are not careful with talloc_steal(). No guarantees are provided
  * as to your sanity or the safety of your data if you do this.
  */
-void *talloc_steal(const void *new_ctx, const void *ptr);
+_PUBLIC_ void *talloc_steal(const void *new_ctx, const void *ptr);
 #else /* DOXYGEN */
 /* try to make talloc_set_destructor() and talloc_steal() type safe,
    if we have a recent gcc */
@@ -369,8 +377,8 @@ void *talloc_steal(const void *new_ctx, const void *ptr);
 #define _TALLOC_TYPEOF(ptr) void *
 #define talloc_steal(ctx, ptr) (_TALLOC_TYPEOF(ptr))_talloc_steal_loc((ctx),(ptr), __location__)
 #endif /* __GNUC__ >= 3 */
-void _talloc_set_destructor(const void *ptr, int (*_destructor)(void *));
-void *_talloc_steal_loc(const void *new_ctx, const void *ptr, const char *location);
+_PUBLIC_ void _talloc_set_destructor(const void *ptr, int (*_destructor)(void *));
+_PUBLIC_ void *_talloc_steal_loc(const void *new_ctx, const void *ptr, const char *location);
 #endif /* DOXYGEN */
 
 /**
@@ -403,7 +411,7 @@ void *_talloc_steal_loc(const void *new_ctx, const void *ptr, const char *locati
  * releasing the name. All of the memory is released when the ptr is freed
  * using talloc_free().
  */
-const char *talloc_set_name(const void *ptr, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
+_PUBLIC_ const char *talloc_set_name(const void *ptr, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
 
 #ifdef DOXYGEN
 /**
@@ -426,10 +434,10 @@ const char *talloc_set_name(const void *ptr, const char *fmt, ...) PRINTF_ATTRIB
  *                      It does not have any failure modes.
  *
  */
-void *talloc_move(const void *new_ctx, void **pptr);
+_PUBLIC_ void *talloc_move(const void *new_ctx, void **pptr);
 #else
 #define talloc_move(ctx, pptr) (_TALLOC_TYPEOF(*(pptr)))_talloc_move((ctx),(void *)(pptr))
-void *_talloc_move(const void *new_ctx, const void *pptr);
+_PUBLIC_ void *_talloc_move(const void *new_ctx, const void *pptr);
 #endif
 
 /**
@@ -448,7 +456,7 @@ void *_talloc_move(const void *new_ctx, const void *pptr);
  *
  * @param[in]  name     Format string for the name.
  */
-void talloc_set_name_const(const void *ptr, const char *name);
+_PUBLIC_ void talloc_set_name_const(const void *ptr, const char *name);
 
 /**
  * @brief Create a named talloc chunk.
@@ -473,7 +481,7 @@ void talloc_set_name_const(const void *ptr, const char *name);
  *
  * @see talloc_set_name()
  */
-void *talloc_named(const void *context, size_t size,
+_PUBLIC_ void *talloc_named(const void *context, size_t size,
 		   const char *fmt, ...) PRINTF_ATTRIBUTE(3,4);
 
 /**
@@ -494,7 +502,7 @@ void *talloc_named(const void *context, size_t size,
  *
  * @return             The allocated memory chunk, NULL on error.
  */
-void *talloc_named_const(const void *context, size_t size, const char *name);
+_PUBLIC_ void *talloc_named_const(const void *context, size_t size, const char *name);
 
 #ifdef DOXYGEN
 /**
@@ -517,7 +525,7 @@ void *talloc_named_const(const void *context, size_t size, const char *name);
  *      void *mem = talloc_size(NULL, 100);
  * @endcode
  */
-void *talloc_size(const void *ctx, size_t size);
+_PUBLIC_ void *talloc_size(const void *ctx, size_t size);
 #else
 #define talloc_size(ctx, size) talloc_named_const(ctx, size, __location__)
 #endif
@@ -544,7 +552,7 @@ void *talloc_size(const void *ctx, size_t size);
  *       unsigned int *a = talloc_ptrtype(NULL, a);
  * @endcode
  */
-void *talloc_ptrtype(const void *ctx, #type);
+_PUBLIC_ void *talloc_ptrtype(const void *ctx, #type);
 #else
 #define talloc_ptrtype(ctx, ptr) (_TALLOC_TYPEOF(ptr))talloc_size(ctx, sizeof(*(ptr)))
 #endif
@@ -562,7 +570,7 @@ void *talloc_ptrtype(const void *ctx, #type);
  *
  * @return              A new talloc chunk, NULL on error.
  */
-void *talloc_new(const void *ctx);
+_PUBLIC_ void *talloc_new(const void *ctx);
 #else
 #define talloc_new(ctx) talloc_named_const(ctx, 0, "talloc_new: " __location__)
 #endif
@@ -596,7 +604,7 @@ void *talloc_new(const void *ctx);
  * @see talloc_zero_size()
  * @see talloc_zero_array()
  */
-void *talloc_zero(const void *ctx, #type);
+_PUBLIC_ void *talloc_zero(const void *ctx, #type);
 
 /**
  * @brief Allocate untyped, 0-initialized memory.
@@ -607,11 +615,11 @@ void *talloc_zero(const void *ctx, #type);
  *
  * @return              The allocated memory chunk.
  */
-void *talloc_zero_size(const void *ctx, size_t size);
+_PUBLIC_ void *talloc_zero_size(const void *ctx, size_t size);
 #else
 #define talloc_zero(ctx, type) (type *)_talloc_zero(ctx, sizeof(type), #type)
 #define talloc_zero_size(ctx, size) _talloc_zero(ctx, size, __location__)
-void *_talloc_zero(const void *ctx, size_t size, const char *name);
+_PUBLIC_ void *_talloc_zero(const void *ctx, size_t size, const char *name);
 #endif
 
 /**
@@ -623,7 +631,7 @@ void *_talloc_zero(const void *ctx, size_t size, const char *name);
  *
  * @see talloc_set_name()
  */
-const char *talloc_get_name(const void *ptr);
+_PUBLIC_ const char *talloc_get_name(const void *ptr);
 
 /**
  * @brief Verify that a talloc chunk carries a specified name.
@@ -637,7 +645,7 @@ const char *talloc_get_name(const void *ptr);
  *
  * @return               The pointer if the name matches, NULL if it doesn't.
  */
-void *talloc_check_name(const void *ptr, const char *name);
+_PUBLIC_ void *talloc_check_name(const void *ptr, const char *name);
 
 /**
  * @brief Get the parent chunk of a pointer.
@@ -646,7 +654,7 @@ void *talloc_check_name(const void *ptr, const char *name);
  *
  * @return              The talloc parent of ptr, NULL on error.
  */
-void *talloc_parent(const void *ptr);
+_PUBLIC_ void *talloc_parent(const void *ptr);
 
 /**
  * @brief Get a talloc chunk's parent name.
@@ -655,7 +663,7 @@ void *talloc_parent(const void *ptr);
  *
  * @return              The name of ptr's parent chunk.
  */
-const char *talloc_parent_name(const void *ptr);
+_PUBLIC_ const char *talloc_parent_name(const void *ptr);
 
 /**
  * @brief Get the total size of a talloc chunk including its children.
@@ -671,7 +679,7 @@ const char *talloc_parent_name(const void *ptr);
  *
  * @return              The total size.
  */
-size_t talloc_total_size(const void *ptr);
+_PUBLIC_ size_t talloc_total_size(const void *ptr);
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list