Skip to content
Permalink
Browse files
Fix the Solaris compilation after MDEV-12674
simple_counter::add(): Add a type cast to the os_atomic_increment_ulint()
call, because GCC would check the type compatibility even when the code
branch is not being instantiated (atomic=false). On Solaris,
os_atomic_increment_ulint() actually needs a compatible parameter type,
and an error would be emitted due to an incompatible 64-bit type,
for srv_stats.n_lock_wait_time.add(diff_time).
  • Loading branch information
dr-m committed May 15, 2017
1 parent ff16609 commit 8417252
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
@@ -908,7 +908,14 @@ struct MY_ALIGNED(CACHE_LINE_SIZE) simple_counter
{
compile_time_assert(!atomic || sizeof(Type) == sizeof(ulint));
if (atomic) {
return os_atomic_increment_ulint(&m_counter, i);
/* GCC would perform a type check in this code
also in case the template is instantiated with
simple_counter<Type=not_ulint, atomic=false>.
On Solaris, os_atomic_increment_ulint() maps
to atomic_add_long_nv(), which expects the
parameter to be correctly typed. */
return os_atomic_increment_ulint(
reinterpret_cast<ulint*>(&m_counter), i);
} else {
return m_counter += i;
}
@@ -960,7 +960,14 @@ struct MY_ALIGNED(CACHE_LINE_SIZE) simple_counter
{
compile_time_assert(!atomic || sizeof(Type) == sizeof(ulint));
if (atomic) {
return os_atomic_increment_ulint(&m_counter, i);
/* GCC would perform a type check in this code
also in case the template is instantiated with
simple_counter<Type=not_ulint, atomic=false>.
On Solaris, os_atomic_increment_ulint() maps
to atomic_add_long_nv(), which expects the
parameter to be correctly typed. */
return os_atomic_increment_ulint(
reinterpret_cast<ulint*>(&m_counter), i);
} else {
return m_counter += i;
}

0 comments on commit 8417252

Please sign in to comment.