[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#8794) Fix implicit function declaration warnings

Full_Name: Jame Gerwe
Version: 2.4.45
OS: linux
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (

If openldap gets compiled with -DLDAP_CONNECTIONLESS, then

/libraries/libldap/open.c: In function ?ldap_initialize?:
/libraries/libldap/open.c:251:7: warning: implicit declaration of function
?ldap_is_ldapc_url? [-Wimplicit-function-declaration]
   if (ldap_is_ldapc_url(url))

Independent of -DLDAP_CONNECTIONLESS we also have complaints about

/libraries/libldap_r/thr_posix.c: In function
/libraries/libldap_r/thr_posix.c:93:9: warning: implicit declaration of function
?pthread_setconcurrency? [-Wimplicit-function-declaration]
  return pthread_setconcurrency( n );
/libraries/libldap_r/thr_posix.c: In function
/libraries/libldap_r/thr_posix.c:107:9: warning: implicit declaration of
function ?pthread_getconcurrency? [-Wimplicit-function-declaration]
  return pthread_getconcurrency();

Although thr_posix.c includes (indirectly) pthread.h, the home of these two
functions, they are not declared in the _DEFAULT_SOURCE set of pthread.h (of
To declare them use #define _GNU_SOURCE or similar prior to including

Suggested patch for the first warning: Add ldap_is_ldapc_url() to ldap.h and
include it by open.c:


[PATCH] Fix implicit-function-declaration in open.c

If LDAP_CONNECTIONLESS is defined, then open.c uses
'ldap_is_ldapc_url()' which is defined in url.c but not part of any API
(neither public nor private). Make the function part of the public API
in ldap.h and include ldap.h in open.c.

diff a/include/ldap.h b/include/ldap.h
--- a/include/ldap.h
+++ b/include/ldap.h
@@ -2041,6 +2041,12 @@ LDAP_F( int )
 ldap_is_ldapi_url LDAP_P((
 	LDAP_CONST char *url ));
+LDAP_F( int )
+ldap_is_ldapc_url LDAP_P((
+	LDAP_CONST char *url ));
 LDAP_F( int )
 ldap_url_parse LDAP_P((
 	LDAP_CONST char *url,
diff a/libraries/libldap/open.c b/libraries/libldap/open.c
--- a/libraries/libldap/open.c
+++ b/libraries/libldap/open.c
@@ -33,6 +33,7 @@
 #include <ac/unistd.h>
 #include "ldap-int.h"
+#include "ldap.h"
 #include "ldap_log.h"
 /* Caller must hold the conn_mutex since simultaneous accesses are possible */