From 39199565356a29674348f72991834255e074f858 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Wed, 11 Jan 2023 23:43:13 +0000 Subject: [PATCH 1/6] Problem: build fails with PGM + CXX98 + clang++ Solution: redefine 'restrict' which is used as an attribute in PGM headers, but that is not available when using clang and CXX98 --- configure.ac | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configure.ac b/configure.ac index ed6bf44e..77f01142 100644 --- a/configure.ac +++ b/configure.ac @@ -713,6 +713,11 @@ fi if test "x$have_pgm_library" = "xyes"; then AC_DEFINE(ZMQ_HAVE_OPENPGM, [1], [Have OpenPGM extension]) + # When using CXX98 mode 'restrict will not be defined, so redefine it, as it + # is used in the PGM headers + if test "x$enable_force_CXX98_compat" = "xyes"; then + CPPFLAGS="-Drestrict=__restrict__ $CPPFLAGS" + fi fi AM_CONDITIONAL(HAVE_PGM, test "x$have_pgm_library" = "xyes") From 634cf9eea749e71ad20a3c4a776fab30c2362edc Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Thu, 12 Jan 2023 00:30:34 +0000 Subject: [PATCH 2/6] Problem: windows-2016 build no longer runs in CI Solution: remove it --- .github/workflows/CI.yaml | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 1256c03c..a995b65f 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -23,16 +23,6 @@ jobs: MSVCYEAR: vs2019 ARTIFACT_NAME: v142-x64 ENABLE_DRAFTS: ON - - platform: x64 - configuration: Release - os: windows-2016 - WITH_LIBSODIUM: ON - ENABLE_CURVE: ON - CMAKE_GENERATOR: "Visual Studio 15 2017 Win64" - MSVCVERSION: "v141" - MSVCYEAR: "vs2017" - ARTIFACT_NAME: v141-x64 - ENABLE_DRAFTS: ON - os: ubuntu-latest BUILD_TYPE: default PACKAGES: asciidoc xmlto @@ -163,11 +153,6 @@ jobs: - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v1.0.2 if: matrix.os == 'windows-2019' - - name: Add msbuild to PATH 2016 - uses: microsoft/setup-msbuild@v1.0.2 - with: - vs-version: '[15.0,16.0)' - if: matrix.os == 'windows-2016' - uses: actions/checkout@v2 if: matrix.WITH_LIBSODIUM == 'ON' with: @@ -175,12 +160,12 @@ jobs: ref: stable path: libsodium - name: Compile libsodium - if: matrix.WITH_LIBSODIUM == 'ON' && (matrix.os == 'windows-2019' || matrix.os == 'windows-2016') + if: matrix.WITH_LIBSODIUM == 'ON' && matrix.os == 'windows-2019' shell: cmd working-directory: libsodium run: msbuild /v:minimal /p:Configuration=%Configuration%DLL builds\msvc\%MSVCYEAR%\libsodium\libsodium.vcxproj - name: Copy libsodium - if: matrix.WITH_LIBSODIUM == 'ON' && (matrix.os == 'windows-2019' || matrix.os == 'windows-2016') + if: matrix.WITH_LIBSODIUM == 'ON' && matrix.os == 'windows-2019' shell: powershell working-directory: libsodium run: Copy-Item "bin\${env:Platform}\${env:Configuration}\${env:MSVCVERSION}\dynamic\libsodium.lib" -Destination "bin\${env:Platform}\${env:Configuration}\${env:MSVCVERSION}\dynamic\sodium.lib" @@ -189,16 +174,16 @@ jobs: path: libzmq - run: md build_libzmq shell: cmd - if: matrix.os == 'windows-2019' || matrix.os == 'windows-2016' + if: matrix.os == 'windows-2019' - name: build-win - if: matrix.os == 'windows-2019' || matrix.os == 'windows-2016' + if: matrix.os == 'windows-2019' shell: cmd working-directory: build_libzmq run: | cmake -D CMAKE_INCLUDE_PATH="%SODIUM_INCLUDE_DIR%" -D CMAKE_LIBRARY_PATH="%SODIUM_LIBRARY_DIR%" -D WITH_LIBSODIUM="%WITH_LIBSODIUM%" -D ENABLE_DRAFTS="%ENABLE_DRAFTS%" -D ENABLE_ANALYSIS="%ENABLE_ANALYSIS%" -D ENABLE_CURVE="%ENABLE_CURVE%" -D API_POLLER="%API_POLLER%" -D POLLER="%POLLER%" %EXTRA_FLAGS% -D WITH_LIBSODIUM="%WITH_LIBSODIUM%" -D LIBZMQ_WERROR="%LIBZMQ_WERROR%" -G "%CMAKE_GENERATOR%" "%LIBZMQ_SRCDIR%" cmake --build . --config %configuration% --target install -- -verbosity:Minimal -maxcpucount - name: test - if: matrix.os == 'windows-2019' || matrix.os == 'windows-2016' + if: matrix.os == 'windows-2019' shell: cmd working-directory: build_libzmq run: ctest -C "%Configuration%" From 47d0ecf63966a3fb17165e4f2612df67bb3bf714 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Thu, 12 Jan 2023 00:36:35 +0000 Subject: [PATCH 3/6] Problem: missing VMCI can also return EPROTONOSUPPORT and the tests fail Solution: ignore that too --- tests/test_pair_vmci.cpp | 4 ++-- tests/test_reqrep_vmci.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_pair_vmci.cpp b/tests/test_pair_vmci.cpp index 87150ed9..42fd09e3 100644 --- a/tests/test_pair_vmci.cpp +++ b/tests/test_pair_vmci.cpp @@ -44,14 +44,14 @@ void test_pair_vmci () void *sb = test_context_socket (ZMQ_PAIR); int rc = zmq_bind (sb, endpoint.c_str ()); - if (rc < 0 && errno == EAFNOSUPPORT) + if (rc < 0 && (errno == EAFNOSUPPORT || errno == EPROTONOSUPPORT)) TEST_IGNORE_MESSAGE ("VMCI not supported"); TEST_ASSERT_SUCCESS_ERRNO (rc); void *sc = test_context_socket (ZMQ_PAIR); TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, endpoint.c_str ())); - expect_bounce_fail (sb, sc); + bounce (sb, sc); test_context_socket_close_zero_linger (sc); test_context_socket_close_zero_linger (sb); diff --git a/tests/test_reqrep_vmci.cpp b/tests/test_reqrep_vmci.cpp index f93b9102..6382e9ef 100644 --- a/tests/test_reqrep_vmci.cpp +++ b/tests/test_reqrep_vmci.cpp @@ -44,14 +44,14 @@ void test_reqrep_vmci () void *sb = test_context_socket (ZMQ_DEALER); int rc = zmq_bind (sb, endpoint.c_str ()); - if (rc < 0 && errno == EAFNOSUPPORT) + if (rc < 0 && (errno == EAFNOSUPPORT || errno == EPROTONOSUPPORT)) TEST_IGNORE_MESSAGE ("VMCI not supported"); TEST_ASSERT_SUCCESS_ERRNO (rc); void *sc = test_context_socket (ZMQ_DEALER); TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, endpoint.c_str ())); - expect_bounce_fail (sb, sc); + bounce (sb, sc); test_context_socket_close_zero_linger (sc); test_context_socket_close_zero_linger (sb); From 7781dd1bbd41c8f94f4f3c90e2fb2ee5e9103432 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Thu, 12 Jan 2023 00:42:09 +0000 Subject: [PATCH 4/6] Problem: formatting errors with clang-format-11 Solution: apply update --- src/atomic_counter.hpp | 5 ++++- src/blob.hpp | 7 +++++-- src/mailbox.hpp | 5 ++++- src/proxy.cpp | 14 +++++++------- src/socket_base.cpp | 2 +- src/ypipe_conflate.hpp | 15 ++++++++++++--- tests/test_hwm_pubsub.cpp | 5 ++++- tests/test_poller.cpp | 5 ++++- tests/test_radio_dish.cpp | 5 ++++- tests/test_spec_dealer.cpp | 5 ++++- tests/test_spec_router.cpp | 5 ++++- tests/test_tcp_accept_filter.cpp | 5 ++++- tests/testutil_unity.hpp | 10 ++++++++-- 13 files changed, 65 insertions(+), 23 deletions(-) diff --git a/src/atomic_counter.hpp b/src/atomic_counter.hpp index d05837a1..371779fb 100644 --- a/src/atomic_counter.hpp +++ b/src/atomic_counter.hpp @@ -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 diff --git a/src/blob.hpp b/src/blob.hpp index 54a41d52..06a41913 100644 --- a/src/blob.hpp +++ b/src/blob.hpp @@ -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) { diff --git a/src/mailbox.hpp b/src/mailbox.hpp index 0cd92d20..ab0119b2 100644 --- a/src/mailbox.hpp +++ b/src/mailbox.hpp @@ -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: diff --git a/src/proxy.cpp b/src/proxy.cpp index 8a517c78..878fe2bf 100644 --- a/src/proxy.cpp +++ b/src/proxy.cpp @@ -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; } diff --git a/src/socket_base.cpp b/src/socket_base.cpp index 4c291d9c..9c367c42 100644 --- a/src/socket_base.cpp +++ b/src/socket_base.cpp @@ -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); } diff --git a/src/ypipe_conflate.hpp b/src/ypipe_conflate.hpp index 7c96d574..c81e66ae 100644 --- a/src/ypipe_conflate.hpp +++ b/src/ypipe_conflate.hpp @@ -69,13 +69,19 @@ template class ypipe_conflate_t ZMQ_FINAL : public ypipe_base_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 class ypipe_conflate_t ZMQ_FINAL : public ypipe_base_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 dbuffer; diff --git a/tests/test_hwm_pubsub.cpp b/tests/test_hwm_pubsub.cpp index b85e6dc6..2452ddb0 100644 --- a/tests/test_hwm_pubsub.cpp +++ b/tests/test_hwm_pubsub.cpp @@ -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); \ diff --git a/tests/test_poller.cpp b/tests/test_poller.cpp index 78a352b0..7320308c 100644 --- a/tests/test_poller.cpp +++ b/tests/test_poller.cpp @@ -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, diff --git a/tests/test_radio_dish.cpp b/tests/test_radio_dish.cpp index 3c3fb18e..c977156b 100644 --- a/tests/test_radio_dish.cpp +++ b/tests/test_radio_dish.cpp @@ -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 () \ { \ diff --git a/tests/test_spec_dealer.cpp b/tests/test_spec_dealer.cpp index e7b6eb2d..0867a5b1 100644 --- a/tests/test_spec_dealer.cpp +++ b/tests/test_spec_dealer.cpp @@ -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); \ diff --git a/tests/test_spec_router.cpp b/tests/test_spec_router.cpp index 9e882f0a..d9b716fb 100644 --- a/tests/test_spec_router.cpp +++ b/tests/test_spec_router.cpp @@ -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); \ diff --git a/tests/test_tcp_accept_filter.cpp b/tests/test_tcp_accept_filter.cpp index 1bb4117b..be5975db 100644 --- a/tests/test_tcp_accept_filter.cpp +++ b/tests/test_tcp_accept_filter.cpp @@ -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") diff --git a/tests/testutil_unity.hpp b/tests/testutil_unity.hpp index b00c0c89..6fe051d7 100644 --- a/tests/testutil_unity.hpp +++ b/tests/testutil_unity.hpp @@ -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 From 961206abd503431cc23d614ae3dd2b0a2a9cfba3 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Thu, 12 Jan 2023 00:46:40 +0000 Subject: [PATCH 5/6] Problem: libsodium doesn't build anymore in VS2010 Solution: disable it in appveyor, not our problem to solve --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 446015ab..6adbee7c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -29,8 +29,8 @@ environment: ARTIFACT_NAME: v90 - platform: Win32 configuration: Release - WITH_LIBSODIUM: ON - ENABLE_CURVE: ON + WITH_LIBSODIUM: OFF + ENABLE_CURVE: OFF CMAKE_GENERATOR: "Visual Studio 10 2010" MSVCVERSION: "v100" MSVCYEAR: "vs2010" From 78777fb9f5f4bed6872a916d68d26b0f2d9fd48d Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Thu, 12 Jan 2023 00:49:09 +0000 Subject: [PATCH 6/6] Problem: shipping binaries is a responsibility that requires time Solution: stop shipping binary releases for Windows. These days there's vcspkg, conda and more that provide pre-built binaries for Windows. Being a software supplier requires a lot of time and effort, and we have no bandwidth. --- appveyor.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 6adbee7c..f0a5d638 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -275,19 +275,6 @@ test_script: ) - cmd: if "%APPVEYOR_REPO_TAG%"=="false" (ctest -C "%Configuration%" -V %TEST_OPTIONS%) -deploy: - - provider: GitHub - tag: $(APPVEYOR_REPO_TAG_NAME) - release: libzmq $(APPVEYOR_REPO_TAG_NAME) - description: | - Windows binaries for libzmq $(APPVEYOR_REPO_TAG_NAME), uploaded from appveyor. - Edit after appveyor is done uploading. - auth_token: - secure: vmAeVtN2qiQgFBCB2I5FDDRtADQ7GUdR9NwAJJyakbiV5OHzLHExDcC/D9Oh5r67 - draft: true - prerelease: false - force_update: true # adds files, clobbers release name and description - # the analysis build is repeated; apparently appveyor only uses the first section that matches some branch for: