[Libreoffice-commits] core.git: sal/osl

Michael Stahl mstahl at redhat.com
Tue Jul 15 12:05:15 PDT 2014


 sal/osl/unx/mutex.c |   16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

New commits:
commit e8ec81d4bf726ea70ef94a7e0f5e43001ce0bdf1
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Jul 14 16:23:40 2014 +0200

    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 at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sal/osl/unx/mutex.c b/sal/osl/unx/mutex.c
index 1ee4418..62f212f 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
 {


More information about the Libreoffice-commits mailing list