From 0b849a441afaa5f4ce1ad1af877363d7b5c4a1e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 23 Feb 2022 07:18:00 +0200 Subject: WSREP: Fix GCC 12.0.1 -Wuninitialized GCC 12 complains if a reference to an uninitialized object is being passed to a constructor. The mysql_mutex_t, mysql_cond_t would be initialized in the constructor body, which is executed after the initializer list. There is no problem passing a pointer instead of a reference. The wrapper classes do not dereference the pointers in the constructor or destructor, so there does not appear to be any correctness issue. --- sql/wsrep_mutex.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sql/wsrep_mutex.h') diff --git a/sql/wsrep_mutex.h b/sql/wsrep_mutex.h index 3454b44e0ec..f396c1be331 100644 --- a/sql/wsrep_mutex.h +++ b/sql/wsrep_mutex.h @@ -25,26 +25,26 @@ class Wsrep_mutex : public wsrep::mutex { public: - Wsrep_mutex(mysql_mutex_t& mutex) + Wsrep_mutex(mysql_mutex_t* mutex) : m_mutex(mutex) { } void lock() { - mysql_mutex_lock(&m_mutex); + mysql_mutex_lock(m_mutex); } void unlock() { - mysql_mutex_unlock(&m_mutex); + mysql_mutex_unlock(m_mutex); } void* native() { - return &m_mutex; + return m_mutex; } private: - mysql_mutex_t& m_mutex; + mysql_mutex_t* m_mutex; }; #endif /* WSREP_MUTEX_H */ -- cgit v1.2.1