Skip to content

Commit

Permalink
MDEV-15778: On macOS pthread_t is opaque, requires explicit cast
Browse files Browse the repository at this point in the history
On macOS pthread id is a pointer to struct _opaque_pthread_t type,
requires explicit cast to ulint which in turn is size_t;
Was failing with Clang 9.1.0 Debug build on macOS 10.13.4:

sync0policy.h:53:4: error: cannot initialize a member subobject of type 'ulint'
(aka 'unsigned long') with an rvalue of type 'os_thread_id_t' (aka '_opaque_pthread_t *')
m_thread_id(os_thread_id_t(ULINT_UNDEFINED))
                        ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sync0policy.h:79:4: error: cannot initialize a parameter of type 'int64' (aka 'long long') with
an rvalue of type 'os_thread_id_t' (aka '_opaque_pthread_t *')
my_atomic_storelint(&m_thread_id, os_thread_get_curr_id());
  • Loading branch information
shinnok committed May 10, 2018
1 parent 70e88b5 commit 6620fbd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions storage/innobase/include/sync0policy.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class MutexDebug {
m_mutex(),
m_filename(),
m_line(),
m_thread_id(os_thread_id_t(ULINT_UNDEFINED))
m_thread_id(ULINT_UNDEFINED)
{
/* No op */
}
Expand All @@ -76,7 +76,7 @@ class MutexDebug {
{
m_mutex = mutex;

my_atomic_storelint(&m_thread_id, os_thread_get_curr_id());
my_atomic_storelint(&m_thread_id, reinterpret_cast<ulint>(os_thread_get_curr_id()));

m_filename = filename;

Expand Down

0 comments on commit 6620fbd

Please sign in to comment.