Re: [xml] [PATCH libxml2] threads: use forward declarations only for glibc (fixes #704908)


I'm guilty of assuming that compiling with gcc on linux meant glibc
(or compatibility to glibc :-)

  Applied and pushed,



On Sun, Dec 21, 2014 at 01:20:28AM +0100, Michael Heimpold wrote:
The declarations of pthread functions, used to generate weak references
to them, fail to suppress macros. Thus, if any pthread function has
been provided as a macro, compiling threads.c will fail.
This breaks on musl libc, which defines pthread_equal as a macro (in
addition to providing the function, as required).

Prevent the declarations for e.g. musl libc by refining the condition.

The idea for this solution was borrowed from the alpine linux guys, see

Signed-off-by: Michael Heimpold <mhei heimpold de>
 threads.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/threads.c b/threads.c
index 8921204..78006a2 100644
--- a/threads.c
+++ b/threads.c
@@ -47,7 +47,7 @@
 static int libxml_is_threaded = -1;
-#ifdef __GNUC__
+#if defined(__GNUC__) && defined(__GLIBC__)
 #ifdef linux
 #if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 3)
 extern int pthread_once (pthread_once_t *__once_control,
@@ -89,7 +89,7 @@ extern int pthread_cond_signal ()
 #endif /* linux */
-#endif /* __GNUC__ */
+#endif /* defined(__GNUC__) && defined(__GLIBC__) */
 #endif /* HAVE_PTHREAD_H */

Daniel Veillard      | Open Source and Standards, Red Hat
veillard redhat com  | libxml Gnome XML XSLT toolkit | virtualization library

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]