Commit 8417252b authored by Marko Mäkelä's avatar Marko Mäkelä

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).
parent ff166093
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment