mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 16:42:05 +00:00
Fix new clang-tidy-s
This commit is contained in:
parent
cbcff6ef08
commit
50c51c2854
@ -108,6 +108,7 @@ Checks: '*,
|
||||
-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 slooow
|
||||
|
@ -177,7 +177,7 @@ inline bool memequalWide(const char * p1, const char * p2, size_t size)
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (size / 16)
|
||||
switch (size / 16) // NOLINT(bugprone-switch-missing-default-case)
|
||||
{
|
||||
case 3: if (!compare8(p1 + 32, p2 + 32)) return false; [[fallthrough]];
|
||||
case 2: if (!compare8(p1 + 16, p2 + 16)) return false; [[fallthrough]];
|
||||
|
@ -185,6 +185,6 @@
|
||||
|
||||
/// A template function for suppressing warnings about unused variables or function results.
|
||||
template <typename... Args>
|
||||
constexpr void UNUSED(Args &&... args [[maybe_unused]])
|
||||
constexpr void UNUSED(Args &&... args [[maybe_unused]]) // NOLINT(cppcoreguidelines-missing-std-forward)
|
||||
{
|
||||
}
|
||||
|
@ -20,14 +20,14 @@ Out & dumpValue(Out &, T &&);
|
||||
|
||||
/// Catch-all case.
|
||||
template <int priority, typename Out, typename T>
|
||||
std::enable_if_t<priority == -1, Out> & dumpImpl(Out & out, T &&)
|
||||
std::enable_if_t<priority == -1, Out> & dumpImpl(Out & out, T &&) // NOLINT(cppcoreguidelines-missing-std-forward)
|
||||
{
|
||||
return out << "{...}";
|
||||
}
|
||||
|
||||
/// An object, that could be output with operator <<.
|
||||
template <int priority, typename Out, typename T>
|
||||
std::enable_if_t<priority == 0, Out> & dumpImpl(Out & out, T && x, std::decay_t<decltype(std::declval<Out &>() << std::declval<T>())> * = nullptr)
|
||||
std::enable_if_t<priority == 0, Out> & dumpImpl(Out & out, T && x, std::decay_t<decltype(std::declval<Out &>() << std::declval<T>())> * = nullptr) // NOLINT(cppcoreguidelines-missing-std-forward)
|
||||
{
|
||||
return out << x;
|
||||
}
|
||||
@ -37,7 +37,7 @@ template <int priority, typename Out, typename T>
|
||||
std::enable_if_t<priority == 1
|
||||
/// Protect from the case when operator * do effectively nothing (function pointer).
|
||||
&& !std::is_same_v<std::decay_t<T>, std::decay_t<decltype(*std::declval<T>())>>
|
||||
, Out> & dumpImpl(Out & out, T && x, std::decay_t<decltype(*std::declval<T>())> * = nullptr)
|
||||
, Out> & dumpImpl(Out & out, T && x, std::decay_t<decltype(*std::declval<T>())> * = nullptr) // NOLINT(cppcoreguidelines-missing-std-forward)
|
||||
{
|
||||
if (!x)
|
||||
return out << "nullptr";
|
||||
@ -46,7 +46,7 @@ std::enable_if_t<priority == 1
|
||||
|
||||
/// Container.
|
||||
template <int priority, typename Out, typename T>
|
||||
std::enable_if_t<priority == 2, Out> & dumpImpl(Out & out, T && x, std::decay_t<decltype(std::begin(std::declval<T>()))> * = nullptr)
|
||||
std::enable_if_t<priority == 2, Out> & dumpImpl(Out & out, T && x, std::decay_t<decltype(std::begin(std::declval<T>()))> * = nullptr) // NOLINT(cppcoreguidelines-missing-std-forward)
|
||||
{
|
||||
bool first = true;
|
||||
out << "{";
|
||||
@ -64,7 +64,7 @@ std::enable_if_t<priority == 2, Out> & dumpImpl(Out & out, T && x, std::decay_t<
|
||||
|
||||
template <int priority, typename Out, typename T>
|
||||
std::enable_if_t<priority == 3 && std::is_enum_v<std::decay_t<T>>, Out> &
|
||||
dumpImpl(Out & out, T && x)
|
||||
dumpImpl(Out & out, T && x) // NOLINT(cppcoreguidelines-missing-std-forward)
|
||||
{
|
||||
return out << magic_enum::enum_name(x);
|
||||
}
|
||||
@ -73,7 +73,7 @@ dumpImpl(Out & out, T && x)
|
||||
|
||||
template <int priority, typename Out, typename T>
|
||||
std::enable_if_t<priority == 3 && (std::is_same_v<std::decay_t<T>, std::string> || std::is_same_v<std::decay_t<T>, const char *>), Out> &
|
||||
dumpImpl(Out & out, T && x)
|
||||
dumpImpl(Out & out, T && x) // NOLINT(cppcoreguidelines-missing-std-forward)
|
||||
{
|
||||
return out << std::quoted(x);
|
||||
}
|
||||
@ -82,7 +82,7 @@ dumpImpl(Out & out, T && x)
|
||||
|
||||
template <int priority, typename Out, typename T>
|
||||
std::enable_if_t<priority == 3 && std::is_same_v<std::decay_t<T>, unsigned char>, Out> &
|
||||
dumpImpl(Out & out, T && x)
|
||||
dumpImpl(Out & out, T && x) // NOLINT(cppcoreguidelines-missing-std-forward)
|
||||
{
|
||||
return out << int(x);
|
||||
}
|
||||
@ -90,7 +90,7 @@ dumpImpl(Out & out, T && x)
|
||||
|
||||
/// Tuple, pair
|
||||
template <size_t N, typename Out, typename T>
|
||||
Out & dumpTupleImpl(Out & out, T && x)
|
||||
Out & dumpTupleImpl(Out & out, T && x) // NOLINT(cppcoreguidelines-missing-std-forward)
|
||||
{
|
||||
if constexpr (N == 0)
|
||||
out << "{";
|
||||
@ -108,14 +108,14 @@ Out & dumpTupleImpl(Out & out, T && x)
|
||||
}
|
||||
|
||||
template <int priority, typename Out, typename T>
|
||||
std::enable_if_t<priority == 4, Out> & dumpImpl(Out & out, T && x, std::decay_t<decltype(std::get<0>(std::declval<T>()))> * = nullptr)
|
||||
std::enable_if_t<priority == 4, Out> & dumpImpl(Out & out, T && x, std::decay_t<decltype(std::get<0>(std::declval<T>()))> * = nullptr) // NOLINT(cppcoreguidelines-missing-std-forward)
|
||||
{
|
||||
return dumpTupleImpl<0>(out, x);
|
||||
}
|
||||
|
||||
|
||||
template <int priority, typename Out, typename T>
|
||||
Out & dumpDispatchPriorities(Out & out, T && x, std::decay_t<decltype(dumpImpl<priority>(std::declval<Out &>(), std::declval<T>()))> *)
|
||||
Out & dumpDispatchPriorities(Out & out, T && x, std::decay_t<decltype(dumpImpl<priority>(std::declval<Out &>(), std::declval<T>()))> *) // NOLINT(cppcoreguidelines-missing-std-forward)
|
||||
{
|
||||
return dumpImpl<priority>(out, x);
|
||||
}
|
||||
@ -124,21 +124,21 @@ Out & dumpDispatchPriorities(Out & out, T && x, std::decay_t<decltype(dumpImpl<p
|
||||
struct LowPriority { LowPriority(void *) {} };
|
||||
|
||||
template <int priority, typename Out, typename T>
|
||||
Out & dumpDispatchPriorities(Out & out, T && x, LowPriority)
|
||||
Out & dumpDispatchPriorities(Out & out, T && x, LowPriority) // NOLINT(cppcoreguidelines-missing-std-forward)
|
||||
{
|
||||
return dumpDispatchPriorities<priority - 1>(out, x, nullptr);
|
||||
}
|
||||
|
||||
|
||||
template <typename Out, typename T>
|
||||
Out & dumpValue(Out & out, T && x)
|
||||
Out & dumpValue(Out & out, T && x) // NOLINT(cppcoreguidelines-missing-std-forward)
|
||||
{
|
||||
return dumpDispatchPriorities<5>(out, x, nullptr);
|
||||
}
|
||||
|
||||
|
||||
template <typename Out, typename T>
|
||||
Out & dump(Out & out, const char * name, T && x)
|
||||
Out & dump(Out & out, const char * name, T && x) // NOLINT(cppcoreguidelines-missing-std-forward)
|
||||
{
|
||||
// Dumping string literal, printing name and demangled type is irrelevant.
|
||||
if constexpr (std::is_same_v<const char *, std::decay_t<std::remove_reference_t<T>>>)
|
||||
|
@ -9,9 +9,9 @@ class [[nodiscard]] BasicScopeGuard
|
||||
{
|
||||
public:
|
||||
constexpr BasicScopeGuard() = default;
|
||||
constexpr BasicScopeGuard(BasicScopeGuard && src) : function{src.release()} {} // NOLINT(hicpp-noexcept-move, performance-noexcept-move-constructor)
|
||||
constexpr BasicScopeGuard(BasicScopeGuard && src) : function{src.release()} {} // NOLINT(hicpp-noexcept-move, performance-noexcept-move-constructor, cppcoreguidelines-noexcept-move-operations)
|
||||
|
||||
constexpr BasicScopeGuard & operator=(BasicScopeGuard && src) // NOLINT(hicpp-noexcept-move, performance-noexcept-move-constructor)
|
||||
constexpr BasicScopeGuard & operator=(BasicScopeGuard && src) // NOLINT(hicpp-noexcept-move, performance-noexcept-move-constructor, cppcoreguidelines-noexcept-move-operations)
|
||||
{
|
||||
if (this != &src)
|
||||
{
|
||||
@ -23,11 +23,11 @@ public:
|
||||
|
||||
template <typename G>
|
||||
requires std::is_convertible_v<G, F>
|
||||
constexpr BasicScopeGuard(BasicScopeGuard<G> && src) : function{src.release()} {} // NOLINT(google-explicit-constructor)
|
||||
constexpr BasicScopeGuard(BasicScopeGuard<G> && src) : function{src.release()} {} // NOLINT(google-explicit-constructor, cppcoreguidelines-rvalue-reference-param-not-moved, cppcoreguidelines-noexcept-move-operations)
|
||||
|
||||
template <typename G>
|
||||
requires std::is_convertible_v<G, F>
|
||||
constexpr BasicScopeGuard & operator=(BasicScopeGuard<G> && src)
|
||||
constexpr BasicScopeGuard & operator=(BasicScopeGuard<G> && src) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved, cppcoreguidelines-noexcept-move-operations)
|
||||
{
|
||||
if (this != &src)
|
||||
{
|
||||
@ -43,7 +43,7 @@ public:
|
||||
|
||||
template <typename G>
|
||||
requires std::is_convertible_v<G, F>
|
||||
constexpr BasicScopeGuard(G && function_) : function{std::move(function_)} {} // NOLINT(google-explicit-constructor, bugprone-forwarding-reference-overload, bugprone-move-forwarding-reference)
|
||||
constexpr BasicScopeGuard(G && function_) : function{std::move(function_)} {} // NOLINT(google-explicit-constructor, bugprone-forwarding-reference-overload, bugprone-move-forwarding-reference, cppcoreguidelines-missing-std-forward)
|
||||
|
||||
~BasicScopeGuard() { invoke(); }
|
||||
|
||||
@ -70,7 +70,7 @@ public:
|
||||
|
||||
template <typename G>
|
||||
requires std::is_convertible_v<G, F>
|
||||
BasicScopeGuard<F> & join(BasicScopeGuard<G> && other)
|
||||
BasicScopeGuard<F> & join(BasicScopeGuard<G> && other) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
if (other.function)
|
||||
{
|
||||
|
@ -23,10 +23,10 @@ public:
|
||||
constexpr StrongTypedef(): t() {}
|
||||
|
||||
constexpr StrongTypedef(const Self &) = default;
|
||||
constexpr StrongTypedef(Self &&) noexcept(std::is_nothrow_move_constructible_v<T>) = default;
|
||||
constexpr StrongTypedef(Self &&) noexcept(std::is_nothrow_move_constructible_v<T>) = default; // NOLINT(cppcoreguidelines-noexcept-move-operations, hicpp-noexcept-move, performance-noexcept-move-constructor)
|
||||
|
||||
Self & operator=(const Self &) = default;
|
||||
Self & operator=(Self &&) noexcept(std::is_nothrow_move_assignable_v<T>)= default;
|
||||
Self & operator=(Self &&) noexcept(std::is_nothrow_move_assignable_v<T>)= default; // NOLINT(cppcoreguidelines-noexcept-move-operations, hicpp-noexcept-move, performance-noexcept-move-constructor)
|
||||
|
||||
template <class Enable = typename std::is_copy_assignable<T>::type>
|
||||
Self & operator=(const T & rhs) { t = rhs; return *this;}
|
||||
|
@ -115,7 +115,7 @@ replxx::Replxx::completions_t LineReader::Suggest::getCompletions(const String &
|
||||
return replxx::Replxx::completions_t(range.first, range.second);
|
||||
}
|
||||
|
||||
void LineReader::Suggest::addWords(Words && new_words)
|
||||
void LineReader::Suggest::addWords(Words && new_words) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
Words new_words_no_case = new_words;
|
||||
if (!new_words.empty())
|
||||
|
@ -800,7 +800,7 @@ Dwarf::CompilationUnit Dwarf::getCompilationUnit(uint64_t offset) const
|
||||
die,
|
||||
[&](const Attribute & attr)
|
||||
{
|
||||
switch (attr.spec.name)
|
||||
switch (attr.spec.name) // NOLINT(bugprone-switch-missing-default-case)
|
||||
{
|
||||
case DW_AT_addr_base:
|
||||
case DW_AT_GNU_addr_base:
|
||||
@ -996,7 +996,7 @@ bool Dwarf::findLocation(
|
||||
|
||||
forEachAttribute(cu, die, [&](const Attribute & attr)
|
||||
{
|
||||
switch (attr.spec.name)
|
||||
switch (attr.spec.name) // NOLINT(bugprone-switch-missing-default-case)
|
||||
{
|
||||
case DW_AT_stmt_list:
|
||||
// Offset in .debug_line for the line number VM program for this
|
||||
@ -1143,7 +1143,7 @@ void Dwarf::findSubProgramDieForAddress(const CompilationUnit & cu,
|
||||
std::optional<uint64_t> range_offset;
|
||||
forEachAttribute(cu, child_die, [&](const Attribute & attr)
|
||||
{
|
||||
switch (attr.spec.name)
|
||||
switch (attr.spec.name) // NOLINT(bugprone-switch-missing-default-case)
|
||||
{
|
||||
case DW_AT_ranges:
|
||||
range_offset = std::get<uint64_t>(attr.attr_value);
|
||||
@ -1234,7 +1234,7 @@ void Dwarf::findInlinedSubroutineDieForAddress(
|
||||
std::optional<uint64_t> range_offset;
|
||||
forEachAttribute(cu, child_die, [&](const Attribute & attr)
|
||||
{
|
||||
switch (attr.spec.name)
|
||||
switch (attr.spec.name) // NOLINT(bugprone-switch-missing-default-case)
|
||||
{
|
||||
case DW_AT_ranges:
|
||||
range_offset = std::get<uint64_t>(attr.attr_value);
|
||||
@ -1349,7 +1349,7 @@ void Dwarf::findInlinedSubroutineDieForAddress(
|
||||
// its DW_AT_call_file and DW_AT_call_line.
|
||||
forEachAttribute(srcu, die_to_look_for_name, [&](const Attribute & attr)
|
||||
{
|
||||
switch (attr.spec.name)
|
||||
switch (attr.spec.name) // NOLINT(bugprone-switch-missing-default-case)
|
||||
{
|
||||
case DW_AT_linkage_name:
|
||||
name = std::get<std::string_view>(attr.attr_value);
|
||||
@ -1910,7 +1910,7 @@ Dwarf::LineNumberVM::FileName Dwarf::LineNumberVM::getFileName(uint64_t index) c
|
||||
auto attr = readLineNumberAttribute(is64Bit_, format, file_names, debugStr_, debugLineStr_);
|
||||
if (i == index)
|
||||
{
|
||||
switch (attr.content_type_code)
|
||||
switch (attr.content_type_code) // NOLINT(bugprone-switch-missing-default-case)
|
||||
{
|
||||
case DW_LNCT_path:
|
||||
fn.relativeName = std::get<std::string_view>(attr.attr_value);
|
||||
@ -2055,7 +2055,7 @@ Dwarf::LineNumberVM::StepResult Dwarf::LineNumberVM::step(std::string_view & pro
|
||||
{ // standard opcode
|
||||
// Only interpret opcodes that are recognized by the version we're parsing;
|
||||
// the others are vendor extensions and we should ignore them.
|
||||
switch (opcode)
|
||||
switch (opcode) // NOLINT(bugprone-switch-missing-default-case)
|
||||
{
|
||||
case DW_LNS_copy:
|
||||
basicBlock_ = false;
|
||||
@ -2127,7 +2127,7 @@ Dwarf::LineNumberVM::StepResult Dwarf::LineNumberVM::step(std::string_view & pro
|
||||
auto extended_opcode = read<uint8_t>(program);
|
||||
--length;
|
||||
|
||||
switch (extended_opcode)
|
||||
switch (extended_opcode) // NOLINT(bugprone-switch-missing-default-case)
|
||||
{
|
||||
case DW_LNE_end_sequence:
|
||||
return END;
|
||||
|
@ -126,7 +126,7 @@ struct FastHash64
|
||||
pos2 = reinterpret_cast<const unsigned char*>(pos);
|
||||
v = 0;
|
||||
|
||||
switch (len & 7)
|
||||
switch (len & 7) // NOLINT(bugprone-switch-missing-default-case)
|
||||
{
|
||||
case 7: v ^= static_cast<uint64_t>(pos2[6]) << 48; [[fallthrough]];
|
||||
case 6: v ^= static_cast<uint64_t>(pos2[5]) << 40; [[fallthrough]];
|
||||
|
@ -174,7 +174,7 @@ int compress(int in_fd, int out_fd, int level, off_t & pointer, const struct sta
|
||||
return 1;
|
||||
}
|
||||
pointer += current_block_size;
|
||||
printf("...block compression rate: %.2f%%\n", static_cast<float>(current_block_size) / size * 100);
|
||||
printf("...block compression rate: %.2f%%\n", static_cast<float>(current_block_size) / size * 100); // NOLINT(modernize-use-std-print)
|
||||
total_size += size;
|
||||
compressed_size += current_block_size;
|
||||
current_block_size = 0;
|
||||
@ -266,7 +266,7 @@ int compressFiles(const char* out_name, const char* exec, char* filenames[], int
|
||||
else
|
||||
filename = filenames[i];
|
||||
|
||||
printf("Compressing: %s\n", filename);
|
||||
printf("Compressing: %s\n", filename); // NOLINT(modernize-use-std-print)
|
||||
|
||||
int input_fd = open(filename, O_RDONLY);
|
||||
if (input_fd == -1)
|
||||
@ -302,7 +302,7 @@ int compressFiles(const char* out_name, const char* exec, char* filenames[], int
|
||||
|
||||
if (info_in.st_size == 0)
|
||||
{
|
||||
printf("...empty file, skipped.\n");
|
||||
printf("...empty file, skipped.\n"); // NOLINT(modernize-use-std-print)
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -597,14 +597,14 @@ int main(int argc, char* argv[])
|
||||
std::cout << "Compression with level: " << level << std::endl;
|
||||
if (0 != compressFiles(out_name, exec, &argv[start_of_files], argc - start_of_files, output_fd, level, info_out))
|
||||
{
|
||||
printf("Compression failed.\n");
|
||||
printf("Compression failed.\n"); // NOLING(modernize-use-std-print)
|
||||
if (0 != close(output_fd))
|
||||
perror("close");
|
||||
unlink(argv[start_of_files - 1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("Successfully compressed.\n");
|
||||
printf("Successfully compressed.\n"); // NOLINT(modernize-use-std-print)
|
||||
|
||||
if (0 != close(output_fd))
|
||||
perror("close");
|
||||
|
@ -478,7 +478,7 @@ int main(int/* argc*/, char* argv[])
|
||||
if (lock_info.st_size == 1)
|
||||
execv(self, argv);
|
||||
|
||||
printf("No target executable - decompression only was performed.\n");
|
||||
printf("No target executable - decompression only was performed.\n"); // NOLINT(modernize-use-std-print)
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@ -498,7 +498,7 @@ int main(int/* argc*/, char* argv[])
|
||||
/// Decompress all files
|
||||
if (0 != decompressFiles(input_fd, path, name, have_compressed_analoge, has_exec, decompressed_suffix, &decompressed_umask))
|
||||
{
|
||||
printf("Error happened during decompression.\n");
|
||||
printf("Error happened during decompression.\n"); // NOLINT(modernize-use-std-print)
|
||||
if (0 != close(input_fd))
|
||||
perror("close");
|
||||
return 1;
|
||||
@ -514,7 +514,7 @@ int main(int/* argc*/, char* argv[])
|
||||
}
|
||||
|
||||
if (!have_compressed_analoge)
|
||||
printf("No target executable - decompression only was performed.\n");
|
||||
printf("No target executable - decompression only was performed.\n"); // NOLINT(modernize-use-std-print)
|
||||
else
|
||||
{
|
||||
const char * const decompressed_name_fmt = "%s.decompressed.%s";
|
||||
@ -563,6 +563,6 @@ int main(int/* argc*/, char* argv[])
|
||||
ftruncate(lock, 0);
|
||||
#endif
|
||||
|
||||
printf("No target executable - decompression only was performed.\n");
|
||||
printf("No target executable - decompression only was performed.\n"); // NOLINT(modernize-use-std-print)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user