Kaydet (Commit) e8ec81d4 authored tarafından Michael Stahl's avatar Michael Stahl

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/10301Tested-by: 's avatarLibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst 7321a659
...@@ -17,6 +17,12 @@ ...@@ -17,6 +17,12 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * 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 "system.h"
#include <osl/mutex.h> #include <osl/mutex.h>
...@@ -25,16 +31,6 @@ ...@@ -25,16 +31,6 @@
#include <pthread.h> #include <pthread.h>
#include <stdlib.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 typedef struct _oslMutexImpl
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment