aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp
diff options
context:
space:
mode:
authorarkady-e1ppa <arkady-e1ppa@yandex-team.com>2024-06-11 09:52:09 +0300
committerarkady-e1ppa <arkady-e1ppa@yandex-team.com>2024-06-11 10:05:50 +0300
commit72cd1bd2a9b1c94a08343c8a8e21e6af4037ce28 (patch)
treea327f31aee0c020cbdac95eb19a78555a31f47a9 /library/cpp
parent37a673eee6d2ecdddf279adaf94970cdf2e25b6c (diff)
downloadydb-72cd1bd2a9b1c94a08343c8a8e21e6af4037ce28.tar.gz
More cosmetic issues
810902d6e6c3104880e1ab3b34d29a8aa4bec21b
Diffstat (limited to 'library/cpp')
-rw-r--r--library/cpp/yt/logging/logger.h2
-rw-r--r--library/cpp/yt/logging/static_analysis-inl.h28
-rw-r--r--library/cpp/yt/logging/static_analysis.h2
-rw-r--r--library/cpp/yt/logging/unittests/static_analysis_ut.cpp4
-rw-r--r--library/cpp/yt/string/format-inl.h38
-rw-r--r--library/cpp/yt/string/format.h20
-rw-r--r--library/cpp/yt/string/format_analyser-inl.h12
-rw-r--r--library/cpp/yt/string/format_arg.h8
8 files changed, 57 insertions, 57 deletions
diff --git a/library/cpp/yt/logging/logger.h b/library/cpp/yt/logging/logger.h
index 5cbd681876..100b15a6e7 100644
--- a/library/cpp/yt/logging/logger.h
+++ b/library/cpp/yt/logging/logger.h
@@ -305,7 +305,7 @@ void LogStructuredEvent(
YT_LOG_EVENT_WITH_ANCHOR(logger, level, nullptr, __VA_ARGS__)
#if !defined(NDEBUG) && !defined(YT_DISABLE_FORMAT_STATIC_ANALYSIS)
- #define YT_LOG_CHECK_FORMAT(...) STATIC_ANALYSIS_CHECK_LOG_FORMAT(__VA_ARGS__)
+ #define YT_LOG_CHECK_FORMAT(...) YT_STATIC_ANALYSIS_CHECK_LOG_FORMAT(__VA_ARGS__)
#else
#define YT_LOG_CHECK_FORMAT(...)
#endif
diff --git a/library/cpp/yt/logging/static_analysis-inl.h b/library/cpp/yt/logging/static_analysis-inl.h
index 13cd425d58..353f7be38b 100644
--- a/library/cpp/yt/logging/static_analysis-inl.h
+++ b/library/cpp/yt/logging/static_analysis-inl.h
@@ -94,38 +94,38 @@ inline constexpr auto InvalidToken = std::monostate{};
//! Parameter pack parsing.
-#define STATIC_ANALYSIS_CAPTURE_TYPES(...) \
+#define YT_STATIC_ANALYSIS_CAPTURE_TYPES(...) \
decltype(::NYT::NLogging::NDetail::AsFormatArgs(__VA_ARGS__)){}
-#define STATIC_ANALYSIS_FIRST_TOKEN(...) \
+#define YT_STATIC_ANALYSIS_FIRST_TOKEN(...) \
PP_STRINGIZE( \
PP_VA_PICK_1_IMPL(__VA_ARGS__ __VA_OPT__(,) ::NYT::NLogging::NDetail::InvalidToken))
-#define STATIC_ANALYSIS_SECOND_TOKEN(...) \
+#define YT_STATIC_ANALYSIS_SECOND_TOKEN(...) \
PP_STRINGIZE(\
PP_VA_PICK_2_IMPL( \
__VA_ARGS__ __VA_OPT__(,) \
::NYT::NLogging::NDetail::InvalidToken, \
::NYT::NLogging::NDetail::InvalidToken))
-#define STATIC_ANALYSIS_FIRST_TOKEN_COND(...) \
- STATIC_ANALYSIS_FIRST_TOKEN(__VA_ARGS__)[0] == '\"'
+#define YT_STATIC_ANALYSIS_FIRST_TOKEN_COND(...) \
+ YT_STATIC_ANALYSIS_FIRST_TOKEN(__VA_ARGS__)[0] == '\"'
-#define STATIC_ANALYSIS_SECOND_TOKEN_COND(...) \
- STATIC_ANALYSIS_SECOND_TOKEN(__VA_ARGS__)[0] == '\"'
+#define YT_STATIC_ANALYSIS_SECOND_TOKEN_COND(...) \
+ YT_STATIC_ANALYSIS_SECOND_TOKEN(__VA_ARGS__)[0] == '\"'
-#undef STATIC_ANALYSIS_CHECK_LOG_FORMAT
-#define STATIC_ANALYSIS_CHECK_LOG_FORMAT(...) \
+#undef YT_STATIC_ANALYSIS_CHECK_LOG_FORMAT
+#define YT_STATIC_ANALYSIS_CHECK_LOG_FORMAT(...) \
::NYT \
::NLogging \
::NDetail \
::TAnalyserDispatcher< \
- STATIC_ANALYSIS_FIRST_TOKEN_COND(__VA_ARGS__), \
- STATIC_ANALYSIS_SECOND_TOKEN_COND(__VA_ARGS__) \
+ YT_STATIC_ANALYSIS_FIRST_TOKEN_COND(__VA_ARGS__), \
+ YT_STATIC_ANALYSIS_SECOND_TOKEN_COND(__VA_ARGS__) \
>::Do( \
- STATIC_ANALYSIS_FIRST_TOKEN(__VA_ARGS__), \
- STATIC_ANALYSIS_SECOND_TOKEN(__VA_ARGS__), \
- STATIC_ANALYSIS_CAPTURE_TYPES(__VA_ARGS__))
+ YT_STATIC_ANALYSIS_FIRST_TOKEN(__VA_ARGS__), \
+ YT_STATIC_ANALYSIS_SECOND_TOKEN(__VA_ARGS__), \
+ YT_STATIC_ANALYSIS_CAPTURE_TYPES(__VA_ARGS__))
////////////////////////////////////////////////////////////////////////////////
diff --git a/library/cpp/yt/logging/static_analysis.h b/library/cpp/yt/logging/static_analysis.h
index a335d8c6cc..4ccf5367d8 100644
--- a/library/cpp/yt/logging/static_analysis.h
+++ b/library/cpp/yt/logging/static_analysis.h
@@ -11,7 +11,7 @@ namespace NYT::NLogging {
// If format is not a string literal or argument list
// is not valid, no check is made -- macro turns to
// a no-op.
-#define STATIC_ANALYSIS_CHECK_LOG_FORMAT(...)
+#define YT_STATIC_ANALYSIS_CHECK_LOG_FORMAT(...)
////////////////////////////////////////////////////////////////////////////////
diff --git a/library/cpp/yt/logging/unittests/static_analysis_ut.cpp b/library/cpp/yt/logging/unittests/static_analysis_ut.cpp
index 1c705dc967..e1bef7aaa9 100644
--- a/library/cpp/yt/logging/unittests/static_analysis_ut.cpp
+++ b/library/cpp/yt/logging/unittests/static_analysis_ut.cpp
@@ -7,7 +7,7 @@ namespace {
////////////////////////////////////////////////////////////////////////////////
-TEST(TStaticAnalysis, ValidFormats)
+TEST(TStaticAnalysisTest, ValidFormats)
{
// Mock for actual error -- we only care that
// it is some runtime object.
@@ -25,7 +25,7 @@ TEST(TStaticAnalysis, ValidFormats)
}
// Uncomment this test to see that we don't have false negatives!
-// TEST(TStaticAnalysis, InvalidFormats)
+// TEST(TStaticAnalysisTest, InvalidFormats)
// {
// YT_LOG_CHECK_FORMAT("Hello", 1);
// YT_LOG_CHECK_FORMAT("Hello %");
diff --git a/library/cpp/yt/string/format-inl.h b/library/cpp/yt/string/format-inl.h
index 069538d84b..acaa8f7011 100644
--- a/library/cpp/yt/string/format-inl.h
+++ b/library/cpp/yt/string/format-inl.h
@@ -712,12 +712,12 @@ concept CFormatter = CInvocable<T, void(size_t, TStringBuilderBase*, TStringBuf)
template <CFormatter TFormatter>
void RunFormatter(
TStringBuilderBase* builder,
- TStringBuf fmt,
+ TStringBuf format,
const TFormatter& formatter)
{
size_t argIndex = 0;
- auto current = std::begin(fmt);
- auto end = std::end(fmt);
+ auto current = std::begin(format);
+ auto end = std::end(format);
while (true) {
// Scan verbatim part until stop symbol.
auto verbatimBegin = current;
@@ -819,14 +819,14 @@ void RunFormatter(
////////////////////////////////////////////////////////////////////////////////
template <class... TArgs>
-void Format(TStringBuilderBase* builder, TStaticFormat<TArgs...> fmt, TArgs&&... args)
+void Format(TStringBuilderBase* builder, TStaticFormat<TArgs...> format, TArgs&&... args)
{
NYT::NDetail::TValueFormatter<0, TArgs...> formatter(args...);
- NYT::NDetail::RunFormatter(builder, fmt.Get(), formatter);
+ NYT::NDetail::RunFormatter(builder, format.Get(), formatter);
}
template <class... TArgs>
-void Format(TStringBuilderBase* builder, TRuntimeFormat fmt, TArgs&&... args)
+void Format(TStringBuilderBase* builder, TRuntimeFormat format, TArgs&&... args)
{
// NB(arkady-e1ppa): StaticFormat performs the
// formattability check of the args in a way
@@ -841,22 +841,22 @@ void Format(TStringBuilderBase* builder, TRuntimeFormat fmt, TArgs&&... args)
Y_UNUSED(argsChecker);
NYT::NDetail::TValueFormatter<0, TArgs...> formatter(args...);
- NYT::NDetail::RunFormatter(builder, fmt.Get(), formatter);
+ NYT::NDetail::RunFormatter(builder, format.Get(), formatter);
}
template <class... TArgs>
-TString Format(TStaticFormat<TArgs...> fmt, TArgs&&... args)
+TString Format(TStaticFormat<TArgs...> format, TArgs&&... args)
{
TStringBuilder builder;
- Format(&builder, fmt, std::forward<TArgs>(args)...);
+ Format(&builder, format, std::forward<TArgs>(args)...);
return builder.Flush();
}
template <class... TArgs>
-TString Format(TRuntimeFormat fmt, TArgs&&... args)
+TString Format(TRuntimeFormat format, TArgs&&... args)
{
TStringBuilder builder;
- Format(&builder, fmt, std::forward<TArgs>(args)...);
+ Format(&builder, format, std::forward<TArgs>(args)...);
return builder.Flush();
}
@@ -865,40 +865,40 @@ TString Format(TRuntimeFormat fmt, TArgs&&... args)
template <size_t Length, class TVector>
void FormatVector(
TStringBuilderBase* builder,
- const char (&fmt)[Length],
+ const char (&format)[Length],
const TVector& vec)
{
NYT::NDetail::TRangeFormatter<typename TVector::value_type> formatter(vec);
- NYT::NDetail::RunFormatter(builder, fmt, formatter);
+ NYT::NDetail::RunFormatter(builder, format, formatter);
}
template <class TVector>
void FormatVector(
TStringBuilderBase* builder,
- TStringBuf fmt,
+ TStringBuf format,
const TVector& vec)
{
NYT::NDetail::TRangeFormatter<typename TVector::value_type> formatter(vec);
- NYT::NDetail::RunFormatter(builder, fmt, formatter);
+ NYT::NDetail::RunFormatter(builder, format, formatter);
}
template <size_t Length, class TVector>
TString FormatVector(
- const char (&fmt)[Length],
+ const char (&format)[Length],
const TVector& vec)
{
TStringBuilder builder;
- FormatVector(&builder, fmt, vec);
+ FormatVector(&builder, format, vec);
return builder.Flush();
}
template <class TVector>
TString FormatVector(
- TStringBuf fmt,
+ TStringBuf format,
const TVector& vec)
{
TStringBuilder builder;
- FormatVector(&builder, fmt, vec);
+ FormatVector(&builder, format, vec);
return builder.Flush();
}
diff --git a/library/cpp/yt/string/format.h b/library/cpp/yt/string/format.h
index 6463135f89..950b23d5f2 100644
--- a/library/cpp/yt/string/format.h
+++ b/library/cpp/yt/string/format.h
@@ -55,14 +55,14 @@ namespace NYT {
*/
template <class... TArgs>
-void Format(TStringBuilderBase* builder, TStaticFormat<TArgs...> fmt, TArgs&&... args);
+void Format(TStringBuilderBase* builder, TStaticFormat<TArgs...> format, TArgs&&... args);
template <class... TArgs>
-void Format(TStringBuilderBase* builder, TRuntimeFormat fmt, TArgs&&... args);
+void Format(TStringBuilderBase* builder, TRuntimeFormat format, TArgs&&... args);
template <class... TArgs>
-TString Format(TStaticFormat<TArgs...> fmt, TArgs&&... args);
+TString Format(TStaticFormat<TArgs...> format, TArgs&&... args);
template <class... TArgs>
-TString Format(TRuntimeFormat fmt, TArgs&&... args);
+TString Format(TRuntimeFormat format, TArgs&&... args);
////////////////////////////////////////////////////////////////////////////////
@@ -142,7 +142,7 @@ class TLazyMultiValueFormatter
: private TNonCopyable
{
public:
- TLazyMultiValueFormatter(TStringBuf fmt, TArgs&&... args);
+ TLazyMultiValueFormatter(TStringBuf format, TArgs&&... args);
// NB(arkady-e1ppa): We actually have to
// forward declare this method as above
@@ -162,7 +162,7 @@ private:
};
template <class ... Args>
-auto MakeLazyMultiValueFormatter(TStringBuf fmt, Args&&... args);
+auto MakeLazyMultiValueFormatter(TStringBuf format, Args&&... args);
////////////////////////////////////////////////////////////////////////////////
@@ -175,23 +175,23 @@ auto MakeLazyMultiValueFormatter(TStringBuf fmt, Args&&... args);
template <size_t Length, class TVector>
void FormatVector(
TStringBuilderBase* builder,
- const char (&fmt)[Length],
+ const char (&format)[Length],
const TVector& vec);
template <class TVector>
void FormatVector(
TStringBuilderBase* builder,
- TStringBuf fmt,
+ TStringBuf format,
const TVector& vec);
template <size_t Length, class TVector>
TString FormatVector(
- const char (&fmt)[Length],
+ const char (&format)[Length],
const TVector& vec);
template <class TVector>
TString FormatVector(
- TStringBuf fmt,
+ TStringBuf format,
const TVector& vec);
////////////////////////////////////////////////////////////////////////////////
diff --git a/library/cpp/yt/string/format_analyser-inl.h b/library/cpp/yt/string/format_analyser-inl.h
index ecc83ebccb..8a3dd897ff 100644
--- a/library/cpp/yt/string/format_analyser-inl.h
+++ b/library/cpp/yt/string/format_analyser-inl.h
@@ -16,7 +16,7 @@ consteval bool Contains(std::string_view sv, char symbol)
}
template <class... TArgs>
-consteval void TFormatAnalyser::ValidateFormat(std::string_view fmt)
+consteval void TFormatAnalyser::ValidateFormat(std::string_view format)
{
std::array<std::string_view, sizeof...(TArgs)> markers = {};
std::array<TSpecifiers, sizeof...(TArgs)> specifiers{GetSpecifiers<TArgs>()...};
@@ -24,14 +24,14 @@ consteval void TFormatAnalyser::ValidateFormat(std::string_view fmt)
int markerCount = 0;
int currentMarkerStart = -1;
- for (int idx = 0; idx < std::ssize(fmt); ++idx) {
- auto symbol = fmt[idx];
+ for (int index = 0; index < std::ssize(format); ++index) {
+ auto symbol = format[index];
// Parse verbatim text.
if (currentMarkerStart == -1) {
if (symbol == IntroductorySymbol) {
// Marker maybe begins.
- currentMarkerStart = idx;
+ currentMarkerStart = index;
}
continue;
}
@@ -41,7 +41,7 @@ consteval void TFormatAnalyser::ValidateFormat(std::string_view fmt)
// we need markerCount to be within range of our
// specifier array.
if (symbol == IntroductorySymbol) {
- if (currentMarkerStart + 1 != idx) {
+ if (currentMarkerStart + 1 != index) {
// '%a% detected'
CrashCompilerWrongTermination("You may not terminate flag sequence other than %% with \'%\' symbol");
return;
@@ -62,7 +62,7 @@ consteval void TFormatAnalyser::ValidateFormat(std::string_view fmt)
// Marker has finished.
markers[markerCount]
- = std::string_view(fmt.begin() + currentMarkerStart, idx - currentMarkerStart + 1);
+ = std::string_view(format.begin() + currentMarkerStart, index - currentMarkerStart + 1);
currentMarkerStart = -1;
++markerCount;
diff --git a/library/cpp/yt/string/format_arg.h b/library/cpp/yt/string/format_arg.h
index 8c4f354f98..da7d13a19b 100644
--- a/library/cpp/yt/string/format_arg.h
+++ b/library/cpp/yt/string/format_arg.h
@@ -35,10 +35,10 @@ struct TFormatArgBase
public:
// TODO(arkady-e1ppa): Consider more strict formatting rules.
static constexpr std::array ConversionSpecifiers = {
- 'v', '1', 'c', 's', 'd', 'i', 'o',
- 'x', 'X', 'u', 'f', 'F', 'e', 'E',
- 'a', 'A', 'g', 'G', 'n', 'p'
- };
+ 'v', '1', 'c', 's', 'd', 'i', 'o',
+ 'x', 'X', 'u', 'f', 'F', 'e', 'E',
+ 'a', 'A', 'g', 'G', 'n', 'p'
+ };
static constexpr std::array FlagSpecifiers = {
'-', '+', ' ', '#', '0',