Description:
There is a lot of new compilation warnings with clang-10. For example:
1.
/data/mysql-server/mysql-8.0/include/m_string.h:345:17: error: implicit conversion from 'unsigned long long' to 'double' changes value from 18446744073709551615 to 18446744073709551616 [-Werror,-Wimplicit-int-float-conversion]
if (dbl_val > ULLONG_MAX)
~ ^~~~~~~~~~
/usr/lib/llvm-10/lib/clang/10.0.0/include/limits.h:84:43: note: expanded from macro 'ULLONG_MAX'
#define ULLONG_MAX (__LONG_LONG_MAX__*2ULL+1ULL)
2.
/data/mysql-server/mysql-8.0/sql/item.h:4602:42: error: implicit conversion from 'long long' to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Werror,-Wimplicit-int-float-conversion]
if (realval < LLONG_MIN || realval > LLONG_MAX) {
~ ^~~~~~~~~
/usr/lib/llvm-10/lib/clang/10.0.0/include/limits.h:82:20: note: expanded from macro 'LLONG_MAX'
3.
/data/mysql-server/mysql-8.0/sql/item.h:4607:40: error: implicit conversion from 'long long' to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Werror,-Wimplicit-int-float-conversion]
const longlong retval = realval == LLONG_MAX ? LLONG_MAX : llrint(realval);
~~ ^~~~~~~~~
/usr/lib/llvm-10/lib/clang/10.0.0/include/limits.h:82:20: note: expanded from macro 'LLONG_MAX'
#define LLONG_MAX __LONG_LONG_MAX__
^~~~~~~~~~~~~~~~~
<built-in>:77:27: note: expanded from here
#define __LONG_LONG_MAX__ 9223372036854775807LL
4.
/data/mysql-server/mysql-8.0/libmysql/libmysql.cc:3121:21: error: implicit conversion from 'unsigned long long' to 'double' changes value from 18446744073709551615 to 18446744073709551616 [-Werror,-Wimplicit-int-float-conversion]
data >= ULLONG_MAX || ((ulonglong)value) != ((ulonglong)data);
~~ ^~~~~~~~~~
/usr/lib/llvm-10/lib/clang/10.0.0/include/limits.h:84:43: note: expanded from macro 'ULLONG_MAX'
#define ULLONG_MAX (__LONG_LONG_MAX__*2ULL+1ULL)
5.
/data/mysql-server/mysql-8.0/plugin/x/client/xsession_impl.cc:462:19: error: loop variable 'value' of type 'const std::__cxx11::basic_string<char>' creates a copy from type 'const std::__cxx11::basic_string<char>' [-Werror,-Wrange-loop-construct]
for (const auto value : values_list) {
6.
/data/mysql-server/mysql-8.0/unittest/gunit/m_string-t.cc:91:16: error: implicit conversion from 'unsigned long long' to 'double' changes value from 18446744073709551615 to 18446744073709551616 [-Werror,-Wimplicit-int-float-conversion]
data_size *= std::numeric_limits<unsigned long long>::max();
7.
/data/mysql-server/mysql-8.0/router/src/router/src/config_generator.cc:2230:26: error: loop variable 'a' of type 'const std::string' (aka 'const basic_string<char>') creates a copy from type 'const std::string' [-Werror,-Wrange-loop-construct]
for (const std::string a : accounts) {
8.
/data/mysql-server/mysql-8.0/unittest/gunit/xplugin/xpl/sql_statement_builder_t.cc:43:35: error: braces around scalar initializer [-Werror,-Wbraced-scalar-init]
Sql_statement_builder m_builder{{&m_qb}};
9.
/data/mysql-server/mysql-8.0/sql/auth/sql_authorization.cc:1072:23: error: loop variable 'rl_itr' of type 'const std::pair<const std::__cxx11::basic_string<char>, unsigned long>' creates a copy from type 'const std::pair<const std::__cxx11::basic_string<char>, unsigned long>' [-Werror,-Wrange-loop-construct]
for (const auto rl_itr : restrictions.get()) {
10.
/data/mysql-server/mysql-8.0/router/tests/component/test_bootstrap.cc:1715:28: error: loop variable 'output' of type 'const std::string' (aka 'const basic_string<char>') creates a copy from type 'const std::string' [-Werror,-Wrange-loop-construct]
for (const std::string output : exp_output) {
11.
/data/mysql-server/mysql-8.0/sql/opt_explain.cc:1471:24: error: implicit conversion from 'unsigned long long' to 'double' changes value from 18446744073709551615 to 18446744073709551616 [-Werror,-Wimplicit-int-float-conversion]
prefix_rows >= std::numeric_limits<ulonglong>::max()
12.
/data/mysql-server/mysql-8.0/sql/sql_db.cc:879:30: error: loop variable 'table_name' of type 'const dd::String_type' (aka 'const basic_string<char, std::char_traits<char>, Stateless_allocator<char, dd::String_type_alloc, My_free_functor> >') creates a copy from type 'const dd::String_type' [-Werror,-Wrange-loop-construct]
for (const dd::String_type table_name : sch_tables) {
13.
/data/mysql-server/mysql-8.0/sql/sql_planner.cc:882:46: error: implicit conversion from 'unsigned long' to 'double' changes value from 18446744073709551615 to 18446744073709551616 [-Werror,-Wimplicit-int-float-conversion]
buffer_count >= std::numeric_limits<ulong>::max()
14.
/data/mysql-server/mysql-8.0/storage/innobase/lock/lock0lock.cc:2333:21: error: loop variable 'new_granted_lock' of type 'const std::pair<ib_lock_t *, unsigned long>' creates a copy from type 'const std::pair<ib_lock_t *, unsigned long>' [-Werror,-Wrange-loop-construct]
for (const auto new_granted_lock : new_granted) {
How to repeat:
Compile a server with clang-10
Suggested fix:
Will be attached.