diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-01-21 14:25:23 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-01-21 14:28:53 +0100 |
commit | ed8110e101db5a8ea4dde43a3ec38fe40e6fe7e2 (patch) | |
tree | d1e5a9d5567c610f0afc28081447eca2b075ddf5 /sal/osl | |
parent | 921cea89da8adbe714ea8f71169dd6afc42354c4 (diff) |
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
Diffstat (limited to 'sal/osl')
-rw-r--r-- | sal/osl/unx/system.hxx | 7 | ||||
-rw-r--r-- | sal/osl/unx/thread.cxx | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/sal/osl/unx/system.hxx b/sal/osl/unx/system.hxx index 3013e91c6341..75c3d9d90d36 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 2dc913c3c554..0ca411383c27 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 { |