Module: wine
Branch: master
Commit: 07cb943d6a6ca4f7b6cd635a68b02e2423c957b0
URL: https://gitlab.winehq.org/wine/wine/-/commit/07cb943d6a6ca4f7b6cd635a68b02e…
Author: Hans Leidekker <hans(a)codeweavers.com>
Date: Wed Nov 16 13:06:40 2022 +0100
ldap: Mark ldap_int_destroy_global_options() as a destructor when building with Clang.
Clang understands __attribute__ ((destructor)) syntax just like GCC. This avoids a
link failure when atexit() used in the fallback path is not available.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53930
---
libs/ldap/libldap/init.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libs/ldap/libldap/init.c b/libs/ldap/libldap/init.c
index 5f8f6ec7bdd..a94744b8dcf 100644
--- a/libs/ldap/libldap/init.c
+++ b/libs/ldap/libldap/init.c
@@ -497,7 +497,7 @@ static void openldap_ldap_init_w_env(
}
}
-#if defined(__GNUC__)
+#if defined(__GNUC__) || defined(__clang__)
/* Declare this function as a destructor so that it will automatically be
* invoked either at program exit (if libldap is a static library) or
* at unload time (if libldap is a dynamic library).
@@ -574,7 +574,7 @@ void ldap_int_initialize_global_options( struct ldapoptions *gopts, int *dbglvl
*/
ldap_url_parselist(&gopts->ldo_defludp, "ldap://localhost/");
gopts->ldo_defport = LDAP_PORT;
-#if !defined(__GNUC__) && !defined(PIC)
+#if !defined(__GNUC__) && !defined(__clang__) && !defined(PIC)
/* Do this only for a static library, and only if we can't
* arrange for it to be executed as a library destructor
*/