Problem: formatting errors with clang-format-11

Solution: apply update
This commit is contained in:
Luca Boccassi 2023-01-12 00:42:09 +00:00
parent 47d0ecf639
commit 7781dd1bbd
13 changed files with 65 additions and 23 deletions

View File

@ -197,7 +197,10 @@ class atomic_counter_t
#endif
}
integer_t get () const ZMQ_NOEXCEPT { return _value; }
integer_t get () const ZMQ_NOEXCEPT
{
return _value;
}
private:
#if defined ZMQ_ATOMIC_COUNTER_CXX11

View File

@ -114,7 +114,7 @@ struct blob_t
unsigned char *data () { return _data; }
// Defines an order relationship on blob_t.
bool operator< (blob_t const &other_) const
bool operator<(blob_t const &other_) const
{
const int cmpres =
memcmp (_data, other_._data, std::min (_size, other_._size));
@ -182,7 +182,10 @@ struct blob_t
return *this;
}
#else
blob_t (const blob_t &other) : _owned (false) { set_deep_copy (other); }
blob_t (const blob_t &other) : _owned (false)
{
set_deep_copy (other);
}
blob_t &operator= (const blob_t &other)
{
if (this != &other) {

View File

@ -58,7 +58,10 @@ class mailbox_t ZMQ_FINAL : public i_mailbox
// close the file descriptors in the signaller. This is used in a forked
// child process to close the file descriptors so that they do not interfere
// with the context in the parent process.
void forked () ZMQ_FINAL { _signaler.forked (); }
void forked () ZMQ_FINAL
{
_signaler.forked ();
}
#endif
private:

View File

@ -397,13 +397,13 @@ int zmq::proxy (class socket_base_t *frontend_,
frontend_in = (events[i].events & ZMQ_POLLIN) != 0;
frontend_out = (events[i].events & ZMQ_POLLOUT) != 0;
} else
// This 'if' needs to be after check for 'frontend_' in order never
// to be reached in case frontend_==backend_, so we ensure backend_in=false in that case.
if (events[i].socket == backend_) {
backend_in = (events[i].events & ZMQ_POLLIN) != 0;
backend_out = (events[i].events & ZMQ_POLLOUT) != 0;
} else if (events[i].socket == control_)
control_in = (events[i].events & ZMQ_POLLIN) != 0;
// This 'if' needs to be after check for 'frontend_' in order never
// to be reached in case frontend_==backend_, so we ensure backend_in=false in that case.
if (events[i].socket == backend_) {
backend_in = (events[i].events & ZMQ_POLLIN) != 0;
backend_out = (events[i].events & ZMQ_POLLOUT) != 0;
} else if (events[i].socket == control_)
control_in = (events[i].events & ZMQ_POLLIN) != 0;
}

View File

@ -1511,7 +1511,7 @@ int zmq::socket_base_t::process_commands (int timeout_, bool throttle_)
while (rc == 0 || errno == EINTR) {
if (rc == 0) {
cmd.destination->process_command (cmd);
}
}
rc = _mailbox->recv (&cmd, 0);
}

View File

@ -69,13 +69,19 @@ template <typename T> class ypipe_conflate_t ZMQ_FINAL : public ypipe_base_t<T>
#endif
// There are no incomplete items for conflate ypipe
bool unwrite (T *) { return false; }
bool unwrite (T *)
{
return false;
}
// Flush is no-op for conflate ypipe. Reader asleep behaviour
// is as of the usual ypipe.
// Returns false if the reader thread is sleeping. In that case,
// caller is obliged to wake the reader up before using the pipe again.
bool flush () { return reader_awake; }
bool flush ()
{
return reader_awake;
}
// Check whether item is available for reading.
bool check_read ()
@ -100,7 +106,10 @@ template <typename T> class ypipe_conflate_t ZMQ_FINAL : public ypipe_base_t<T>
// Applies the function fn to the first element in the pipe
// and returns the value returned by the fn.
// The pipe mustn't be empty or the function crashes.
bool probe (bool (*fn_) (const T &)) { return dbuffer.probe (fn_); }
bool probe (bool (*fn_) (const T &))
{
return dbuffer.probe (fn_);
}
protected:
dbuffer_t<T> dbuffer;

View File

@ -273,7 +273,10 @@ void test_blocking (const char *bind_endpoint_)
test_defaults_small (bind_endpoint); \
} \
\
void test_blocking_##name () { test_blocking (bind_endpoint); }
void test_blocking_##name () \
{ \
test_blocking (bind_endpoint); \
}
#define RUN_REGULAR_TEST_CASES(name) \
RUN_TEST (test_defaults_large_##name); \

View File

@ -333,7 +333,10 @@ void call_poller_wait_all_null_event_fails_event_count_zero (void *poller_)
}
#define TEST_CASE_FUNC_PARAM(name, func) \
void test_##name () { func (name); }
void test_##name () \
{ \
func (name); \
}
TEST_CASE_FUNC_PARAM (call_poller_wait_null_event_fails, test_with_valid_poller)
TEST_CASE_FUNC_PARAM (call_poller_wait_all_null_event_fails_event_count_nonzero,

View File

@ -41,7 +41,10 @@
// Helper macro to define the v4/v6 function pairs
#define MAKE_TEST_V4V6(_test) \
static void _test##_ipv4 () { _test (false); } \
static void _test##_ipv4 () \
{ \
_test (false); \
} \
\
static void _test##_ipv6 () \
{ \

View File

@ -185,7 +185,10 @@ void test_block_on_send_no_peers (const char *bind_address_)
{ \
test_round_robin_out (bind_address); \
} \
void test_fair_queue_in_##name () { test_fair_queue_in (bind_address); } \
void test_fair_queue_in_##name () \
{ \
test_fair_queue_in (bind_address); \
} \
void test_block_on_send_no_peers_##name () \
{ \
test_block_on_send_no_peers (bind_address); \

View File

@ -168,7 +168,10 @@ void test_destroy_queue_on_disconnect (const char *bind_address_)
}
#define TEST_SUITE(name, bind_address) \
void test_fair_queue_in_##name () { test_fair_queue_in (bind_address); } \
void test_fair_queue_in_##name () \
{ \
test_fair_queue_in (bind_address); \
} \
void test_destroy_queue_on_disconnect_##name () \
{ \
test_destroy_queue_on_disconnect (bind_address); \

View File

@ -83,7 +83,10 @@ void test_bad_filter_string (const char *const filter_)
}
#define TEST_BAD_FILTER_STRING(case, filter) \
void test_bad_filter_string_##case () { test_bad_filter_string (filter); }
void test_bad_filter_string_##case () \
{ \
test_bad_filter_string (filter); \
}
TEST_BAD_FILTER_STRING (foo, "foo")
TEST_BAD_FILTER_STRING (zeros_foo, "0.0.0.0foo")

View File

@ -197,8 +197,14 @@ void recv_array_expect_success (void *socket_,
// Use this is an test executable to perform a default setup and teardown of
// the test context, which is appropriate for many libzmq test cases.
#define SETUP_TEARDOWN_TESTCONTEXT \
void setUp () { setup_test_context (); } \
void tearDown () { teardown_test_context (); }
void setUp () \
{ \
setup_test_context (); \
} \
void tearDown () \
{ \
teardown_test_context (); \
}
// The maximum number of sockets that can be managed by the test context.
#define MAX_TEST_SOCKETS 128