mirror of
https://github.com/MariaDB/server.git
synced 2026-04-28 19:25:32 +02:00
Bug#45288: pb2 returns a lot of compilation warnings
Fix assorted warnings that are generated in optimized builds. Most of it is silencing variables that are set but unused. This patch also introduces the MY_ASSERT_UNREACHABLE macro which helps the compiler to deduce that a certain piece of code is unreachable. include/my_compiler.h: Use GCC's __builtin_unreachable if available. It allows GCC to deduce the unreachability of certain code paths, thus avoiding warnings that, for example, accused that a variable could be used without being initialized (due to unreachable code paths).
This commit is contained in:
parent
b5bb13ec03
commit
3e9c52250a
18 changed files with 53 additions and 45 deletions
|
|
@ -693,7 +693,6 @@ TABLE_LIST *mysql_lock_have_duplicate(THD *thd, TABLE_LIST *needle,
|
|||
TABLE_LIST *haystack)
|
||||
{
|
||||
MYSQL_LOCK *mylock;
|
||||
TABLE **lock_tables;
|
||||
TABLE *table;
|
||||
TABLE *table2;
|
||||
THR_LOCK_DATA **lock_locks;
|
||||
|
|
@ -722,12 +721,11 @@ TABLE_LIST *mysql_lock_have_duplicate(THD *thd, TABLE_LIST *needle,
|
|||
if (mylock->table_count < 2)
|
||||
goto end;
|
||||
|
||||
lock_locks= mylock->locks;
|
||||
lock_tables= mylock->table;
|
||||
lock_locks= mylock->locks;
|
||||
|
||||
/* Prepare table related variables that don't change in loop. */
|
||||
DBUG_ASSERT((table->lock_position < mylock->table_count) &&
|
||||
(table == lock_tables[table->lock_position]));
|
||||
(table == mylock->table[table->lock_position]));
|
||||
table_lock_data= lock_locks + table->lock_data_start;
|
||||
end_data= table_lock_data + table->lock_count;
|
||||
|
||||
|
|
@ -741,7 +739,7 @@ TABLE_LIST *mysql_lock_have_duplicate(THD *thd, TABLE_LIST *needle,
|
|||
|
||||
/* All tables in list must be in lock. */
|
||||
DBUG_ASSERT((table2->lock_position < mylock->table_count) &&
|
||||
(table2 == lock_tables[table2->lock_position]));
|
||||
(table2 == mylock->table[table2->lock_position]));
|
||||
|
||||
for (lock_data2= lock_locks + table2->lock_data_start,
|
||||
end_data2= lock_data2 + table2->lock_count;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue