Skip to content

Commit a877067

Browse files
committed
Remove clang-tidy checks in source code for testing
1 parent 63b3ad1 commit a877067

File tree

6 files changed

+9
-36
lines changed

6 files changed

+9
-36
lines changed

libs/mysql/binlog/event/compression/buffer/managed_buffer.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,7 @@ class Managed_buffer : public buffer::Rw_buffer<Char_tp> {
124124
// Nolint: clang-tidy does not recognize that m_owns_default_buffer
125125
// is initialized, despite it is initialized in the targed
126126
// constructor.
127-
// NOLINTBEGIN(cppcoreguidelines-pro-type-member-init)
128-
explicit Managed_buffer(
129-
const Memory_resource_t &memory_resource = Memory_resource_t())
130-
: Managed_buffer(Size_t(0), memory_resource) {}
131-
// NOLINTEND(cppcoreguidelines-pro-type-member-init)
127+
explicit Managed_buffer(const Memory_resource_t &memory_resource = Memory_resource_t()) : Managed_buffer(Size_t(0), memory_resource) {}
132128

133129
/// Construct a new object that owns a default buffer.
134130
///

libs/mysql/binlog/event/compression/payload_event_buffer_istream.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,17 +144,10 @@ void Payload_event_buffer_istream::update_buffer() {
144144
#ifndef NDEBUG
145145
// "nolint": clang-tidy reports an unnecessary warning since 'if'
146146
// and 'else' branches may compile to the same. Suppressing that.
147-
// NOLINTBEGIN(bugprone-branch-clone)
148147
if (m_managed_buffer_ptr.use_count() == 0)
149148
BAPI_LOG("info", "Allocating managed buffer for the first time.");
150149
else
151-
BAPI_LOG("info",
152-
"Allocating new managed buffer. "
153-
"The previous one cannot be reused since there are "
154-
<< m_managed_buffer_ptr.use_count()
155-
<< ">1 shared pointer references to "
156-
"it.");
157-
// NOLINTEND(bugprone-branch-clone)
150+
BAPI_LOG("info", "Allocating new managed buffer. The previous one cannot be reused since there are " << m_managed_buffer_ptr.use_count() << ">1 shared pointer references to it.");
158151
#endif
159152
try {
160153
auto allocator = Allocator_t<Managed_buffer_t>(m_memory_resource);

libs/mysql/binlog/event/compression/payload_event_buffer_istream.h

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,8 @@ class Payload_event_buffer_istream {
9696
/// @param memory_resource @c Memory_resource object used to
9797
/// allocate memory.
9898
template <class String_char_t>
99-
Payload_event_buffer_istream(
100-
const String_char_t *compressed_buffer, Size_t compressed_buffer_size,
101-
type compression_algorithm, Size_t default_buffer_size = 0,
102-
const Memory_resource_t &memory_resource = Memory_resource_t())
103-
: m_memory_resource(memory_resource),
104-
m_compressed_buffer(
105-
reinterpret_cast<const Char_t *>(compressed_buffer)),
106-
m_compressed_buffer_size(compressed_buffer_size),
107-
m_compression_algorithm(compression_algorithm),
108-
m_default_buffer_size(default_buffer_size) {
99+
Payload_event_buffer_istream(const String_char_t *compressed_buffer, Size_t compressed_buffer_size, type compression_algorithm, Size_t default_buffer_size = 0, const Memory_resource_t &memory_resource = Memory_resource_t())
100+
: m_memory_resource(memory_resource), m_compressed_buffer(reinterpret_cast<const Char_t *>(compressed_buffer)), m_compressed_buffer_size(compressed_buffer_size), m_compression_algorithm(compression_algorithm), m_default_buffer_size(default_buffer_size) {
109101
initialize();
110102
}
111103

@@ -130,7 +122,6 @@ class Payload_event_buffer_istream {
130122
// Nolint: clang-tidy does not recognize that m_default_buffer_size
131123
// is initialized, despite it is initialized in the targed
132124
// constructor.
133-
// NOLINTBEGIN(cppcoreguidelines-pro-type-member-init)
134125
template <class String_char_t>
135126
Payload_event_buffer_istream(
136127
const std::basic_string<String_char_t> &compressed_data,
@@ -139,7 +130,6 @@ class Payload_event_buffer_istream {
139130
: Payload_event_buffer_istream(
140131
compressed_data.data(), compressed_data.size(),
141132
compression_algorithm, default_buffer_size, memory_resource) {}
142-
// NOLINTEND(cppcoreguidelines-pro-type-member-init)
143133

144134
/// Construct the stream from a (non-owned) Payload Event.
145135
///
@@ -346,7 +336,7 @@ class Payload_event_buffer_istream {
346336
/// Grow calculator for the Managed_buffer.
347337
Grow_calculator_t m_grow_calculator;
348338
/// Default buffer size for the Managed_buffer.
349-
Size_t m_default_buffer_size;
339+
Size_t m_default_buffer_size;
350340
/// Shared pointer to Managed_buffer that holds the output. This
351341
/// will be shared with API clients. Therefore, API clients can use
352342
/// the returned buffer as long as they like. The next time this

sql/raii/thread_stage_guard.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ class Thread_stage_guard {
111111
/// @param new_stage The new stage. `thd` will use this stage until
112112
/// the end of the scope where the macro is invoked. At that point,
113113
/// the stage is reverted to what it was before invoking this macro.
114-
#define NAMED_THD_STAGE_GUARD(name, thd, new_stage) \
115-
raii::Thread_stage_guard name { \
116-
(thd), (new_stage), __func__, __FILE__, __LINE__ \
114+
#define NAMED_THD_STAGE_GUARD(name, thd, new_stage) \
115+
raii::Thread_stage_guard name { \
116+
(thd), (new_stage), __func__, __FILE__, __LINE__ \
117117
}
118118

119119
/// Set the thread stage for the given thread, and make it restore the
@@ -127,8 +127,6 @@ class Thread_stage_guard {
127127
#define THD_STAGE_GUARD(thd, new_stage) \
128128
NAMED_THD_STAGE_GUARD(_thread_stage_guard_##new_stage, (thd), (new_stage))
129129

130-
// NOLINTEND(cppcoreguidelines-macro-usage)
131-
132130
} // namespace raii
133131

134132
#endif /// THREAD_STAGE_GUARD_H_INCLUDED

unittest/gunit/binlogevents/managed_buffer_sequence-t.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ using Difference_t = mysql::binlog::event::compression::buffer::
8080
// make the program stop with assertion.
8181
[[maybe_unused]] static int n_assertions = 0;
8282
static bool _shall_stop_after_assertion = false;
83-
// NOLINTBEGIN(cppcoreguidelines-macro-usage)
8483
#define ASSERTION_TAIL \
8584
<< debug_output(fileline) << (_shall_stop_after_assertion = true, ""), \
8685
assert(!_shall_stop_after_assertion)
@@ -94,7 +93,6 @@ static bool _shall_stop_after_assertion = false;
9493
ASSERT_NE(v1, v2) ASSERTION_TAIL; \
9594
++n_assertions; \
9695
} while (0)
97-
// NOLINTEND(cppcoreguidelines-macro-usage)
9896

9997
// Requirements:
10098
//
@@ -251,10 +249,8 @@ class Grow_tester {
251249
Size_t extra_container_capacity, Size_t position,
252250
Size_t capacity, Size_t max_capacity,
253251
Size_t requested_capacity, Size_t requested_position) {
254-
// NOLINTBEGIN(cppcoreguidelines-macro-usage)
255252
#define CHECK_SIZES(POSITION, CAPACITY) \
256253
check_sizes(FILELINE(), debug_output, mbs, buffer_size, POSITION, CAPACITY)
257-
// NOLINTEND(cppcoreguidelines-macro-usage)
258254

259255
// This does the following:
260256
//

unittest/gunit/binlogevents/payload_event_buffer_istream-t.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ class PayloadEventBufferStreamTest {
364364
// clang-tidy warns about it. But this is an allocator so it is
365365
// appropriate to use malloc and therefore we suppress the check.
366366
// NOLINTNEXTLINE(cppcoreguidelines-no-malloc)
367-
return std::malloc(n);
367+
return std::malloc(n);
368368
};
369369
Memory_resource_t failing_memory_resource(failing_allocator, std::free);
370370
auto debug_func = [&] {

0 commit comments

Comments
 (0)