From 78d7bb1d27daf8d86fae9c54dbfe35f803531c1e Mon Sep 17 00:00:00 2001 From: Brandon Nesterenko Date: Sat, 26 Oct 2024 14:19:57 -0600 Subject: [PATCH] MDEV-34348: Miscellaneous fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Partial commit of the greater MDEV-34348 scope. MDEV-34348: MariaDB is violating clang-16 -Wcast-function-type-strict Various additional fixes, each too small to put into their own commit. Reviewed By: ============ Marko Mäkelä --- sql/sql_list.h | 9 ++++----- sql/sql_udf.h | 2 +- storage/csv/ha_tina.cc | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/sql/sql_list.h b/sql/sql_list.h index 277d5bc3808..8ec61bcd749 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -129,8 +129,6 @@ struct list_node :public Sql_alloc } }; -typedef bool List_eq(void *a, void *b); - extern MYSQL_PLUGIN_IMPORT list_node end_of_list; class base_list :public Sql_alloc @@ -301,11 +299,12 @@ public: inline void **head_ref() { return first != &end_of_list ? &first->info : 0; } inline bool is_empty() { return first == &end_of_list ; } inline list_node *last_ref() { return &end_of_list; } - inline bool add_unique(void *info, List_eq *eq) + template + inline bool add_unique(T *info, bool (*eq)(T *a, T *b)) { list_node *node= first; for (; - node != &end_of_list && (!(*eq)(node->info, info)); + node != &end_of_list && (!(*eq)(static_cast(node->info), info)); node= node->next) ; if (node == &end_of_list) return push_back(info); @@ -513,7 +512,7 @@ public: inline void prepend(List *list) { base_list::prepend(list); } inline void disjoin(List *list) { base_list::disjoin(list); } inline bool add_unique(T *a, bool (*eq)(T *a, T *b)) - { return base_list::add_unique(a, (List_eq *)eq); } + { return base_list::add_unique(a, eq); } inline bool copy(const List *list, MEM_ROOT *root) { return base_list::copy(list, root); } void delete_elements(void) diff --git a/sql/sql_udf.h b/sql/sql_udf.h index 5bd2c6e5445..83e2df48eda 100644 --- a/sql/sql_udf.h +++ b/sql/sql_udf.h @@ -30,7 +30,7 @@ typedef void (*Udf_func_clear)(UDF_INIT *, uchar *, uchar *); typedef void (*Udf_func_add)(UDF_INIT *, UDF_ARGS *, uchar *, uchar *); typedef void (*Udf_func_deinit)(UDF_INIT*); typedef my_bool (*Udf_func_init)(UDF_INIT *, UDF_ARGS *, char *); -typedef void (*Udf_func_any)(); +typedef void *Udf_func_any; typedef double (*Udf_func_double)(UDF_INIT *, UDF_ARGS *, uchar *, uchar *); typedef longlong (*Udf_func_longlong)(UDF_INIT *, UDF_ARGS *, uchar *, uchar *); diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index ef7865b366c..71c06776cfe 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -183,7 +183,7 @@ static int tina_init_func(void *p) init_tina_psi_keys(); #endif - tina_hton= (handlerton *)p; + tina_hton= static_cast(p); mysql_mutex_init(csv_key_mutex_tina, &tina_mutex, MY_MUTEX_INIT_FAST); (void) my_hash_init(csv_key_memory_tina_share, &tina_open_tables, Lex_ident_table::charset_info(), 32, 0, 0, tina_get_key,