[Libreoffice-commits] core.git: sal/osl
Stephan Bergmann
sbergman at redhat.com
Wed Jan 21 05:29:35 PST 2015
sal/osl/unx/system.hxx | 7 +++++--
sal/osl/unx/thread.cxx | 2 +-
2 files changed, 6 insertions(+), 3 deletions(-)
New commits:
commit ed8110e101db5a8ea4dde43a3ec38fe40e6fe7e2
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Jan 21 14:25:23 2015 +0100
Avoid reinterpret_cast to same type
...as GCC 4.6 reports "error: invalid cast from type 'pthread_t {aka long
unsigned int}' to type 'long unsigned int'" despite [expr.reinterpret.cast]/2:
"An expression of integral, enumeration, pointer, or pointer-to-member type can
be explicitly converted to its own type; such a cast yields the value of its
operand."
Change-Id: I26f1a3e6df2f0e55c665ad4f49185e0ebf432e95
diff --git a/sal/osl/unx/system.hxx b/sal/osl/unx/system.hxx
index 3013e91..75c3d9d 100644
--- a/sal/osl/unx/system.hxx
+++ b/sal/osl/unx/system.hxx
@@ -309,9 +309,12 @@ int macxp_resolveAlias(char *path, int buflen);
# define INIT_GROUPS(name, gid) ((setgid((gid)) == 0) && (initgroups((name), (gid)) == 0))
#endif
-#ifndef PTHREAD_VALUE
-# define PTHREAD_VALUE(t) (t)
+#if defined MACOSX
+#define PTHREAD_VALUE(t) reinterpret_cast<unsigned long>(t)
+#else
+#define PTHREAD_VALUE(t) (t)
#endif
+
#ifndef PTHREAD_NONE
# define PTHREAD_NONE _pthread_none_
# ifndef PTHREAD_NONE_INIT
diff --git a/sal/osl/unx/thread.cxx b/sal/osl/unx/thread.cxx
index 2dc913c..0ca4113 100644
--- a/sal/osl/unx/thread.cxx
+++ b/sal/osl/unx/thread.cxx
@@ -551,7 +551,7 @@ void SAL_CALL osl_setThreadName(char const * name) {
/* osl_getThreadIdentifier @@@ see TODO @@@ */
/*****************************************************************************/
-#define HASHID(x) (reinterpret_cast<unsigned long>(PTHREAD_VALUE(x)) % HashSize)
+#define HASHID(x) ((unsigned long)PTHREAD_VALUE(x) % HashSize)
typedef struct _HashEntry
{
More information about the Libreoffice-commits
mailing list