diff --git a/client/check/mysqlcheck_core.cc b/client/check/mysqlcheck_core.cc index 7983f608e517..f258e97deb2d 100644 --- a/client/check/mysqlcheck_core.cc +++ b/client/check/mysqlcheck_core.cc @@ -269,7 +269,6 @@ static void print_result() { MYSQL_ROW row; char prev[NAME_LEN * 3 + 2]; char prev_alter[MAX_ALTER_STR_SIZE]; - uint i; size_t dot_pos; bool found_error = false, table_rebuild = false; @@ -279,7 +278,7 @@ static void print_result() { prev[0] = '\0'; prev_alter[0] = 0; - for (i = 0; (row = mysql_fetch_row(res)); i++) { + while ((row = mysql_fetch_row(res))) { int changed = strcmp(prev, row[0]); bool status = !strcmp(row[2], "status"); diff --git a/client/mysqlslap.cc b/client/mysqlslap.cc index 80b1e6b6a356..2dcfc891c7ab 100644 --- a/client/mysqlslap.cc +++ b/client/mysqlslap.cc @@ -1670,7 +1670,7 @@ static int run_scheduler(stats *sptr, statement *stmts, uint concur, } extern "C" void *run_task(void *p) { - ulonglong counter = 0, queries; + ulonglong queries; ulonglong detach_counter; unsigned int commit_counter; MYSQL *mysql; @@ -1780,7 +1780,8 @@ extern "C" void *run_task(void *p) { fprintf(stderr, "%s: Error when storing result: %d %s\n", my_progname, mysql_errno(mysql), mysql_error(mysql)); else { - while ((row = mysql_fetch_row(result))) counter++; + while ((row = mysql_fetch_row(result))) + ; mysql_free_result(result); } } diff --git a/extra/libcbor/src/cbor/arrays.h b/extra/libcbor/src/cbor/arrays.h index 85fe51dcd8dc..17706f5adb29 100644 --- a/extra/libcbor/src/cbor/arrays.h +++ b/extra/libcbor/src/cbor/arrays.h @@ -96,7 +96,7 @@ CBOR_EXPORT cbor_item_t* cbor_new_definite_array(size_t size); * * @return **new** array or `NULL` upon malloc failure */ -CBOR_EXPORT cbor_item_t* cbor_new_indefinite_array(); +CBOR_EXPORT cbor_item_t *cbor_new_indefinite_array(void); /** Append to the end * diff --git a/extra/libcbor/src/cbor/bytestrings.h b/extra/libcbor/src/cbor/bytestrings.h index 71483f708e26..f7c35c421d84 100644 --- a/extra/libcbor/src/cbor/bytestrings.h +++ b/extra/libcbor/src/cbor/bytestrings.h @@ -104,7 +104,7 @@ CBOR_EXPORT bool cbor_bytestring_add_chunk(cbor_item_t *item, * * @return **new** definite bytestring. `NULL` on malloc failure. */ -CBOR_EXPORT cbor_item_t *cbor_new_definite_bytestring(); +CBOR_EXPORT cbor_item_t *cbor_new_definite_bytestring(void); /** Creates a new indefinite byte string * @@ -112,7 +112,7 @@ CBOR_EXPORT cbor_item_t *cbor_new_definite_bytestring(); * * @return **new** indefinite bytestring. `NULL` on malloc failure. */ -CBOR_EXPORT cbor_item_t *cbor_new_indefinite_bytestring(); +CBOR_EXPORT cbor_item_t *cbor_new_indefinite_bytestring(void); /** Creates a new byte string and initializes it * diff --git a/extra/libcbor/src/cbor/floats_ctrls.h b/extra/libcbor/src/cbor/floats_ctrls.h index f43dca5ccf15..1a574a9a5201 100644 --- a/extra/libcbor/src/cbor/floats_ctrls.h +++ b/extra/libcbor/src/cbor/floats_ctrls.h @@ -84,7 +84,7 @@ CBOR_EXPORT bool cbor_get_bool(const cbor_item_t *item); * * @return **new** 1B ctrl or `NULL` upon memory allocation failure */ -CBOR_EXPORT cbor_item_t *cbor_new_ctrl(); +CBOR_EXPORT cbor_item_t *cbor_new_ctrl(void); /** Constructs a new float item * @@ -92,7 +92,7 @@ CBOR_EXPORT cbor_item_t *cbor_new_ctrl(); * * @return **new** 2B float or `NULL` upon memory allocation failure */ -CBOR_EXPORT cbor_item_t *cbor_new_float2(); +CBOR_EXPORT cbor_item_t *cbor_new_float2(void); /** Constructs a new float item * @@ -100,7 +100,7 @@ CBOR_EXPORT cbor_item_t *cbor_new_float2(); * * @return **new** 4B float or `NULL` upon memory allocation failure */ -CBOR_EXPORT cbor_item_t *cbor_new_float4(); +CBOR_EXPORT cbor_item_t *cbor_new_float4(void); /** Constructs a new float item * @@ -108,19 +108,19 @@ CBOR_EXPORT cbor_item_t *cbor_new_float4(); * * @return **new** 8B float or `NULL` upon memory allocation failure */ -CBOR_EXPORT cbor_item_t *cbor_new_float8(); +CBOR_EXPORT cbor_item_t *cbor_new_float8(void); /** Constructs new null ctrl item * * @return **new** null ctrl item or `NULL` upon memory allocation failure */ -CBOR_EXPORT cbor_item_t *cbor_new_null(); +CBOR_EXPORT cbor_item_t *cbor_new_null(void); /** Constructs new undef ctrl item * * @return **new** undef ctrl item or `NULL` upon memory allocation failure */ -CBOR_EXPORT cbor_item_t *cbor_new_undef(); +CBOR_EXPORT cbor_item_t *cbor_new_undef(void); /** Constructs new boolean ctrl item * diff --git a/extra/libcbor/src/cbor/internal/stack.h b/extra/libcbor/src/cbor/internal/stack.h index 42ed04429c7e..67e8a17450f6 100644 --- a/extra/libcbor/src/cbor/internal/stack.h +++ b/extra/libcbor/src/cbor/internal/stack.h @@ -27,7 +27,7 @@ struct _cbor_stack { size_t size; }; -struct _cbor_stack _cbor_stack_init(); +struct _cbor_stack _cbor_stack_init(void); void _cbor_stack_pop(struct _cbor_stack *); diff --git a/extra/libcbor/src/cbor/ints.h b/extra/libcbor/src/cbor/ints.h index fc7de600102e..6835f8f49fc1 100644 --- a/extra/libcbor/src/cbor/ints.h +++ b/extra/libcbor/src/cbor/ints.h @@ -118,7 +118,7 @@ CBOR_EXPORT void cbor_mark_negint(cbor_item_t *item); * @return **new** positive integer or `NULL` on memory allocation failure. The * value is not initialized */ -CBOR_EXPORT cbor_item_t *cbor_new_int8(); +CBOR_EXPORT cbor_item_t *cbor_new_int8(void); /** Allocates new integer with 2B width * @@ -127,7 +127,7 @@ CBOR_EXPORT cbor_item_t *cbor_new_int8(); * @return **new** positive integer or `NULL` on memory allocation failure. The * value is not initialized */ -CBOR_EXPORT cbor_item_t *cbor_new_int16(); +CBOR_EXPORT cbor_item_t *cbor_new_int16(void); /** Allocates new integer with 4B width * @@ -136,7 +136,7 @@ CBOR_EXPORT cbor_item_t *cbor_new_int16(); * @return **new** positive integer or `NULL` on memory allocation failure. The * value is not initialized */ -CBOR_EXPORT cbor_item_t *cbor_new_int32(); +CBOR_EXPORT cbor_item_t *cbor_new_int32(void); /** Allocates new integer with 8B width * @@ -145,7 +145,7 @@ CBOR_EXPORT cbor_item_t *cbor_new_int32(); * @return **new** positive integer or `NULL` on memory allocation failure. The * value is not initialized */ -CBOR_EXPORT cbor_item_t *cbor_new_int64(); +CBOR_EXPORT cbor_item_t *cbor_new_int64(void); /** Constructs a new positive integer * diff --git a/extra/libcbor/src/cbor/maps.h b/extra/libcbor/src/cbor/maps.h index 370c6fcd4336..1d45c89bf3d5 100644 --- a/extra/libcbor/src/cbor/maps.h +++ b/extra/libcbor/src/cbor/maps.h @@ -47,7 +47,7 @@ CBOR_EXPORT cbor_item_t *cbor_new_definite_map(size_t size); * @param size The number of slots to preallocate * @return **new** definite map. `NULL` on malloc failure. */ -CBOR_EXPORT cbor_item_t *cbor_new_indefinite_map(); +CBOR_EXPORT cbor_item_t *cbor_new_indefinite_map(void); /** Add a pair to the map * diff --git a/extra/libcbor/src/cbor/strings.h b/extra/libcbor/src/cbor/strings.h index b06463e98fc8..682c403f8d09 100644 --- a/extra/libcbor/src/cbor/strings.h +++ b/extra/libcbor/src/cbor/strings.h @@ -117,7 +117,7 @@ CBOR_EXPORT bool cbor_string_add_chunk(cbor_item_t *item, cbor_item_t *chunk); * * @return **new** definite string. `NULL` on malloc failure. */ -CBOR_EXPORT cbor_item_t *cbor_new_definite_string(); +CBOR_EXPORT cbor_item_t *cbor_new_definite_string(void); /** Creates a new indefinite string * @@ -125,7 +125,7 @@ CBOR_EXPORT cbor_item_t *cbor_new_definite_string(); * * @return **new** indefinite string. `NULL` on malloc failure. */ -CBOR_EXPORT cbor_item_t *cbor_new_indefinite_string(); +CBOR_EXPORT cbor_item_t *cbor_new_indefinite_string(void); /** Creates a new string and initializes it * diff --git a/extra/robin-hood-hashing/robin_hood.h b/extra/robin-hood-hashing/robin_hood.h index c92b96ad5f6f..de915d3b7624 100644 --- a/extra/robin-hood-hashing/robin_hood.h +++ b/extra/robin-hood-hashing/robin_hood.h @@ -205,7 +205,7 @@ static Counts& counts() { // workaround missing "is_trivially_copyable" in g++ < 5.0 // See https://stackoverflow.com/a/31798726/48181 -#if defined(__GNUC__) && __GNUC__ < 5 +#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ < 5 # define ROBIN_HOOD_IS_TRIVIALLY_COPYABLE(...) __has_trivial_copy(__VA_ARGS__) #else # define ROBIN_HOOD_IS_TRIVIALLY_COPYABLE(...) std::is_trivially_copyable<__VA_ARGS__>::value diff --git a/plugin/clone/src/clone_hton.cc b/plugin/clone/src/clone_hton.cc index ec3f64eb2e3e..608c6a4fc15f 100644 --- a/plugin/clone/src/clone_hton.cc +++ b/plugin/clone/src/clone_hton.cc @@ -236,7 +236,9 @@ int hton_clone_apply_begin(THD *thd, const char *clone_data_dir, return (clone_args.m_err); } +#ifndef NDEBUG uint32_t loop_index = 0; +#endif for (auto &loc_iter : clone_loc_vec) { uint32_t task_id = 0; @@ -269,7 +271,9 @@ int hton_clone_apply_begin(THD *thd, const char *clone_data_dir, } assert(task_vec[loop_index] == task_id); +#ifndef NDEBUG ++loop_index; +#endif } return (0); diff --git a/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/task_debug.cc b/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/task_debug.cc index 34be42f5d80e..beb53cb6be1f 100644 --- a/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/task_debug.cc +++ b/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/task_debug.cc @@ -38,9 +38,7 @@ char *mystrcat(char *dest, int *size, const char *src) { int current_size = *size; char *ret = dest; - int num = 0; while (*dest) { - num++; dest++; } diff --git a/plugin/group_replication/src/plugin.cc b/plugin/group_replication/src/plugin.cc index 6dc07a19fa80..94faaceccb6c 100644 --- a/plugin/group_replication/src/plugin.cc +++ b/plugin/group_replication/src/plugin.cc @@ -80,7 +80,6 @@ SERVICE_TYPE(log_builtins_string) * log_bs; These pointers will be initialized on plugin_group_replication_init() or plugin_group_replication_start(). */ -constexpr gr_modules::mask gr_modules::all_modules; /** The plugin applier */ Applier_module *applier_module = nullptr; /** The plugin recovery module */ diff --git a/router/src/harness/include/CMakeLists.txt b/router/src/harness/include/CMakeLists.txt index ad2284ea65a7..68b785fee25c 100644 --- a/router/src/harness/include/CMakeLists.txt +++ b/router/src/harness/include/CMakeLists.txt @@ -20,12 +20,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -ADD_LIBRARY(harness_net_ts STATIC - ${CMAKE_CURRENT_SOURCE_DIR}/mysql/harness/net_ts/internet.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/mysql/harness/net_ts/socket.cpp - ) +ADD_LIBRARY(harness_net_ts INTERFACE) TARGET_INCLUDE_DIRECTORIES(harness_net_ts - PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) TARGET_SOURCES(harness_net_ts INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/mysql/harness/net_ts.h diff --git a/router/src/harness/include/mysql/harness/net_ts/internet.cpp b/router/src/harness/include/mysql/harness/net_ts/internet.cpp deleted file mode 100644 index 81467f89de1d..000000000000 --- a/router/src/harness/include/mysql/harness/net_ts/internet.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - Copyright (c) 2020, 2022, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License, version 2.0, - as published by the Free Software Foundation. - - This program is also distributed with certain software (including - but not limited to OpenSSL) that is licensed under separate terms, - as designated in a particular file or component or in included license - documentation. The authors of MySQL hereby grant you an additional - permission to link the program and your derivative works with the - separately licensed software that they have included with MySQL. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#include "mysql/harness/net_ts/internet.h" - -// materialize constexpr's - -constexpr net::ip::resolver_base::flags net::ip::resolver_base::passive; diff --git a/router/src/harness/include/mysql/harness/net_ts/socket.cpp b/router/src/harness/include/mysql/harness/net_ts/socket.cpp deleted file mode 100644 index cc4c6b0161fa..000000000000 --- a/router/src/harness/include/mysql/harness/net_ts/socket.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (c) 2019, 2022, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License, version 2.0, - as published by the Free Software Foundation. - - This program is also distributed with certain software (including - but not limited to OpenSSL) that is licensed under separate terms, - as designated in a particular file or component or in included license - documentation. The authors of MySQL hereby grant you an additional - permission to link the program and your derivative works with the - separately licensed software that they have included with MySQL. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#include "mysql/harness/net_ts/socket.h" - -// materialize constexpr's - -constexpr net::socket_base::wait_type net::socket_base::wait_write; -constexpr net::socket_base::wait_type net::socket_base::wait_read; -constexpr net::socket_base::wait_type net::socket_base::wait_error; - -constexpr net::socket_base::shutdown_type net::socket_base::shutdown_receive; -constexpr net::socket_base::shutdown_type net::socket_base::shutdown_send; -constexpr net::socket_base::shutdown_type net::socket_base::shutdown_both; - -constexpr net::socket_base::message_flags net::socket_base::message_peek; -constexpr net::socket_base::message_flags - net::socket_base::message_do_not_route; -constexpr net::socket_base::message_flags net::socket_base::message_out_of_band; diff --git a/router/src/harness/include/mysql/harness/net_ts/socket.h b/router/src/harness/include/mysql/harness/net_ts/socket.h index 5ea2d11cb2ff..a269388f34eb 100644 --- a/router/src/harness/include/mysql/harness/net_ts/socket.h +++ b/router/src/harness/include/mysql/harness/net_ts/socket.h @@ -1802,8 +1802,4 @@ stdx::expected connect( } // namespace net -#if defined(MYSQL_HARNESS_HEADER_ONLY) -#include "mysql/harness/net_ts/socket.cpp" -#endif - #endif diff --git a/router/src/harness/src/CMakeLists.txt b/router/src/harness/src/CMakeLists.txt index 6802ef805c95..91c8b2f76d77 100644 --- a/router/src/harness/src/CMakeLists.txt +++ b/router/src/harness/src/CMakeLists.txt @@ -24,19 +24,18 @@ INCLUDE(GenerateExportHeader) INCLUDE(Plugin) -# Generate dynamic_state_schema.cc -# With *one* common custom command, generating dynamic_state_schema.[cc|h] +# Generate dynamic_state_schema.h +# With *one* common custom command, generating dynamic_state_schema.h # we had spurious build failures on Windows: -# CustomBuild: Failed to open output file 'dynamic_state_schema.cc': +# CustomBuild: Failed to open output file 'dynamic_state_schema.h': # Permission denied -# Seems like Visual Studio wants to generate dynamic_state_schema.cc +# Seems like Visual Studio wants to generate dynamic_state_schema.h # at least twice, once for the static library, once for the dynamic one. # If both generation jobs run simultaneously, one of them may fail. # The solution is to have separate commands, for the STATIC and SHARED targets. FUNCTION(ADD_DYNAMIC_STATE_SCHEMA_COMMAND SHARED_OR_STATIC) SET(SUBDIR src_${SHARED_OR_STATIC}) SET(GENERATED_SOURCES_${SHARED_OR_STATIC} - ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIR}/dynamic_state_schema.cc ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIR}/dynamic_state_schema.h ) SET(GENERATED_SOURCES_${SHARED_OR_STATIC} @@ -49,7 +48,6 @@ FUNCTION(ADD_DYNAMIC_STATE_SCHEMA_COMMAND SHARED_OR_STATIC) OUTPUT ${GENERATED_SOURCES_${SHARED_OR_STATIC}} COMMAND json_schema_embedder ${CMAKE_CURRENT_SOURCE_DIR}/dynamic_state_schema.js - dynamic_state_schema.cc dynamic_state_schema.h "StateFileJsonSchema" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIR} diff --git a/router/src/harness/src/config_parser.cc b/router/src/harness/src/config_parser.cc index d9a565f2b602..9bcb66f5429b 100644 --- a/router/src/harness/src/config_parser.cc +++ b/router/src/harness/src/config_parser.cc @@ -53,9 +53,6 @@ using mysql_harness::utility::strip; namespace mysql_harness { -// satisfy ODR requirements -constexpr const char *Config::DEFAULT_PATTERN; - bool is_valid_conf_ident_char(const char ch) { return isalnum(ch) || ch == '_'; } diff --git a/router/src/harness/src/logging/handler.cc b/router/src/harness/src/logging/handler.cc index ae8719a18930..69151dcdf1c4 100644 --- a/router/src/harness/src/logging/handler.cc +++ b/router/src/harness/src/logging/handler.cc @@ -132,9 +132,6 @@ std::string Handler::format(const Record &record) const { void Handler::handle(const Record &record) { do_log(record); } -// satisfy ODR -constexpr const char *StreamHandler::kDefaultName; - //////////////////////////////////////////////////////////////// // class StreamHandler @@ -159,9 +156,6 @@ NullHandler::NullHandler(bool format_messages, LogLevel level, void NullHandler::do_log(const Record & /*record*/) {} -// satisfy ODR -constexpr const char *NullHandler::kDefaultName; - //////////////////////////////////////////////////////////////// // class FileHandler @@ -299,9 +293,6 @@ void FileHandler::do_log(const Record &record) { } } -// satisfy ODR -constexpr const char *FileHandler::kDefaultName; - FileHandler::~FileHandler() = default; } // namespace logging diff --git a/router/src/harness/src/stdx/io/file_handle.cc b/router/src/harness/src/stdx/io/file_handle.cc index 0dcd45470301..893f30d4e2c6 100644 --- a/router/src/harness/src/stdx/io/file_handle.cc +++ b/router/src/harness/src/stdx/io/file_handle.cc @@ -62,9 +62,6 @@ using namespace std::string_literals; namespace stdx { namespace io { -constexpr const file_handle::native_handle_type file_handle::invalid_handle; -constexpr const flag::value_type flag::unlink_on_first_close; - static std::error_code last_posix_error_code() { return {errno, std::generic_category()}; } diff --git a/router/src/harness/src/tls_server_context.cc b/router/src/harness/src/tls_server_context.cc index aee77c453b7f..79c7d1636f1a 100644 --- a/router/src/harness/src/tls_server_context.cc +++ b/router/src/harness/src/tls_server_context.cc @@ -57,9 +57,6 @@ constexpr int kMinRsaKeySize{2048}; #endif constexpr int kMinDhKeySize{1024}; -constexpr std::array - TlsServerContext::unacceptable_cipher_spec; - namespace { const SSL_METHOD *server_method = #if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0) diff --git a/router/src/http/src/CMakeLists.txt b/router/src/http/src/CMakeLists.txt index 33fdd3f2b4f0..fa052d2e5209 100644 --- a/router/src/http/src/CMakeLists.txt +++ b/router/src/http/src/CMakeLists.txt @@ -28,7 +28,6 @@ ENDIF() ADD_LIBRARY(http_common SHARED - base64.cc http_common.cc http_time.cc ) @@ -162,7 +161,6 @@ TARGET_INCLUDE_DIRECTORIES(http_auth_realm PRIVATE ADD_HARNESS_PLUGIN(http_server SOURCES - content_type.cc http_auth.cc http_auth_method_basic.cc http_server_component.cc diff --git a/router/src/http/src/base64.cc b/router/src/http/src/base64.cc deleted file mode 100644 index 5a87e368cfe7..000000000000 --- a/router/src/http/src/base64.cc +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (c) 2018, 2022, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License, version 2.0, - as published by the Free Software Foundation. - - This program is also distributed with certain software (including - but not limited to OpenSSL) that is licensed under separate terms, - as designated in a particular file or component or in included license - documentation. The authors of MySQL hereby grant you an additional - permission to link the program and your derivative works with the - separately licensed software that they have included with MySQL. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#include "../src/base64.h" - -// instantiate the constexpr's - -namespace Base64Alphabet { -constexpr alphabet_type Base64::alphabet; -constexpr inverse_alphabet_type Base64::inverse_alphabet; -constexpr alphabet_type Mcf::alphabet; -constexpr inverse_alphabet_type Mcf::inverse_alphabet; -constexpr alphabet_type Crypt::alphabet; -constexpr inverse_alphabet_type Crypt::inverse_alphabet; -constexpr alphabet_type Bcrypt::alphabet; -constexpr inverse_alphabet_type Bcrypt::inverse_alphabet; -constexpr alphabet_type Uuencode::alphabet; -constexpr inverse_alphabet_type Uuencode::inverse_alphabet; -} // namespace Base64Alphabet diff --git a/router/src/http/src/content_type.cc b/router/src/http/src/content_type.cc deleted file mode 100644 index 96a8bddf3b2a..000000000000 --- a/router/src/http/src/content_type.cc +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright (c) 2019, 2022, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License, version 2.0, - as published by the Free Software Foundation. - - This program is also distributed with certain software (including - but not limited to OpenSSL) that is licensed under separate terms, - as designated in a particular file or component or in included license - documentation. The authors of MySQL hereby grant you an additional - permission to link the program and your derivative works with the - separately licensed software that they have included with MySQL. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#include "content_type.h" - -constexpr const char MimeType::ApplicationJavascript[]; -constexpr const char MimeType::ApplicationJson[]; -constexpr const char MimeType::ApplicationOctetStream[]; -constexpr const char MimeType::TextCss[]; -constexpr const char MimeType::TextHtml[]; -constexpr const char MimeType::ImageJpeg[]; -constexpr const char MimeType::ImagePng[]; -constexpr const char MimeType::ImageSvgXML[]; diff --git a/router/src/http/src/http_auth_method_basic.cc b/router/src/http/src/http_auth_method_basic.cc index a09013a18b42..e4153ab6224a 100644 --- a/router/src/http/src/http_auth_method_basic.cc +++ b/router/src/http/src/http_auth_method_basic.cc @@ -32,9 +32,6 @@ #include "../src/base64.h" -// instantiate the constexpr members -constexpr const char HttpAuthMethodBasic::kMethodName[]; - HttpAuthMethodBasic::AuthData HttpAuthMethodBasic::decode_authorization( const std::string &http_auth_data, std::error_code &ec) { std::vector decoded; diff --git a/router/src/http/src/kdf_pbkdf2.cc b/router/src/http/src/kdf_pbkdf2.cc index b985e8428a4b..699bb0765b57 100644 --- a/router/src/http/src/kdf_pbkdf2.cc +++ b/router/src/http/src/kdf_pbkdf2.cc @@ -42,12 +42,6 @@ #include "base64.h" -constexpr char Pbkdf2McfType::kTypeSha256[]; -constexpr char Pbkdf2McfType::kTypeSha512[]; -constexpr unsigned long Pbkdf2McfAdaptor::kMaxRounds; -constexpr unsigned long Pbkdf2McfAdaptor::kMinRounds; -constexpr size_t Pbkdf2McfAdaptor::kMaxSaltLength; - std::vector Pbkdf2::salt() { std::vector out(16); diff --git a/router/src/http/src/kdf_sha_crypt.cc b/router/src/http/src/kdf_sha_crypt.cc index 732a6557e4c9..f6338f965e0e 100644 --- a/router/src/http/src/kdf_sha_crypt.cc +++ b/router/src/http/src/kdf_sha_crypt.cc @@ -42,13 +42,6 @@ #include "base64.h" -constexpr char ShaCryptMcfType::kTypeSha256[]; -constexpr char ShaCryptMcfType::kTypeSha512[]; -constexpr char ShaCryptMcfType::kTypeCachingSha2Password[]; -constexpr unsigned long ShaCryptMcfAdaptor::kDefaultRounds; -constexpr unsigned long ShaCryptMcfAdaptor::kMinRounds; -constexpr unsigned long ShaCryptMcfAdaptor::kMaxRounds; - std::string ShaCrypt::salt() { // 12 byte input, generate 16 byte output std::vector out(12); diff --git a/router/src/http/tests/CMakeLists.txt b/router/src/http/tests/CMakeLists.txt index 0d585710c3c6..4e68c9b51484 100644 --- a/router/src/http/tests/CMakeLists.txt +++ b/router/src/http/tests/CMakeLists.txt @@ -79,13 +79,7 @@ SET_TARGET_PROPERTIES(routertest_http_auth_method PROPERTIES add_test_file(test_content_type.cc MODULE http - EXTRA_SOURCES ../src/content_type.cc ) -## content_type.cc is from the http_server plugin and its symbols are marked a "dllimport" -## by default. As we use them directly, mark them as "static" instead. -SET_TARGET_PROPERTIES(routertest_http_content_type PROPERTIES - COMPILE_DEFINITIONS "http_server_DEFINE_STATIC") - add_test_file(test_matcher.cc MODULE http @@ -105,7 +99,6 @@ IF(LIBFUZZER_COMPILE_FLAGS) ../src/kdf_sha_crypt.cc ../src/kdf_pbkdf2.cc ../src/mcf_error.cc - ../src/base64.cc COMPONENT Router LINK_LIBRARIES ${SSL_LIBRARIES} metadata_cache RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} @@ -121,7 +114,6 @@ IF(LIBFUZZER_COMPILE_FLAGS) MYSQL_ADD_EXECUTABLE(routerfuzz_auth_method_basic fuzz_auth_method_basic.cc ../src/http_auth_method_basic.cc - ../src/base64.cc COMPONENT Router RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SKIP_INSTALL @@ -135,7 +127,6 @@ IF(LIBFUZZER_COMPILE_FLAGS) ## base64 MYSQL_ADD_EXECUTABLE(routerfuzz_base64 fuzz_base64.cc - ../src/base64.cc COMPONENT Router RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SKIP_INSTALL diff --git a/router/src/json_schema_embedder/json_schema_embedder.cc b/router/src/json_schema_embedder/json_schema_embedder.cc index 1cf584508757..cb48ef48cd1b 100644 --- a/router/src/json_schema_embedder/json_schema_embedder.cc +++ b/router/src/json_schema_embedder/json_schema_embedder.cc @@ -30,7 +30,7 @@ /** * This program takes a text file as input (presumably a JSON schema), and - * writes a .cc file as output, which contains contents of the input file as an + * writes a .h file as output, which contains contents of the input file as an * array of chars. You can think of it as our own customised version of 'xxd -i' * Unix command. */ @@ -42,42 +42,17 @@ int main(int argc, const char **argv) { try { // get commandline args - if (argc != 5) - throw std::runtime_error( - std::string("USAGE: ") + argv[0] + - " "); + if (argc != 4) + throw std::runtime_error(std::string("USAGE: ") + argv[0] + + " "); const char *in_filename = argv[1]; - const char *out_filename = argv[2]; - const char *hdr_filename = argv[3]; - const char *symbol_name = argv[4]; + const char *hdr_filename = argv[2]; + const char *symbol_name = argv[3]; // open input and output files FILE *in_file; if (!(in_file = fopen(in_filename, "r"))) throw_error("Failed to open input file", in_filename); - { - FILE *out_file; - if (!(out_file = fopen(out_filename, "w"))) - throw_error("Failed to open output file", out_filename); - - // write comment and 1st part of the array definition - if (!fprintf( - out_file, - "// This file was auto-generated during CMake build process, " - "using command:\n" - "//\n" - "// %s %s %s %s %s\n" - "//\n" - "// (see " __FILE__ ")\n" - "#include \"%s\"\n" - "\n" - "constexpr const char %s::data_[];\n", - argv[0], in_filename, out_filename, hdr_filename, symbol_name, - hdr_filename, symbol_name)) - throw_error("Failed writing output file", out_filename); - if (fclose(out_file)) - throw_error("Failed closing output file", out_filename); - } FILE *hdr_file; if (!(hdr_file = fopen(hdr_filename, "w"))) @@ -104,7 +79,7 @@ int main(int argc, const char **argv) { char c; if (fread(&c, 1, 1, in_file)) { if (!fprintf(hdr_file, "0x%02x, ", c)) - throw_error("Failed writing output file", out_filename); + throw_error("Failed writing output file", hdr_filename); } else { if (feof(in_file)) break; @@ -115,7 +90,7 @@ int main(int argc, const char **argv) { // line break every 16th element if ((cnt++ & 0xf) == 0xf) if (!fprintf(hdr_file, "\n ")) - throw_error("Failed writing output file", out_filename); + throw_error("Failed writing output file", hdr_filename); } // write last part of array definition @@ -128,7 +103,7 @@ int main(int argc, const char **argv) { "};\n" "\n" "#endif\n")) - throw_error("Failed writing output file", out_filename); + throw_error("Failed writing output file", hdr_filename); if (fclose(hdr_file)) throw_error("Failed closing header file", hdr_filename); diff --git a/router/src/mock_server/src/CMakeLists.txt b/router/src/mock_server/src/CMakeLists.txt index 19aa920f65eb..2ff93e30eb52 100644 --- a/router/src/mock_server/src/CMakeLists.txt +++ b/router/src/mock_server/src/CMakeLists.txt @@ -28,7 +28,6 @@ ADD_CUSTOM_COMMAND(OUTPUT mysql_server_mock_schema.cc mysql_server_mock_schema.h COMMAND json_schema_embedder ${CMAKE_CURRENT_SOURCE_DIR}/mysql_server_mock_schema.js - mysql_server_mock_schema.cc mysql_server_mock_schema.h "SqlQueryJsonSchema" DEPENDS mysql_server_mock_schema.js) @@ -143,7 +142,6 @@ add_harness_plugin(mock_server mysql_server_mock.cc classic_mock_session.cc x_mock_session.cc - mysql_server_mock_schema.cc duk_module_shim.cc duk_node_fs.c mock_server_plugin.cc diff --git a/router/src/mock_server/src/authentication.cc b/router/src/mock_server/src/authentication.cc index 4aa0118c2ea7..e79b6af45414 100644 --- a/router/src/mock_server/src/authentication.cc +++ b/router/src/mock_server/src/authentication.cc @@ -113,15 +113,12 @@ std::optional> MySQLNativePassword::scramble( return impl::scramble(nonce, password, EVP_sha1(), true); } -constexpr char MySQLNativePassword::name[]; - // caching_sha2_password std::optional> CachingSha2Password::scramble( std::string_view nonce, std::string_view password) { return impl::scramble(nonce, password, EVP_sha256(), false); } -constexpr char CachingSha2Password::name[]; // clear_text_password @@ -134,5 +131,3 @@ std::optional> ClearTextPassword::scramble( return res; } - -constexpr char ClearTextPassword::name[]; diff --git a/router/src/mock_server/src/mock_server_rest_client.cc b/router/src/mock_server/src/mock_server_rest_client.cc index 6af31c60a40a..8b0152432d52 100644 --- a/router/src/mock_server/src/mock_server_rest_client.cc +++ b/router/src/mock_server/src/mock_server_rest_client.cc @@ -37,11 +37,6 @@ #include #include -/* static */ constexpr std::chrono::milliseconds - MockServerRestClient::kMockServerMaxRestEndpointStepTime; -/* static */ constexpr std::chrono::milliseconds - MockServerRestClient::kMockServerDefaultRestEndpointTimeout; - MockServerRestClient::MockServerRestClient(const uint16_t http_port, const std::string &http_hostname) : http_hostname_(http_hostname), http_port_(http_port) {} diff --git a/router/src/rest_connection_pool/src/rest_connection_pool_config.cc b/router/src/rest_connection_pool/src/rest_connection_pool_config.cc index d7bec3cb388a..f07c32690dde 100644 --- a/router/src/rest_connection_pool/src/rest_connection_pool_config.cc +++ b/router/src/rest_connection_pool/src/rest_connection_pool_config.cc @@ -35,8 +35,6 @@ #include "mysqlrouter/connection_pool_component.h" #include "mysqlrouter/rest_api_utils.h" -constexpr const char RestConnectionPoolConfig::path_regex[]; - bool RestConnectionPoolConfig::on_handle_request( HttpRequest &req, const std::string & /* base_path */, const std::vector &path_matches) { diff --git a/router/src/rest_connection_pool/src/rest_connection_pool_list.cc b/router/src/rest_connection_pool/src/rest_connection_pool_list.cc index c567687dd1b1..535a5c7ad7df 100644 --- a/router/src/rest_connection_pool/src/rest_connection_pool_list.cc +++ b/router/src/rest_connection_pool/src/rest_connection_pool_list.cc @@ -30,8 +30,6 @@ #include "mysqlrouter/connection_pool_component.h" #include "mysqlrouter/rest_api_utils.h" -constexpr const char RestConnectionPoolList::path_regex[]; - bool RestConnectionPoolList::on_handle_request( HttpRequest &req, const std::string & /* base_path */, const std::vector & /* path_matches */) { diff --git a/router/src/rest_connection_pool/src/rest_connection_pool_status.cc b/router/src/rest_connection_pool/src/rest_connection_pool_status.cc index 7815ed932d55..88f9b1e7eb9c 100644 --- a/router/src/rest_connection_pool/src/rest_connection_pool_status.cc +++ b/router/src/rest_connection_pool/src/rest_connection_pool_status.cc @@ -37,8 +37,6 @@ #include "mysqlrouter/connection_pool_component.h" #include "mysqlrouter/rest_api_utils.h" -constexpr const char RestConnectionPoolStatus::path_regex[]; - bool RestConnectionPoolStatus::on_handle_request( HttpRequest &req, const std::string & /* base_path */, const std::vector &path_matches) { diff --git a/router/src/rest_metadata_cache/src/rest_clusters_list.cc b/router/src/rest_metadata_cache/src/rest_clusters_list.cc index 5b9c1fae879d..f8dd82825172 100644 --- a/router/src/rest_metadata_cache/src/rest_clusters_list.cc +++ b/router/src/rest_metadata_cache/src/rest_clusters_list.cc @@ -34,8 +34,6 @@ #include "mysqlrouter/metadata_cache.h" #include "mysqlrouter/rest_api_utils.h" -constexpr const char RestClustersList::path_regex[]; - bool RestClustersList::on_handle_request( HttpRequest &req, const std::string & /* base_path */, const std::vector & /* path_matches */) { diff --git a/router/src/rest_metadata_cache/src/rest_clusters_nodes.cc b/router/src/rest_metadata_cache/src/rest_clusters_nodes.cc index bb95c2c4389a..17b621f7ad03 100644 --- a/router/src/rest_metadata_cache/src/rest_clusters_nodes.cc +++ b/router/src/rest_metadata_cache/src/rest_clusters_nodes.cc @@ -34,8 +34,6 @@ #include "mysqlrouter/metadata_cache.h" #include "mysqlrouter/rest_api_utils.h" -constexpr const char RestClustersNodes::path_regex[]; - static const char *server_mode_to_string(metadata_cache::ServerMode mode) { switch (mode) { case metadata_cache::ServerMode::ReadOnly: diff --git a/router/src/rest_metadata_cache/src/rest_metadata_cache_config.cc b/router/src/rest_metadata_cache/src/rest_metadata_cache_config.cc index 3ca10e481f2b..a34165afe282 100644 --- a/router/src/rest_metadata_cache/src/rest_metadata_cache_config.cc +++ b/router/src/rest_metadata_cache/src/rest_metadata_cache_config.cc @@ -34,8 +34,6 @@ #include "mysqlrouter/metadata_cache.h" #include "mysqlrouter/rest_api_utils.h" -constexpr const char RestMetadataCacheConfig::path_regex[]; - template static rapidjson::Value json_value_from_string(const std::string &s, AllocatorType &allocator) { diff --git a/router/src/rest_metadata_cache/src/rest_metadata_cache_list.cc b/router/src/rest_metadata_cache/src/rest_metadata_cache_list.cc index 4df1773c66b5..7497bb1d919e 100644 --- a/router/src/rest_metadata_cache/src/rest_metadata_cache_list.cc +++ b/router/src/rest_metadata_cache/src/rest_metadata_cache_list.cc @@ -34,8 +34,6 @@ #include "mysqlrouter/metadata_cache.h" #include "mysqlrouter/rest_api_utils.h" -constexpr const char RestMetadataCacheList::path_regex[]; - template rapidjson::Value json_value_from_string(const std::string &s, AllocatorType &allocator) { diff --git a/router/src/rest_metadata_cache/src/rest_metadata_cache_status.cc b/router/src/rest_metadata_cache/src/rest_metadata_cache_status.cc index d5741c2165c6..b5f89c191874 100644 --- a/router/src/rest_metadata_cache/src/rest_metadata_cache_status.cc +++ b/router/src/rest_metadata_cache/src/rest_metadata_cache_status.cc @@ -34,8 +34,6 @@ #include "mysqlrouter/metadata_cache.h" #include "mysqlrouter/rest_api_utils.h" -constexpr const char RestMetadataCacheStatus::path_regex[]; - template static rapidjson::Value json_value_from_string(const std::string &s, AllocatorType &allocator) { diff --git a/router/src/rest_router/src/rest_router_status.cc b/router/src/rest_router/src/rest_router_status.cc index 92a7879a94c5..611c9272af01 100644 --- a/router/src/rest_router/src/rest_router_status.cc +++ b/router/src/rest_router/src/rest_router_status.cc @@ -44,8 +44,6 @@ #include "router_config.h" // MYSQL_ROUTER_VERSION -constexpr const char RestRouterStatus::path_regex[]; - bool RestRouterStatus::on_handle_request(HttpRequest &req, const std::string & /* base_path */, const std::vector &) { diff --git a/router/src/rest_routing/src/rest_routing_blocked_hosts.cc b/router/src/rest_routing/src/rest_routing_blocked_hosts.cc index bdfffe2732e4..b19f6f2e9cf4 100644 --- a/router/src/rest_routing/src/rest_routing_blocked_hosts.cc +++ b/router/src/rest_routing/src/rest_routing_blocked_hosts.cc @@ -34,8 +34,6 @@ #include "mysqlrouter/rest_api_utils.h" #include "mysqlrouter/routing_component.h" -constexpr const char RestRoutingBlockedHosts::path_regex[]; - bool RestRoutingBlockedHosts::on_handle_request( HttpRequest &req, const std::string & /* base_path */, const std::vector &path_matches) { diff --git a/router/src/rest_routing/src/rest_routing_config.cc b/router/src/rest_routing/src/rest_routing_config.cc index f967e7fd8ae0..2287b8ffbe84 100644 --- a/router/src/rest_routing/src/rest_routing_config.cc +++ b/router/src/rest_routing/src/rest_routing_config.cc @@ -34,8 +34,6 @@ #include "mysqlrouter/rest_api_utils.h" #include "mysqlrouter/routing_component.h" -constexpr const char RestRoutingConfig::path_regex[]; - static void add_if_set(rapidjson::Document &json_doc, const rapidjson::Value::StringRefType member, const std::string &v) { diff --git a/router/src/rest_routing/src/rest_routing_connections.cc b/router/src/rest_routing/src/rest_routing_connections.cc index f1de4d8f9668..6ba5e1c49b2a 100644 --- a/router/src/rest_routing/src/rest_routing_connections.cc +++ b/router/src/rest_routing/src/rest_routing_connections.cc @@ -34,16 +34,6 @@ #include "mysqlrouter/rest_api_utils.h" #include "mysqlrouter/routing_component.h" -constexpr const char RestRoutingConnections::kKeyBytesFromServer[]; -constexpr const char RestRoutingConnections::kKeyBytesToServer[]; -constexpr const char RestRoutingConnections::kKeyDestinationAddress[]; -constexpr const char RestRoutingConnections::kKeyTimeConnectedToServer[]; -constexpr const char RestRoutingConnections::kKeyTimeLastReceivedFromServer[]; -constexpr const char RestRoutingConnections::kKeyTimeLastSentToServer[]; -constexpr const char RestRoutingConnections::kKeyTimeStarted[]; -constexpr const char RestRoutingConnections::kKeySourceAddress[]; -constexpr const char RestRoutingConnections::path_regex[]; - bool RestRoutingConnections::on_handle_request( HttpRequest &req, const std::string & /* base_path */, const std::vector &path_matches) { diff --git a/router/src/rest_routing/src/rest_routing_destinations.cc b/router/src/rest_routing/src/rest_routing_destinations.cc index fd8037b86126..c7f09dbb97ec 100644 --- a/router/src/rest_routing/src/rest_routing_destinations.cc +++ b/router/src/rest_routing/src/rest_routing_destinations.cc @@ -36,8 +36,6 @@ #include "mysqlrouter/rest_api_utils.h" #include "mysqlrouter/routing_component.h" -constexpr const char RestRoutingDestinations::path_regex[]; - bool RestRoutingDestinations::on_handle_request( HttpRequest &req, const std::string & /* base_path */, const std::vector &path_matches) { diff --git a/router/src/rest_routing/src/rest_routing_health.cc b/router/src/rest_routing/src/rest_routing_health.cc index a24014a20aa2..f4d6469ec919 100644 --- a/router/src/rest_routing/src/rest_routing_health.cc +++ b/router/src/rest_routing/src/rest_routing_health.cc @@ -34,8 +34,6 @@ #include "mysqlrouter/rest_api_utils.h" #include "mysqlrouter/routing_component.h" -constexpr const char RestRoutingHealth::path_regex[]; - bool RestRoutingHealth::on_handle_request( HttpRequest &req, const std::string & /* base_path */, const std::vector &path_matches) { diff --git a/router/src/rest_routing/src/rest_routing_list.cc b/router/src/rest_routing/src/rest_routing_list.cc index 760923125f42..a5061f06989a 100644 --- a/router/src/rest_routing/src/rest_routing_list.cc +++ b/router/src/rest_routing/src/rest_routing_list.cc @@ -30,8 +30,6 @@ #include "mysqlrouter/rest_api_utils.h" #include "mysqlrouter/routing_component.h" -constexpr const char RestRoutingList::path_regex[]; - bool RestRoutingList::on_handle_request( HttpRequest &req, const std::string & /* base_path */, const std::vector & /* path_matches */) { diff --git a/router/src/rest_routing/src/rest_routing_routes_status.cc b/router/src/rest_routing/src/rest_routing_routes_status.cc index 40cf6e50a1ba..1f830aaa2c4b 100644 --- a/router/src/rest_routing/src/rest_routing_routes_status.cc +++ b/router/src/rest_routing/src/rest_routing_routes_status.cc @@ -36,8 +36,6 @@ #include "mysqlrouter/rest_api_utils.h" #include "mysqlrouter/routing_component.h" -constexpr const char RestRoutingRoutesStatus::path_regex[]; - bool RestRoutingRoutesStatus::on_handle_request( HttpRequest &req, const std::string & /* base_path */, const std::vector &path_matches) { diff --git a/router/src/rest_routing/src/rest_routing_status.cc b/router/src/rest_routing/src/rest_routing_status.cc index 3e6ab4c98860..fd9d4bba6567 100644 --- a/router/src/rest_routing/src/rest_routing_status.cc +++ b/router/src/rest_routing/src/rest_routing_status.cc @@ -36,8 +36,6 @@ #include "mysqlrouter/rest_api_utils.h" #include "mysqlrouter/routing_component.h" -constexpr const char RestRoutingStatus::path_regex[]; - bool RestRoutingStatus::on_handle_request( HttpRequest &req, const std::string & /* base_path */, const std::vector & /*path_matches*/) { diff --git a/router/tests/component/test_async_replicaset.cc b/router/tests/component/test_async_replicaset.cc index 00359369fcbd..f9c1c973629f 100644 --- a/router/tests/component/test_async_replicaset.cc +++ b/router/tests/component/test_async_replicaset.cc @@ -1366,7 +1366,7 @@ TEST_P(NodeUnavailableTest, NodeUnavailable) { SCOPED_TRACE("// The cluster has 4 nodes but the first SECONDARY is down"); const auto trace_file = get_data_dir().join("metadata_dynamic_nodes_v2_ar.js").str(); - for (unsigned i = 0, nodes = 0; i < CLUSTER_NODES; ++i) { + for (unsigned i = 0; i < CLUSTER_NODES; ++i) { if (i == 1) continue; cluster_nodes.push_back(&ProcessManager::launch_mysql_server_mock( trace_file, cluster_nodes_ports[i], EXIT_SUCCESS, false, @@ -1375,7 +1375,6 @@ TEST_P(NodeUnavailableTest, NodeUnavailable) { SCOPED_TRACE("// All 4 nodes are in the metadata"); set_mock_metadata(cluster_http_ports[i], cluster_id, cluster_nodes_ports, /*primary_id=*/0, view_id); - nodes++; } const std::string state_file = create_state_file( diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 6da551fe27eb..66c7d686fb0e 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -898,6 +898,12 @@ IF(MY_COMPILER_IS_GNU_OR_CLANG) ${CMAKE_CURRENT_BINARY_DIR}/sql_hints.yy.cc COMPILE_FLAGS "-Wno-free-nonheap-object") ENDIF() + IF(MY_COMPILER_IS_CLANG AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15) + ADD_COMPILE_FLAGS( + ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc + ${CMAKE_CURRENT_BINARY_DIR}/sql_hints.yy.cc + COMPILE_FLAGS "-Wno-unused-but-set-variable") + ENDIF() ENDIF() IF(WIN32) diff --git a/sql/auth/sql_auth_cache.cc b/sql/auth/sql_auth_cache.cc index 683157cab05e..d1914ce1f288 100644 --- a/sql/auth/sql_auth_cache.cc +++ b/sql/auth/sql_auth_cache.cc @@ -94,7 +94,6 @@ using std::make_unique; using std::min; -using std::move; using std::string; using std::unique_ptr; @@ -2235,7 +2234,7 @@ bool acl_reload(THD *thd, bool mdl_locked) { old_acl_users = acl_users; old_acl_dbs = acl_dbs; old_acl_proxy_users = acl_proxy_users; - old_acl_restrictions = move(acl_restrictions); + old_acl_restrictions = std::move(acl_restrictions); swap_role_cache(); roles_init(); @@ -2249,7 +2248,7 @@ bool acl_reload(THD *thd, bool mdl_locked) { // acl_load() overwrites global_acl_memory, so we need to free it. // However, we can't do that immediately, because acl_load() might fail, // and then we'd need to keep it. - old_mem = move(global_acl_memory); + old_mem = std::move(global_acl_memory); delete acl_wild_hosts; acl_wild_hosts = nullptr; delete acl_check_hosts; @@ -2270,8 +2269,8 @@ bool acl_reload(THD *thd, bool mdl_locked) { acl_users = old_acl_users; acl_dbs = old_acl_dbs; acl_proxy_users = old_acl_proxy_users; - global_acl_memory = move(old_mem); - acl_restrictions = move(old_acl_restrictions); + global_acl_memory = std::move(old_mem); + acl_restrictions = std::move(old_acl_restrictions); // Revert to the old role caches swap_role_cache(); // Old caches must be pointing to the global role caches right now @@ -2606,17 +2605,17 @@ static bool grant_reload_procs_priv(TABLE_LIST *table) { /* Save a copy of the current hash if we need to undo the grant load */ unique_ptr< malloc_unordered_multimap>> - old_proc_priv_hash(move(proc_priv_hash)); + old_proc_priv_hash(std::move(proc_priv_hash)); unique_ptr< malloc_unordered_multimap>> - old_func_priv_hash(move(func_priv_hash)); + old_func_priv_hash(std::move(func_priv_hash)); bool return_val = false; if ((return_val = grant_load_procs_priv(table->table))) { /* Error; Reverting to old hash */ DBUG_PRINT("error", ("Reverting to old privileges")); - proc_priv_hash = move(old_proc_priv_hash); - func_priv_hash = move(old_func_priv_hash); + proc_priv_hash = std::move(old_proc_priv_hash); + func_priv_hash = std::move(old_func_priv_hash); } return return_val; @@ -2683,13 +2682,13 @@ bool grant_reload(THD *thd, bool mdl_locked) { { unique_ptr< malloc_unordered_multimap>> - old_column_priv_hash(move(column_priv_hash)); + old_column_priv_hash(std::move(column_priv_hash)); /* Create a new memory pool but save the current memory pool to make an undo operation possible in case of failure. */ - old_mem = move(memex); + old_mem = std::move(memex); init_sql_alloc(key_memory_acl_memex, &memex, ACL_ALLOC_BLOCK_SIZE); /* tables[2].table i.e. procs_priv can be null if we are working with @@ -2699,9 +2698,10 @@ bool grant_reload(THD *thd, bool mdl_locked) { grant_reload_procs_priv( &tables[2])))) { // Error. Revert to old hash DBUG_PRINT("error", ("Reverting to old privileges")); - column_priv_hash = move(old_column_priv_hash); /* purecov: deadcode */ + column_priv_hash = + std::move(old_column_priv_hash); /* purecov: deadcode */ memex.Clear(); - memex = move(old_mem); /* purecov: deadcode */ + memex = std::move(old_mem); /* purecov: deadcode */ } else { // Reload successful old_column_priv_hash.reset(); old_mem.Clear(); @@ -3265,13 +3265,13 @@ Acl_map::~Acl_map() { Acl_map::Acl_map(const Acl_map &&map) { operator=(map); } Acl_map &Acl_map::operator=(Acl_map &&map) { - m_db_acls = move(map.m_db_acls); + m_db_acls = std::move(map.m_db_acls); m_global_acl = map.m_global_acl; m_reference_count = map.m_reference_count.load(); - m_table_acls = move(map.m_table_acls); - m_sp_acls = move(map.m_sp_acls); - m_func_acls = move(map.m_func_acls); - m_with_admin_acls = move(map.m_with_admin_acls); + m_table_acls = std::move(map.m_table_acls); + m_sp_acls = std::move(map.m_sp_acls); + m_func_acls = std::move(map.m_func_acls); + m_with_admin_acls = std::move(map.m_with_admin_acls); m_version = map.m_version; m_restrictions = map.m_restrictions; map.m_reference_count = 0; diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 06cf3bc2b078..2eb72191c34c 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -147,7 +147,7 @@ void Item_subselect::init(Query_block *query_block, unit = query_block->master_query_expression(); if (unit->item) { - subquery = move(unit->item->subquery); + subquery = std::move(unit->item->subquery); parsing_place = unit->item->parsing_place; unit->item = this; subquery->change_query_result(current_thd, this, result); diff --git a/sql/iterators/bka_iterator.cc b/sql/iterators/bka_iterator.cc index a112b1f45752..693afe2e7cf1 100644 --- a/sql/iterators/bka_iterator.cc +++ b/sql/iterators/bka_iterator.cc @@ -77,8 +77,8 @@ BKAIterator::BKAIterator(THD *thd, MultiRangeRowIterator *mrr_iterator, JoinType join_type) : RowIterator(thd), - m_outer_input(move(outer_input)), - m_inner_input(move(inner_input)), + m_outer_input(std::move(outer_input)), + m_inner_input(std::move(inner_input)), m_mem_root(key_memory_hash_join, 16384 /* 16 kB */), m_rows(&m_mem_root), m_outer_input_tables(outer_input_tables, store_rowids, diff --git a/sql/iterators/composite_iterators.cc b/sql/iterators/composite_iterators.cc index d1459b40895d..17d21906c6c1 100644 --- a/sql/iterators/composite_iterators.cc +++ b/sql/iterators/composite_iterators.cc @@ -176,7 +176,7 @@ AggregateIterator::AggregateIterator( THD *thd, unique_ptr_destroy_only source, JOIN *join, TableCollection tables, bool rollup) : RowIterator(thd), - m_source(move(source)), + m_source(std::move(source)), m_join(join), m_rollup(rollup), m_tables(std::move(tables)) { @@ -770,7 +770,7 @@ MaterializeIterator::MaterializeIterator( unique_ptr_destroy_only table_iterator, JOIN *join) : TableRowIterator(thd, path_params->table), m_query_blocks_to_materialize(std::move(query_blocks_to_materialize)), - m_table_iterator(move(table_iterator)), + m_table_iterator(std::move(table_iterator)), m_cte(path_params->cte), m_query_expression(path_params->unit), m_join(join), @@ -1461,7 +1461,7 @@ RowIterator *materialize_iterator::CreateIterator( auto iter = new (thd->mem_root) MaterializeIterator( thd, std::move(query_blocks_to_materialize), path_params, - move(table_iterator), join); + std::move(table_iterator), join); /* Provide timing data for the iterator that iterates over the temporary @@ -1473,7 +1473,7 @@ RowIterator *materialize_iterator::CreateIterator( } else { return new (thd->mem_root) MaterializeIterator( thd, std::move(query_blocks_to_materialize), path_params, - move(table_iterator), join); + std::move(table_iterator), join); } } @@ -1482,7 +1482,7 @@ StreamingIterator::StreamingIterator( Temp_table_param *temp_table_param, TABLE *table, bool provide_rowid, JOIN *join, int ref_slice) : TableRowIterator(thd, table), - m_subquery_iterator(move(subquery_iterator)), + m_subquery_iterator(std::move(subquery_iterator)), m_temp_table_param(temp_table_param), m_join(join), m_output_slice(ref_slice), @@ -1658,8 +1658,8 @@ TemptableAggregateIterator::TemptableAggregateIterator( unique_ptr_destroy_only table_iterator, JOIN *join, int ref_slice) : TableRowIterator(thd, table), - m_subquery_iterator(move(subquery_iterator)), - m_table_iterator(move(table_iterator)), + m_subquery_iterator(std::move(subquery_iterator)), + m_table_iterator(std::move(table_iterator)), m_temp_table_param(temp_table_param), m_join(join), m_ref_slice(ref_slice) {} @@ -1918,8 +1918,8 @@ RowIterator *temptable_aggregate_iterator::CreateIterator( auto iter = new (thd->mem_root) TemptableAggregateIterator( - thd, move(subquery_iterator), temp_table_param, table, - move(table_iterator), join, ref_slice); + thd, std::move(subquery_iterator), temp_table_param, table, + std::move(table_iterator), join, ref_slice); /* Provide timing data for the iterator that iterates over the temporary @@ -1931,8 +1931,8 @@ RowIterator *temptable_aggregate_iterator::CreateIterator( } else { return new (thd->mem_root) TemptableAggregateIterator( - thd, move(subquery_iterator), temp_table_param, table, - move(table_iterator), join, ref_slice); + thd, std::move(subquery_iterator), temp_table_param, table, + std::move(table_iterator), join, ref_slice); } } @@ -1940,7 +1940,7 @@ MaterializedTableFunctionIterator::MaterializedTableFunctionIterator( THD *thd, Table_function *table_function, TABLE *table, unique_ptr_destroy_only table_iterator) : TableRowIterator(thd, table), - m_table_iterator(move(table_iterator)), + m_table_iterator(std::move(table_iterator)), m_table_function(table_function) {} bool MaterializedTableFunctionIterator::Init() { @@ -1961,7 +1961,7 @@ WeedoutIterator::WeedoutIterator(THD *thd, SJ_TMP_TABLE *sj, table_map tables_to_get_rowid_for) : RowIterator(thd), - m_source(move(source)), + m_source(std::move(source)), m_sj(sj), m_tables_to_get_rowid_for(tables_to_get_rowid_for) { // Confluent weedouts should have been rewritten to LIMIT 1 earlier. @@ -2020,7 +2020,7 @@ int WeedoutIterator::Read() { RemoveDuplicatesIterator::RemoveDuplicatesIterator( THD *thd, unique_ptr_destroy_only source, JOIN *join, Item **group_items, int group_items_size) - : RowIterator(thd), m_source(move(source)) { + : RowIterator(thd), m_source(std::move(source)) { m_caches = Bounds_checked_array::Alloc(thd->mem_root, group_items_size); for (int i = 0; i < group_items_size; ++i) { @@ -2065,7 +2065,7 @@ RemoveDuplicatesOnIndexIterator::RemoveDuplicatesOnIndexIterator( THD *thd, unique_ptr_destroy_only source, const TABLE *table, KEY *key, size_t key_len) : RowIterator(thd), - m_source(move(source)), + m_source(std::move(source)), m_table(table), m_key(key), m_key_buf(new (thd->mem_root) uchar[key_len]), @@ -2105,8 +2105,8 @@ NestedLoopSemiJoinWithDuplicateRemovalIterator:: unique_ptr_destroy_only source_inner, const TABLE *table, KEY *key, size_t key_len) : RowIterator(thd), - m_source_outer(move(source_outer)), - m_source_inner(move(source_inner)), + m_source_outer(std::move(source_outer)), + m_source_inner(std::move(source_inner)), m_table_outer(table), m_key(key), m_key_buf(new (thd->mem_root) uchar[key_len]), @@ -2183,7 +2183,7 @@ MaterializeInformationSchemaTableIterator:: THD *thd, unique_ptr_destroy_only table_iterator, TABLE_LIST *table_list, Item *condition) : RowIterator(thd), - m_table_iterator(move(table_iterator)), + m_table_iterator(std::move(table_iterator)), m_table_list(table_list), m_condition(condition) {} @@ -2206,7 +2206,7 @@ bool MaterializeInformationSchemaTableIterator::Init() { AppendIterator::AppendIterator( THD *thd, std::vector> &&sub_iterators) - : RowIterator(thd), m_sub_iterators(move(sub_iterators)) { + : RowIterator(thd), m_sub_iterators(std::move(sub_iterators)) { assert(!m_sub_iterators.empty()); } diff --git a/sql/iterators/composite_iterators.h b/sql/iterators/composite_iterators.h index 7ff3417602d1..f5aa8eeb5c16 100644 --- a/sql/iterators/composite_iterators.h +++ b/sql/iterators/composite_iterators.h @@ -78,7 +78,7 @@ class FilterIterator final : public RowIterator { public: FilterIterator(THD *thd, unique_ptr_destroy_only source, Item *condition) - : RowIterator(thd), m_source(move(source)), m_condition(condition) {} + : RowIterator(thd), m_source(std::move(source)), m_condition(condition) {} bool Init() override { return m_source->Init(); } @@ -123,7 +123,7 @@ class LimitOffsetIterator final : public RowIterator { ha_rows limit, ha_rows offset, bool count_all_rows, bool reject_multiple_rows, ha_rows *skipped_rows) : RowIterator(thd), - m_source(move(source)), + m_source(std::move(source)), m_limit(limit), m_offset(offset), m_count_all_rows(count_all_rows), @@ -326,8 +326,8 @@ class NestedLoopIterator final : public RowIterator { unique_ptr_destroy_only source_inner, JoinType join_type, bool pfs_batch_mode) : RowIterator(thd), - m_source_outer(move(source_outer)), - m_source_inner(move(source_inner)), + m_source_outer(std::move(source_outer)), + m_source_inner(std::move(source_inner)), m_join_type(join_type), m_pfs_batch_mode(pfs_batch_mode) { assert(m_source_outer != nullptr); @@ -394,7 +394,7 @@ class CacheInvalidatorIterator final : public RowIterator { unique_ptr_destroy_only source_iterator, const std::string &name) : RowIterator(thd), - m_source_iterator(move(source_iterator)), + m_source_iterator(std::move(source_iterator)), m_name(name) {} bool Init() override { diff --git a/sql/iterators/hash_join_buffer.cc b/sql/iterators/hash_join_buffer.cc index c4b97878e652..f417aaa6e9bf 100644 --- a/sql/iterators/hash_join_buffer.cc +++ b/sql/iterators/hash_join_buffer.cc @@ -115,7 +115,7 @@ void LoadImmutableStringIntoTableBuffers(const TableCollection &tables, HashJoinRowBuffer::HashJoinRowBuffer( TableCollection tables, std::vector join_conditions, size_t max_mem_available) - : m_join_conditions(move(join_conditions)), + : m_join_conditions(std::move(join_conditions)), m_tables(std::move(tables)), m_mem_root(key_memory_hash_join, 16384 /* 16 kB */), m_overflow_mem_root(key_memory_hash_join, 256), diff --git a/sql/iterators/hash_join_iterator.cc b/sql/iterators/hash_join_iterator.cc index a17946cb2db2..c676097d59eb 100644 --- a/sql/iterators/hash_join_iterator.cc +++ b/sql/iterators/hash_join_iterator.cc @@ -54,8 +54,6 @@ class JOIN; using hash_join_buffer::LoadBufferRowIntoTableBuffers; using hash_join_buffer::LoadImmutableStringIntoTableBuffers; -constexpr size_t HashJoinIterator::kMaxChunks; - // An arbitrary hash value for the empty string, to avoid the hash function // from doing arithmetic on nullptr, which is undefined behavior. static constexpr size_t kZeroKeyLengthHash = 2669509769; @@ -74,8 +72,8 @@ HashJoinIterator::HashJoinIterator( : RowIterator(thd), m_state(State::READING_ROW_FROM_PROBE_ITERATOR), m_hash_table_generation(hash_table_generation), - m_build_input(move(build_input)), - m_probe_input(move(probe_input)), + m_build_input(std::move(build_input)), + m_probe_input(std::move(probe_input)), m_probe_input_tables(probe_input_tables, store_rowids, tables_to_get_rowid_for), m_build_input_tables(build_input_tables, store_rowids, diff --git a/sql/iterators/ref_row_iterators.cc b/sql/iterators/ref_row_iterators.cc index 6df7adc0a852..d725e6dedea6 100644 --- a/sql/iterators/ref_row_iterators.cc +++ b/sql/iterators/ref_row_iterators.cc @@ -69,7 +69,6 @@ #include "template_utils.h" using std::make_pair; -using std::move; using std::pair; static inline pair FindKeyBufferAndMap( @@ -584,7 +583,7 @@ bool DynamicRangeIterator::Init() { // two different read sets, to be used once the access strategy is chosen // here. if (qck) { - m_iterator = move(qck); + m_iterator = std::move(qck); // If the range optimizer chose index merge scan or a range scan with // covering index, use the read set without base columns. Otherwise we use // the read set with base columns included. diff --git a/sql/iterators/sorting_iterator.cc b/sql/iterators/sorting_iterator.cc index d9a3c68954fa..ecb1486fd6ac 100644 --- a/sql/iterators/sorting_iterator.cc +++ b/sql/iterators/sorting_iterator.cc @@ -404,7 +404,7 @@ SortingIterator::SortingIterator(THD *thd, Filesort *filesort, ha_rows *examined_rows) : RowIterator(thd), m_filesort(filesort), - m_source_iterator(move(source)), + m_source_iterator(std::move(source)), m_num_rows_estimate(num_rows_estimate), m_tables_to_get_rowid_for(tables_to_get_rowid_for), m_examined_rows(examined_rows) {} diff --git a/sql/iterators/window_iterators.cc b/sql/iterators/window_iterators.cc index 63f09dbbbafc..f8f1377a219d 100644 --- a/sql/iterators/window_iterators.cc +++ b/sql/iterators/window_iterators.cc @@ -1518,7 +1518,7 @@ WindowIterator::WindowIterator(THD *thd, Temp_table_param *temp_table_param, JOIN *join, int output_slice) : RowIterator(thd), - m_source(move(source)), + m_source(std::move(source)), m_temp_table_param(temp_table_param), m_window(temp_table_param->m_window), m_join(join), @@ -1565,7 +1565,7 @@ BufferingWindowIterator::BufferingWindowIterator( THD *thd, unique_ptr_destroy_only source, Temp_table_param *temp_table_param, JOIN *join, int output_slice) : RowIterator(thd), - m_source(move(source)), + m_source(std::move(source)), m_temp_table_param(temp_table_param), m_window(temp_table_param->m_window), m_join(join), diff --git a/sql/join_optimizer/access_path.cc b/sql/join_optimizer/access_path.cc index aaf54401a3fc..1a21eca39832 100644 --- a/sql/join_optimizer/access_path.cc +++ b/sql/join_optimizer/access_path.cc @@ -560,12 +560,12 @@ unique_ptr_destroy_only CreateIteratorFromAccessPath( children.reserve(param.children->size()); for (size_t child_idx = 0; child_idx < param.children->size(); ++child_idx) { - children.push_back(move(job.children[child_idx])); + children.push_back(std::move(job.children[child_idx])); } unique_ptr_destroy_only cpk_child; if (param.cpk_child != nullptr) { - cpk_child = move(job.children[param.children->size()]); + cpk_child = std::move(job.children[param.children->size()]); } iterator = NewIterator( thd, mem_root, mem_root, param.table, param.retrieve_full_rows, @@ -593,7 +593,7 @@ unique_ptr_destroy_only CreateIteratorFromAccessPath( Mem_root_array> children(mem_root); children.reserve(param.children->size()); for (unique_ptr_destroy_only &child : job.children) { - children.push_back(move(child)); + children.push_back(std::move(child)); } iterator = NewIterator( thd, mem_root, mem_root, param.table, std::move(children)); @@ -662,7 +662,7 @@ unique_ptr_destroy_only CreateIteratorFromAccessPath( } iterator = NewIterator( thd, mem_root, param.table_function, param.table, - move(job.children[0])); + std::move(job.children[0])); break; } case AccessPath::UNQUALIFIED_COUNT: @@ -677,8 +677,8 @@ unique_ptr_destroy_only CreateIteratorFromAccessPath( } iterator = NewIterator( - thd, mem_root, move(job.children[0]), move(job.children[1]), - param.join_type, param.pfs_batch_mode); + thd, mem_root, std::move(job.children[0]), + std::move(job.children[1]), param.join_type, param.pfs_batch_mode); break; } case AccessPath::NESTED_LOOP_SEMIJOIN_WITH_DUPLICATE_REMOVAL: { @@ -689,8 +689,8 @@ unique_ptr_destroy_only CreateIteratorFromAccessPath( continue; } iterator = NewIterator( - thd, mem_root, move(job.children[0]), move(job.children[1]), - param.table, param.key, param.key_len); + thd, mem_root, std::move(job.children[0]), + std::move(job.children[1]), param.table, param.key, param.key_len); break; } case AccessPath::BKA_JOIN: { @@ -709,9 +709,9 @@ unique_ptr_destroy_only CreateIteratorFromAccessPath( down_cast( mrr_path->iterator->real_iterator()); iterator = NewIterator( - thd, mem_root, move(job.children[0]), + thd, mem_root, std::move(job.children[0]), GetUsedTables(param.outer, /*include_pruned_tables=*/true), - move(job.children[1]), thd->variables.join_buff_size, + std::move(job.children[1]), thd->variables.join_buff_size, param.mrr_length_per_rec, param.rec_per_key, param.store_rowids, param.tables_to_get_rowid_for, mrr_iterator, param.join_type); break; @@ -786,12 +786,12 @@ unique_ptr_destroy_only CreateIteratorFromAccessPath( : nullptr; iterator = NewIterator( - thd, mem_root, move(job.children[1]), + thd, mem_root, std::move(job.children[1]), GetUsedTables(param.inner, /*include_pruned_tables=*/true), - estimated_build_rows, move(job.children[0]), + estimated_build_rows, std::move(job.children[0]), GetUsedTables(param.outer, /*include_pruned_tables=*/true), param.store_rowids, param.tables_to_get_rowid_for, - thd->variables.join_buff_size, move(conditions), + thd->variables.join_buff_size, std::move(conditions), param.allow_spill_to_disk, join_type, join_predicate->expr->join_conditions, probe_input_batch_mode, hash_table_generation); @@ -808,7 +808,7 @@ unique_ptr_destroy_only CreateIteratorFromAccessPath( return nullptr; } iterator = NewIterator( - thd, mem_root, move(job.children[0]), param.condition); + thd, mem_root, std::move(job.children[0]), param.condition); break; } case AccessPath::SORT: { @@ -823,8 +823,8 @@ unique_ptr_destroy_only CreateIteratorFromAccessPath( : lrint(param.child->num_output_rows()); Filesort *filesort = param.filesort; iterator = NewIterator( - thd, mem_root, filesort, move(job.children[0]), num_rows_estimate, - param.tables_to_get_rowid_for, examined_rows); + thd, mem_root, filesort, std::move(job.children[0]), + num_rows_estimate, param.tables_to_get_rowid_for, examined_rows); if (filesort->m_remove_duplicates) { filesort->tables[0]->duplicate_removal_iterator = down_cast(iterator->real_iterator()); @@ -844,7 +844,7 @@ unique_ptr_destroy_only CreateIteratorFromAccessPath( Prealloced_array tables = GetUsedTables(param.child, /*include_pruned_tables=*/true); iterator = NewIterator( - thd, mem_root, move(job.children[0]), join, + thd, mem_root, std::move(job.children[0]), join, TableCollection(tables, /*store_rowids=*/false, /*tables_to_get_rowid_for=*/0), param.rollup); @@ -870,8 +870,9 @@ unique_ptr_destroy_only CreateIteratorFromAccessPath( iterator = unique_ptr_destroy_only( temptable_aggregate_iterator::CreateIterator( - thd, move(job.children[0]), param.temp_table_param, param.table, - move(job.children[1]), join, param.ref_slice)); + thd, std::move(job.children[0]), param.temp_table_param, + param.table, std::move(job.children[1]), join, + param.ref_slice)); break; } @@ -889,8 +890,9 @@ unique_ptr_destroy_only CreateIteratorFromAccessPath( send_records = &join->send_records; } iterator = NewIterator( - thd, mem_root, move(job.children[0]), param.limit, param.offset, - param.count_all_rows, param.reject_multiple_rows, send_records); + thd, mem_root, std::move(job.children[0]), param.limit, + param.offset, param.count_all_rows, param.reject_multiple_rows, + send_records); break; } case AccessPath::STREAM: { @@ -901,7 +903,7 @@ unique_ptr_destroy_only CreateIteratorFromAccessPath( continue; } iterator = NewIterator( - thd, mem_root, move(job.children[0]), param.temp_table_param, + thd, mem_root, std::move(job.children[0]), param.temp_table_param, param.table, param.provide_rowid, param.join, param.ref_slice); break; } @@ -941,14 +943,14 @@ unique_ptr_destroy_only CreateIteratorFromAccessPath( continue; } unique_ptr_destroy_only table_iterator = - move(job.children[0]); + std::move(job.children[0]); Mem_root_array query_blocks( thd->mem_root, param->query_blocks.size()); for (size_t i = 0; i < param->query_blocks.size(); ++i) { const MaterializePathParameters::QueryBlock &from = param->query_blocks[i]; materialize_iterator::QueryBlock &to = query_blocks[i]; - to.subquery_iterator = move(job.children[i + 1]); + to.subquery_iterator = std::move(job.children[i + 1]); to.select_number = from.select_number; to.join = from.join; to.disable_deduplication_by_hash_field = @@ -979,9 +981,9 @@ unique_ptr_destroy_only CreateIteratorFromAccessPath( JOIN *subjoin = param->ref_slice == -1 ? nullptr : query_blocks[0].join; iterator = unique_ptr_destroy_only( - materialize_iterator::CreateIterator(thd, std::move(query_blocks), - param, move(table_iterator), - subjoin)); + materialize_iterator::CreateIterator( + thd, std::move(query_blocks), param, std::move(table_iterator), + subjoin)); break; } @@ -993,7 +995,7 @@ unique_ptr_destroy_only CreateIteratorFromAccessPath( continue; } iterator = NewIterator( - thd, mem_root, move(job.children[0]), param.table_list, + thd, mem_root, std::move(job.children[0]), param.table_list, param.condition); break; } @@ -1019,9 +1021,10 @@ unique_ptr_destroy_only CreateIteratorFromAccessPath( vector> children; children.reserve(param.children->size()); for (unique_ptr_destroy_only &child : job.children) { - children.push_back(move(child)); + children.push_back(std::move(child)); } - iterator = NewIterator(thd, mem_root, move(children)); + iterator = + NewIterator(thd, mem_root, std::move(children)); break; } case AccessPath::WINDOW: { @@ -1033,11 +1036,11 @@ unique_ptr_destroy_only CreateIteratorFromAccessPath( } if (param.needs_buffering) { iterator = NewIterator( - thd, mem_root, move(job.children[0]), param.temp_table_param, + thd, mem_root, std::move(job.children[0]), param.temp_table_param, join, param.ref_slice); } else { iterator = NewIterator( - thd, mem_root, move(job.children[0]), param.temp_table_param, + thd, mem_root, std::move(job.children[0]), param.temp_table_param, join, param.ref_slice); } break; @@ -1050,7 +1053,7 @@ unique_ptr_destroy_only CreateIteratorFromAccessPath( continue; } iterator = NewIterator( - thd, mem_root, move(job.children[0]), param.weedout_table, + thd, mem_root, std::move(job.children[0]), param.weedout_table, param.tables_to_get_rowid_for); break; } @@ -1062,7 +1065,7 @@ unique_ptr_destroy_only CreateIteratorFromAccessPath( continue; } iterator = NewIterator( - thd, mem_root, move(job.children[0]), join, param.group_items, + thd, mem_root, std::move(job.children[0]), join, param.group_items, param.group_items_size); break; } @@ -1074,7 +1077,7 @@ unique_ptr_destroy_only CreateIteratorFromAccessPath( continue; } iterator = NewIterator( - thd, mem_root, move(job.children[0]), param.table, param.key, + thd, mem_root, std::move(job.children[0]), param.table, param.key, param.loosescan_key_len); break; } @@ -1097,7 +1100,8 @@ unique_ptr_destroy_only CreateIteratorFromAccessPath( } iterator = NewIterator( thd, mem_root, param.table_scan_path->table_scan().table, - move(job.children[0]), move(job.children[1]), param.used_ref); + std::move(job.children[0]), std::move(job.children[1]), + param.used_ref); break; } case AccessPath::CACHE_INVALIDATOR: { @@ -1108,7 +1112,7 @@ unique_ptr_destroy_only CreateIteratorFromAccessPath( continue; } iterator = NewIterator( - thd, mem_root, move(job.children[0]), param.name); + thd, mem_root, std::move(job.children[0]), param.name); break; } case AccessPath::DELETE_ROWS: { @@ -1124,7 +1128,7 @@ unique_ptr_destroy_only CreateIteratorFromAccessPath( continue; } iterator = NewIterator( - thd, mem_root, move(job.children[0]), join, + thd, mem_root, std::move(job.children[0]), join, param.tables_to_delete_from, param.immediate_tables); break; } diff --git a/sql/join_optimizer/explain_access_path.cc b/sql/join_optimizer/explain_access_path.cc index 1f6f29b753f2..6c56cdc79c72 100644 --- a/sql/join_optimizer/explain_access_path.cc +++ b/sql/join_optimizer/explain_access_path.cc @@ -156,7 +156,7 @@ static bool SetIndexInfoInObject( if (!lookup_condition.empty()) error |= AddMemberToObject(obj, "lookup_condition", lookup_condition); - if (range_arr) error |= obj->add_alias("ranges", move(range_arr)); + if (range_arr) error |= obj->add_alias("ranges", std::move(range_arr)); if (reverse) error |= AddMemberToObject(obj, "reverse", true); if (pushed_idx_cond) error |= AddMemberToObject(obj, "pushed_index_condition", @@ -412,7 +412,7 @@ static std::unique_ptr ExplainMaterializeAccessPath( * object for this table path. */ ret_obj = AssignParentPath(path->materialize().table_path, path, - move(ret_obj), join); + std::move(ret_obj), join); // Children. @@ -526,9 +526,10 @@ static std::unique_ptr AssignParentPath( /* Place the input object as a child of the bottom-most object */ std::unique_ptr children(new (std::nothrow) Json_array()); - if (children == nullptr || children->append_alias(move(materialized_obj))) + if (children == nullptr || + children->append_alias(std::move(materialized_obj))) return nullptr; - if (bottom_obj->add_alias("inputs", move(children))) return nullptr; + if (bottom_obj->add_alias("inputs", std::move(children))) return nullptr; return table_obj; } @@ -600,7 +601,7 @@ static bool ExplainIndexSkipScanAccessPath(Json_object *obj, // good reason why we cannot fix this limitation in the future. return SetIndexInfoInObject( description, "index_skip_scan", nullptr, table, key_info, "skip scan", - /*lookup condition*/ "", &ranges, move(range_arr), /*reverse*/ false, + /*lookup condition*/ "", &ranges, std::move(range_arr), /*reverse*/ false, /*push_condition*/ nullptr, obj); } @@ -728,10 +729,10 @@ static bool AddChildrenToObject(Json_object *obj, child.description)) return true; } - if (children_json->append_alias(move(child_obj))) return true; + if (children_json->append_alias(std::move(child_obj))) return true; } - return obj->add_alias(alias, move(children_json)); + return obj->add_alias(alias, std::move(children_json)); } static std::unique_ptr ExplainQueryPlan( @@ -773,11 +774,11 @@ static std::unique_ptr ExplainQueryPlan( /* There might not be a select plan. E.g. INSERT ... VALUES() */ if (obj != nullptr) { std::unique_ptr children(new (std::nothrow) Json_array()); - if (children == nullptr || children->append_alias(move(obj))) + if (children == nullptr || children->append_alias(std::move(obj))) return nullptr; - if (dml_obj->add_alias("inputs", move(children))) return nullptr; + if (dml_obj->add_alias("inputs", std::move(children))) return nullptr; } - obj = move(dml_obj); + obj = std::move(dml_obj); } return obj; @@ -1077,7 +1078,7 @@ static std::unique_ptr SetObjectMembers( /*single_part_only=*/false, range_arr, &ranges); error |= SetIndexInfoInObject( &description, "index_range_scan", nullptr, table, key_info, - "range scan", /*lookup condition*/ "", &ranges, move(range_arr), + "range scan", /*lookup condition*/ "", &ranges, std::move(range_arr), path->index_range_scan().reverse, table->file->pushed_idx_cond, obj); error |= AddChildrenFromPushedCondition(table, children); @@ -1383,7 +1384,7 @@ static std::unique_ptr SetObjectMembers( error |= AddMemberToObject(obj, "access_type", "temp_table_aggregate"); ret_obj = AssignParentPath(path->temptable_aggregate().table_path, - nullptr, move(ret_obj), join); + nullptr, std::move(ret_obj), join); if (ret_obj == nullptr) return nullptr; description = "Aggregate using temporary table"; children->push_back({path->temptable_aggregate().subquery_path}); @@ -1426,14 +1427,14 @@ static std::unique_ptr SetObjectMembers( error |= AddMemberToObject(obj, "access_type", "materialize"); ret_obj = - ExplainMaterializeAccessPath(path, join, move(ret_obj), children, + ExplainMaterializeAccessPath(path, join, std::move(ret_obj), children, current_thd->lex->is_explain_analyze); if (ret_obj == nullptr) return nullptr; break; case AccessPath::MATERIALIZE_INFORMATION_SCHEMA_TABLE: { ret_obj = AssignParentPath( path->materialize_information_schema_table().table_path, nullptr, - move(ret_obj), join); + std::move(ret_obj), join); if (ret_obj == nullptr) return nullptr; const char *table = path->materialize_information_schema_table().table_list->table->alias; @@ -1642,7 +1643,7 @@ static std::unique_ptr SetObjectMembers( error |= AddMemberToObject(obj, "operation", description); } - return (error ? nullptr : move(ret_obj)); + return (error ? nullptr : std::move(ret_obj)); } /** @@ -1683,8 +1684,8 @@ static std::unique_ptr ExplainAccessPath( return ret_obj; } - if ((ret_obj = SetObjectMembers(move(ret_obj), path, materialized_path, join, - &children)) == nullptr) + if ((ret_obj = SetObjectMembers(std::move(ret_obj), path, materialized_path, + join, &children)) == nullptr) return nullptr; // If we are crossing into a different query block, but there's a streaming diff --git a/sql/join_optimizer/graph_simplification.cc b/sql/join_optimizer/graph_simplification.cc index 493b77a4c4d8..9fe3003e064e 100644 --- a/sql/join_optimizer/graph_simplification.cc +++ b/sql/join_optimizer/graph_simplification.cc @@ -60,7 +60,6 @@ using hypergraph::NodeMap; using std::fill; using std::max; using std::min; -using std::move; using std::string; using std::swap; using std::vector; @@ -302,7 +301,7 @@ double GetCardinality(NodeMap tables_to_join, const JoinHypergraph &graph, active_components &= ~(uint64_t{1} << right_component); return active_components == 0b1; }; - ConnectComponentsThroughJoins(graph, cycles, move(func), components, + ConnectComponentsThroughJoins(graph, cycles, std::move(func), components, in_component); // In rare situations, we could be left in a situation where an edge @@ -545,7 +544,7 @@ bool GraphIsJoinable(const JoinHypergraph &graph, } return false; }; - ConnectComponentsThroughJoins(graph, cycles, move(func), components, + ConnectComponentsThroughJoins(graph, cycles, std::move(func), components, in_component); return num_in_component0 == graph.nodes.size(); } diff --git a/sql/join_optimizer/interesting_orders.cc b/sql/join_optimizer/interesting_orders.cc index ff80ea754053..2b8dbf9e1701 100644 --- a/sql/join_optimizer/interesting_orders.cc +++ b/sql/join_optimizer/interesting_orders.cc @@ -48,7 +48,6 @@ using std::fill; using std::lower_bound; using std::make_pair; using std::max; -using std::move; using std::none_of; using std::pair; using std::sort; @@ -1217,7 +1216,7 @@ int LogicalOrderings::AddArtificialState(THD *thd, Ordering ordering) { state.satisfied_ordering_idx = -1; // Irrelevant, but placate the compiler. state.outgoing_edges.init(thd->mem_root); state.type = NFSMState::ARTIFICIAL; - m_states.push_back(move(state)); + m_states.push_back(std::move(state)); return m_states.size() - 1; } @@ -1282,7 +1281,7 @@ void LogicalOrderings::BuildNFSM(THD *thd) { state.type = m_orderings[i].type == OrderingWithInfo::INTERESTING ? NFSMState::INTERESTING : NFSMState::ARTIFICIAL; - m_states.push_back(move(state)); + m_states.push_back(std::move(state)); } // Add an edge from the initial state to each producible ordering/grouping. @@ -1731,7 +1730,7 @@ void LogicalOrderings::ConvertNFSMToDFSM(THD *thd) { initial.nfsm_states.push_back(0); ExpandThroughAlwaysActiveFDs(&initial.nfsm_states, &generation, /*extra_allowed_fd_idx=*/0); - m_dfsm_states.push_back(move(initial)); + m_dfsm_states.push_back(std::move(initial)); constructed_states.insert(0); FinalizeDFSMState(thd, /*state_idx=*/0); @@ -1818,7 +1817,7 @@ void LogicalOrderings::ConvertNFSMToDFSM(THD *thd) { // Add a new DFSM state for the NFSM states we've collected. int target_dfsm_state_idx = m_dfsm_states.size(); m_dfsm_states.push_back(DFSMState{}); - m_dfsm_states.back().nfsm_states = move(nfsm_states); + m_dfsm_states.back().nfsm_states = std::move(nfsm_states); // See if there is an existing DFSM state that matches the set of // NFSM states we've collected. @@ -1833,7 +1832,7 @@ void LogicalOrderings::ConvertNFSMToDFSM(THD *thd) { // newly added duplicate and use the original one. target_dfsm_state_idx = *place; // Allow reuse of the memory in the next iteration. - nfsm_states = move(m_dfsm_states.back().nfsm_states); + nfsm_states = std::move(m_dfsm_states.back().nfsm_states); m_dfsm_states.pop_back(); } diff --git a/sql/partition_info.cc b/sql/partition_info.cc index a3c89ecf7061..32aff930f8c4 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -1730,7 +1730,6 @@ bool partition_info::set_up_charset_field_preps() { uchar **char_ptrs; unsigned i; size_t size; - uint tot_fields = 0; uint tot_part_fields = 0; uint tot_subpart_fields = 0; DBUG_TRACE; @@ -1742,7 +1741,6 @@ bool partition_info::set_up_charset_field_preps() { while ((field = *(ptr++))) { if (field_is_partition_charset(field)) { tot_part_fields++; - tot_fields++; } } size = tot_part_fields * sizeof(char *); @@ -1773,7 +1771,6 @@ bool partition_info::set_up_charset_field_preps() { while ((field = *(ptr++))) { if (field_is_partition_charset(field)) { tot_subpart_fields++; - tot_fields++; } } size = tot_subpart_fields * sizeof(char *); diff --git a/sql/range_optimizer/group_index_skip_scan_plan.cc b/sql/range_optimizer/group_index_skip_scan_plan.cc index a66370508e07..bbf9d6262838 100644 --- a/sql/range_optimizer/group_index_skip_scan_plan.cc +++ b/sql/range_optimizer/group_index_skip_scan_plan.cc @@ -70,7 +70,6 @@ struct MEM_ROOT; using std::max; using std::min; -using std::move; static bool add_range(MEM_ROOT *return_mem_root, SEL_ARG *sel_range, uint key_length, Quick_ranges *range_array); @@ -1024,9 +1023,9 @@ AccessPath *get_best_group_min_max(THD *thd, RANGE_OPT_PARAM *param, p->used_key_part = param->key[best_param_idx]; p->real_key_parts = real_key_parts; p->max_used_key_length = max_used_key_length; - p->prefix_ranges = move(prefix_ranges); - p->key_infix_ranges = move(key_infix_ranges); - p->min_max_ranges = move(min_max_ranges); + p->prefix_ranges = std::move(prefix_ranges); + p->key_infix_ranges = std::move(key_infix_ranges); + p->min_max_ranges = std::move(min_max_ranges); if (cost_est < best_read_cost.total_cost() && is_agg_distinct) { trace_group.add("index_scan", true); path->cost = 0.0; diff --git a/sql/range_optimizer/rowid_ordered_retrieval.cc b/sql/range_optimizer/rowid_ordered_retrieval.cc index 5f127a2c8e0b..11e1d773477d 100644 --- a/sql/range_optimizer/rowid_ordered_retrieval.cc +++ b/sql/range_optimizer/rowid_ordered_retrieval.cc @@ -49,8 +49,8 @@ RowIDIntersectionIterator::RowIDIntersectionIterator( Mem_root_array> children, unique_ptr_destroy_only cpk_child) : RowIDCapableRowIterator(thd, table_arg), - m_children(move(children)), - m_cpk_child(move(cpk_child)), + m_children(std::move(children)), + m_cpk_child(std::move(cpk_child)), retrieve_full_rows(retrieve_full_rows), scans_inited(false), need_rows_in_rowid_order(need_rows_in_rowid_order) { @@ -229,7 +229,7 @@ RowIDUnionIterator::RowIDUnionIterator( THD *thd, MEM_ROOT *return_mem_root, TABLE *table, Mem_root_array> children) : TableRowIterator(thd, table), - m_children(move(children)), + m_children(std::move(children)), queue(Quick_ror_union_less(table->file), Malloc_allocator(PSI_INSTRUMENT_ME)), mem_root(return_mem_root), diff --git a/sql/range_optimizer/rowid_ordered_retrieval_plan.cc b/sql/range_optimizer/rowid_ordered_retrieval_plan.cc index 9b1c361694ad..1de9abb79a06 100644 --- a/sql/range_optimizer/rowid_ordered_retrieval_plan.cc +++ b/sql/range_optimizer/rowid_ordered_retrieval_plan.cc @@ -58,7 +58,6 @@ class Opt_trace_context; using std::max; using std::min; -using std::move; #ifndef NDEBUG static void print_ror_scans_arr(TABLE *table, const char *msg, diff --git a/sql/rpl_replica.cc b/sql/rpl_replica.cc index a8ca14fed800..be64dfa3d861 100644 --- a/sql/rpl_replica.cc +++ b/sql/rpl_replica.cc @@ -6167,7 +6167,7 @@ bool mts_recovery_groups(Relay_log_info *rli) { Relaylog_file_reader relaylog_file_reader(opt_replica_sql_verify_checksum); - for (int checking = 0; not_reached_commit; checking++) { + while (not_reached_commit) { if (relaylog_file_reader.open(linfo.log_file_name, offset)) { LogErr(ERROR_LEVEL, ER_BINLOG_FILE_OPEN_FAILED, relaylog_file_reader.get_error_str()); diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 4f33bc48b229..ee8caa48287f 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -1028,7 +1028,7 @@ bool DeleteRowsIterator::Init() { auto tempfile = make_unique_destroy_only( thd()->mem_root, refpos_order_cmp, table->file, table->file->ref_length, thd()->variables.sortbuff_size); - if (tempfile == nullptr || m_tempfiles.push_back(move(tempfile)) || + if (tempfile == nullptr || m_tempfiles.push_back(std::move(tempfile)) || m_delayed_tables.push_back(table)) { return true; /* purecov: inspected */ } diff --git a/sql/sql_executor.cc b/sql/sql_executor.cc index 6fd1f7c8dad3..11a2a2fc0b20 100644 --- a/sql/sql_executor.cc +++ b/sql/sql_executor.cc @@ -115,7 +115,6 @@ using std::make_pair; using std::max; using std::min; -using std::move; using std::pair; using std::string; using std::unique_ptr; @@ -2064,7 +2063,7 @@ static AccessPath *CreateHashJoinAccessPath( // For inner join, attach the extra conditions as filters after the join. // This gives us more detailed output in EXPLAIN ANALYZE since we get an // instrumented FilterIterator on top of the join. - *join_conditions = move(hash_join_extra_conditions); + *join_conditions = std::move(hash_join_extra_conditions); } else { join_conditions->clear(); @@ -2216,7 +2215,7 @@ static void ExtractJoinConditions(const QEP_TAB *current_table, } } - *predicates = move(real_predicates); + *predicates = std::move(real_predicates); } static bool UseHashJoin(QEP_TAB *qep_tab) { diff --git a/sql/sql_lex.h b/sql/sql_lex.h index dde2db18dc80..ee473fb48b3c 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -869,7 +869,7 @@ class Query_expression { RowIterator *root_iterator() const { return m_root_iterator.get(); } unique_ptr_destroy_only release_root_iterator() { - return move(m_root_iterator); + return std::move(m_root_iterator); } AccessPath *root_access_path() const { return m_root_access_path; } diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 46a498336d8a..2886aa9c484f 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -94,7 +94,6 @@ #include "sql/visible_fields.h" #include "sql/window.h" // Window #include "template_utils.h" -using std::move; using std::vector; class Item_rollup_group_item; @@ -1192,7 +1191,7 @@ static AccessPath *add_materialized_access_path( Mem_root_array &query_blocks, TABLE *dest, ha_rows limit = HA_POS_ERROR) { AccessPath *path = qt->query_block()->join->root_access_path(); - path = NewMaterializeAccessPath(thd, move(query_blocks), + path = NewMaterializeAccessPath(thd, std::move(query_blocks), /*invalidators=*/nullptr, dest, path, /*cte=*/nullptr, /*unit=*/nullptr, /*ref_slice=*/-1, @@ -1287,7 +1286,7 @@ AccessPath *make_set_op_access_path( qts->query_block()->setup_materialize_query_block(path, dest); Mem_root_array query_blocks( thd->mem_root); - query_blocks.push_back(move(param)); + query_blocks.push_back(std::move(param)); path = add_materialized_access_path(thd, parent, query_blocks, dest); } } break; @@ -1302,7 +1301,7 @@ AccessPath *make_set_op_access_path( qts->query_block()->setup_materialize_query_block(path, dest); Mem_root_array query_blocks( thd->mem_root); - query_blocks.push_back(move(param)); + query_blocks.push_back(std::move(param)); path = add_materialized_access_path(thd, parent, query_blocks, dest); } break; @@ -1388,7 +1387,7 @@ Query_term_set_op::setup_materialize_set_op(THD *thd, TABLE *dst_table, param.m_total_operands = m_children.size(); param.disable_deduplication_by_hash_field = (has_mixed_distinct_operators() && !activate_deduplication); - query_blocks.push_back(move(param)); + query_blocks.push_back(std::move(param)); if (idx == m_last_distinct && idx > 0 && union_distinct_only) // The rest will be done by appending. diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 42f8d0e4ec88..dac76ba2e8a7 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -3949,16 +3949,24 @@ static Sys_var_charptr Sys_socket( READ_ONLY NON_PERSIST GLOBAL_VAR(mysqld_unix_port), CMD_LINE(REQUIRED_ARG), IN_FS_CHARSET, DEFAULT(nullptr)); +#if defined(__clang__) && (__clang_major__ >= 15) && defined(HAVE_ASAN) +#define ADJUSTED_DEFAULT_THREAD_STACK (4 * DEFAULT_THREAD_STACK) +#else +#define ADJUSTED_DEFAULT_THREAD_STACK (DEFAULT_THREAD_STACK) +#endif + static Sys_var_ulong Sys_thread_stack( "thread_stack", "The stack size for each thread", READ_ONLY GLOBAL_VAR(my_thread_stack_size), CMD_LINE(REQUIRED_ARG), -#if defined(__clang__) && defined(HAVE_UBSAN) - // Clang with DEBUG needs more stack, esp. with UBSAN. - VALID_RANGE(DEFAULT_THREAD_STACK, ULONG_MAX), +#if defined(__clang__) && \ + (defined(HAVE_UBSAN) || (__clang_major__ >= 15) && (defined(HAVE_ASAN))) + // Clang with DEBUG needs more stack, esp. with UBSAN (1MB). + // Clang-15 with ASAN / UBSAN needs even more stack (4MB). + VALID_RANGE(ADJUSTED_DEFAULT_THREAD_STACK, ULONG_MAX), #else VALID_RANGE(128 * 1024, ULONG_MAX), #endif - DEFAULT(DEFAULT_THREAD_STACK), BLOCK_SIZE(1024)); + DEFAULT(ADJUSTED_DEFAULT_THREAD_STACK), BLOCK_SIZE(1024)); static Sys_var_charptr Sys_tmpdir( "tmpdir", diff --git a/storage/heap/hp_test1.cc b/storage/heap/hp_test1.cc index 55353c20ef5c..c729924b8b33 100644 --- a/storage/heap/hp_test1.cc +++ b/storage/heap/hp_test1.cc @@ -39,7 +39,7 @@ static int get_options(int argc, char *argv[]); static int flag = 0, verbose = 0, remove_ant = 0, flags[50]; int main(int argc, char **argv) { - int i, j, error, deleted; + int i, j, error; HP_INFO *file; uchar record[128], key[32]; const char *filename; @@ -71,7 +71,6 @@ int main(int argc, char **argv) { keyinfo[0].seg[0].null_bit = 0; keyinfo[0].flag = HA_NOSAME; - deleted = 0; memset(flags, 0, sizeof(flags)); printf("- Creating heap-file\n"); @@ -116,7 +115,6 @@ int main(int argc, char **argv) { printf("key: %s delete: %d my_errno: %d\n", (char *)key, error, my_errno()); flags[j] = 0; - if (!error) deleted++; } if (heap_check_heap(file, false)) { puts("Heap keys crashed"); diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index 69eccfd99409..f84583b0e5c0 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -400,6 +400,12 @@ IF(HAS_WARN_FLAG) ADD_COMPILE_FLAGS(fts/fts0pars.cc COMPILE_FLAGS "${HAS_WARN_FLAG}") ENDIF() +MY_CHECK_CXX_COMPILER_WARNING("-Wunused-but-set-variable" HAS_WARN_FLAG) +IF(HAS_WARN_FLAG) + ADD_COMPILE_FLAGS(fts/fts0pars.cc + COMPILE_FLAGS "${HAS_WARN_FLAG}") +ENDIF() + IF(MSVC AND NOT WIN32_CLANG) # Disable C4100: unreferenced formal parameter diff --git a/storage/innobase/arch/arch0page.cc b/storage/innobase/arch/arch0page.cc index 55624d052065..6a63789ce9a9 100644 --- a/storage/innobase/arch/arch0page.cc +++ b/storage/innobase/arch/arch0page.cc @@ -2189,8 +2189,6 @@ void Arch_Page_Sys::track_initial_pages() { buf_flush_list_mutex_enter(buf_pool); buf_page_t *bpage; - uint page_count; - uint skip_count; bpage = buf_pool->oldest_hp.get(); if (bpage != nullptr) { @@ -2199,9 +2197,6 @@ void Arch_Page_Sys::track_initial_pages() { bpage = UT_LIST_GET_LAST(buf_pool->flush_list); } - page_count = 0; - skip_count = 0; - /* Add all pages for which IO is already started. */ while (bpage != nullptr) { if (fsp_is_system_temporary(bpage->id.space())) { @@ -2247,9 +2242,6 @@ void Arch_Page_Sys::track_initial_pages() { if (bpage->is_io_fix_write()) { /* IO has already started. Must add the page */ track_page(bpage, LSN_MAX, LSN_MAX, true); - ++page_count; - } else { - ++skip_count; } bpage = UT_LIST_GET_PREV(list, bpage); diff --git a/storage/innobase/arch/arch0recv.cc b/storage/innobase/arch/arch0recv.cc index 77f49aa09843..ad7bb31ad8cc 100644 --- a/storage/innobase/arch/arch0recv.cc +++ b/storage/innobase/arch/arch0recv.cc @@ -389,7 +389,9 @@ dberr_t Arch_Group::Recovery::cleanup_if_required(Arch_Recv_Group_Info &info) { dberr_t Arch_Page_Sys::Recovery::recover() { dberr_t err = DB_SUCCESS; +#ifndef NDEBUG uint num_active = 0; +#endif for (auto info = m_dir_group_info_map.begin(); info != m_dir_group_info_map.end(); ++info) { @@ -415,9 +417,11 @@ dberr_t Arch_Page_Sys::Recovery::recover() { continue; } +#ifndef NDEBUG if (group_info.m_active) { ++num_active; } +#endif group_info.m_group = group; } diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 1e8e68cd1998..922670a75107 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -1730,7 +1730,9 @@ void btr_cur_search_to_nth_level_with_no_latch(dict_index_t *index, ulint level, Page_fetch fetch; page_cur_t *page_cursor; ulint root_height = 0; /* remove warning */ +#ifndef NDEBUG ulint n_blocks = 0; +#endif mem_heap_t *heap = nullptr; ulint offsets_[REC_OFFS_NORMAL_SIZE]; @@ -1826,7 +1828,9 @@ void btr_cur_search_to_nth_level_with_no_latch(dict_index_t *index, ulint level, /* Go to the child node */ page_id.reset(space, btr_node_ptr_get_child_page_no(node_ptr, offsets)); +#ifndef NDEBUG n_blocks++; +#endif } else { /* If this is the desired level, leave the loop */ at_desired_level = true; @@ -2174,7 +2178,9 @@ void btr_cur_open_at_index_side_with_no_latch(bool from_left, page_cur_t *page_cursor; ulint height; rec_t *node_ptr; +#ifndef NDEBUG ulint n_blocks = 0; +#endif mem_heap_t *heap = nullptr; ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint *offsets = offsets_; @@ -2241,7 +2247,9 @@ void btr_cur_open_at_index_side_with_no_latch(bool from_left, /* Go to the child node */ page_id.set_page_no(btr_node_ptr_get_child_page_no(node_ptr, offsets)); +#ifndef NDEBUG n_blocks++; +#endif } if (heap != nullptr) { diff --git a/storage/innobase/clone/clone0desc.cc b/storage/innobase/clone/clone0desc.cc index 9327a5f37fde..d51c0aa16083 100644 --- a/storage/innobase/clone/clone0desc.cc +++ b/storage/innobase/clone/clone0desc.cc @@ -358,7 +358,9 @@ void Chunk_Info::serialize(byte *desc_chunk, uint &len) { ut_ad(len_left >= 4); len_left -= 4; +#ifndef NDEBUG ulint index = 0; +#endif for (auto &key_value : m_incomplete_chunks) { ut_ad(index < chunk_map_size); @@ -375,7 +377,9 @@ void Chunk_Info::serialize(byte *desc_chunk, uint &len) { ut_ad(len_left >= 4); len_left -= 4; +#ifndef NDEBUG ++index; +#endif } ut_ad(index == chunk_map_size); diff --git a/storage/innobase/data/data0data.cc b/storage/innobase/data/data0data.cc index 4d3753b34390..07e60cb5b3a0 100644 --- a/storage/innobase/data/data0data.cc +++ b/storage/innobase/data/data0data.cc @@ -180,7 +180,7 @@ bool dtuple_validate(const dtuple_t *tuple) { auto len = dfield_get_len(field); if (!dfield_is_null(field)) { - const byte *data; + const byte *data [[maybe_unused]]; data = static_cast(dfield_get_data(field)); #ifndef UNIV_DEBUG_VALGRIND @@ -427,7 +427,9 @@ big_rec_t *dtuple_convert_big_rec(dict_index_t *index, upd_t *upd, dfield_t *dfield; dict_field_t *ifield; ulint size; +#ifndef NDEBUG ulint n_fields; +#endif ulint local_len; ulint local_prefix_len; @@ -464,7 +466,9 @@ big_rec_t *dtuple_convert_big_rec(dict_index_t *index, upd_t *upd, a variable-length field that yields the biggest savings when stored externally */ +#ifndef NDEBUG n_fields = 0; +#endif while (page_zip_rec_needs_ext( rec_get_converted_size(index, entry), dict_table_is_comp(index->table), @@ -578,7 +582,9 @@ big_rec_t *dtuple_convert_big_rec(dict_index_t *index, upd_t *upd, dfield_set_data(dfield, data, local_len); dfield_set_ext(dfield); +#ifndef NDEBUG n_fields++; +#endif ut_ad(n_fields < dtuple_get_n_fields(entry)); if (upd && !upd->is_modified(longest_i)) { diff --git a/storage/innobase/ddl/ddl0builder.cc b/storage/innobase/ddl/ddl0builder.cc index 13d8c3e4e468..da3622ef5d77 100644 --- a/storage/innobase/ddl/ddl0builder.cc +++ b/storage/innobase/ddl/ddl0builder.cc @@ -1712,7 +1712,6 @@ dberr_t Builder::btree_build() noexcept { Merge_cursor cursor(this, &dup, m_local_stage); const auto io_buffer_size = m_ctx.load_io_buffer_size(m_thread_ctxs.size()); - size_t total_files{}; uint64_t total_rows{}; dberr_t err{DB_SUCCESS}; @@ -1730,7 +1729,6 @@ dberr_t Builder::btree_build() noexcept { ut_a(thread_ctx->m_n_recs == thread_ctx->m_file.m_n_recs); - ++total_files; total_rows += thread_ctx->m_n_recs; } diff --git a/storage/innobase/ddl/ddl0fts.cc b/storage/innobase/ddl/ddl0fts.cc index 0a57bb1b5427..9e056b16f910 100644 --- a/storage/innobase/ddl/ddl0fts.cc +++ b/storage/innobase/ddl/ddl0fts.cc @@ -1364,7 +1364,6 @@ dberr_t FTS::Inserter::insert(Builder *builder, Merge_cursor cursor(builder, nullptr, nullptr); { - size_t i{}; const auto n_buffers = handler->m_files.size(); const auto io_buffer_size = m_ctx.merge_io_buffer_size(n_buffers); @@ -1377,8 +1376,6 @@ dberr_t FTS::Inserter::insert(Builder *builder, return err; } - ++i; - total_rows += file.m_n_recs; } } diff --git a/storage/innobase/dict/dict0dd.cc b/storage/innobase/dict/dict0dd.cc index 1eab513e44e0..9805f7ca84c1 100644 --- a/storage/innobase/dict/dict0dd.cc +++ b/storage/innobase/dict/dict0dd.cc @@ -1801,7 +1801,6 @@ void dd_clear_instant_part(dd::Partition &dd_part) { bool dd_instant_columns_consistent(const dd::Table &dd_table) { bool found = false; size_t n_non_instant_cols = 0; - size_t n_version_add_cols = 0; size_t n_instant_add_cols = 0; size_t n_version_drop_cols = 0; for (auto column : dd_table.columns()) { @@ -1814,9 +1813,7 @@ bool dd_instant_columns_consistent(const dd::Table &dd_table) { column->se_private_data().exists( dd_column_key_strings[DD_INSTANT_COLUMN_DEFAULT])) { found = true; - if (dd_column_is_added(column)) { - n_version_add_cols++; - } else { + if (!dd_column_is_added(column)) { /* In upgraded table, Instant ADD column with no v_added */ ut_ad(dd_table_is_upgraded_instant(dd_table)); n_instant_add_cols++; diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 362881aadb7b..36c59acd75b9 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -96,13 +96,6 @@ The tablespace memory cache */ using Dirs = std::vector; using Space_id_set = std::set; -constexpr char Fil_path::DB_SEPARATOR; -constexpr char Fil_path::OS_SEPARATOR; -constexpr const char *Fil_path::SEPARATOR; -constexpr const char *Fil_path::DOT_SLASH; -constexpr const char *Fil_path::DOT_DOT_SLASH; -constexpr const char *Fil_path::SLASH_DOT_DOT_SLASH; - dberr_t dict_stats_rename_table(const char *old_name, const char *new_name, char *errstr, size_t errstr_sz); @@ -1915,8 +1908,6 @@ because of the race condition below. */ void Fil_shard::validate() const { mutex_acquire(); - size_t n_open = 0; - for (auto elem : m_spaces) { page_no_t size = 0; auto space = elem.second; @@ -1924,10 +1915,6 @@ void Fil_shard::validate() const { for (const auto &file : space->files) { ut_a(file.is_open || !file.n_pending_ios); - if (file.is_open) { - ++n_open; - } - size += file.size; } @@ -9105,7 +9092,6 @@ void Fil_system::encryption_reencrypt( } size_t fail_count = 0; - size_t rotate_count = 0; byte encrypt_info[Encryption::INFO_SIZE]; /* This operation is done either post recovery or when the first time @@ -9125,7 +9111,6 @@ void Fil_system::encryption_reencrypt( mtr_commit(&mtr); if (rotate_ok) { - ++rotate_count; if (fsp_is_ibd_tablespace(space_id)) { if (fsp_is_file_per_table(space_id, space->flags)) { ib::info(ER_IB_MSG_REENCRYPTED_TABLESPACE_KEY, space->name); diff --git a/storage/innobase/gis/gis0rtree.cc b/storage/innobase/gis/gis0rtree.cc index 35097b61a802..112386c1456a 100644 --- a/storage/innobase/gis/gis0rtree.cc +++ b/storage/innobase/gis/gis0rtree.cc @@ -919,7 +919,9 @@ rec_t *rtr_page_split_and_insert( lock_prdt_t new_prdt; rec_t *first_rec = nullptr; int first_rec_group = 1; +#ifndef NDEBUG ulint n_iterations = 0; +#endif if (!*heap) { *heap = mem_heap_create(1024, UT_LOCATION_HERE); @@ -1183,7 +1185,9 @@ rec_t *rtr_page_split_and_insert( } cursor->rtr_info = nullptr; +#ifndef NDEBUG n_iterations++; +#endif rec_t *i_rec = page_rec_get_next(page_get_infimum_rec(buf_block_get_frame(block))); diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 31770db91318..351fdc2a3ce4 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -752,7 +752,6 @@ static int trx_i_s_common_fill_table( Item *) /*!< in: condition (not used) */ { const char *table_name; - int ret; trx_i_s_cache_t *cache; DBUG_TRACE; @@ -782,15 +781,10 @@ static int trx_i_s_common_fill_table( << TRX_I_S_MEM_LIMIT << " bytes"; } - ret = 0; - trx_i_s_cache_start_read(cache); if (innobase_strcasecmp(table_name, "innodb_trx") == 0) { - if (fill_innodb_trx_from_cache(cache, thd, tables->table) != 0) { - ret = 1; - } - + fill_innodb_trx_from_cache(cache, thd, tables->table); } else { ib::error(ER_IB_MSG_600) << "trx_i_s_common_fill_table() was" " called to fill unknown table: " @@ -799,22 +793,15 @@ static int trx_i_s_common_fill_table( " This function only knows how to fill" " innodb_trx, innodb_locks and" " innodb_lock_waits tables."; - - ret = 1; } trx_i_s_cache_end_read(cache); -#if 0 - return ret; -#else /* if this function returns something else than 0 then a deadlock occurs between the mysqld server and mysql client, see http://bugs.mysql.com/29900 ; when that bug is resolved we can enable the return ret above */ - ret++; // silence a gcc46 warning return 0; -#endif } /* Fields of the dynamic table information_schema.innodb_cmp. diff --git a/storage/innobase/include/fts0tokenize.h b/storage/innobase/include/fts0tokenize.h index b138874c1de8..c4b1c4bf5fc7 100644 --- a/storage/innobase/include/fts0tokenize.h +++ b/storage/innobase/include/fts0tokenize.h @@ -76,7 +76,6 @@ inline uchar fts_get_word(const CHARSET_INFO *cs, uchar **start, uchar *end, FT_WORD *word, MYSQL_FTPARSER_BOOLEAN_INFO *info) { uchar *doc = *start; int ctype; - uint length; int mbl; info->yesno = (FTB_YES == ' ') ? 1 : (info->quot != nullptr); @@ -140,9 +139,8 @@ inline uchar fts_get_word(const CHARSET_INFO *cs, uchar **start, uchar *end, info->weight_adjust = info->wasign = 0; } - length = 0; for (word->pos = doc; doc < end; - length++, doc += (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1))) { + doc += (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1))) { mbl = cs->cset->ctype(cs, &ctype, doc, end); if (!true_word_char(ctype, *doc)) { diff --git a/storage/innobase/lob/lob0update.cc b/storage/innobase/lob/lob0update.cc index caf637770295..72a2772f5015 100644 --- a/storage/innobase/lob/lob0update.cc +++ b/storage/innobase/lob/lob0update.cc @@ -271,7 +271,6 @@ dberr_t replace(InsertContext &ctx, trx_t *trx, dict_index_t *index, ref_t ref, dberr_t ret(DB_SUCCESS); mtr_t *mtr = ctx.get_mtr(); - uint32_t new_entries = 0; const undo_no_t undo_no = (trx == nullptr ? 0 : trx->undo_no - 1); const uint32_t lob_version = first_page.get_lob_version(); @@ -362,7 +361,6 @@ dberr_t replace(InsertContext &ctx, trx_t *trx, dict_index_t *index, ref_t ref, goto error; } - new_entries++; index_entry_t new_entry(new_node, mtr, index); new_entry.set_versions_null(); new_entry.set_trx_id(trx->id); @@ -422,7 +420,6 @@ dberr_t replace(InsertContext &ctx, trx_t *trx, dict_index_t *index, ref_t ref, goto error; } - new_entries++; index_entry_t new_entry(new_node, mtr, index); new_entry.set_lob_version(lob_version); new_entry.set_versions_null(); @@ -471,7 +468,6 @@ dberr_t replace(InsertContext &ctx, trx_t *trx, dict_index_t *index, ref_t ref, goto error; } - new_entries++; index_entry_t new_entry(new_node, mtr, index); new_entry.set_lob_version(lob_version); new_entry.set_versions_null(); @@ -547,7 +543,9 @@ static dberr_t replace_inline(InsertContext &ctx, trx_t *trx, index_entry_t cur_entry(mtr, index); +#ifndef NDEBUG ulint loop_count = 0; +#endif while (!fil_addr_is_null(node_loc) && want > 0) { ut_ad(loop_count <= 1); @@ -584,7 +582,9 @@ static dberr_t replace_inline(InsertContext &ctx, trx_t *trx, page_offset = 0; node_loc = cur_entry.get_next(); +#ifndef NDEBUG loop_count++; +#endif } ut_ad(want == 0); diff --git a/storage/innobase/lob/zlob0update.cc b/storage/innobase/lob/zlob0update.cc index e10541eb8c56..58070eedf663 100644 --- a/storage/innobase/lob/zlob0update.cc +++ b/storage/innobase/lob/zlob0update.cc @@ -178,7 +178,6 @@ static dberr_t z_replace(InsertContext &ctx, trx_t *trx, dict_index_t *index, ulint len, byte *buf) { DBUG_TRACE; dberr_t ret(DB_SUCCESS); - uint32_t new_entries = 0; trx_id_t trxid = (trx == nullptr) ? 0 : trx->id; const undo_no_t undo_no = (trx == nullptr ? 0 : trx->undo_no - 1); const uint32_t lob_version = first_page.get_lob_version(); @@ -284,7 +283,6 @@ static dberr_t z_replace(InsertContext &ctx, trx_t *trx, dict_index_t *index, cur_entry.set_trx_undo_no_modifier(undo_no); new_entry.set_old_version(cur_entry); new_entry.set_lob_version(lob_version); - new_entries++; yet_to_skip = 0; } else { @@ -313,7 +311,6 @@ static dberr_t z_replace(InsertContext &ctx, trx_t *trx, dict_index_t *index, cur_entry.remove(base_node); new_entry.set_old_version(cur_entry); new_entry.set_lob_version(lob_version); - new_entries++; } node_loc = new_entry.get_next(); diff --git a/storage/innobase/os/os0enc.cc b/storage/innobase/os/os0enc.cc index a54475a350d0..0787d324ee6d 100644 --- a/storage/innobase/os/os0enc.cc +++ b/storage/innobase/os/os0enc.cc @@ -192,12 +192,6 @@ void deinit_keyring_services(SERVICE_TYPE(registry) *) { return; } } // namespace encryption } // namespace innobase -constexpr char Encryption::KEY_MAGIC_V1[]; -constexpr char Encryption::KEY_MAGIC_V2[]; -constexpr char Encryption::KEY_MAGIC_V3[]; -constexpr char Encryption::MASTER_KEY_PREFIX[]; -constexpr char Encryption::DEFAULT_MASTER_KEY[]; - /** Minimum length needed for encryption */ constexpr size_t MIN_ENCRYPTION_LEN = 2 * MY_AES_BLOCK_SIZE + FIL_PAGE_DATA; /** Key type */ diff --git a/storage/innobase/row/row0pread.cc b/storage/innobase/row/row0pread.cc index 6056afe179fa..021314a0a8bc 100644 --- a/storage/innobase/row/row0pread.cc +++ b/storage/innobase/row/row0pread.cc @@ -442,7 +442,9 @@ dberr_t PCursor::move_to_next_block(dict_index_t *index) { err = move_to_user_rec(); } +#ifndef NDEBUG int n_retries = 0; +#endif while (err == DB_LOCK_NOWAIT) { /* We should restore the cursor from index root page, to avoid deadlock opportunity. */ @@ -455,7 +457,9 @@ dberr_t PCursor::move_to_next_block(dict_index_t *index) { err = restore_from_savepoint(); +#ifndef NDEBUG n_retries++; +#endif ut_ad(n_retries < 10); } diff --git a/storage/innobase/sync/sync0rw.cc b/storage/innobase/sync/sync0rw.cc index 4404ddfaf038..5300a9224fdd 100644 --- a/storage/innobase/sync/sync0rw.cc +++ b/storage/innobase/sync/sync0rw.cc @@ -644,7 +644,6 @@ void rw_lock_sx_lock_func(rw_lock_t *lock, ulint pass, ut::Location location) { ulint i = 0; sync_array_t *sync_arr; uint64_t count_os_wait = 0; - ulint spin_wait_count = 0; ut_ad(rw_lock_validate(lock)); ut_ad(!rw_lock_own(lock, RW_LOCK_S)); @@ -660,8 +659,6 @@ void rw_lock_sx_lock_func(rw_lock_t *lock, ulint pass, ut::Location location) { return; } else { - ++spin_wait_count; - /* Spin waiting for the lock_word to become free */ os_rmb; while (i < srv_n_spin_wait_rounds && lock->lock_word <= X_LOCK_HALF_DECR) { diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index 73dbf2b76414..95cf934c8927 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -2281,7 +2281,7 @@ static ulint trx_purge_attach_undo_recs(const ulint n_purge_threads, Purge_groups_t purge_groups(n_purge_threads, heap); purge_groups.init(); - for (ulint i = 0; n_pages_handled < batch_size; ++i) { + while (n_pages_handled < batch_size) { /* Track the max {trx_id, undo_no} for truncating the UNDO logs once we have purged the records. */ diff --git a/storage/innobase/trx/trx0rseg.cc b/storage/innobase/trx/trx0rseg.cc index 419b5fdeaf5c..8097935437be 100644 --- a/storage/innobase/trx/trx0rseg.cc +++ b/storage/innobase/trx/trx0rseg.cc @@ -813,7 +813,6 @@ bool trx_rseg_add_rollback_segments(space_id_t space_id, ulong target_rsegs, mtr_t mtr; page_no_t page_no; trx_rseg_t *rseg; - ulint n_existing = 0; ulint n_created = 0; ulint n_tracked = 0; @@ -839,7 +838,6 @@ bool trx_rseg_add_rollback_segments(space_id_t space_id, ulong target_rsegs, rseg = rsegs->find(rseg_id); if (rseg != nullptr) { ut_ad(rseg->id == rseg_id); - n_existing++; continue; } @@ -874,8 +872,6 @@ bool trx_rseg_add_rollback_segments(space_id_t space_id, ulong target_rsegs, any more. */ break; } - } else { - n_existing++; } /* Create the trx_rseg_t object. */ diff --git a/storage/ndb/plugin/ha_ndb_index_stat.cc b/storage/ndb/plugin/ha_ndb_index_stat.cc index 0afedadd8c84..6e59684452bc 100644 --- a/storage/ndb/plugin/ha_ndb_index_stat.cc +++ b/storage/ndb/plugin/ha_ndb_index_stat.cc @@ -982,7 +982,9 @@ static void ndb_index_stat_free(Ndb_index_stat *st) { Ndb_index_stat *st_head = 0; Ndb_index_stat *st_tail = 0; Ndb_index_stat *st_loop = share->index_stat_list; +#ifndef NDEBUG uint found = 0; +#endif while (st_loop != 0) { if (st == st_loop) { // Unlink entry from NDB_SHARE and request it to be released @@ -993,7 +995,9 @@ static void ndb_index_stat_free(Ndb_index_stat *st) { assert(!st->to_delete); st->to_delete = true; st->abort_request = true; +#ifndef NDEBUG found++; +#endif } else { if (st_head == 0) st_head = st_loop; @@ -2274,7 +2278,9 @@ static int ndb_index_stat_wait_query(Ndb_index_stat *st, Ndb_index_stat_glob &glob = ndb_index_stat_glob; mysql_mutex_lock(&ndb_index_stat_thread.stat_mutex); int err = 0; +#ifndef NDEBUG uint count = 0; +#endif struct timespec abstime; glob.wait_stats++; glob.query_count++; @@ -2308,7 +2314,9 @@ static int ndb_index_stat_wait_query(Ndb_index_stat *st, err = NdbIndexStat::MyAbortReq; break; } +#ifndef NDEBUG count++; +#endif DBUG_PRINT("index_stat", ("st %s wait_query count:%u", st->id, count)); ndb_index_stat_thread.wakeup(); @@ -2339,7 +2347,9 @@ static int ndb_index_stat_wait_analyze(Ndb_index_stat *st, Ndb_index_stat_glob &glob = ndb_index_stat_glob; mysql_mutex_lock(&ndb_index_stat_thread.stat_mutex); int err = 0; +#ifndef NDEBUG uint count = 0; +#endif struct timespec abstime; glob.wait_update++; glob.analyze_count++; @@ -2382,7 +2392,9 @@ static int ndb_index_stat_wait_analyze(Ndb_index_stat *st, err = NdbIndexStat::InternalError; break; } +#ifndef NDEBUG count++; +#endif DBUG_PRINT("index_stat", ("st %s wait_analyze count:%u", st->id, count)); ndb_index_stat_thread.wakeup(); diff --git a/storage/ndb/plugin/ha_ndbcluster_binlog.cc b/storage/ndb/plugin/ha_ndbcluster_binlog.cc index 08710787b88e..5f895fd2a5f5 100644 --- a/storage/ndb/plugin/ha_ndbcluster_binlog.cc +++ b/storage/ndb/plugin/ha_ndbcluster_binlog.cc @@ -4664,8 +4664,6 @@ class Ndb_binlog_index_table_util { return false; } }; -constexpr const char *const Ndb_binlog_index_table_util::DB_NAME; -constexpr const char *const Ndb_binlog_index_table_util::TABLE_NAME; // Wrapper function allowing Ndb_binlog_index_table_util::remove_rows_for_file() // to be forward declared diff --git a/storage/ndb/plugin/ndb_table_stats.cc b/storage/ndb/plugin/ndb_table_stats.cc index fb2ea4d8b6df..cde3ff6df587 100644 --- a/storage/ndb/plugin/ndb_table_stats.cc +++ b/storage/ndb/plugin/ndb_table_stats.cc @@ -72,7 +72,9 @@ bool ndb_get_table_statistics(THD *thd, Ndb *ndb, int retries = 100; NdbTransaction *trans; do { +#ifndef NDEBUG Uint32 count = 0; +#endif Uint64 sum_rows = 0; Uint64 sum_row_size = 0; Uint64 sum_mem = 0; @@ -127,7 +129,9 @@ bool ndb_get_table_statistics(THD *thd, Ndb *ndb, sum_rows += rows; if (sum_row_size < size) sum_row_size = size; sum_mem += fixed_mem + var_mem; +#ifndef NDEBUG count++; +#endif sum_ext_space += ext_space; sum_free_ext_space += free_ext_space; diff --git a/storage/ndb/src/common/mgmcommon/ConfigInfo.cpp b/storage/ndb/src/common/mgmcommon/ConfigInfo.cpp index aa14bb44e2d7..5465b1a159b1 100644 --- a/storage/ndb/src/common/mgmcommon/ConfigInfo.cpp +++ b/storage/ndb/src/common/mgmcommon/ConfigInfo.cpp @@ -4634,13 +4634,17 @@ ConfigInfo::get_enum_values(const Properties * section, const char* fname, Properties::Iterator it(values); Vector enum_names; const char* fill = nullptr; +#ifndef NDEBUG unsigned cnt = 0; +#endif for (const char* name = it.first(); name != NULL; name = it.next()) { Uint32 val; values->get(name, &val); enum_names.set(name, val, fill); +#ifndef NDEBUG cnt++; +#endif } // Enum values should be consecutive starting at zero. assert(enum_names.size() == cnt); @@ -6924,7 +6928,6 @@ static bool saveSectionsInConfigValues( // Estimate size of Properties when saved as ConfigValues // and expand ConfigValues to that size in order to avoid // the need of allocating memory and copying from new to old - Uint32 keys = 0; Uint64 data_sz [[maybe_unused]] = 0; for (const char * name = it.first(); name != 0; name = it.next()) { @@ -6936,13 +6939,8 @@ static bool saveSectionsInConfigValues( const Properties* tmp; require(ctx.m_config->get(name, &tmp) != 0); - keys += 2; // openSection(key + no) - keys += 1; // CFG_TYPE_OF_SECTION - Properties::Iterator it2(tmp); - for (const char * name2 = it2.first(); name2 != 0; name2 = it2.next()) - { - keys++; + for (const char *name2 = it2.first(); name2 != 0; name2 = it2.next()) { require(tmp->getTypeOf(name2, &pt) != 0); switch(pt){ case PropertiesType_char: diff --git a/storage/ndb/src/common/portlib/NdbHW.cpp b/storage/ndb/src/common/portlib/NdbHW.cpp index 6e65d3330710..defb12e90a96 100644 --- a/storage/ndb/src/common/portlib/NdbHW.cpp +++ b/storage/ndb/src/common/portlib/NdbHW.cpp @@ -1746,7 +1746,6 @@ static int Ndb_ReloadCPUData(struct ndb_hwinfo *hwinfo) { hwinfo->cpu_data[i].online = 0; } - Uint32 cpu_online_count = 0; char buf[1024]; char * p = &buf[0]; char * c = nullptr; @@ -1777,7 +1776,6 @@ static int Ndb_ReloadCPUData(struct ndb_hwinfo *hwinfo) return -1; } curr_cpu = val; - cpu_online_count++; Uint64 ticks[12]; memset(ticks, 0, sizeof(ticks)); diff --git a/storage/ndb/src/ndbapi/ClusterMgr.cpp b/storage/ndb/src/ndbapi/ClusterMgr.cpp index b4a876aa8e49..87acb8ac91dc 100644 --- a/storage/ndb/src/ndbapi/ClusterMgr.cpp +++ b/storage/ndb/src/ndbapi/ClusterMgr.cpp @@ -1157,10 +1157,8 @@ ClusterMgr::execDUMP_STATE_ORD(const NdbApiSignal* signal, } } -void -ClusterMgr::execNF_COMPLETEREP(const NdbApiSignal* signal, - const LinearSectionPtr ptr[3]) -{ +void ClusterMgr::execNF_COMPLETEREP(const NdbApiSignal *signal, + const LinearSectionPtr ptr[]) { const NFCompleteRep * nfComp = CAST_CONSTPTR(NFCompleteRep, signal->getDataPtr()); const NodeId nodeId = nfComp->failedNodeId; diff --git a/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp index 02df97625a87..066d3add1c10 100644 --- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp +++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp @@ -5982,7 +5982,6 @@ NdbDictionaryImpl::createEvent(NdbEventImpl & evnt) evnt.m_name.c_str(), evnt.m_columns.size())); - int pk_count = 0; evnt.m_attrListBitmask.clear(); for(i = 0; im_pk){ - pk_count++; - } - + evnt.m_attrListBitmask.set(col->m_attrId); } @@ -7377,10 +7372,8 @@ NdbDictInterface::listObjects(NdbApiSignal* signal, return -1; } -void -NdbDictInterface::execLIST_TABLES_CONF(const NdbApiSignal* signal, - const LinearSectionPtr ptr[3]) -{ +void NdbDictInterface::execLIST_TABLES_CONF(const NdbApiSignal *signal, + const LinearSectionPtr ptr[]) { const ListTablesConf* const conf= CAST_CONSTPTR(ListTablesConf, signal->getDataPtr()); if(!m_tx.checkRequestId(conf->senderData, "LIST_TABLES_CONF")) @@ -7444,7 +7437,7 @@ NdbDictInterface::execLIST_TABLES_CONF(const NdbApiSignal* signal, } m_impl->theWaiter.signal(NO_WAIT); -} + } int NdbDictionaryImpl::forceGCPWait(int type) diff --git a/storage/ndb/src/ndbapi/NdbImpl.hpp b/storage/ndb/src/ndbapi/NdbImpl.hpp index 03624d9e8ae0..c98555e8d0f6 100644 --- a/storage/ndb/src/ndbapi/NdbImpl.hpp +++ b/storage/ndb/src/ndbapi/NdbImpl.hpp @@ -473,12 +473,10 @@ Ndb_free_list_t::~Ndb_free_list_t() assert(m_free_cnt == 0); assert(m_used_cnt == 0); } - -template -inline -int -Ndb_free_list_t::fill(Ndb* ndb, Uint32 cnt) -{ + +template +inline int Ndb_free_list_t::fill(Ndb *ndb [[maybe_unused]], + Uint32 cnt [[maybe_unused]]) { #ifndef HAVE_VALGRIND m_is_growing = true; if (m_free_list == 0) diff --git a/storage/ndb/src/ndbapi/NdbIndexStat.cpp b/storage/ndb/src/ndbapi/NdbIndexStat.cpp index a589826f66bf..e5ac2c5ddb1a 100644 --- a/storage/ndb/src/ndbapi/NdbIndexStat.cpp +++ b/storage/ndb/src/ndbapi/NdbIndexStat.cpp @@ -201,7 +201,7 @@ int NdbIndexStat::records_in_range(const NdbDictionary::Index* /*index*/, { Uint32 out[4] = { 0, 0, 0, 0 }; // rows, in, before, after float tot[4] = { 0, 0, 0, 0 }; // totals of above - int cnt, ret; + int ret; bool forceSend = true; const Uint32 codeWords= 1; Uint32 codeSpace[ codeWords ]; @@ -260,7 +260,6 @@ int NdbIndexStat::records_in_range(const NdbDictionary::Index* /*index*/, op->getNdbError().code)); DBUG_RETURN(-1); } - cnt = 0; const char* dummy_out_ptr= NULL; while ((ret = op->nextResult(&dummy_out_ptr, true, forceSend)) == 0) { @@ -268,9 +267,7 @@ int NdbIndexStat::records_in_range(const NdbDictionary::Index* /*index*/, out[0], out[1], out[2], out[3], (int)(out[1] + out[2] + out[3]) - (int)out[0])); unsigned i; - for (i = 0; i < 4; i++) - tot[i] += (float)out[i]; - cnt++; + for (i = 0; i < 4; i++) tot[i] += (float)out[i]; } if (ret == -1) { m_impl.setError(op->getNdbError().code, __LINE__); diff --git a/storage/ndb/src/ndbapi/NdbQueryBuilder.cpp b/storage/ndb/src/ndbapi/NdbQueryBuilder.cpp index 5277bf889000..dee52c0e7aa0 100644 --- a/storage/ndb/src/ndbapi/NdbQueryBuilder.cpp +++ b/storage/ndb/src/ndbapi/NdbQueryBuilder.cpp @@ -1853,7 +1853,9 @@ NdbQueryIndexScanOperationDefImpl::checkPrunable( // Loop over the fields in each bound. Uint32 keyPartNo = 0; +#ifndef NDEBUG Uint32 distKeyPartNo = 0; +#endif while (keyPos < keyEnd) { const NdbIndexScanOperation::BoundType type = @@ -1955,7 +1957,9 @@ NdbQueryIndexScanOperationDefImpl::checkPrunable( assert(distKeyPtr->len == 0 && distKeyPtr->ptr == NULL); *distKeyPtr = keyPart1; +#ifndef NDEBUG distKeyPartNo++; +#endif } keyPartNo++; diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc index 9b2ef7a5d74c..0fd711a59d83 100644 --- a/storage/perfschema/pfs_engine_table.cc +++ b/storage/perfschema/pfs_engine_table.cc @@ -1433,13 +1433,11 @@ enum ha_rkey_function PFS_key_reader::read_text_utf8( */ assert(m_remaining_key_part_info->type == HA_KEYTYPE_TEXT); - size_t length_offset = 0; size_t data_offset = 0; isnull = false; if (m_remaining_key_part_info->field->is_nullable()) { assert(HA_KEY_NULL_LENGTH <= m_remaining_key_len); - length_offset++; data_offset++; if (m_remaining_key[0]) { isnull = true; diff --git a/storage/perfschema/pfs_instr_class.cc b/storage/perfschema/pfs_instr_class.cc index 015534dcd7a5..e4dc948c1dfa 100644 --- a/storage/perfschema/pfs_instr_class.cc +++ b/storage/perfschema/pfs_instr_class.cc @@ -257,8 +257,6 @@ static uint safe_strlen(const char *s, uint max_len) { return end == nullptr ? max_len : static_cast(end - s); } -constexpr uint PFS_instr_name::max_length; - void PFS_instr_name::set(PFS_class_type class_type, const char *name, uint max_length_arg) { // Copy the given name to the member. diff --git a/storage/temptable/include/temptable/sharded_kv_store_logger.h b/storage/temptable/include/temptable/sharded_kv_store_logger.h index 80e2974ec32a..6a084daeec78 100644 --- a/storage/temptable/include/temptable/sharded_kv_store_logger.h +++ b/storage/temptable/include/temptable/sharded_kv_store_logger.h @@ -63,7 +63,9 @@ struct Sharded_key_value_store_logger { }; auto &kv_store_shards = static_cast(*this).m_kv_store_shard; +#ifndef NDEBUG uint32_t shard_id = 0; +#endif for (auto &kv : kv_store_shards) { auto kv_shard_stats = kv.shard.stats(); size_t nr_of_emplace_events = std::count_if( @@ -94,7 +96,9 @@ struct Sharded_key_value_store_logger { stat.max_bucket_count, std_thread_id_to_str(stat.thread_id).c_str())); } +#ifndef NDEBUG shard_id++; +#endif } } }; diff --git a/testclients/mysql_client_test.cc b/testclients/mysql_client_test.cc index f6d2347b5298..52a31db20903 100644 --- a/testclients/mysql_client_test.cc +++ b/testclients/mysql_client_test.cc @@ -22539,14 +22539,14 @@ static void test_bug31691060_2() { rc = mysql_stmt_execute(stmt); check_execute(stmt, rc); - int count = 0; - while (mysql_stmt_fetch(stmt) == 0) count++; + while (mysql_stmt_fetch(stmt) == 0) + ; mysql_stmt_execute(stmt); check_execute(stmt, rc); - count = 0; - while (mysql_stmt_fetch(stmt) == 0) count++; + while (mysql_stmt_fetch(stmt) == 0) + ; rc = mysql_stmt_close(stmt); } @@ -23212,9 +23212,15 @@ static void test_bug33535746() { mysql_stmt_bind_result(stmt, bind); +#ifndef NDEBUG int row_count = 0; +#endif - while (!(rc = mysql_stmt_fetch(stmt))) row_count++; + while (!(rc = mysql_stmt_fetch(stmt))) +#ifndef NDEBUG + row_count++ +#endif + ; DIE_UNLESS(rc == MYSQL_NO_DATA); @@ -23231,9 +23237,15 @@ static void test_bug33535746() { mysql_stmt_bind_result(stmt, bind); +#ifndef NDEBUG row_count = 0; +#endif - while (!(rc = mysql_stmt_fetch(stmt))) row_count++; + while (!(rc = mysql_stmt_fetch(stmt))) +#ifndef NDEBUG + row_count++ +#endif + ; DIE_UNLESS(rc == MYSQL_NO_DATA); @@ -23250,9 +23262,15 @@ static void test_bug33535746() { mysql_stmt_bind_result(stmt, bind); +#ifndef NDEBUG row_count = 0; +#endif - while (!(rc = mysql_stmt_fetch(stmt))) row_count++; + while (!(rc = mysql_stmt_fetch(stmt))) +#ifndef NDEBUG + row_count++ +#endif + ; DIE_UNLESS(rc == MYSQL_NO_DATA); @@ -23269,9 +23287,15 @@ static void test_bug33535746() { mysql_stmt_bind_result(stmt, bind); +#ifndef NDEBUG row_count = 0; +#endif - while (!(rc = mysql_stmt_fetch(stmt))) row_count++; + while (!(rc = mysql_stmt_fetch(stmt))) +#ifndef NDEBUG + row_count++ +#endif + ; DIE_UNLESS(rc == MYSQL_NO_DATA); diff --git a/unittest/gunit/fake_integer_iterator.h b/unittest/gunit/fake_integer_iterator.h index 2ba1a64302d4..5bab43a8f206 100644 --- a/unittest/gunit/fake_integer_iterator.h +++ b/unittest/gunit/fake_integer_iterator.h @@ -45,7 +45,7 @@ class FakeIntegerIterator final : public TableRowIterator { std::vector> dataset) : TableRowIterator(thd, table), m_field(field), - m_dataset(move(dataset)) {} + m_dataset(std::move(dataset)) {} bool Init() override { m_current_index = 0; diff --git a/unittest/gunit/fake_string_iterator.h b/unittest/gunit/fake_string_iterator.h index e2660c83a542..ad08e1512527 100644 --- a/unittest/gunit/fake_string_iterator.h +++ b/unittest/gunit/fake_string_iterator.h @@ -46,7 +46,7 @@ class FakeStringIterator final : public TableRowIterator { std::vector> dataset) : TableRowIterator(thd, table), m_field(field), - m_dataset(move(dataset)) {} + m_dataset(std::move(dataset)) {} bool Init() override { m_current_index = 0; diff --git a/unittest/gunit/graph_simplification-t.cc b/unittest/gunit/graph_simplification-t.cc index e8bd20403fa7..e69220b1659a 100644 --- a/unittest/gunit/graph_simplification-t.cc +++ b/unittest/gunit/graph_simplification-t.cc @@ -50,7 +50,6 @@ class Item; class THD; using hypergraph::NodeMap; -using std::move; using testing::UnorderedElementsAre; TEST(OnlineCycleFinderTest, SelfEdges) { @@ -99,7 +98,7 @@ static void AddEdge(THD *thd, RelationalExpression::Type join_type, pred.expr->type = join_type; pred.expr->nodes_in_subtree = left | right; pred.estimated_bytes_per_row = 0; // To keep the compiler happy. - graph->edges.push_back(move(pred)); + graph->edges.push_back(std::move(pred)); graph->graph.AddEdge(left, right); } diff --git a/unittest/gunit/hash_join-t.cc b/unittest/gunit/hash_join-t.cc index 4bc500606772..97ec5c3bf90b 100644 --- a/unittest/gunit/hash_join-t.cc +++ b/unittest/gunit/hash_join-t.cc @@ -288,10 +288,12 @@ class HashJoinTestHelper { left_iterator.reset(new (&m_mem_root) FakeIntegerIterator( initializer.thd(), m_left_table.get(), - down_cast(m_left_table->field[0]), move(left_dataset))); + down_cast(m_left_table->field[0]), + std::move(left_dataset))); right_iterator.reset(new (&m_mem_root) FakeIntegerIterator( initializer.thd(), m_right_table.get(), - down_cast(m_right_table->field[0]), move(right_dataset))); + down_cast(m_right_table->field[0]), + std::move(right_dataset))); } HashJoinTestHelper(const Server_initializer &initializer, @@ -312,11 +314,11 @@ class HashJoinTestHelper { left_iterator.reset(new (&m_mem_root) FakeStringIterator( initializer.thd(), m_left_table.get(), down_cast(m_left_table->field[0]), - move(left_dataset))); + std::move(left_dataset))); right_iterator.reset(new (&m_mem_root) FakeStringIterator( initializer.thd(), m_right_table.get(), down_cast(m_right_table->field[0]), - move(right_dataset))); + std::move(right_dataset))); } Prealloced_array
left_tables() const { @@ -564,8 +566,8 @@ static void BM_HashTableIteratorBuild(size_t num_iterations) { right_dataset.emplace_back(distribution(generator)); } - HashJoinTestHelper test_helper(initializer, move(left_dataset), - move(right_dataset)); + HashJoinTestHelper test_helper(initializer, std::move(left_dataset), + std::move(right_dataset)); HashJoinIterator hash_join_iterator( initializer.thd(), std::move(test_helper.left_iterator), @@ -610,8 +612,8 @@ static void BM_HashTableIteratorProbe(size_t num_iterations) { left_dataset.emplace_back(distribution(generator)); right_dataset.emplace_back(distribution(generator)); } - HashJoinTestHelper test_helper(initializer, move(left_dataset), - move(right_dataset)); + HashJoinTestHelper test_helper(initializer, std::move(left_dataset), + std::move(right_dataset)); HashJoinIterator hash_join_iterator( initializer.thd(), std::move(test_helper.left_iterator), @@ -660,8 +662,8 @@ static void BM_HashTableIteratorProbeSemiJoin(size_t num_iterations) { left_dataset.emplace_back(distribution(generator)); right_dataset.emplace_back(distribution(generator)); } - HashJoinTestHelper test_helper(initializer, move(left_dataset), - move(right_dataset)); + HashJoinTestHelper test_helper(initializer, std::move(left_dataset), + std::move(right_dataset)); HashJoinIterator hash_join_iterator( initializer.thd(), std::move(test_helper.left_iterator), diff --git a/unittest/gunit/innodb/os0file-t.cc b/unittest/gunit/innodb/os0file-t.cc index d0b0fa475378..733e6eda4f5b 100644 --- a/unittest/gunit/innodb/os0file-t.cc +++ b/unittest/gunit/innodb/os0file-t.cc @@ -129,8 +129,6 @@ class os0file_t : public ::testing::Test { static constexpr char TEST_FILE_NAME[] = "os0file-t-temp.txt"; }; -constexpr char os0file_t::TEST_FILE_NAME[]; - TEST_F(os0file_t, hundred_10_byte_writes_reads_flushes_with_fsync) { srv_use_fdatasync = false; static constexpr char TEST_DATA[] = "testdata42"; diff --git a/unittest/gunit/overflow_bitset-t.cc b/unittest/gunit/overflow_bitset-t.cc index 6216f129bc24..a619e1d7671b 100644 --- a/unittest/gunit/overflow_bitset-t.cc +++ b/unittest/gunit/overflow_bitset-t.cc @@ -26,7 +26,6 @@ #include "my_alloc.h" #include "sql/join_optimizer/overflow_bitset.h" -using std::move; using std::vector; TEST(OverflowBitsetTest, ZeroInitialize) { @@ -68,7 +67,7 @@ TEST(OverflowBitsetTest, MutateInline) { s.ClearBits(2, 9); s.ClearBit(27); - OverflowBitset cs = move(s); + OverflowBitset cs = std::move(s); for (int i = 0; i < 30; ++i) { SCOPED_TRACE(i); EXPECT_EQ(i % 3 == 0 && (i < 2 || i >= 9) && (i != 27), IsBitSet(i, cs)); @@ -87,7 +86,7 @@ TEST(OverflowBitsetTest, MutateOverflow) { s.ClearBits(60, 150); s.ClearBit(42); - OverflowBitset cs = move(s); + OverflowBitset cs = std::move(s); for (int i = 0; i < 200; ++i) { SCOPED_TRACE(i); EXPECT_EQ( @@ -149,7 +148,7 @@ TEST(OverflowBitsetTest, BitsSetInOverflow) { s.SetBit(199); vector ret; - for (int bit_num : BitsSetIn(move(s))) { + for (int bit_num : BitsSetIn(std::move(s))) { ret.push_back(bit_num); } EXPECT_THAT(ret, testing::ElementsAre(100, 180, 181, 199)); @@ -176,7 +175,7 @@ TEST(OverflowBitsetTest, BitsSetInBothOverflow) { t.SetBit(181); vector ret; - for (int bit_num : BitsSetInBoth(move(s), move(t))) { + for (int bit_num : BitsSetInBoth(std::move(s), std::move(t))) { ret.push_back(bit_num); } EXPECT_THAT(ret, testing::ElementsAre(100, 181)); @@ -214,9 +213,9 @@ TEST(OverflowBitsetTest, OverlapsOverflow) { s3_tmp.SetBit(1); s3_tmp.SetBit(160); - OverflowBitset s1 = move(s1_tmp); - OverflowBitset s2 = move(s2_tmp); - OverflowBitset s3 = move(s3_tmp); + OverflowBitset s1 = std::move(s1_tmp); + OverflowBitset s2 = std::move(s2_tmp); + OverflowBitset s3 = std::move(s3_tmp); EXPECT_FALSE(Overlaps(s1, s2)); EXPECT_TRUE(Overlaps(s2, s3)); EXPECT_TRUE(Overlaps(s1, s3)); @@ -257,9 +256,9 @@ TEST(OverflowBitsetTest, IsSubsetOverflow) { s3_tmp.SetBit(100); s3_tmp.SetBit(160); - OverflowBitset s1 = move(s1_tmp); - OverflowBitset s2 = move(s2_tmp); - OverflowBitset s3 = move(s3_tmp); + OverflowBitset s1 = std::move(s1_tmp); + OverflowBitset s2 = std::move(s2_tmp); + OverflowBitset s3 = std::move(s3_tmp); EXPECT_TRUE(IsSubset(s1, s1)); EXPECT_FALSE(IsSubset(s1, s2)); @@ -283,11 +282,11 @@ TEST(OverflowBitsetTest, IsEmptyInline) { TEST(OverflowBitsetTest, IsEmptyOverflow) { MEM_ROOT mem_root; MutableOverflowBitset s1{&mem_root, 200}; - EXPECT_TRUE(IsEmpty(move(s1))); + EXPECT_TRUE(IsEmpty(std::move(s1))); MutableOverflowBitset s2{&mem_root, 200}; s2.SetBit(186); - EXPECT_FALSE(IsEmpty(move(s2))); + EXPECT_FALSE(IsEmpty(std::move(s2))); } TEST(OverflowBitsetTest, PopulationCountInline) { @@ -299,7 +298,7 @@ TEST(OverflowBitsetTest, PopulationCountInline) { } } - EXPECT_EQ(10, PopulationCount(move(s))); + EXPECT_EQ(10, PopulationCount(std::move(s))); } TEST(OverflowBitsetTest, PopulationCountOverflow) { @@ -310,5 +309,5 @@ TEST(OverflowBitsetTest, PopulationCountOverflow) { s.SetBit(i); } } - EXPECT_EQ(67, PopulationCount(move(s))); + EXPECT_EQ(67, PopulationCount(std::move(s))); }