From 145083061112fb272aa8cf8098a907d9caaa5ef2 Mon Sep 17 00:00:00 2001 From: Simon Giesecke Date: Sat, 23 Mar 2019 08:04:57 -0400 Subject: [PATCH] Problem: unused include directives Solution: remove and add where needed --- src/ip_resolver.hpp | 1 + tests/CMakeLists.txt | 3 +++ tests/test_abstract_ipc.cpp | 1 + tests/test_app_meta.cpp | 1 + tests/test_connect_rid.cpp | 2 ++ tests/test_ctx_options.cpp | 1 + tests/test_dgram.cpp | 2 ++ tests/test_disconnect_inproc.cpp | 2 ++ tests/test_filter_ipc.cpp | 3 +++ tests/test_fork.cpp | 4 ++++ tests/test_getsockopt_memset.cpp | 1 + tests/test_heartbeats.cpp | 3 +++ tests/test_hwm_pubsub.cpp | 2 ++ tests/test_iov.cpp | 2 ++ tests/test_metadata.cpp | 1 + tests/test_mock_pub_sub.cpp | 3 +++ tests/test_monitor.cpp | 3 +++ tests/test_msg_ffn.cpp | 2 ++ tests/test_pair_tcp.cpp | 2 ++ tests/test_poller.cpp | 7 ++++++ tests/test_proxy.cpp | 3 +++ tests/test_proxy_hwm.cpp | 2 ++ tests/test_proxy_single_socket.cpp | 2 ++ tests/test_proxy_terminate.cpp | 2 ++ tests/test_pub_invert_matching.cpp | 2 ++ tests/test_radio_dish.cpp | 9 +++++++ tests/test_reqrep_ipc.cpp | 1 + tests/test_reqrep_tcp.cpp | 2 ++ tests/test_router_mandatory.cpp | 1 + tests/test_router_notify.cpp | 1 + tests/test_security_gssapi.cpp | 3 +++ tests/test_security_null.cpp | 2 ++ tests/test_security_plain.cpp | 3 +++ tests/test_setsockopt.cpp | 2 ++ tests/test_shutdown_stress_tipc.cpp | 2 ++ tests/test_spec_pushpull.cpp | 3 +++ tests/test_spec_rep.cpp | 1 + tests/test_spec_router.cpp | 2 ++ tests/test_srcfd.cpp | 1 + tests/test_stream.cpp | 2 ++ tests/test_stream_disconnect.cpp | 2 ++ tests/test_stream_exceeds_buffer.cpp | 8 +++++++ tests/test_stream_timeout.cpp | 3 +++ tests/test_unbind_wildcard.cpp | 2 ++ tests/test_use_fd.cpp | 4 ++++ tests/test_zmq_poll_fd.cpp | 5 ++++ tests/testutil.cpp | 30 +++++++++++++++++++++++ tests/testutil.hpp | 33 -------------------------- tests/testutil_monitoring.cpp | 3 +++ tests/testutil_security.cpp | 3 +++ tests/testutil_unity.cpp | 7 ++++++ unittests/unittest_ip_resolver.cpp | 6 +++++ unittests/unittest_resolver_common.hpp | 1 + 53 files changed, 166 insertions(+), 33 deletions(-) diff --git a/src/ip_resolver.hpp b/src/ip_resolver.hpp index 65e0cb10..af6e932e 100644 --- a/src/ip_resolver.hpp +++ b/src/ip_resolver.hpp @@ -33,6 +33,7 @@ #if !defined ZMQ_HAVE_WINDOWS #include #include +#include #endif #include "address.hpp" diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 5d31c4e3..7106bdaf 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -209,6 +209,9 @@ endif() # add include dirs for all targets include_directories("${ZeroMQ_SOURCE_DIR}/../include" "${ZeroMQ_BINARY_DIR}") +if(WIN32) + add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) +endif() foreach(test ${tests}) # target_sources not supported before CMake 3.1 diff --git a/tests/test_abstract_ipc.cpp b/tests/test_abstract_ipc.cpp index 78ef6557..de31bd06 100644 --- a/tests/test_abstract_ipc.cpp +++ b/tests/test_abstract_ipc.cpp @@ -30,6 +30,7 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include #include void setUp () diff --git a/tests/test_app_meta.cpp b/tests/test_app_meta.cpp index 2e2f8a34..beb01e12 100644 --- a/tests/test_app_meta.cpp +++ b/tests/test_app_meta.cpp @@ -31,6 +31,7 @@ #include "testutil_unity.hpp" #include +#include void setUp () { diff --git a/tests/test_connect_rid.cpp b/tests/test_connect_rid.cpp index cbf8b02f..595017a4 100644 --- a/tests/test_connect_rid.cpp +++ b/tests/test_connect_rid.cpp @@ -30,6 +30,8 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include + void setUp () { setup_test_context (); diff --git a/tests/test_ctx_options.cpp b/tests/test_ctx_options.cpp index 8bef23ae..dd2807fe 100644 --- a/tests/test_ctx_options.cpp +++ b/tests/test_ctx_options.cpp @@ -47,6 +47,7 @@ void tearDown () #include #include #include // for sleep() +#include #define TEST_POLICY \ (SCHED_OTHER) // NOTE: SCHED_OTHER is the default Linux scheduler diff --git a/tests/test_dgram.cpp b/tests/test_dgram.cpp index bc5d2c29..56d37be9 100644 --- a/tests/test_dgram.cpp +++ b/tests/test_dgram.cpp @@ -30,6 +30,8 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include +#include #include void setUp () diff --git a/tests/test_disconnect_inproc.cpp b/tests/test_disconnect_inproc.cpp index 98af16a0..a3cd5ce6 100644 --- a/tests/test_disconnect_inproc.cpp +++ b/tests/test_disconnect_inproc.cpp @@ -30,6 +30,8 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include + void setUp () { setup_test_context (); diff --git a/tests/test_filter_ipc.cpp b/tests/test_filter_ipc.cpp index b39f4892..b0b65082 100644 --- a/tests/test_filter_ipc.cpp +++ b/tests/test_filter_ipc.cpp @@ -30,6 +30,9 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include +#include + void setUp () { setup_test_context (); diff --git a/tests/test_fork.cpp b/tests/test_fork.cpp index 5477d980..ebcf5bca 100644 --- a/tests/test_fork.cpp +++ b/tests/test_fork.cpp @@ -32,6 +32,10 @@ #include +#include +#include +#include + void setUp () { setup_test_context (); diff --git a/tests/test_getsockopt_memset.cpp b/tests/test_getsockopt_memset.cpp index d19cb4d8..f90df9b4 100644 --- a/tests/test_getsockopt_memset.cpp +++ b/tests/test_getsockopt_memset.cpp @@ -25,6 +25,7 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include void setUp () { setup_test_context (); diff --git a/tests/test_heartbeats.cpp b/tests/test_heartbeats.cpp index 00644707..8ecc3f6f 100644 --- a/tests/test_heartbeats.cpp +++ b/tests/test_heartbeats.cpp @@ -26,10 +26,13 @@ typedef SOCKET raw_socket; #else #include +#include typedef int raw_socket; #endif #include +#include +#include // TODO remove this here, either ensure that UINT16_MAX is always properly // defined or handle this at a more central location diff --git a/tests/test_hwm_pubsub.cpp b/tests/test_hwm_pubsub.cpp index ab8cec41..bb634097 100644 --- a/tests/test_hwm_pubsub.cpp +++ b/tests/test_hwm_pubsub.cpp @@ -30,6 +30,8 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include + // NOTE: on OSX the endpoint returned by ZMQ_LAST_ENDPOINT may be quite long, // ensure we have extra space for that: #define SOCKET_STRING_LEN (MAX_SOCKET_STRING * 4) diff --git a/tests/test_iov.cpp b/tests/test_iov.cpp index f38d3183..66d5bbcd 100644 --- a/tests/test_iov.cpp +++ b/tests/test_iov.cpp @@ -30,6 +30,8 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include +#include #include void setUp () diff --git a/tests/test_metadata.cpp b/tests/test_metadata.cpp index 686ce581..746f185c 100644 --- a/tests/test_metadata.cpp +++ b/tests/test_metadata.cpp @@ -30,6 +30,7 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include #include void setUp () diff --git a/tests/test_mock_pub_sub.cpp b/tests/test_mock_pub_sub.cpp index 13ca7fd2..c8a01fc0 100644 --- a/tests/test_mock_pub_sub.cpp +++ b/tests/test_mock_pub_sub.cpp @@ -27,9 +27,12 @@ typedef SOCKET raw_socket; #else #include +#include typedef int raw_socket; #endif +#include +#include void setUp () { diff --git a/tests/test_monitor.cpp b/tests/test_monitor.cpp index 485dd409..a484c052 100644 --- a/tests/test_monitor.cpp +++ b/tests/test_monitor.cpp @@ -32,6 +32,9 @@ #include "testutil_unity.hpp" +#include +#include + void setUp () { setup_test_context (); diff --git a/tests/test_msg_ffn.cpp b/tests/test_msg_ffn.cpp index fd8c18db..e27d11dd 100644 --- a/tests/test_msg_ffn.cpp +++ b/tests/test_msg_ffn.cpp @@ -30,6 +30,8 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include + void setUp () { setup_test_context (); diff --git a/tests/test_pair_tcp.cpp b/tests/test_pair_tcp.cpp index 2b16ffb3..0b575ece 100644 --- a/tests/test_pair_tcp.cpp +++ b/tests/test_pair_tcp.cpp @@ -30,6 +30,8 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include + void setUp () { setup_test_context (); diff --git a/tests/test_poller.cpp b/tests/test_poller.cpp index 49cef95b..d1a5b184 100644 --- a/tests/test_poller.cpp +++ b/tests/test_poller.cpp @@ -33,6 +33,13 @@ #include #include +#ifndef _WIN32 +#include +#include +#include +#include +#endif + void setUp () { setup_test_context (); diff --git a/tests/test_proxy.cpp b/tests/test_proxy.cpp index 632fa0a7..d4010e5e 100644 --- a/tests/test_proxy.cpp +++ b/tests/test_proxy.cpp @@ -30,6 +30,9 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include +#include + void setUp () { setup_test_context (); diff --git a/tests/test_proxy_hwm.cpp b/tests/test_proxy_hwm.cpp index bf1addbf..c2ebaaf1 100644 --- a/tests/test_proxy_hwm.cpp +++ b/tests/test_proxy_hwm.cpp @@ -29,8 +29,10 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include #include #include +#include // // Asynchronous proxy test using ZMQ_XPUB_NODROP and HWM: diff --git a/tests/test_proxy_single_socket.cpp b/tests/test_proxy_single_socket.cpp index 1aa9c0e0..31a9adf0 100644 --- a/tests/test_proxy_single_socket.cpp +++ b/tests/test_proxy_single_socket.cpp @@ -30,6 +30,8 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include + void setUp () { setup_test_context (); diff --git a/tests/test_proxy_terminate.cpp b/tests/test_proxy_terminate.cpp index 1dfbae48..215eb384 100644 --- a/tests/test_proxy_terminate.cpp +++ b/tests/test_proxy_terminate.cpp @@ -30,6 +30,8 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include + void setUp () { setup_test_context (); diff --git a/tests/test_pub_invert_matching.cpp b/tests/test_pub_invert_matching.cpp index bc81fea7..330bbb03 100644 --- a/tests/test_pub_invert_matching.cpp +++ b/tests/test_pub_invert_matching.cpp @@ -30,6 +30,8 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include + void setUp () { setup_test_context (); diff --git a/tests/test_radio_dish.cpp b/tests/test_radio_dish.cpp index fbac309f..6a7c1476 100644 --- a/tests/test_radio_dish.cpp +++ b/tests/test_radio_dish.cpp @@ -32,6 +32,15 @@ #include +#include + +#ifndef _WIN32 +#include +#include +#include +#include +#endif + // Helper macro to define the v4/v6 function pairs #define MAKE_TEST_V4V6(_test) \ static void _test##_ipv4 () { _test (false); } \ diff --git a/tests/test_reqrep_ipc.cpp b/tests/test_reqrep_ipc.cpp index 76996a4a..d488c470 100644 --- a/tests/test_reqrep_ipc.cpp +++ b/tests/test_reqrep_ipc.cpp @@ -30,6 +30,7 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include #include void setUp () diff --git a/tests/test_reqrep_tcp.cpp b/tests/test_reqrep_tcp.cpp index 3b81cc71..71da2c3d 100644 --- a/tests/test_reqrep_tcp.cpp +++ b/tests/test_reqrep_tcp.cpp @@ -30,6 +30,8 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include + void setUp () { setup_test_context (); diff --git a/tests/test_router_mandatory.cpp b/tests/test_router_mandatory.cpp index ca20f856..7bfd0d8d 100644 --- a/tests/test_router_mandatory.cpp +++ b/tests/test_router_mandatory.cpp @@ -30,6 +30,7 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include #include void setUp () diff --git a/tests/test_router_notify.cpp b/tests/test_router_notify.cpp index 6b76ad26..aad1d9e1 100644 --- a/tests/test_router_notify.cpp +++ b/tests/test_router_notify.cpp @@ -30,6 +30,7 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include #include void setUp () diff --git a/tests/test_security_gssapi.cpp b/tests/test_security_gssapi.cpp index 5e699268..4d552a3f 100644 --- a/tests/test_security_gssapi.cpp +++ b/tests/test_security_gssapi.cpp @@ -41,6 +41,9 @@ #include #endif +#include +#include + // This test requires a KRB5 environment with the following // service principal (substitute your host.domain and REALM): // diff --git a/tests/test_security_null.cpp b/tests/test_security_null.cpp index f63a3459..87aac91e 100644 --- a/tests/test_security_null.cpp +++ b/tests/test_security_null.cpp @@ -42,6 +42,8 @@ #include #endif +#include + static void zap_handler (void *handler_) { // Process ZAP requests forever diff --git a/tests/test_security_plain.cpp b/tests/test_security_plain.cpp index 2e08fb82..61599880 100644 --- a/tests/test_security_plain.cpp +++ b/tests/test_security_plain.cpp @@ -42,6 +42,9 @@ #include #endif +#include +#include + static void zap_handler (void *zap_) { // Process ZAP requests forever diff --git a/tests/test_setsockopt.cpp b/tests/test_setsockopt.cpp index bb3d0a8b..29c48a77 100644 --- a/tests/test_setsockopt.cpp +++ b/tests/test_setsockopt.cpp @@ -30,6 +30,8 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include + void setUp () { setup_test_context (); diff --git a/tests/test_shutdown_stress_tipc.cpp b/tests/test_shutdown_stress_tipc.cpp index e20a22da..abcd2b6c 100644 --- a/tests/test_shutdown_stress_tipc.cpp +++ b/tests/test_shutdown_stress_tipc.cpp @@ -30,6 +30,8 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include + void setUp () { } diff --git a/tests/test_spec_pushpull.cpp b/tests/test_spec_pushpull.cpp index 0cf19e52..3ae16a1a 100644 --- a/tests/test_spec_pushpull.cpp +++ b/tests/test_spec_pushpull.cpp @@ -30,6 +30,9 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include +#include + void setUp () { setup_test_context (); diff --git a/tests/test_spec_rep.cpp b/tests/test_spec_rep.cpp index 1c9d3de4..816e0dbf 100644 --- a/tests/test_spec_rep.cpp +++ b/tests/test_spec_rep.cpp @@ -30,6 +30,7 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include #include void setUp () diff --git a/tests/test_spec_router.cpp b/tests/test_spec_router.cpp index fe4ada47..87c7610c 100644 --- a/tests/test_spec_router.cpp +++ b/tests/test_spec_router.cpp @@ -30,6 +30,8 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include +#include #include void setUp () diff --git a/tests/test_srcfd.cpp b/tests/test_srcfd.cpp index 85158e9c..ae855f27 100644 --- a/tests/test_srcfd.cpp +++ b/tests/test_srcfd.cpp @@ -30,6 +30,7 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include #include void setUp () diff --git a/tests/test_stream.cpp b/tests/test_stream.cpp index b15fe1fd..cc16b8e5 100644 --- a/tests/test_stream.cpp +++ b/tests/test_stream.cpp @@ -30,6 +30,8 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include + void setUp () { setup_test_context (); diff --git a/tests/test_stream_disconnect.cpp b/tests/test_stream_disconnect.cpp index be843079..6859dc8b 100644 --- a/tests/test_stream_disconnect.cpp +++ b/tests/test_stream_disconnect.cpp @@ -30,6 +30,8 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include + void setUp () { setup_test_context (); diff --git a/tests/test_stream_exceeds_buffer.cpp b/tests/test_stream_exceeds_buffer.cpp index 11b0f5d2..e3ef19d9 100644 --- a/tests/test_stream_exceeds_buffer.cpp +++ b/tests/test_stream_exceeds_buffer.cpp @@ -30,6 +30,14 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include + +#ifndef _WIN32 +#include +#include +#include +#endif + void setUp () { setup_test_context (); diff --git a/tests/test_stream_timeout.cpp b/tests/test_stream_timeout.cpp index 5cca887c..41cab0c6 100644 --- a/tests/test_stream_timeout.cpp +++ b/tests/test_stream_timeout.cpp @@ -30,6 +30,9 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include +#include + void setUp () { setup_test_context (); diff --git a/tests/test_unbind_wildcard.cpp b/tests/test_unbind_wildcard.cpp index f4d19fd5..8d09fd5f 100644 --- a/tests/test_unbind_wildcard.cpp +++ b/tests/test_unbind_wildcard.cpp @@ -20,6 +20,8 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include + void setUp () { setup_test_context (); diff --git a/tests/test_use_fd.cpp b/tests/test_use_fd.cpp index e9852b13..49e2e0f2 100644 --- a/tests/test_use_fd.cpp +++ b/tests/test_use_fd.cpp @@ -30,7 +30,10 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include +#include #include +#include void setUp () { @@ -47,6 +50,7 @@ void tearDown () #include #include #include +#include int setup_socket_and_set_fd (void *zmq_socket_, int af_, diff --git a/tests/test_zmq_poll_fd.cpp b/tests/test_zmq_poll_fd.cpp index 77a32a8d..4df49c56 100644 --- a/tests/test_zmq_poll_fd.cpp +++ b/tests/test_zmq_poll_fd.cpp @@ -31,8 +31,13 @@ #include "testutil_unity.hpp" #include +#include #include +#ifndef _WIN32 +#include +#endif + void setUp () { setup_test_context (); diff --git a/tests/testutil.cpp b/tests/testutil.cpp index ce152e5f..2ea4e3a7 100644 --- a/tests/testutil.cpp +++ b/tests/testutil.cpp @@ -29,8 +29,38 @@ #include "testutil.hpp" #include "testutil_unity.hpp" +#include #include +#if defined _WIN32 +#include "../src/windows.hpp" +#if defined _MSC_VER +#include +#pragma warning(disable : 4996) +// iphlpapi is needed for if_nametoindex (not on Windows XP) +#if !defined ZMQ_HAVE_WINDOWS_TARGET_XP +#pragma comment(lib, "iphlpapi") +#endif +#endif +#else +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if defined(ZMQ_HAVE_AIX) +#include +#include +#endif +#endif + const char *SEQ_END = (const char *) 1; const char bounce_content[] = "12345678ABCDEFGH12345678abcdefgh"; diff --git a/tests/testutil.hpp b/tests/testutil.hpp index 87627a5b..b06efc5b 100644 --- a/tests/testutil.hpp +++ b/tests/testutil.hpp @@ -58,39 +58,6 @@ #define PORT_6 5561 #undef NDEBUG -#include -#include -#include -#include - -#if defined _WIN32 -#include "../src/windows.hpp" -#if defined _MSC_VER -#include -#pragma warning(disable : 4996) -// iphlpapi is needed for if_nametoindex (not on Windows XP) -#if !defined ZMQ_HAVE_WINDOWS_TARGET_XP -#pragma comment(lib, "iphlpapi") -#endif -#endif -#else -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if defined(ZMQ_HAVE_AIX) -#include -#include -#endif -#endif // duplicated from fd.hpp #ifdef ZMQ_HAVE_WINDOWS diff --git a/tests/testutil_monitoring.cpp b/tests/testutil_monitoring.cpp index 10c1b549..3afb455f 100644 --- a/tests/testutil_monitoring.cpp +++ b/tests/testutil_monitoring.cpp @@ -29,6 +29,9 @@ #include "testutil_monitoring.hpp" #include "testutil_unity.hpp" +#include +#include + // Read one event off the monitor socket; return value and address // by reference, if not null, and event number by value. Returns -1 // in case of error. diff --git a/tests/testutil_security.cpp b/tests/testutil_security.cpp index 3cfe7999..90803e4d 100644 --- a/tests/testutil_security.cpp +++ b/tests/testutil_security.cpp @@ -28,6 +28,9 @@ */ #include "testutil_security.hpp" +#include +#include + const char *test_zap_domain = "ZAPTEST"; void socket_config_null_client (void *server_, void *server_secret_) diff --git a/tests/testutil_unity.cpp b/tests/testutil_unity.cpp index 51b671f8..0d217238 100644 --- a/tests/testutil_unity.cpp +++ b/tests/testutil_unity.cpp @@ -28,6 +28,13 @@ */ #include "testutil_unity.hpp" +#include +#include + +#ifndef _WIN32 +#include +#endif + int test_assert_success_message_errno_helper (int rc_, const char *msg_, const char *expr_) diff --git a/unittests/unittest_ip_resolver.cpp b/unittests/unittest_ip_resolver.cpp index 01c36371..75939e0e 100644 --- a/unittests/unittest_ip_resolver.cpp +++ b/unittests/unittest_ip_resolver.cpp @@ -25,6 +25,12 @@ along with this program. If not, see . #include #include +#ifndef _WIN32 +#include +#include +#include +#endif + void setUp () { } diff --git a/unittests/unittest_resolver_common.hpp b/unittests/unittest_resolver_common.hpp index 2a874c35..ebbc446f 100644 --- a/unittests/unittest_resolver_common.hpp +++ b/unittests/unittest_resolver_common.hpp @@ -21,6 +21,7 @@ along with this program. If not, see . #define __UNITTEST_RESOLVER_COMMON_INCLUDED__ #include +#include // Attempt a resolution and test the results. //