1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-33161 Function pointer signature mismatch in LF_HASH

In cmake -DWITH_UBSAN=ON builds with clang but not with GCC,
-fsanitize=undefined will flag several runtime errors on
function pointer mismatch related to the lock-free hash table LF_HASH.

Let us use matching function signatures and remove function pointer
casts in order to avoid potential bugs due to undefined behaviour.

These errors could be caught at compilation time by
-Wcast-function-type-strict, which is available starting with clang-16,
but not available in any version of GCC as of now. The old GCC flag
-Wcast-function-type is enabled as part of -Wextra, but it specifically
does not catch these errors.

Reviewed by: Vladislav Vaintroub
This commit is contained in:
Marko Mäkelä
2024-06-10 12:35:33 +03:00
parent 246c0b3a35
commit a2bd936c52
12 changed files with 137 additions and 131 deletions

View File

@ -116,7 +116,7 @@ static void print_cached_tables(void)
/* purecov: begin tested */
puts("DB Table Version Thread Open Lock");
tdc_iterate(0, (my_hash_walk_action) print_cached_tables_callback, NULL, true);
tdc_iterate(0, print_cached_tables_callback, NULL, true);
fflush(stdout);
/* purecov: end */