update fmtlib version to 9.1.0

Signed-off-by: Duc Canh Le <duccanh.le@ahrefs.com>
This commit is contained in:
Duc Canh Le 2024-06-07 06:44:36 +00:00
parent 3f58fcb26b
commit de5258128e
27 changed files with 41 additions and 37 deletions

View File

@ -32,7 +32,7 @@ constexpr void static_for(F && f)
template <is_enum T>
struct fmt::formatter<T> : fmt::formatter<std::string_view>
{
constexpr auto format(T value, auto& format_context)
constexpr auto format(T value, auto& format_context) const
{
return formatter<string_view>::format(magic_enum::enum_name(value), format_context);
}

View File

@ -62,7 +62,7 @@ struct fmt::formatter<wide::integer<Bits, Signed>>
}
template <typename FormatContext>
auto format(const wide::integer<Bits, Signed> & value, FormatContext & ctx)
auto format(const wide::integer<Bits, Signed> & value, FormatContext & ctx) const
{
return fmt::format_to(ctx.out(), "{}", to_string(value));
}

2
contrib/fmtlib vendored

@ -1 +1 @@
Subproject commit b6f4ceaed0a0a24ccf575fab6c56dd50ccf6f1a9
Subproject commit a33701196adfad74917046096bf5a2aa0ab0bb50

View File

@ -13,7 +13,6 @@ set (SRCS
${FMT_SOURCE_DIR}/include/fmt/core.h
${FMT_SOURCE_DIR}/include/fmt/format.h
${FMT_SOURCE_DIR}/include/fmt/format-inl.h
${FMT_SOURCE_DIR}/include/fmt/locale.h
${FMT_SOURCE_DIR}/include/fmt/os.h
${FMT_SOURCE_DIR}/include/fmt/ostream.h
${FMT_SOURCE_DIR}/include/fmt/printf.h

View File

@ -406,7 +406,7 @@ struct fmt::formatter<DB::Identifier>
}
template <typename FormatContext>
auto format(const DB::Identifier & identifier, FormatContext & ctx)
auto format(const DB::Identifier & identifier, FormatContext & ctx) const
{
return fmt::format_to(ctx.out(), "{}", identifier.getFullName());
}
@ -428,7 +428,7 @@ struct fmt::formatter<DB::IdentifierView>
}
template <typename FormatContext>
auto format(const DB::IdentifierView & identifier_view, FormatContext & ctx)
auto format(const DB::IdentifierView & identifier_view, FormatContext & ctx) const
{
return fmt::format_to(ctx.out(), "{}", identifier_view.getFullName());
}

View File

@ -112,7 +112,7 @@ struct fmt::formatter<DB::TestHint::ErrorVector>
}
template <typename FormatContext>
auto format(const DB::TestHint::ErrorVector & ErrorVector, FormatContext & ctx)
auto format(const DB::TestHint::ErrorVector & ErrorVector, FormatContext & ctx) const
{
if (ErrorVector.empty())
return fmt::format_to(ctx.out(), "{}", 0);

View File

@ -108,7 +108,7 @@ struct fmt::formatter<DB::TransactionID>
}
template<typename FormatContext>
auto format(const DB::TransactionID & tid, FormatContext & context)
auto format(const DB::TransactionID & tid, FormatContext & context) const
{
return fmt::format_to(context.out(), "({}, {}, {})", tid.start_csn, tid.local_tid, tid.host_id);
}

View File

@ -647,7 +647,7 @@ public:
template <> struct fmt::formatter<Coordination::Error> : fmt::formatter<std::string_view>
{
constexpr auto format(Coordination::Error code, auto & ctx)
constexpr auto format(Coordination::Error code, auto & ctx) const
{
return formatter<string_view>::format(Coordination::errorMessage(code), ctx);
}

View File

@ -1,4 +1,6 @@
#include "filesystemHelpers.h"
#include <bits/types/struct_timeval.h>
#include <sys/select.h>
#if defined(OS_LINUX)
# include <mntent.h>
@ -11,7 +13,7 @@
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <utime.h>
#include <sys/time.h>
#include <IO/ReadBufferFromFile.h>
#include <IO/Operators.h>
#include <IO/WriteBufferFromString.h>
@ -369,10 +371,11 @@ Poco::Timestamp getModificationTimestamp(const std::string & path)
void setModificationTime(const std::string & path, time_t time)
{
struct utimbuf tb;
tb.actime = time;
tb.modtime = time;
if (utime(path.c_str(), &tb) != 0)
struct timeval times[2];
times[0].tv_usec = times[1].tv_usec = 0;
times[0].tv_sec = ::time(nullptr);
times[1].tv_sec = time;
if (utimes(path.c_str(), times) != 0)
DB::ErrnoException::throwFromPath(DB::ErrorCodes::PATH_ACCESS_DENIED, path, "Cannot set modification time to file: {}", path);
}

View File

@ -49,7 +49,7 @@ struct fmt::formatter<ReadableSize>
}
template <typename FormatContext>
auto format(const ReadableSize & size, FormatContext & ctx)
auto format(const ReadableSize & size, FormatContext & ctx) const
{
return fmt::format_to(ctx.out(), "{}", formatReadableSizeWithBinarySuffix(size.value));
}

View File

@ -466,7 +466,7 @@ void KeeperStorageSnapshot::deserialize(SnapshotDeserializationResult & deserial
#ifdef NDEBUG
/// TODO (alesapin) remove this, it should be always CORRUPTED_DATA.
LOG_ERROR(getLogger("KeeperSnapshotManager"), "Children counter in stat.numChildren {}"
" is different from actual children size {} for node {}", itr.value.numChildren(), itr.value.getChildren().size(), itr.key);
" is different from actual children size {} for node {}", itr.value.numChildren(), itr.value.getChildren().size(), itr.key.toView());
#else
throw Exception(ErrorCodes::LOGICAL_ERROR, "Children counter in stat.numChildren {}"
" is different from actual children size {} for node {}",

View File

@ -57,7 +57,7 @@ using ClusterUpdateActions = std::vector<ClusterUpdateAction>;
template <>
struct fmt::formatter<DB::RaftServerConfig> : fmt::formatter<string_view>
{
constexpr auto format(const DB::RaftServerConfig & server, format_context & ctx)
constexpr auto format(const DB::RaftServerConfig & server, format_context & ctx) const
{
return fmt::format_to(
ctx.out(), "server.{}={};{};{}", server.id, server.endpoint, server.learner ? "learner" : "participant", server.priority);
@ -67,7 +67,7 @@ struct fmt::formatter<DB::RaftServerConfig> : fmt::formatter<string_view>
template <>
struct fmt::formatter<DB::ClusterUpdateAction> : fmt::formatter<string_view>
{
constexpr auto format(const DB::ClusterUpdateAction & action, format_context & ctx)
constexpr auto format(const DB::ClusterUpdateAction & action, format_context & ctx) const
{
if (const auto * add = std::get_if<DB::AddRaftServer>(&action))
return fmt::format_to(ctx.out(), "(Add server {})", add->id);

View File

@ -1038,7 +1038,7 @@ struct fmt::formatter<DB::Field>
}
template <typename FormatContext>
auto format(const DB::Field & x, FormatContext & ctx)
auto format(const DB::Field & x, FormatContext & ctx) const
{
return fmt::format_to(ctx.out(), "{}", toString(x));
}

View File

@ -125,7 +125,7 @@ namespace fmt
}
template <typename FormatContext>
auto format(const DB::QualifiedTableName & name, FormatContext & ctx)
auto format(const DB::QualifiedTableName & name, FormatContext & ctx) const
{
return fmt::format_to(ctx.out(), "{}.{}", DB::backQuoteIfNeed(name.database), DB::backQuoteIfNeed(name.table));
}

View File

@ -623,7 +623,7 @@ struct fmt::formatter<DB::DataTypePtr>
}
template <typename FormatContext>
auto format(const DB::DataTypePtr & type, FormatContext & ctx)
auto format(const DB::DataTypePtr & type, FormatContext & ctx) const
{
return fmt::format_to(ctx.out(), "{}", type->getName());
}

View File

@ -159,7 +159,7 @@ struct ByteJaccardIndexImpl
}
else
{
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Illegal UTF-8 sequence, while processing '{}'", StringRef(haystack, haystack_end - haystack));
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Illegal UTF-8 sequence, while processing '{}'", std::string_view(haystack, haystack_end - haystack));
}
}
}
@ -186,7 +186,7 @@ struct ByteJaccardIndexImpl
}
else
{
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Illegal UTF-8 sequence, while processing '{}'", StringRef(needle, needle_end - needle));
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Illegal UTF-8 sequence, while processing '{}'", std::string_view(needle, needle_end - needle));
}
}
}

View File

@ -1420,7 +1420,7 @@ struct fmt::formatter<DB::UUID>
}
template<typename FormatContext>
auto format(const DB::UUID & uuid, FormatContext & context)
auto format(const DB::UUID & uuid, FormatContext & context) const
{
return fmt::format_to(context.out(), "{}", toString(uuid));
}

View File

@ -136,7 +136,7 @@ namespace fmt
}
template <typename FormatContext>
auto format(const DB::StorageID & storage_id, FormatContext & ctx)
auto format(const DB::StorageID & storage_id, FormatContext & ctx) const
{
return fmt::format_to(ctx.out(), "{}", storage_id.getNameForLogs());
}

View File

@ -40,7 +40,7 @@ struct fmt::formatter<DB::ASTPtr>
}
template<typename FormatContext>
auto format(const DB::ASTPtr & ast, FormatContext & context)
auto format(const DB::ASTPtr & ast, FormatContext & context) const
{
return fmt::format_to(context.out(), "{}", DB::serializeAST(*ast));
}

View File

@ -421,7 +421,7 @@ void BSONEachRowRowInputFormat::readTuple(IColumn & column, const DataTypePtr &
"Cannot parse tuple column with type {} from BSON array/embedded document field: "
"tuple doesn't have element with name \"{}\"",
data_type->getName(),
name);
name.toView());
index = *try_get_index;
}
@ -806,7 +806,7 @@ bool BSONEachRowRowInputFormat::readRow(MutableColumns & columns, RowReadExtensi
else
{
if (seen_columns[index])
throw Exception(ErrorCodes::INCORRECT_DATA, "Duplicate field found while parsing BSONEachRow format: {}", name);
throw Exception(ErrorCodes::INCORRECT_DATA, "Duplicate field found while parsing BSONEachRow format: {}", name.toView());
seen_columns[index] = true;
read_columns[index] = readField(*columns[index], types[index], BSONType(type));

View File

@ -37,7 +37,7 @@ struct fmt::formatter<DB::RowNumber>
}
template <typename FormatContext>
auto format(const DB::RowNumber & x, FormatContext & ctx)
auto format(const DB::RowNumber & x, FormatContext & ctx) const
{
return fmt::format_to(ctx.out(), "{}:{}", x.block, x.row);
}

View File

@ -1,7 +1,4 @@
// Needs to go first because its partial specialization of fmt::formatter
// should be defined before any instantiation
#include <fmt/ostream.h>
#include <fmt/ranges.h>
#include <Storages/Kafka/KafkaConsumer.h>
#include <IO/ReadBufferFromMemory.h>

View File

@ -1,5 +1,7 @@
#pragma once
#include <cppkafka/topic_partition.h>
#include <fmt/ostream.h>
#include <boost/circular_buffer.hpp>
#include <Core/Names.h>
@ -197,3 +199,6 @@ private:
};
}
template <> struct fmt::formatter<cppkafka::TopicPartition> : fmt::ostream_formatter {};
template <> struct fmt::formatter<cppkafka::Error> : fmt::ostream_formatter {};

View File

@ -69,7 +69,7 @@ struct fmt::formatter<DB::MarkRange>
}
template <typename FormatContext>
auto format(const DB::MarkRange & range, FormatContext & ctx)
auto format(const DB::MarkRange & range, FormatContext & ctx) const
{
return fmt::format_to(ctx.out(), "{}", fmt::format("({}, {})", range.begin, range.end));
}

View File

@ -112,7 +112,7 @@ struct fmt::formatter<DB::Part>
static constexpr auto parse(format_parse_context & ctx) { return ctx.begin(); }
template <typename FormatContext>
auto format(const DB::Part & part, FormatContext & ctx)
auto format(const DB::Part & part, FormatContext & ctx) const
{
return fmt::format_to(ctx.out(), "{} in replicas [{}]", part.description.describe(), fmt::join(part.replicas, ", "));
}

View File

@ -13,7 +13,7 @@ struct fmt::formatter<DB::RangesInDataPartDescription>
static constexpr auto parse(format_parse_context & ctx) { return ctx.begin(); }
template <typename FormatContext>
auto format(const DB::RangesInDataPartDescription & range, FormatContext & ctx)
auto format(const DB::RangesInDataPartDescription & range, FormatContext & ctx) const
{
return fmt::format_to(ctx.out(), "{}", range.describe());
}

View File

@ -158,7 +158,7 @@ struct fmt::formatter<DB::NamedCollectionValidateKey<T>>
}
template <typename FormatContext>
auto format(const DB::NamedCollectionValidateKey<T> & elem, FormatContext & context)
auto format(const DB::NamedCollectionValidateKey<T> & elem, FormatContext & context) const
{
return fmt::format_to(context.out(), "{}", elem.value);
}