Issue 8794 - Fix implicit function declaration warnings
Summary: Fix implicit function declaration warnings
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: build (show other issues)
Version: 2.4.45
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-29 08:31 UTC by jamegerwe@fake-box.com
Modified: 2019-07-24 18:54 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description jamegerwe@fake-box.com 2017-12-29 08:31:51 UTC
Full_Name: Jame Gerwe
Version: 2.4.45
OS: linux
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (88.198.125.96)


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
pthread_{set,get}concurrency():

/libraries/libldap_r/thr_posix.c: In function
�ldap_pvt_thread_set_concurrency�:
/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
�ldap_pvt_thread_get_concurrency�:
/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
glibc).
To declare them use #define _GNU_SOURCE or similar prior to including
pthread.h.



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 ));
 
+#ifdef LDAP_CONNECTIONLESS
+LDAP_F( int )
+ldap_is_ldapc_url LDAP_P((
+	LDAP_CONST char *url ));
+#endif
+
 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 */

Comment 1 Quanah Gibson-Mount 2019-06-04 20:58:39 UTC
changed notes
Comment 2 Howard Chu 2019-06-17 12:14:34 UTC
moved from Incoming to Build
Comment 3 Quanah Gibson-Mount 2019-06-17 17:26:09 UTC
changed notes
changed state Open to Test
Comment 4 Quanah Gibson-Mount 2019-06-17 17:30:32 UTC
changed notes
changed state Test to Release
Comment 5 OpenLDAP project 2019-07-24 18:54:38 UTC
Fixed in master
Fixed in RE24 (2.4.48)
Comment 6 Quanah Gibson-Mount 2019-07-24 18:54:38 UTC
changed notes
changed state Release to Closed