diff options
author | Michael Stahl <mstahl@redhat.com> | 2014-07-14 16:23:40 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-07-15 19:04:45 +0000 |
commit | e8ec81d4bf726ea70ef94a7e0f5e43001ce0bdf1 (patch) | |
tree | be4a7923c6fc8389d35ec2f43242172e85bbb89d /sal | |
parent | 7321a659713aeb08cd3d2db13e0bfa17dc3da6aa (diff) |
sal: unx/mutex.c: try to avoid system declarations with _GNU_SOURCE
Apparently the __USE_UNIX98 that is required to get the goodies is not
defined for some reason; apply some brute force to get it defined
(we don't care about anything older than RHEL5's glibc 2.5 anyway).)
For mysterious reasons "system.h" defines __USE_GNU but not _GNU_SOURCE,
which appears odd...
Change-Id: I97d75050a6be7f393d5cdb686f1357da052109f7
Reviewed-on: https://gerrit.libreoffice.org/10301
Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/unx/mutex.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/sal/osl/unx/mutex.c b/sal/osl/unx/mutex.c index 1ee4418cf60f..62f212f15a93 100644 --- a/sal/osl/unx/mutex.c +++ b/sal/osl/unx/mutex.c @@ -17,6 +17,12 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#if defined LINUX +// to define __USE_UNIX98, via _XOPEN_SOURCE, enabling pthread_mutexattr_settype +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif +#endif #include "system.h" #include <osl/mutex.h> @@ -25,16 +31,6 @@ #include <pthread.h> #include <stdlib.h> -/* Bad hack. This function has two problems - on older systems it has a different name, - and on some older systems it is not defined in the header file. - Unfortunately there is no completely foolproof test, so we're just working around - the issue here. The __clang__ test prevents this hack from triggering the check - in the externandnotdefined clang plugin. */ -#if defined LINUX && ! defined __clang__ -int pthread_mutexattr_setkind_np(pthread_mutexattr_t *, int); -#define pthread_mutexattr_settype pthread_mutexattr_setkind_np -#define PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP -#endif typedef struct _oslMutexImpl { |