Bug #99514 gcc-10 and clang-10 compilation warnings
Description:
There are some minor warnings for 5.7.30 with clang-10 and gcc-10.
clang-10 warning:
/data/mysql-server/mysql-5.7/storage/myisam/mi_rkey.c:194:5: error: misleading indentation; statement is not part of the previous 'else' [-Werror,-Wmisleading-indentation]
info->set_rnext_same_key= TRUE;
^
/data/mysql-server/mysql-5.7/storage/myisam/mi_rkey.c:190:3: note: previous statement is here
else
^
1 error generated.
gcc-10 warnings:
In file included from /data/mysql-server/mysql-5.7/include/my_global.h:80,
from /data/mysql-server/mysql-5.7/sql/sql_parse.h:26,
from /data/mysql-server/mysql-5.7/sql/auth/sql_user.cc:22:
/data/mysql-server/mysql-5.7/sql/auth/sql_user.cc: In function ‘void append_user(THD*, String*, LEX_USER*, bool, bool)’:
/data/mysql-server/mysql-5.7/sql/auth/sql_user.cc:125:52: error: suggest parentheses around assignment used as truth value [-Werror=parentheses]
125 | DBUG_ASSERT(thd->variables.old_passwords = 2);
How to repeat:
compile server with clang-10 and gcc-10
Suggested fix:
diff --git a/sql/auth/sql_user.cc b/sql/auth/sql_user.cc
index 42bcdcd99f4..dc2e38538c9 100644
--- a/sql/auth/sql_user.cc
+++ b/sql/auth/sql_user.cc
@@ -122,7 +122,7 @@ void append_user(THD *thd, String *str, LEX_USER *user, bool comma= true,
/*
With old_passwords == 2 the scrambled password will be binary.
*/
- DBUG_ASSERT(thd->variables.old_passwords = 2);
+ DBUG_ASSERT(thd->variables.old_passwords == 2);
str->append("<secret>");
}
str->append("'");
diff --git a/storage/myisam/mi_rkey.c b/storage/myisam/mi_rkey.c
index 70aae9b6016..b65419067d3 100644
--- a/storage/myisam/mi_rkey.c
+++ b/storage/myisam/mi_rkey.c
@@ -191,7 +191,7 @@ int mi_rkey(MI_INFO *info, uchar *buf, int inx, const uchar *key,
info->last_rkey_length= pack_key_length;
/* Next call to mi_rnext_same should set rnext_same_key. */
- info->set_rnext_same_key= TRUE;
+ info->set_rnext_same_key= TRUE;
/* Check if we don't want to have record back, only error message */
if (!buf)
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.062 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: There are some minor warnings for 5.7.30 with clang-10 and gcc-10. clang-10 warning: /data/mysql-server/mysql-5.7/storage/myisam/mi_rkey.c:194:5: error: misleading indentation; statement is not part of the previous 'else' [-Werror,-Wmisleading-indentation] info->set_rnext_same_key= TRUE; ^ /data/mysql-server/mysql-5.7/storage/myisam/mi_rkey.c:190:3: note: previous statement is here else ^ 1 error generated. gcc-10 warnings: In file included from /data/mysql-server/mysql-5.7/include/my_global.h:80, from /data/mysql-server/mysql-5.7/sql/sql_parse.h:26, from /data/mysql-server/mysql-5.7/sql/auth/sql_user.cc:22: /data/mysql-server/mysql-5.7/sql/auth/sql_user.cc: In function ‘void append_user(THD*, String*, LEX_USER*, bool, bool)’: /data/mysql-server/mysql-5.7/sql/auth/sql_user.cc:125:52: error: suggest parentheses around assignment used as truth value [-Werror=parentheses] 125 | DBUG_ASSERT(thd->variables.old_passwords = 2); How to repeat: compile server with clang-10 and gcc-10 Suggested fix: diff --git a/sql/auth/sql_user.cc b/sql/auth/sql_user.cc index 42bcdcd99f4..dc2e38538c9 100644 --- a/sql/auth/sql_user.cc +++ b/sql/auth/sql_user.cc @@ -122,7 +122,7 @@ void append_user(THD *thd, String *str, LEX_USER *user, bool comma= true, /* With old_passwords == 2 the scrambled password will be binary. */ - DBUG_ASSERT(thd->variables.old_passwords = 2); + DBUG_ASSERT(thd->variables.old_passwords == 2); str->append("<secret>"); } str->append("'"); diff --git a/storage/myisam/mi_rkey.c b/storage/myisam/mi_rkey.c index 70aae9b6016..b65419067d3 100644 --- a/storage/myisam/mi_rkey.c +++ b/storage/myisam/mi_rkey.c @@ -191,7 +191,7 @@ int mi_rkey(MI_INFO *info, uchar *buf, int inx, const uchar *key, info->last_rkey_length= pack_key_length; /* Next call to mi_rnext_same should set rnext_same_key. */ - info->set_rnext_same_key= TRUE; + info->set_rnext_same_key= TRUE; /* Check if we don't want to have record back, only error message */ if (!buf)