mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 04:22:27 +01:00
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).
This commit is contained in:
parent
ff16609374
commit
8417252b04
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue