From 541ca30d8e6b0e94cc420d4220187b048ca91f99 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Mon, 5 Mar 2018 22:41:11 +0000 Subject: [PATCH 1/2] Problem: make clang-format still shows error in the CI Solution: run make clang-format-diff and commit the changes. --- src/generic_mtrie_impl.hpp | 2 +- src/ip.cpp | 6 +++--- src/socket_base.cpp | 8 ++++---- src/tcp_connecter.cpp | 4 ++-- src/zmq.cpp | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/generic_mtrie_impl.hpp b/src/generic_mtrie_impl.hpp index 0e942d1f..ef194f37 100644 --- a/src/generic_mtrie_impl.hpp +++ b/src/generic_mtrie_impl.hpp @@ -167,7 +167,7 @@ void zmq::generic_mtrie_t::rm (value_t *pipe_, template template -void zmq::generic_mtrie_t::rm_helper(value_t *pipe_, +void zmq::generic_mtrie_t::rm_helper (value_t *pipe_, unsigned char **buff_, size_t buffsize_, size_t maxbuffsize_, diff --git a/src/ip.cpp b/src/ip.cpp index ab253b96..0e07f780 100644 --- a/src/ip.cpp +++ b/src/ip.cpp @@ -594,9 +594,9 @@ int zmq::make_fdpair (fd_t *r_, fd_t *w_) *w_ = *r_ = -1; return -1; } else { - // If there's no SOCK_CLOEXEC, let's try the second best option. Note that - // race condition can cause socket not to be closed (if fork happens - // between socket creation and this point). + // If there's no SOCK_CLOEXEC, let's try the second best option. Note that + // race condition can cause socket not to be closed (if fork happens + // between socket creation and this point). #if !defined ZMQ_HAVE_SOCK_CLOEXEC && defined FD_CLOEXEC rc = fcntl (sv[0], F_SETFD, FD_CLOEXEC); errno_assert (rc != -1); diff --git a/src/socket_base.cpp b/src/socket_base.cpp index b28a8e3a..8668121f 100644 --- a/src/socket_base.cpp +++ b/src/socket_base.cpp @@ -313,9 +313,9 @@ int zmq::socket_base_t::check_protocol (const std::string &protocol_) return -1; } - // Check whether socket type and transport protocol match. - // Specifically, multicast protocols can't be combined with - // bi-directional messaging patterns (socket types). + // Check whether socket type and transport protocol match. + // Specifically, multicast protocols can't be combined with + // bi-directional messaging patterns (socket types). #if defined ZMQ_HAVE_OPENPGM || defined ZMQ_HAVE_NORM if ((protocol_ == "pgm" || protocol_ == "epgm" || protocol_ == "norm") && options.type != ZMQ_PUB && options.type != ZMQ_SUB @@ -912,7 +912,7 @@ int zmq::socket_base_t::connect (const char *addr_) } } - // TBD - Should we check address for ZMQ_HAVE_NORM??? + // TBD - Should we check address for ZMQ_HAVE_NORM??? #ifdef ZMQ_HAVE_OPENPGM if (protocol == "pgm" || protocol == "epgm") { diff --git a/src/tcp_connecter.cpp b/src/tcp_connecter.cpp index 11c00307..ae9c6088 100644 --- a/src/tcp_connecter.cpp +++ b/src/tcp_connecter.cpp @@ -343,8 +343,8 @@ int zmq::tcp_connecter_t::open () return 0; } - // Translate error codes indicating asynchronous connect has been - // launched to a uniform EINPROGRESS. + // Translate error codes indicating asynchronous connect has been + // launched to a uniform EINPROGRESS. #ifdef ZMQ_HAVE_WINDOWS const int last_error = WSAGetLastError (); if (last_error == WSAEINPROGRESS || last_error == WSAEWOULDBLOCK) diff --git a/src/zmq.cpp b/src/zmq.cpp index 59dfc287..eec06492 100644 --- a/src/zmq.cpp +++ b/src/zmq.cpp @@ -682,7 +682,7 @@ const char *zmq_msg_gets (const zmq_msg_t *msg_, const char *property_) } } -// Polling. + // Polling. #if defined ZMQ_HAVE_POLLER inline int zmq_poller_poll (zmq_pollitem_t *items_, int nitems_, long timeout_) From c36d8cb8e42ce8e95d46384bb48184d717b588a0 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Mon, 5 Mar 2018 22:45:00 +0000 Subject: [PATCH 2/2] Problem: PR template does not mention clang-format Solution: add paragraph explaining how to run it to make sure code is correctly formatted. --- .github/PULL_REQUEST_TEMPLATE.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index d0cb6195..a58221c5 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -9,6 +9,14 @@ Problem: X is broken Solution: do Y and Z to fix X ``` +Please try to have the code changes conform to our coding style. For your +convenience, you can install clang-format (at least version 5.0) and then +run ```make clang-format-check```. Don't fix existing issues, if any - just +make sure your changes are compliant. ```make clang-format-diff``` will +automatically apply the required changes. +To set a specific clang-format binary with autotools, you can for example +run: ```./configure CLANG_FORMAT=clang-format-5.0``` + Please avoid sending a pull request with recursive merge nodes, as they are impossible to fix once merged. Please rebase your branch on zeromq/libzmq master instead of merging it.