Some clang-tidy fixes

This commit is contained in:
Robert Schulze 2024-12-05 23:57:25 +00:00
parent d9fad57bde
commit 7d6fbe5a57
No known key found for this signature in database
GPG Key ID: 26703B55FB13728A
138 changed files with 451 additions and 201 deletions

View File

@ -17,34 +17,23 @@ Checks: [
'-android-*',
'-boost-use-ranges',
'-modernize-use-ranges',
'-bugprone-assignment-in-if-condition',
'-bugprone-branch-clone',
'-bugprone-easily-swappable-parameters',
'-bugprone-exception-escape',
'-bugprone-forward-declaration-namespace',
'-bugprone-implicit-widening-of-multiplication-result',
'-bugprone-multi-level-implicit-pointer-conversion',
'-bugprone-narrowing-conversions',
'-bugprone-not-null-terminated-result',
'-bugprone-unchecked-optional-access',
'-bugprone-crtp-constructor-accessibility',
'-bugprone-not-null-terminated-result',
'-cert-dcl16-c',
'-cert-err58-cpp',
'-cert-msc32-c',
'-cert-msc51-cpp',
'-cert-oop54-cpp',
'-cert-oop57-cpp',
'-cert-err33-c', # Misreports on clang-19: it warns about all functions containing 'remove' in the name, not only about the standard library.
'-clang-analyzer-optin.performance.Padding',
'-clang-analyzer-cplusplus.PlacementNew',
'-clang-analyzer-unix.Malloc',
'-cppcoreguidelines-*', # impractical in a codebase as large as ClickHouse, also slow
'-darwin-*',
@ -77,39 +66,33 @@ Checks: [
'-hicpp-use-emplace',
'-hicpp-vararg',
'-linuxkernel-*',
'-llvm-*',
'-llvmlibc-*',
'-openmp-*',
'-misc-const-correctness',
'-misc-include-cleaner', # useful but far too many occurrences
'-misc-no-recursion',
'-misc-non-private-member-variables-in-classes',
'-misc-confusable-identifiers', # useful but slooo
'-misc-use-anonymous-namespace',
'-misc-use-internal-linkage',
'-modernize-avoid-c-arrays',
'-modernize-concat-nested-namespaces',
'-modernize-macro-to-enum',
'-modernize-pass-by-value',
'-modernize-return-braced-init-list',
'-modernize-use-auto',
'-modernize-use-constraints', # This is a good check, but clang-tidy crashes, see https://github.com/llvm/llvm-project/issues/91872
'-modernize-use-default-member-init',
'-modernize-use-emplace',
'-modernize-use-nodiscard',
'-modernize-use-ranges',
'-modernize-use-trailing-return-type',
'-modernize-use-designated-initializers',
'-performance-avoid-endl',
'-performance-enum-size',
'-performance-inefficient-string-concatenation',
'-performance-no-int-to-ptr',
'-performance-avoid-endl',
'-performance-unnecessary-value-param',
'-portability-simd-intrinsics',
@ -124,7 +107,6 @@ Checks: [
'-readability-identifier-length',
'-readability-identifier-naming', # useful but too slow
'-readability-implicit-bool-conversion',
'-readability-isolate-declaration',
'-readability-magic-numbers',
'-readability-named-parameter',
'-readability-redundant-declaration',

View File

@ -7,7 +7,7 @@
#include <base/find_symbols.h>
#include <base/preciseExp10.h>
#define JSON_MAX_DEPTH 100
constexpr size_t JSON_MAX_DEPTH = 100;
#pragma clang diagnostic push

View File

@ -421,13 +421,13 @@ ALWAYS_INLINE inline char * writeSIntText(T x, char * pos)
if constexpr (std::is_same_v<T, Int128>)
{
const char * res = "-170141183460469231731687303715884105728";
memcpy(pos, res, strlen(res));
memcpy(pos, res, strlen(res)); /// NOLINT(bugprone-not-null-terminated-result)
return pos + strlen(res);
}
else if constexpr (std::is_same_v<T, Int256>)
{
const char * res = "-57896044618658097711785492504343953926634992332820282019728792003956564819968";
memcpy(pos, res, strlen(res));
memcpy(pos, res, strlen(res)); /// NOLINT(bugprone-not-null-terminated-result)
return pos + strlen(res);
}
}

View File

@ -76,7 +76,8 @@ double preciseExp10(double x)
1e+289, 1e+290, 1e+291, 1e+292, 1e+293, 1e+294, 1e+295, 1e+296, 1e+297, 1e+298, 1e+299, 1e+300, 1e+301, 1e+302, 1e+303, 1e+304, 1e+305,
1e+306, 1e+307, 1e+308};
double n, y = modf(x, &n);
double n;
double y = modf(x, &n);
if (n > 308) return INFINITY;
if (n < -323) return 0;

2
contrib/arrow vendored

@ -1 +1 @@
Subproject commit 6e2574f5013a005c050c9a7787d341aef09d0063
Subproject commit ae9f3d6a2f4e5c3fb99b52cb471e1921f5e66495

View File

@ -611,6 +611,8 @@ struct FileBlame
/// This is important when file was copied or renamed.
FileBlame & operator=(const FileBlame & rhs)
{
if (&rhs == this)
return *this;
lines = rhs.lines;
it = lines.begin();
current_idx = 1;

View File

@ -3,7 +3,7 @@
#include <cstdint>
#include <string>
#define CLICKHOUSE_DICTIONARY_LIBRARY_API 1
constexpr int CLICKHOUSE_DICTIONARY_LIBRARY_API = 1;
struct ExternalDictionaryLibraryAPI
{

View File

@ -1183,6 +1183,9 @@ AccessRights::AccessRights(const AccessRights & src)
AccessRights & AccessRights::operator =(const AccessRights & src)
{
if (&src == this)
return *this;
if (src.root)
root = std::make_unique<Node>(*src.root);
else
@ -1631,7 +1634,8 @@ void AccessRights::modifyFlags(const ModifyFlagsFunction & function)
if (!root)
return;
bool flags_added, flags_removed;
bool flags_added;
bool flags_removed;
root->modifyFlags(function, false, flags_added, flags_removed);
if (flags_removed && root_with_grant_option)
root_with_grant_option->makeIntersection(*root);

View File

@ -354,7 +354,8 @@ void ContextAccess::setUser(const UserPtr & user_) const
user_name = user->getName();
trace_log = getLogger("ContextAccess (" + user_name + ")");
std::vector<UUID> current_roles, current_roles_with_admin_option;
std::vector<UUID> current_roles;
std::vector<UUID> current_roles_with_admin_option;
if (params.use_default_roles)
{
current_roles = user->granted_roles.findGranted(user->default_roles);

View File

@ -228,7 +228,8 @@ namespace
const auto conf_pref = ssh_keys_config + "." + entry + ".";
if (entry.starts_with("ssh_key"))
{
String type, base64_key;
String type;
String base64_key;
if (config.has(conf_pref + "type"))
{
type = config.getString(conf_pref + "type");

View File

@ -120,7 +120,8 @@ public:
bool allowTypes(const DataTypePtr& left, const DataTypePtr& right) noexcept
{
const WhichDataType l_dt(left), r_dt(right);
const WhichDataType l_dt(left);
const WhichDataType r_dt(right);
constexpr auto allow = [](WhichDataType t)
{

View File

@ -197,13 +197,15 @@ struct AggregateFunctionDistinctJSONPathsAndTypesData
void deserialize(ReadBuffer & buf)
{
size_t paths_size, types_size;
size_t paths_size;
size_t types_size;
readVarUInt(paths_size, buf);
if (paths_size > DISTINCT_JSON_PATHS_MAX_ARRAY_SIZE)
throw Exception(ErrorCodes::TOO_LARGE_ARRAY_SIZE, "Too large array size for paths (maximum: {}): {}", DISTINCT_JSON_PATHS_MAX_ARRAY_SIZE, paths_size);
data.reserve(paths_size);
String path, type;
String path;
String type;
for (size_t i = 0; i != paths_size; ++i)
{
readStringBinary(path, buf);

View File

@ -26,7 +26,7 @@
#include <type_traits>
#define AGGREGATE_FUNCTION_GROUP_ARRAY_MAX_ELEMENT_SIZE 0xFFFFFF
constexpr size_t AGGREGATE_FUNCTION_GROUP_ARRAY_MAX_ELEMENT_SIZE = 0xFFFFFF;
namespace DB

View File

@ -16,7 +16,7 @@
#include <AggregateFunctions/IAggregateFunction.h>
#define AGGREGATE_FUNCTION_GROUP_ARRAY_INSERT_AT_MAX_SIZE 0xFFFFFF
constexpr size_t AGGREGATE_FUNCTION_GROUP_ARRAY_INSERT_AT_MAX_SIZE = 0xFFFFFF;
namespace DB

View File

@ -19,7 +19,7 @@
#include <type_traits>
#define AGGREGATE_FUNCTION_MOVING_MAX_ARRAY_SIZE 0xFFFFFF
constexpr size_t AGGREGATE_FUNCTION_MOVING_MAX_ARRAY_SIZE = 0xFFFFFF;
namespace DB

View File

@ -169,7 +169,11 @@ struct KolmogorovSmirnov : public StatisticalSample<Float64, Float64>
* J.DURBIN
* Distribution theory for tests based on the sample distribution function
*/
Float64 new_val, old_val, s, w, z;
Float64 new_val;
Float64 old_val;
Float64 s;
Float64 w;
Float64 z;
UInt64 k_max = static_cast<UInt64>(sqrt(2 - log(tol)));
if (p < 1)

View File

@ -14,7 +14,7 @@
#include <AggregateFunctions/IAggregateFunction.h>
#define AGGREGATE_FUNCTION_MAX_INTERSECTIONS_MAX_ARRAY_SIZE 0xFFFFFF
constexpr size_t AGGREGATE_FUNCTION_MAX_INTERSECTIONS_MAX_ARRAY_SIZE = 0xFFFFFF;
namespace DB

View File

@ -171,7 +171,8 @@ private:
}
else
{
size_t start = 0, end = size - 1;
size_t start = 0;
size_t end = size - 1;
while (start <= end)
{
size_t mid = start + (end - start) / 2;
@ -191,8 +192,10 @@ private:
size_t l = idx;
size_t u = idx + 1 < size ? idx + 1 : idx;
Float64 xl = value_weight_pairs[l].second, xr = value_weight_pairs[u].second;
UnderlyingType yl = value_weight_pairs[l].first, yr = value_weight_pairs[u].first;
Float64 xl = value_weight_pairs[l].second;
Float64 xr = value_weight_pairs[u].second;
UnderlyingType yl = value_weight_pairs[l].first;
UnderlyingType yr = value_weight_pairs[u].first;
if (level < xl)
yr = yl;
@ -268,7 +271,8 @@ private:
}
else
{
size_t start = 0, end = size - 1;
size_t start = 0;
size_t end = size - 1;
while (start <= end)
{
size_t mid = start + (end - start) / 2;
@ -288,8 +292,10 @@ private:
size_t l = idx;
size_t u = idx + 1 < size ? idx + 1 : idx;
Float64 xl = value_weight_pairs[l].second, xr = value_weight_pairs[u].second;
UnderlyingType yl = value_weight_pairs[l].first, yr = value_weight_pairs[u].first;
Float64 xl = value_weight_pairs[l].second;
Float64 xr = value_weight_pairs[u].second;
UnderlyingType yl = value_weight_pairs[l].first;
UnderlyingType yr = value_weight_pairs[u].first;
if (level < xl)
yr = yl;

View File

@ -65,7 +65,8 @@ public:
if (which.isNativeInt() || which.isEnum() || which.isInterval())
{
Int64 begin, end;
Int64 begin;
Int64 end;
// notice: UInt64 -> Int64 may lead to overflow
if (!params[params.size() - 3].tryGet<Int64>(begin))

View File

@ -93,7 +93,8 @@ public:
{
// Calculate the size of the dense and sparse encodings to choose the smallest one
UInt64 num_bins = 0, num_non_empty_bins = 0;
UInt64 num_bins = 0;
UInt64 num_non_empty_bins = 0;
if (count != 0)
{
num_bins = max_key - min_key + 1;

View File

@ -543,7 +543,8 @@ void BackupCoordinationStageSync::readCurrentState(Coordination::ZooKeeperWithFa
std::lock_guard lock{mutex};
/// Log all changes in zookeeper nodes in the "stage" folder to make debugging easier.
Strings added_zk_nodes, removed_zk_nodes;
Strings added_zk_nodes;
Strings removed_zk_nodes;
std::set_difference(new_zk_nodes.begin(), new_zk_nodes.end(), zk_nodes.begin(), zk_nodes.end(), back_inserter(added_zk_nodes));
std::set_difference(zk_nodes.begin(), zk_nodes.end(), new_zk_nodes.begin(), new_zk_nodes.end(), back_inserter(removed_zk_nodes));
if (!added_zk_nodes.empty())

View File

@ -513,7 +513,8 @@ void BackupEntriesCollector::gatherTablesMetadata()
const auto & create = create_table_query->as<const ASTCreateQuery &>();
String table_name = create.getTable();
fs::path metadata_path_in_backup, data_path_in_backup;
fs::path metadata_path_in_backup;
fs::path data_path_in_backup;
auto table_name_in_backup = renaming_map.getNewTableName({database_name, table_name});
if (table_name_in_backup.database == DatabaseCatalog::TEMPORARY_DATABASE)
{

View File

@ -496,7 +496,8 @@ void RestorerFromBackup::findDatabaseInBackupImpl(const String & database_name_i
std::unordered_set<String> table_names_in_backup;
for (const auto & root_path_in_backup : root_paths_in_backup)
{
fs::path try_metadata_path, try_tables_metadata_path;
fs::path try_metadata_path;
fs::path try_tables_metadata_path;
if (database_name_in_backup == DatabaseCatalog::TEMPORARY_DATABASE)
{
try_tables_metadata_path = root_path_in_backup / "temporary_tables" / "metadata";
@ -869,7 +870,8 @@ void RestorerFromBackup::removeUnresolvedDependencies()
table_id);
}
size_t num_dependencies, num_dependents;
size_t num_dependencies;
size_t num_dependents;
tables_dependencies.getNumberOfAdjacents(table_id, num_dependencies, num_dependents);
if (num_dependencies || !num_dependents)
throw Exception(

View File

@ -48,7 +48,9 @@ void registerBackupEngineS3(BackupFactory & factory)
const String & id_arg = params.backup_info.id_arg;
const auto & args = params.backup_info.args;
String s3_uri, access_key_id, secret_access_key;
String s3_uri;
String access_key_id;
String secret_access_key;
if (!id_arg.empty())
{

View File

@ -547,7 +547,8 @@ void Connection::receiveHello(const Poco::Timespan & handshake_timeout)
for (size_t i = 0; i < rules_size; ++i)
{
String original_pattern, exception_message;
String original_pattern;
String exception_message;
readStringBinary(original_pattern, *in);
readStringBinary(exception_message, *in);
password_complexity_rules.push_back({std::move(original_pattern), std::move(exception_message)});

View File

@ -121,7 +121,8 @@ Collator::~Collator() // NOLINT
int Collator::compare(const char * str1, size_t length1, const char * str2, size_t length2) const
{
#if USE_ICU
UCharIterator iter1, iter2;
UCharIterator iter1;
UCharIterator iter2;
uiter_setUTF8(&iter1, str1, length1);
uiter_setUTF8(&iter2, str2, length2);

View File

@ -542,7 +542,8 @@ void ColumnNullable::updatePermutationImpl(IColumn::PermutationSortDirection dir
return;
/// We will sort nested columns into `new_ranges` and call updatePermutation in next columns with `null_ranges`.
EqualRanges new_ranges, null_ranges;
EqualRanges new_ranges;
EqualRanges null_ranges;
bool reverse = direction == IColumn::PermutationSortDirection::Descending;
const auto is_nulls_last = ((null_direction_hint > 0) != reverse);

View File

@ -1075,7 +1075,8 @@ DECLARE_AVX512VBMI_SPECIFIC_CODE(
__m512i table1 = _mm512_loadu_epi8(data_pos);
__m512i table2 = _mm512_loadu_epi8(data_pos + 64);
__m512i table3, table4;
__m512i table3;
__m512i table4;
if (data_size <= 192)
{
/// only 3 tables need to load if size <= 192

View File

@ -20,6 +20,8 @@ struct CopyableAtomic
CopyableAtomic & operator=(const CopyableAtomic & other)
{
if (&other == this)
return *this;
value = other.value.load();
return *this;
}

View File

@ -9,6 +9,7 @@
#include <string>
#include <type_traits>
/// NOLINTBEGIN(modernize-macro-to-enum)
#define DATE_SECONDS_PER_DAY 86400 /// Number of seconds in a day, 60 * 60 * 24
#define DATE_LUT_MIN_YEAR 1900 /// 1900 since majority of financial organizations consider 1900 as an initial year.
@ -28,6 +29,7 @@
/// A constant to add to time_t so every supported time point becomes non-negative and still has the same remainder of division by 3600.
/// If we treat "remainder of division" operation in the sense of modular arithmetic (not like in C++).
#define DATE_LUT_ADD ((1970 - DATE_LUT_MIN_YEAR) * 366L * 86400)
/// NOLINTEND(modernize-macro-to-enum)
/// Flags for toYearWeek() function.

View File

@ -5,8 +5,8 @@
#include <Common/checkStackSize.h>
#include <Common/OptimizedRegularExpression.h>
#define MIN_LENGTH_FOR_STRSTR 3
#define MAX_SUBPATTERNS 1024
constexpr size_t MIN_LENGTH_FOR_STRSTR = 3;
constexpr size_t MAX_SUBPATTERNS = 1024;
namespace DB

View File

@ -21,8 +21,10 @@ struct OvercommitRatio
friend bool operator<(OvercommitRatio const & lhs, OvercommitRatio const & rhs) noexcept
{
Int128 lhs_committed = lhs.committed, lhs_soft_limit = lhs.soft_limit;
Int128 rhs_committed = rhs.committed, rhs_soft_limit = rhs.soft_limit;
Int128 lhs_committed = lhs.committed;
Int128 lhs_soft_limit = lhs.soft_limit;
Int128 rhs_committed = rhs.committed;
Int128 rhs_soft_limit = rhs.soft_limit;
// (a / b < c / d) <=> (a * d < c * b)
return (lhs_committed * rhs_soft_limit) < (rhs_committed * lhs_soft_limit)
|| (lhs_soft_limit == 0 && rhs_soft_limit > 0)

View File

@ -189,7 +189,8 @@ void ProgressIndication::writeProgress(WriteBufferFromFileDescriptor & message,
/// If the approximate number of rows to process is known, we can display a progress bar and percentage.
if (progress.total_rows_to_read || progress.total_bytes_to_read)
{
size_t current_count, max_count;
size_t current_count;
size_t max_count;
if (progress.total_rows_to_read)
{
current_count = progress.read_rows;

View File

@ -91,6 +91,8 @@ SSHKey::SSHKey(SSHKey && other) noexcept
SSHKey & SSHKey::operator=(const SSHKey & other)
{
if (&other == this)
return *this;
ssh_key_free(key);
key = ssh_key_dup(other.key);
return *this;
@ -127,7 +129,8 @@ String SSHKey::signString(std::string_view input) const
bool SSHKey::verifySignature(std::string_view signature, std::string_view original) const
{
SSHString sig(signature), orig(original);
SSHString sig(signature);
SSHString orig(original);
int rc = pki_verify_string(key, sig.get(), orig.get());
return rc == SSH_OK;
}

View File

@ -34,7 +34,8 @@ static void setAffinity()
static inline ALWAYS_INLINE UInt64 rdtsc()
{
#if defined(__x86_64__)
UInt32 a, d;
UInt32 a;
UInt32 d;
__asm__ volatile ("rdtsc" : "=a" (a), "=d" (d));
return static_cast<UInt64>(a) | (static_cast<UInt64>(d) << 32);
#else

View File

@ -9,12 +9,14 @@
#include <mysqlxx/Query.h>
#include <mysqlxx/Exception.h>
/// NOLINTBEGIN(modernize-macro-to-enum)
#define MYSQLXX_DEFAULT_TIMEOUT 60
#define MYSQLXX_DEFAULT_RW_TIMEOUT 1800
/// Disable LOAD DATA LOCAL INFILE because it is insecure
#define MYSQLXX_DEFAULT_ENABLE_LOCAL_INFILE false
/// See https://dev.mysql.com/doc/c-api/5.7/en/c-api-auto-reconnect.html
/// NOLINTEND(modernize-macro-to-enum)
#define MYSQLXX_DEFAULT_MYSQL_OPT_RECONNECT true

View File

@ -13,9 +13,11 @@
#include <mysqlxx/Connection.h>
/// NOLINTBEGIN(modernize-macro-to-enum)
#define MYSQLXX_POOL_DEFAULT_START_CONNECTIONS 1
#define MYSQLXX_POOL_DEFAULT_MAX_CONNECTIONS 16
#define MYSQLXX_POOL_SLEEP_ON_CONNECT_FAIL 1
/// NOLINTEND(modernize-macro-to-enum)
namespace mysqlxx

View File

@ -7,9 +7,11 @@
#include <mysqlxx/PoolWithFailover.h>
/// NOLINTBEGIN(modernize-macro-to-enum)
#define MYSQLXX_POOL_WITH_FAILOVER_DEFAULT_START_CONNECTIONS 1
#define MYSQLXX_POOL_WITH_FAILOVER_DEFAULT_MAX_CONNECTIONS 16
#define MYSQLXX_POOL_WITH_FAILOVER_DEFAULT_MAX_TRIES 3
/// NOLINTEND(modernize-macro-to-enum)
namespace mysqlxx

View File

@ -3,10 +3,12 @@
#include "Pool.h"
/// NOLINTBEGIN(modernize-macro-to-enum)
#define MYSQLXX_POOL_WITH_FAILOVER_DEFAULT_START_CONNECTIONS 1
#define MYSQLXX_POOL_WITH_FAILOVER_DEFAULT_MAX_CONNECTIONS 16
#define MYSQLXX_POOL_WITH_FAILOVER_DEFAULT_MAX_TRIES 3
#define MYSQLXX_POOL_WITH_FAILOVER_DEFAULT_CONNECTION_WAIT_TIMEOUT 5 /// in seconds
/// NOLINTEND(modernize-macro-to-enum)
namespace mysqlxx

View File

@ -95,7 +95,8 @@ std::vector<String> parseRemoteDescription(
/// The presence of a dot - numeric interval
if (last_dot != -1)
{
size_t left, right;
size_t left;
size_t right;
if (description[last_dot - 1] != '.')
throw Exception(
ErrorCodes::BAD_ARGUMENTS,

View File

@ -12,7 +12,7 @@
#include <Common/Exception.h>
#include <Common/setThreadName.h>
#define THREAD_NAME_SIZE 16
constexpr size_t THREAD_NAME_SIZE = 16;
namespace DB

View File

@ -533,7 +533,8 @@ UInt32 CompressionCodecEncrypted::doCompressData(const char * source, UInt32 sou
/// Get key and nonce for encryption
UInt64 current_key_id;
String current_key, nonce;
String current_key;
String nonce;
Configuration::instance().getCurrentKeyAndNonce(encryption_method, current_key_id, current_key, nonce);
/// Write current key id to support multiple keys.

View File

@ -494,7 +494,8 @@ UInt32 compressData(const char * src, UInt32 bytes_size, char * dst)
UInt32 num_full = src_size / matrix_size;
UInt32 tail = src_size % matrix_size;
T min, max;
T min;
T max;
findMinMax<T>(src, bytes_size, min, max);
MinMaxType min64 = min; // NOLINT
MinMaxType max64 = max; // NOLINT

View File

@ -4,10 +4,10 @@
/** Common defines for compression */
#define DBMS_MAX_COMPRESSED_SIZE 0x40000000ULL /// 1GB
constexpr uint64_t DBMS_MAX_COMPRESSED_SIZE = 0x40000000ULL; /// 1GB
/** one byte for method, 4 bytes for compressed size, 4 bytes for uncompressed size */
#define COMPRESSED_BLOCK_HEADER_SIZE 9
constexpr uint8_t COMPRESSED_BLOCK_HEADER_SIZE = 9;
namespace DB
{

View File

@ -499,7 +499,8 @@ void KeeperStorageSnapshot<Storage>::deserialize(SnapshotDeserializationResult<S
size_t current_session_size = 0;
while (current_session_size < active_sessions_size)
{
int64_t active_session_id, timeout;
int64_t active_session_id;
int64_t timeout;
readBinary(active_session_id, in);
readBinary(timeout, in);
storage.addSessionID(active_session_id, timeout);
@ -513,7 +514,8 @@ void KeeperStorageSnapshot<Storage>::deserialize(SnapshotDeserializationResult<S
size_t session_auth_counter = 0;
while (session_auth_counter < session_auths_size)
{
String scheme, id;
String scheme;
String id;
readBinary(scheme, in);
readBinary(id, in);
ids.emplace_back(typename Storage::AuthID{scheme, id});

View File

@ -486,7 +486,8 @@ ClusterUpdateActions KeeperStateManager::getRaftConfigurationDiff(
{
auto new_configuration_wrapper = parseServersConfiguration(config, true, coordination_settings[CoordinationSetting::async_replication]);
std::unordered_map<int, KeeperServerConfigPtr> new_ids, old_ids;
std::unordered_map<int, KeeperServerConfigPtr> new_ids;
std::unordered_map<int, KeeperServerConfigPtr> old_ids;
for (const auto & new_server : new_configuration_wrapper.cluster_config->get_servers())
new_ids[new_server->get_id()] = new_server;

View File

@ -31,7 +31,8 @@ int64_t getZxidFromName(const std::string & filename)
void deserializeSnapshotMagic(ReadBuffer & in)
{
int32_t magic_header, version;
int32_t magic_header;
int32_t version;
int64_t dbid;
Coordination::read(magic_header, in);
Coordination::read(version, in);
@ -227,7 +228,8 @@ void deserializeKeeperStorageFromSnapshotsDir(Storage & storage, const std::stri
void deserializeLogMagic(ReadBuffer & in)
{
int32_t magic_header, version;
int32_t magic_header;
int32_t version;
int64_t dbid;
Coordination::read(magic_header, in);
Coordination::read(version, in);

View File

@ -196,8 +196,10 @@ bool GTIDSet::contains(const GTIDSet & gtid_set) const
//use the fact that intervals are sorted to make this linear instead of quadratic.
if (uuid != gtid_set.uuid) { return false; }
auto mine = intervals.begin(), other = gtid_set.intervals.begin();
auto my_end = intervals.end(), other_end = gtid_set.intervals.end();
auto mine = intervals.begin();
auto other = gtid_set.intervals.begin();
auto my_end = intervals.end();
auto other_end = gtid_set.intervals.end();
while (mine != my_end && other != other_end)
{
bool mine_contains_other = mine->start <= other->start && mine->end >= other->end;

View File

@ -646,7 +646,9 @@ namespace MySQLReplication
break;
}
}
Int64 hh, mm, ss;
Int64 hh;
Int64 mm;
Int64 ss;
bool negative = false;
if (intpart == 0)
{
@ -699,7 +701,8 @@ namespace MySQLReplication
}
case MYSQL_TYPE_TIMESTAMP2:
{
UInt32 sec = 0, fsp = 0;
UInt32 sec = 0;
UInt32 fsp = 0;
readBigEndianStrict(payload, reinterpret_cast<char *>(&sec), 4);
readTimeFractionalPart(payload, fsp, meta);

View File

@ -34,7 +34,8 @@ namespace MySQLReplication
{
payload.readStrict(to, n);
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
char *start = to, *end = to + n;
char *start = to;
char *end = to + n;
std::reverse(start, end);
#endif
}

View File

@ -128,7 +128,9 @@ void insertPostgreSQLValue(
pqxx::array_parser parser{value};
std::pair<pqxx::array_parser::juncture, std::string> parsed = parser.get_next();
size_t dimension = 0, max_dimension = 0, expected_dimensions = array_info.at(idx).num_dimensions;
size_t dimension = 0;
size_t max_dimension = 0;
size_t expected_dimensions = array_info.at(idx).num_dimensions;
const auto parse_value = array_info.at(idx).pqxx_parser;
std::vector<Row> dimensions(expected_dimensions + 1);

View File

@ -6213,6 +6213,8 @@ Settings::~Settings() = default;
Settings & Settings::operator=(const Settings & other)
{
if (&other == this)
return *this;
*impl = *other.impl;
return *this;
}
@ -6328,7 +6330,8 @@ void Settings::dumpToSystemSettingsColumns(MutableColumnsAndConstraints & params
res_columns[3]->insert(doc);
Field min, max;
Field min;
Field max;
SettingConstraintWritability writability = SettingConstraintWritability::WRITABLE;
params.constraints.get(*this, setting_name, min, max, writability);

View File

@ -4,8 +4,8 @@
#include <Common/PODArray_fwd.h>
#include <Common/Exception.h>
#define MAX_FIXEDSTRING_SIZE 0xFFFFFF
#define MAX_FIXEDSTRING_SIZE_WITHOUT_SUSPICIOUS 256
constexpr size_t MAX_FIXEDSTRING_SIZE = 0xFFFFFF;
constexpr size_t MAX_FIXEDSTRING_SIZE_WITHOUT_SUSPICIOUS = 256;
namespace DB

View File

@ -151,7 +151,8 @@ static bool checkSyncUserPrivImpl(const mysqlxx::PoolWithFailover::Entry & conne
{std::make_shared<DataTypeString>(), "current_user_grants"}
};
String grants_query, sub_privs;
String grants_query;
String sub_privs;
StreamSettings mysql_input_stream_settings(global_settings);
auto input = std::make_unique<MySQLSource>(connection, "SHOW GRANTS FOR CURRENT_USER();", sync_user_privs_header, mysql_input_stream_settings);
QueryPipeline pipeline(std::move(input));

View File

@ -108,7 +108,8 @@ static DataTypePtr convertPostgreSQLDataType(String & type, Fn<void()> auto && r
{
/// Numeric and decimal will both end up here as numeric. If it has type and precision,
/// there will be Numeric(x, y), otherwise just Numeric
UInt32 precision, scale;
UInt32 precision;
UInt32 scale;
if (type.ends_with(")"))
{
res = DataTypeFactory::instance().get(type);

View File

@ -190,7 +190,8 @@ void TablesLoader::removeUnresolvableDependencies()
table_id);
}
size_t num_dependencies, num_dependents;
size_t num_dependencies;
size_t num_dependents;
all_loading_dependencies.getNumberOfAdjacents(table_id, num_dependencies, num_dependents);
if (num_dependencies || !num_dependents)
throw Exception(ErrorCodes::LOGICAL_ERROR, "Table {} does not have dependencies and dependent tables as it expected to."

View File

@ -127,7 +127,8 @@ void SlabsPolygonIndex::indexBuild(const std::vector<Polygon> & polygons)
edges_index_tree.resize(2 * n);
/** Map of interesting edge ids to the index of left x, the index of right x */
std::vector<size_t> edge_left(m, n), edge_right(m, n);
std::vector<size_t> edge_left(m, n);
std::vector<size_t> edge_right(m, n);
size_t edges_it = 0;
for (size_t l = 0, r = 1; r < sorted_x.size(); ++l, ++r)

View File

@ -248,7 +248,8 @@ void RegExpTreeDictionary::initRegexNodes(Block & block)
#if USE_VECTORSCAN
String required_substring;
bool is_trivial, required_substring_is_prefix;
bool is_trivial;
bool required_substring_is_prefix;
std::vector<std::string> alternatives;
if (use_vectorscan)
@ -887,7 +888,8 @@ Pipe RegExpTreeDictionary::read(const Names & , size_t max_block_size, size_t) c
const auto & node = it->second;
col_pid->insert(node->parent_id);
col_regex->insert(node->regex);
std::vector<Field> keys, values;
std::vector<Field> keys;
std::vector<Field> values;
for (const auto & [key, attr] : node->attributes)
{
keys.push_back(key);

View File

@ -386,7 +386,8 @@ private:
bool is_column_const[3];
const ColumnAggregateFunction * col_agg_func;
const PaddedPODArray<AggregateDataPtr> * container0;
const PaddedPODArray<UInt64> * container1, * container2;
const PaddedPODArray<UInt64> * container1;
const PaddedPODArray<UInt64> * container2;
ColumnPtr column_holder[2];
for (size_t i = 0; i < 3; ++i)

View File

@ -84,7 +84,8 @@ bool sliceHasImplAnyAllImplInt64(
size_t j = 0;
int has_mask = 1;
static constexpr Int64 full = -1, none = 0;
static constexpr Int64 full = -1;
static constexpr Int64 none = 0;
const __m256i ones = _mm256_set1_epi64x(full);
const __m256i zeros = _mm256_setzero_si256();
@ -174,7 +175,8 @@ bool sliceHasImplAnyAllImplInt32(
size_t j = 0;
int has_mask = 1;
static constexpr int full = -1, none = 0;
static constexpr int full = -1;
static constexpr int none = 0;
const __m256i ones = _mm256_set1_epi32(full);
const __m256i zeros = _mm256_setzero_si256();
@ -287,7 +289,8 @@ bool sliceHasImplAnyAllImplInt16(
size_t j = 0;
int has_mask = 1;
static constexpr int16_t full = -1, none = 0;
static constexpr int16_t full = -1;
static constexpr int16_t none = 0;
const __m256i ones = _mm256_set1_epi16(full);
const __m256i zeros = _mm256_setzero_si256();
if (second.size > 15 && first.size > 15)
@ -436,7 +439,8 @@ inline ALWAYS_INLINE bool sliceHasImplAnyAllImplInt64(
size_t j = 0;
int has_mask = 1;
static constexpr Int64 full = -1, none = 0;
static constexpr Int64 full = -1;
static constexpr Int64 none = 0;
const __m128i zeros = _mm_setzero_si128();
if (second.size > 1 && first.size > 1)
{
@ -512,7 +516,8 @@ inline ALWAYS_INLINE bool sliceHasImplAnyAllImplInt32(
size_t j = 0;
int has_mask = 1;
static constexpr int full = -1, none = 0;
static constexpr int full = -1;
static constexpr int none = 0;
const __m128i zeros = _mm_setzero_si128();
if (second.size > 3 && first.size > 3)
{
@ -597,7 +602,8 @@ inline ALWAYS_INLINE bool sliceHasImplAnyAllImplInt16(
size_t j = 0;
int has_mask = 1;
static constexpr int16_t full = -1, none = 0;
static constexpr int16_t full = -1;
static constexpr int16_t none = 0;
const __m128i zeros = _mm_setzero_si128();
if (second.size > 6 && first.size > 6)
{
@ -699,7 +705,8 @@ inline ALWAYS_INLINE bool sliceHasImplAnyAllImplInt8(
size_t j = 0;
int has_mask = 1;
static constexpr int8_t full = -1, none = 0;
static constexpr int8_t full = -1;
static constexpr int8_t none = 0;
const __m128i zeros = _mm_setzero_si128();
if (second.size > 15 && first.size > 15)

View File

@ -133,7 +133,8 @@ inline Encoded merge(const Encoded & encodedLon, const Encoded & encodedLat, uin
inline std::tuple<Encoded, Encoded> split(const Encoded & combined, uint8_t precision)
{
Encoded lat, lon;
Encoded lat;
Encoded lon;
lat.fill(0);
lon.fill(0);
@ -253,7 +254,8 @@ void geohashDecode(const char * encoded_string, size_t encoded_len, Float64 * lo
return;
}
Encoded lat_encoded, lon_encoded;
Encoded lat_encoded;
Encoded lon_encoded;
std::tie(lon_encoded, lat_encoded) = split(base32Decode(encoded_string, precision), precision);
*longitude = decodeCoordinate(lon_encoded, LON_MIN, LON_MAX, singleCoordBitsPrecision(precision, LONGITUDE));

View File

@ -26,7 +26,7 @@
#pragma GCC diagnostic ignored "-Wunused-macros"
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#pragma GCC diagnostic ignored "-Wshorten-64-to-32"
// NOLINTBEGIN(google-runtime-int,hicpp-use-nullptr,modernize-use-nullptr)
// NOLINTBEGIN(google-runtime-int,hicpp-use-nullptr,modernize-use-nullptr,modernize-macro-to-enum)
#line 16 "HTMLCharacterReference.gperf"
struct NameAndGlyph
{
@ -17874,4 +17874,4 @@ const struct NameAndGlyph * HTMLCharacterHash::Lookup(const char * str, size_t l
}
#line 2252 "HTMLCharacterReference.gperf"
// NOLINTEND(google-runtime-int,hicpp-use-nullptr,modernize-use-nullptr)
// NOLINTEND(google-runtime-int,hicpp-use-nullptr,modernize-use-nullptr,modernize-macro-to-enum)

View File

@ -26,6 +26,8 @@
#pragma GCC diagnostic ignored "-Wunused-macros"
#include <cstring>
/// NOLINTBEGIN(modernize-macro-to-enum)
#define TOTAL_KEYWORDS 5045
#define MIN_WORD_LENGTH 4
#define MAX_WORD_LENGTH 34
@ -110735,4 +110737,6 @@ const char * TopLevelDomainLookupHash::isValid(const char * str, size_t len)
}
return nullptr;
}
/// NOLINTEND(modernize-macro-to-enum)
#line 5060 "tldLookup.gperf"

View File

@ -112,8 +112,10 @@ private:
Float64 area = 0.0;
Float64 prev_score = sorted_labels[0].score;
size_t prev_fp = 0, prev_tp = 0;
size_t curr_fp = 0, curr_tp = 0;
size_t prev_fp = 0;
size_t prev_tp = 0;
size_t curr_fp = 0;
size_t curr_tp = 0;
for (size_t i = 0; i < size; ++i)
{
/// Only increment the area when the score changes

View File

@ -141,7 +141,8 @@ public:
static constexpr ResultType lowerBound(const Data & data, const Target & target, size_t array_size, ArrOffset current_offset)
{
ResultType current = 0;
size_t low = 0, high = array_size;
size_t low = 0;
size_t high = array_size;
while (high - low > 0)
{
auto middle = low + ((high - low) >> 1);

View File

@ -54,7 +54,8 @@ public:
IColumn::Offsets & out_offsets_2 = col_res_inner_offsets->getData();
IColumn::Offsets & out_offsets_1 = col_res_outer_offsets->getData();
size_t pos1 = 0, pos2 = 0;
size_t pos1 = 0;
size_t pos2 = 0;
for (size_t row = 0; row < input_rows_count; ++row)
{
const Int64 shingle_length = col_length->getInt(row);

View File

@ -81,7 +81,9 @@ private:
DataTypePtr getReturnTypeForTuples(const DataTypes & arguments) const
{
DataTypePtr key_type, val_type, res;
DataTypePtr key_type;
DataTypePtr val_type;
DataTypePtr res;
for (const auto & arg : arguments)
{
@ -125,7 +127,9 @@ private:
DataTypePtr getReturnTypeForMaps(const DataTypes & arguments) const
{
DataTypePtr key_type, val_type, res;
DataTypePtr key_type;
DataTypePtr val_type;
DataTypePtr res;
for (const auto & arg : arguments)
{
@ -168,7 +172,8 @@ private:
ColumnPtr execute2(size_t row_count, TupleMaps & args, const DataTypePtr res_type) const
{
MutableColumnPtr res_column = res_type->createColumn();
IColumn *to_keys_data, *to_vals_data;
IColumn *to_keys_data;
IColumn *to_vals_data;
ColumnArray::Offsets * to_keys_offset;
ColumnArray::Offsets * to_vals_offset = nullptr;
@ -204,7 +209,8 @@ private:
[[maybe_unused]] bool first = true;
for (auto & arg : args)
{
size_t offset = 0, len = arg.key_offsets[0];
size_t offset = 0;
size_t len = arg.key_offsets[0];
if (!arg.is_const)
{

View File

@ -195,8 +195,10 @@ public:
auto minutes = (time % 10'000) / 100;
auto seconds = time % 100;
Int64 min_date = 0, max_date = 0;
Int16 min_year, max_year;
Int64 min_date = 0;
Int64 max_date = 0;
Int16 min_year;
Int16 max_year;
if (isDate(result_type))
{
min_date = date_lut.makeDayNum(1970, 1, 1);

View File

@ -109,7 +109,8 @@ public:
ColumnPtr executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr &, size_t input_rows_count) const override
{
std::string_view maximum_unit_str, minimum_unit_str;
std::string_view maximum_unit_str;
std::string_view minimum_unit_str;
if (arguments.size() >= 2)
{
const ColumnPtr & maximum_unit_column = arguments[1].column;

View File

@ -44,7 +44,7 @@ constexpr uint64_t counter_high_bits_mask = rand_a_bits_mask;
uint64_t getTimestampMillisecond()
{
timespec tp;
clock_gettime(CLOCK_REALTIME, &tp);
clock_gettime(CLOCK_REALTIME, &tp); /// NOLINT(cert-err33-c)
const uint64_t sec = tp.tv_sec;
return sec * 1000 + tp.tv_nsec / 1000000;
}

View File

@ -8,7 +8,7 @@
#include <string>
#define GEOHASH_MAX_TEXT_LENGTH 16
constexpr size_t GEOHASH_MAX_TEXT_LENGTH = 16;
namespace DB

View File

@ -171,7 +171,9 @@ SOFTWARE.
/* Adjust Second Byte range for special First Bytes(E0,ED,F0,F4) */
/* Overlaps lead to index 9~15, which are illegal in range table */
__m128i shift1, pos, range2;
__m128i shift1;
__m128i pos;
__m128i range2;
/* shift1 = (input, prev_input) << 1 byte */
shift1 = _mm_alignr_epi8(input, prev_input, 15);
pos = _mm_sub_epi8(shift1, _mm_set1_epi8(0xEF));

View File

@ -10,7 +10,8 @@ namespace
/// Code from https://arxiv.org/pdf/1406.2294.pdf
inline int32_t JumpConsistentHash(uint64_t key, int32_t num_buckets)
{
int64_t b = -1, j = 0;
int64_t b = -1;
int64_t j = 0;
while (j < num_buckets)
{
b = j;

View File

@ -91,7 +91,8 @@ public:
throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH,
"Function {} requires even number of arguments, but {} given", getName(), arguments.size());
DataTypes keys, values;
DataTypes keys;
DataTypes values;
for (size_t i = 0; i < arguments.size(); i += 2)
{
keys.emplace_back(arguments[i]);

View File

@ -57,7 +57,8 @@ namespace DB
if (unlikely(begin > end))
{
const FormatSettings default_format{};
WriteBufferFromOwnString buf_begin, buf_end;
WriteBufferFromOwnString buf_begin;
WriteBufferFromOwnString buf_end;
begin_serializaion->serializeTextQuoted(*(arguments[0].column), i, buf_begin, default_format);
end_serialization->serializeTextQuoted(*(arguments[1].column), i, buf_end, default_format);
throw Exception(ErrorCodes::INCORRECT_DATA, "Incorrect order of events: {} > {}", buf_begin.str(), buf_end.str());

View File

@ -163,7 +163,8 @@ struct TranslateUTF8Impl
{
size_t len_from = UTF8::seqLength(*map_from_ptr);
std::optional<UInt32> res_from, res_to;
std::optional<UInt32> res_from;
std::optional<UInt32> res_to;
if (map_from_ptr + len_from <= map_from_end)
res_from = UTF8::convertUTF8ToCodePoint(map_from_ptr, len_from);

View File

@ -5,7 +5,7 @@
#include <IO/ReadHelpers.h>
#include <city.h>
#define DBMS_DEFAULT_HASHING_BLOCK_SIZE 2048ULL
constexpr size_t DBMS_DEFAULT_HASHING_BLOCK_SIZE = 2048ULL;
namespace DB

View File

@ -102,7 +102,9 @@ struct PcgDeserializer
{
static void deserializePcg32(pcg32_fast & rng, ReadBuffer & buf)
{
decltype(rng.state_) multiplier, increment, state;
decltype(rng.state_) multiplier;
decltype(rng.state_) increment;
decltype(rng.state_) state;
readText(multiplier, buf);
assertChar(' ', buf);
readText(increment, buf);

View File

@ -349,7 +349,9 @@ bool AWSEC2InstanceProfileConfigLoader::LoadInternal()
LOG_ERROR(logger, "Failed to parse output from EC2MetadataService.");
return false;
}
String access_key, secret_key, token;
String access_key;
String secret_key;
String token;
auto credentials_view = credentials_doc.View();
access_key = credentials_view.GetString("AccessKeyId");
@ -647,7 +649,8 @@ Aws::String SSOCredentialsProvider::loadAccessTokenFile(const Aws::String & sso_
return "";
}
Aws::Utils::Json::JsonView token_view(token_doc);
Aws::String tmp_access_token, expiration_str;
Aws::String tmp_access_token;
Aws::String expiration_str;
tmp_access_token = token_view.GetString("accessToken");
expiration_str = token_view.GetString("expiresAt");
Aws::Utils::DateTime expiration(expiration_str, Aws::Utils::DateFormat::ISO_8601);

View File

@ -53,8 +53,8 @@ inline char * writeVarUInt(UInt64 x, char * ostr)
return ostr;
}
template <typename Out>
inline void writeVarInt(Int64 x, Out & ostr)
template <typename OutBuf>
inline void writeVarInt(Int64 x, OutBuf & ostr)
{
writeVarUInt(static_cast<UInt64>((x << 1) ^ (x >> 63)), ostr);
}
@ -117,8 +117,8 @@ inline const char * readVarUInt(UInt64 & x, const char * istr, size_t size)
return istr;
}
template <typename In>
inline void readVarInt(Int64 & x, In & istr)
template <typename InBuf>
inline void readVarInt(Int64 & x, InBuf & istr)
{
readVarUInt(*reinterpret_cast<UInt64*>(&x), istr);
x = (static_cast<UInt64>(x) >> 1) ^ -(x & 1);

View File

@ -13,7 +13,8 @@ int readAndPrint(DB::ReadBuffer & in)
{
Int64 a;
Float64 b;
String c, d;
String c;
String d;
DB::readIntText(a, in);
in.ignore();

View File

@ -15,7 +15,8 @@ int main(int, char **)
Int64 a = 0;
Float64 b = 0;
String c, d;
String c;
String d;
size_t i = 0;
while (!in.eof())

View File

@ -400,7 +400,8 @@ namespace
/// Updates grants of a specified user or role.
void updateFromQuery(IAccessEntity & grantee, const ASTGrantQuery & query)
{
AccessRightsElements elements_to_grant, elements_to_revoke;
AccessRightsElements elements_to_grant;
AccessRightsElements elements_to_revoke;
collectAccessRightsElementsToGrantOrRevoke(query, elements_to_grant, elements_to_revoke);
std::vector<UUID> roles_to_grant;
@ -431,7 +432,8 @@ BlockIO InterpreterGrantQuery::execute()
std::vector<UUID> grantees = RolesOrUsersSet{*query.grantees, access_control, getContext()->getUserID()}.getMatchingIDs(access_control);
/// Collect access rights and roles we're going to grant or revoke.
AccessRightsElements elements_to_grant, elements_to_revoke;
AccessRightsElements elements_to_grant;
AccessRightsElements elements_to_revoke;
collectAccessRightsElementsToGrantOrRevoke(query, elements_to_grant, elements_to_revoke);
std::vector<UUID> roles_to_grant;

View File

@ -68,7 +68,8 @@ ASTs InterpreterShowAccessQuery::getCreateAndGrantQueries() const
auto entities = getEntities();
const auto & access_control = getContext()->getAccessControl();
ASTs create_queries, grant_queries;
ASTs create_queries;
ASTs grant_queries;
for (const auto & entity : entities)
{
create_queries.push_back(InterpreterShowCreateAccessEntityQuery::getCreateQuery(*entity, access_control));

View File

@ -1083,7 +1083,8 @@ void NO_INLINE Aggregator::executeImplBatch(
/// - and plus this will require other changes in the interface.
std::unique_ptr<AggregateDataPtr[]> places(new AggregateDataPtr[all_keys_are_const ? 1 : row_end]);
size_t key_start, key_end;
size_t key_start;
size_t key_end;
/// If all keys are const, key columns contain only 1 row.
if (all_keys_are_const)
{

View File

@ -1332,7 +1332,8 @@ void FileCache::loadMetadataForKeys(const fs::path & keys_dir)
user = getCommonUser();
}
UInt64 offset = 0, size = 0;
UInt64 offset = 0;
UInt64 size = 0;
for (; key_it != fs::directory_iterator(); key_it++)
{
const fs::path key_directory = key_it->path();

View File

@ -499,6 +499,8 @@ public:
KitchenSink & operator=(const KitchenSink & rhs)
{
if (&rhs == this)
return *this;
analyze_counter = rhs.analyze_counter.load();
return *this;
}

View File

@ -59,7 +59,8 @@ std::optional<HashTablesCacheStatistics> HashTablesStatistics::getCacheStats() c
std::lock_guard lock(mutex);
if (hash_table_stats)
{
size_t hits = 0, misses = 0;
size_t hits = 0;
size_t misses = 0;
hash_table_stats->getStats(hits, misses);
return DB::HashTablesCacheStatistics{.entries = hash_table_stats->count(), .hits = hits, .misses = misses};
}

View File

@ -145,7 +145,7 @@ void TraceCollector::run()
// time and time_in_microseconds are both being constructed from the same timespec so that the
// times will be equal up to the precision of a second.
struct timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
clock_gettime(CLOCK_REALTIME, &ts); /// NOLINT(cert-err33-c)
UInt64 time = static_cast<UInt64>(ts.tv_sec * 1000000000LL + ts.tv_nsec);
UInt64 time_in_microseconds = static_cast<UInt64>((ts.tv_sec * 1000000LL) + (ts.tv_nsec / 1000));

View File

@ -145,7 +145,8 @@ struct CrapWow
size_t len = x.size;
size_t seed = 0;
const UInt64 m = 0x95b47aa3355ba1a1, n = 0x8a970be7488fda55;
const UInt64 m = 0x95b47aa3355ba1a1;
const UInt64 n = 0x8a970be7488fda55;
UInt64 hash;
// 3 = m, 4 = n

View File

@ -174,7 +174,8 @@ struct CrapWow
size_t len = x.size;
size_t seed = 0;
const UInt64 m = 0x95b47aa3355ba1a1, n = 0x8a970be7488fda55;
const UInt64 m = 0x95b47aa3355ba1a1;
const UInt64 n = 0x8a970be7488fda55;
UInt64 hash;
// 3 = m, 4 = n
// r12 = h, r13 = k, ecx = seed, r12 = key

View File

@ -49,7 +49,7 @@ static std::string renderFileNameTemplate(time_t now, const std::string & file_p
{
fs::path path{file_path};
std::tm buf;
localtime_r(&now, &buf);
localtime_r(&now, &buf); /// NOLINT(cert-err33-c)
std::ostringstream ss; // STYLE_CHECK_ALLOW_STD_STRING_STREAM
ss << std::put_time(&buf, path.filename().c_str());
return path.replace_filename(ss.str());

View File

@ -78,7 +78,8 @@ void ASTLiteral::appendColumnNameImpl(WriteBuffer & ostr) const
{
SipHash hash;
applyVisitor(FieldVisitorHash(hash), value);
UInt64 low, high;
UInt64 low;
UInt64 high;
hash.get128(low, high);
writeCString(type == Field::Types::Array ? "__array_" : "__tuple_", ostr);
@ -114,7 +115,8 @@ void ASTLiteral::appendColumnNameImplLegacy(WriteBuffer & ostr) const
{
SipHash hash;
applyVisitor(FieldVisitorHash(hash), value);
UInt64 low, high;
UInt64 low;
UInt64 high;
hash.get128(low, high);
writeCString("__array_", ostr);

View File

@ -68,7 +68,8 @@ namespace
}
boost::container::flat_set<std::string_view> commands;
String filter, check;
String filter;
String check;
do
{

View File

@ -25,7 +25,8 @@ namespace
{
return IParserBase::wrapParseImpl(pos, [&]
{
String res_database, res_table_name;
String res_database;
String res_table_name;
bool wildcard = false;
bool default_database = false;
@ -78,7 +79,8 @@ namespace
auto parse_db_and_table_name = [&]
{
String database, table_name;
String database;
String table_name;
if (!parseDBAndTableName(pos, expected, database, table_name))
return false;
res.emplace_back(std::move(database), std::move(table_name));
@ -127,7 +129,8 @@ namespace
}
else
{
String database, table_name;
String database;
String table_name;
if (!parseOnDBAndTableName(pos, expected, database, table_name))
return false;
database_and_table_names.emplace_back(std::move(database), std::move(table_name));

View File

@ -73,7 +73,8 @@ bool ParserShowAccessEntitiesQuery::parseImpl(Pos & pos, ASTPtr & node, Expected
std::optional<std::pair<String, String>> database_and_table_name;
if (type == AccessEntityType::ROW_POLICY)
{
String database, table_name;
String database;
String table_name;
bool wildcard = false;
bool default_database = false;
if (parseOnDBAndTableName(pos, expected, database, table_name, wildcard, default_database))

View File

@ -107,7 +107,8 @@ bool ParserShowCreateAccessEntityQuery::parseImpl(Pos & pos, ASTPtr & node, Expe
case AccessEntityType::ROW_POLICY:
{
ASTPtr ast;
String database, table_name;
String database;
String table_name;
bool wildcard = false;
bool default_database = false;
if (ParserRowPolicyNames{}.parse(pos, ast, expected))

View File

@ -117,7 +117,9 @@ bool parseAccessRightsElementsWithoutOptions(IParser::Pos & pos, Expected & expe
if (!parseAccessFlagsWithColumns(pos, expected, access_and_columns))
return false;
String database_name, table_name, parameter;
String database_name;
String table_name;
String parameter;
size_t is_global_with_parameter = 0;
for (const auto & elem : access_and_columns)

View File

@ -2592,7 +2592,8 @@ Action ParserExpressionImpl::tryParseOperand(Layers & layers, IParser::Pos & pos
if (subquery_function_type != SubqueryFunctionType::NONE)
{
Operator prev_op;
ASTPtr function, argument;
ASTPtr function;
ASTPtr argument;
if (!layers.back()->popOperator(prev_op))
return Action::NONE;

View File

@ -10,6 +10,7 @@ namespace ErrorCodes
}
/// NOLINTBEGIN(cert-oop54-cpp)
IParser::Pos & IParser::Pos::operator=(const IParser::Pos & rhs)
{
depth = rhs.depth;
@ -29,6 +30,7 @@ IParser::Pos & IParser::Pos::operator=(const IParser::Pos & rhs)
return *this;
}
/// NOLINTEND(cert-oop54-cpp)
template <typename T>

Some files were not shown because too many files have changed in this diff Show More