summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-05-15 10:26:42 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2017-05-15 10:26:42 +0300
commit8417252b04404496c33cf049c1914a92653acd5c (patch)
treee2212ce4d49b9a1068d0ca397b16d6d52fab43fd
parentff166093741df0bd91ba24e02714ef882073c51b (diff)
downloadmariadb-git-8417252b04404496c33cf049c1914a92653acd5c.tar.gz
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).
-rw-r--r--storage/innobase/include/os0sync.h9
-rw-r--r--storage/xtradb/include/os0sync.h9
2 files changed, 16 insertions, 2 deletions
diff --git a/storage/innobase/include/os0sync.h b/storage/innobase/include/os0sync.h
index 54032b5ad31..bb225c53dfe 100644
--- a/storage/innobase/include/os0sync.h
+++ b/storage/innobase/include/os0sync.h
@@ -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;
}
diff --git a/storage/xtradb/include/os0sync.h b/storage/xtradb/include/os0sync.h
index b152ab53e68..7bc591b2911 100644
--- a/storage/xtradb/include/os0sync.h
+++ b/storage/xtradb/include/os0sync.h
@@ -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;
}