From fda704c82c982c554ca0f0d28cb08ca972c4ddd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 30 Aug 2021 11:52:59 +0300 Subject: Fix GCC 11 -Wmaybe-uninitialized for PLUGIN_PERFSCHEMA init_mutex_v1_t: Stop lying that the mutex parameter is const. GCC 11.2.0 assumes that it is and could complain about any mysql_mutex_t being uninitialized even after mysql_mutex_init() as long as PLUGIN_PERFSCHEMA is enabled. init_rwlock_v1_t, init_cond_v1_t: Remove untruthful const qualifiers. Note: init_socket_v1_t is expecting that the socket fd has already been created before PSI_SOCKET_CALL(init_socket), and therefore that parameter really is being treated as a pointer to const. --- include/mysql/psi/psi.h | 6 +++--- include/mysql/psi/psi_abi_v1.h.pp | 6 +++--- mysys/psi_noop.c | 6 +++--- storage/perfschema/pfs.cc | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/mysql/psi/psi.h b/include/mysql/psi/psi.h index 3f7b04b0841..4fa9c3842a8 100644 --- a/include/mysql/psi/psi.h +++ b/include/mysql/psi/psi.h @@ -1134,7 +1134,7 @@ typedef void (*register_socket_v1_t) @return an instrumented mutex */ typedef struct PSI_mutex* (*init_mutex_v1_t) - (PSI_mutex_key key, const void *identity); + (PSI_mutex_key key, void *identity); /** Mutex instrumentation destruction API. @@ -1149,7 +1149,7 @@ typedef void (*destroy_mutex_v1_t)(struct PSI_mutex *mutex); @return an instrumented rwlock */ typedef struct PSI_rwlock* (*init_rwlock_v1_t) - (PSI_rwlock_key key, const void *identity); + (PSI_rwlock_key key, void *identity); /** Rwlock instrumentation destruction API. @@ -1164,7 +1164,7 @@ typedef void (*destroy_rwlock_v1_t)(struct PSI_rwlock *rwlock); @return an instrumented cond */ typedef struct PSI_cond* (*init_cond_v1_t) - (PSI_cond_key key, const void *identity); + (PSI_cond_key key, void *identity); /** Cond instrumentation destruction API. diff --git a/include/mysql/psi/psi_abi_v1.h.pp b/include/mysql/psi/psi_abi_v1.h.pp index 17ac0271da2..162c5bcccd1 100644 --- a/include/mysql/psi/psi_abi_v1.h.pp +++ b/include/mysql/psi/psi_abi_v1.h.pp @@ -300,13 +300,13 @@ typedef void (*register_statement_v1_t) typedef void (*register_socket_v1_t) (const char *category, struct PSI_socket_info_v1 *info, int count); typedef struct PSI_mutex* (*init_mutex_v1_t) - (PSI_mutex_key key, const void *identity); + (PSI_mutex_key key, void *identity); typedef void (*destroy_mutex_v1_t)(struct PSI_mutex *mutex); typedef struct PSI_rwlock* (*init_rwlock_v1_t) - (PSI_rwlock_key key, const void *identity); + (PSI_rwlock_key key, void *identity); typedef void (*destroy_rwlock_v1_t)(struct PSI_rwlock *rwlock); typedef struct PSI_cond* (*init_cond_v1_t) - (PSI_cond_key key, const void *identity); + (PSI_cond_key key, void *identity); typedef void (*destroy_cond_v1_t)(struct PSI_cond *cond); typedef struct PSI_socket* (*init_socket_v1_t) (PSI_socket_key key, const my_socket *fd, diff --git a/mysys/psi_noop.c b/mysys/psi_noop.c index 1cf544be0e1..b20aae84849 100644 --- a/mysys/psi_noop.c +++ b/mysys/psi_noop.c @@ -86,7 +86,7 @@ static void register_socket_noop(const char *category NNN, } static PSI_mutex* -init_mutex_noop(PSI_mutex_key key NNN, const void *identity NNN) +init_mutex_noop(PSI_mutex_key key NNN, void *identity NNN) { return NULL; } @@ -97,7 +97,7 @@ static void destroy_mutex_noop(PSI_mutex* mutex NNN) } static PSI_rwlock* -init_rwlock_noop(PSI_rwlock_key key NNN, const void *identity NNN) +init_rwlock_noop(PSI_rwlock_key key NNN, void *identity NNN) { return NULL; } @@ -108,7 +108,7 @@ static void destroy_rwlock_noop(PSI_rwlock* rwlock NNN) } static PSI_cond* -init_cond_noop(PSI_cond_key key NNN, const void *identity NNN) +init_cond_noop(PSI_cond_key key NNN, void *identity NNN) { return NULL; } diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc index dbad7e966a5..2a484bea7f2 100644 --- a/storage/perfschema/pfs.cc +++ b/storage/perfschema/pfs.cc @@ -1496,7 +1496,7 @@ static void register_socket_v1(const char *category, @sa PSI_v1::init_mutex. */ static PSI_mutex* -init_mutex_v1(PSI_mutex_key key, const void *identity) +init_mutex_v1(PSI_mutex_key key, void *identity) { INIT_BODY_V1(mutex, key, identity); } @@ -1519,7 +1519,7 @@ static void destroy_mutex_v1(PSI_mutex* mutex) @sa PSI_v1::init_rwlock. */ static PSI_rwlock* -init_rwlock_v1(PSI_rwlock_key key, const void *identity) +init_rwlock_v1(PSI_rwlock_key key, void *identity) { INIT_BODY_V1(rwlock, key, identity); } @@ -1542,7 +1542,7 @@ static void destroy_rwlock_v1(PSI_rwlock* rwlock) @sa PSI_v1::init_cond. */ static PSI_cond* -init_cond_v1(PSI_cond_key key, const void *identity) +init_cond_v1(PSI_cond_key key, void *identity) { INIT_BODY_V1(cond, key, identity); } -- cgit v1.2.1