After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 704908 - Failure to suppress macros when re-declaring pthread functions
Failure to suppress macros when re-declaring pthread functions
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2013-07-26 02:05 UTC by bugdal
Modified: 2015-10-16 10:32 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description bugdal 2013-07-26 02:05:20 UTC
The declarations of pthread functions in threads.c, 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).

There are three possible solutions:

1. Move the declarations before the inclusion of pthread.h.

2. #undef all of them to ensure that the function is used instead of a macro.

3. Enclose the names in parentheses (e.g. extern int (pthread_equal)() ...) so that function-like macro expansion is inhibited.
Comment 1 Daniel Veillard 2015-10-16 10:32:57 UTC
current code does 

static int libxml_is_threaded = -1;
#if defined(__GNUC__) && defined(__GLIBC__)
#ifdef linux
#if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 3)
extern int pthread_once (pthread_once_t *__once_control,

  so assuming the musc don't define __GLIBC___ then the issue ought to be fixed
in git already,

Daniel