NO-JIRA: C++ enable warnings as errors for examples and tests. Fixed warnings for gcc++ and clang++, 03 and 11, including some real bugs. Removed some redundant FIXME comments.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/95c99503 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/95c99503 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/95c99503 Branch: refs/heads/master Commit: 95c99503ad94e9fe2f92fdc7a8a520193c9710c2 Parents: e6086da Author: Alan Conway <[email protected]> Authored: Tue May 3 16:07:49 2016 -0400 Committer: Alan Conway <[email protected]> Committed: Fri May 13 14:51:26 2016 -0400 ---------------------------------------------------------------------- examples/cpp/broker.hpp | 5 +++-- examples/cpp/encode_decode.cpp | 8 ++++---- examples/cpp/flow_control.cpp | 3 +++ examples/cpp/helloworld_direct.cpp | 2 +- examples/cpp/mt/broker.cpp | 2 +- examples/cpp/mt/epoll_controller.cpp | 8 ++++---- examples/cpp/options.hpp | 2 +- examples/cpp/queue_browser.cpp | 2 +- examples/cpp/selected_recv.cpp | 2 +- examples/cpp/server.cpp | 7 +++---- examples/cpp/server_direct.cpp | 5 +++-- examples/cpp/simple_send.cpp | 6 +++--- examples/cpp/ssl.cpp | 4 ++-- examples/cpp/ssl_client_cert.cpp | 6 +++--- proton-c/CMakeLists.txt | 4 ++++ proton-c/bindings/cpp/CMakeLists.txt | 4 +++- proton-c/bindings/cpp/src/codec_test.cpp | 11 ++++++----- proton-c/bindings/cpp/src/engine_test.cpp | 10 +++++++--- proton-c/bindings/cpp/src/interop_test.cpp | 8 +++++--- proton-c/bindings/cpp/src/message_test.cpp | 12 +++++++----- proton-c/bindings/cpp/src/scalar_test.cpp | 12 ++++++++---- proton-c/bindings/cpp/src/test_bits.hpp | 2 +- proton-c/bindings/cpp/src/value_test.cpp | 9 ++++++--- .../org/apache/qpid/proton/amqp/messaging/Terminus.java | 6 +++--- 24 files changed, 83 insertions(+), 57 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/95c99503/examples/cpp/broker.hpp ---------------------------------------------------------------------- diff --git a/examples/cpp/broker.hpp b/examples/cpp/broker.hpp index 6eb45f9..5bcf121 100644 --- a/examples/cpp/broker.hpp +++ b/examples/cpp/broker.hpp @@ -63,7 +63,7 @@ class queue { return (consumers_.size() == 0 && (dynamic_ || messages_.size() == 0)); } - void publish(const proton::message &m, proton::receiver r) { + void publish(const proton::message &m) { messages_.push_back(m); dispatch(0); } @@ -118,6 +118,7 @@ class queue { class queues { public: queues() : next_id_(0) {} + virtual ~queues() {} // Get or create a queue. virtual queue &get(const std::string &address = std::string()) { @@ -225,7 +226,7 @@ class broker_handler : public proton::handler { void on_message(proton::delivery &d, proton::message &m) override { std::string address = d.receiver().target().address(); - queues_.get(address).publish(m, d.receiver()); + queues_.get(address).publish(m); } protected: http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/95c99503/examples/cpp/encode_decode.cpp ---------------------------------------------------------------------- diff --git a/examples/cpp/encode_decode.cpp b/examples/cpp/encode_decode.cpp index b1c39b8..832c78a 100644 --- a/examples/cpp/encode_decode.cpp +++ b/examples/cpp/encode_decode.cpp @@ -59,7 +59,7 @@ template<class K, class T> ostream& operator<<(ostream& o, const map<K, T>& m) { } // Insert/extract native C++ containers with uniform type values. -void uniform_containers() { +static void uniform_containers() { std::cout << std::endl << "== Array, list and map of uniform type." << std::endl; proton::value v; @@ -111,7 +111,7 @@ void uniform_containers() { } // Containers with mixed types use value to represent arbitrary AMQP types. -void mixed_containers() { +static void mixed_containers() { std::cout << std::endl << "== List and map of mixed type values." << std::endl; proton::value v; @@ -134,7 +134,7 @@ void mixed_containers() { } // Insert using stream operators (see print_next for example of extracting with stream ops.) -void insert_stream_operators() { +static void insert_stream_operators() { std::cout << std::endl << "== Insert with stream operators." << std::endl; proton::value v; @@ -178,7 +178,7 @@ int main(int, char**) { // NOTE this is for example puroses only: There is a built in ostream operator<< for values. // // -void print_next(proton::codec::decoder& d) { +static void print_next(proton::codec::decoder& d) { proton::type_id type = d.next_type(); proton::codec::start s; switch (type) { http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/95c99503/examples/cpp/flow_control.cpp ---------------------------------------------------------------------- diff --git a/examples/cpp/flow_control.cpp b/examples/cpp/flow_control.cpp index 48d31d2..271cb9e 100644 --- a/examples/cpp/flow_control.cpp +++ b/examples/cpp/flow_control.cpp @@ -33,6 +33,8 @@ #include "fake_cpp11.hpp" +namespace { + bool verbose = true; void verify(bool success, const std::string &msg) { @@ -44,6 +46,7 @@ void verify(bool success, const std::string &msg) { } } +} // flow_sender manages the incoming connection and acts as the message sender. class flow_sender : public proton::handler { http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/95c99503/examples/cpp/helloworld_direct.cpp ---------------------------------------------------------------------- diff --git a/examples/cpp/helloworld_direct.cpp b/examples/cpp/helloworld_direct.cpp index 856cd18..f8d8fa8 100644 --- a/examples/cpp/helloworld_direct.cpp +++ b/examples/cpp/helloworld_direct.cpp @@ -49,7 +49,7 @@ class hello_world_direct : public proton::handler { s.close(); } - void on_message(proton::delivery &d, proton::message &m) override { + void on_message(proton::delivery &, proton::message &m) override { std::cout << m.body() << std::endl; } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/95c99503/examples/cpp/mt/broker.cpp ---------------------------------------------------------------------- diff --git a/examples/cpp/mt/broker.cpp b/examples/cpp/mt/broker.cpp index ff8e051..526d59d 100644 --- a/examples/cpp/mt/broker.cpp +++ b/examples/cpp/mt/broker.cpp @@ -247,7 +247,7 @@ class broker { } void run() { - for(int i = 0; i < std::thread::hardware_concurrency(); ++i) + for(size_t i = 0; i < std::thread::hardware_concurrency(); ++i) std::thread(&proton::controller::run, controller_.get()).detach(); controller_->wait(); } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/95c99503/examples/cpp/mt/epoll_controller.cpp ---------------------------------------------------------------------- diff --git a/examples/cpp/mt/epoll_controller.cpp b/examples/cpp/mt/epoll_controller.cpp index 311ed08..80aba0c 100644 --- a/examples/cpp/mt/epoll_controller.cpp +++ b/examples/cpp/mt/epoll_controller.cpp @@ -141,9 +141,9 @@ class epoll_controller : public proton::controller { std::map<pollable*, std::unique_ptr<pollable_engine> > engines_; std::condition_variable stopped_; - std::atomic<size_t> threads_; bool stopping_; proton::error_condition stop_err_; + std::atomic<size_t> threads_; }; // Base class for pollable file-descriptors. Manages epoll interaction, @@ -154,13 +154,13 @@ class pollable { { int flags = check(::fcntl(fd, F_GETFL, 0), "non-blocking"); check(::fcntl(fd, F_SETFL, flags | O_NONBLOCK), "non-blocking"); - ::epoll_event ev = {0}; + ::epoll_event ev = {}; ev.data.ptr = this; ::epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, fd_, &ev); } virtual ~pollable() { - ::epoll_event ev = {0}; + ::epoll_event ev = {}; ::epoll_ctl(epoll_fd_, EPOLL_CTL_DEL, fd_, &ev); // Ignore errors. } @@ -501,7 +501,7 @@ void epoll_controller::wait() { void epoll_controller::interrupt() { // Add an always-readable fd with 0 data and no ONESHOT to interrupt all threads. - epoll_event ev = {0}; + epoll_event ev = {}; ev.events = EPOLLIN; check(epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, interrupt_fd_, &ev), "interrupt"); } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/95c99503/examples/cpp/options.hpp ---------------------------------------------------------------------- diff --git a/examples/cpp/options.hpp b/examples/cpp/options.hpp index 54f6503..dab1bc2 100644 --- a/examples/cpp/options.hpp +++ b/examples/cpp/options.hpp @@ -91,7 +91,7 @@ class options { virtual ~option() {} virtual bool parse(int argc, char const * const * argv, int &i) = 0; - virtual void print_default(std::ostream&) const {}; + virtual void print_default(std::ostream&) const {} friend std::ostream& operator<<(std::ostream& os, const option& op) { os << " " << op.short_; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/95c99503/examples/cpp/queue_browser.cpp ---------------------------------------------------------------------- diff --git a/examples/cpp/queue_browser.cpp b/examples/cpp/queue_browser.cpp index 87cb147..e4fc29e 100644 --- a/examples/cpp/queue_browser.cpp +++ b/examples/cpp/queue_browser.cpp @@ -46,7 +46,7 @@ class browser : public proton::handler { conn.open_receiver(url.path(), proton::receiver_options().source(browsing)); } - void on_message(proton::delivery &d, proton::message &m) override { + void on_message(proton::delivery &, proton::message &m) override { std::cout << m.body() << std::endl; } }; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/95c99503/examples/cpp/selected_recv.cpp ---------------------------------------------------------------------- diff --git a/examples/cpp/selected_recv.cpp b/examples/cpp/selected_recv.cpp index e1529e4..5bb65ff 100644 --- a/examples/cpp/selected_recv.cpp +++ b/examples/cpp/selected_recv.cpp @@ -67,7 +67,7 @@ class selected_recv : public proton::handler { conn.open_receiver(url.path(), proton::receiver_options().source(opts)); } - void on_message(proton::delivery &d, proton::message &m) override { + void on_message(proton::delivery &, proton::message &m) override { std::cout << m.body() << std::endl; } }; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/95c99503/examples/cpp/server.cpp ---------------------------------------------------------------------- diff --git a/examples/cpp/server.cpp b/examples/cpp/server.cpp index f4c75d7..6f2f150 100644 --- a/examples/cpp/server.cpp +++ b/examples/cpp/server.cpp @@ -54,13 +54,12 @@ class server : public proton::handler { std::string to_upper(const std::string &s) { std::string uc(s); size_t l = uc.size(); - - for (size_t i=0; i<l; i++) uc[i] = std::toupper(uc[i]); - + for (size_t i=0; i<l; i++) + uc[i] = static_cast<char>(std::toupper(uc[i])); return uc; } - void on_message(proton::delivery &d, proton::message &m) override { + void on_message(proton::delivery &, proton::message &m) override { std::cout << "Received " << m.body() << std::endl; std::string reply_to = m.reply_to(); http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/95c99503/examples/cpp/server_direct.cpp ---------------------------------------------------------------------- diff --git a/examples/cpp/server_direct.cpp b/examples/cpp/server_direct.cpp index 28fd7a2..fc7aa67 100644 --- a/examples/cpp/server_direct.cpp +++ b/examples/cpp/server_direct.cpp @@ -55,7 +55,8 @@ class server : public proton::handler { std::string uc(s); size_t l = uc.size(); - for (size_t i=0; i<l; i++) uc[i] = std::toupper(uc[i]); + for (size_t i=0; i<l; i++) + uc[i] = static_cast<char>(std::toupper(uc[i])); return uc; } @@ -75,7 +76,7 @@ class server : public proton::handler { } } - void on_message(proton::delivery &d, proton::message &m) override { + void on_message(proton::delivery &, proton::message &m) override { std::cout << "Received " << m.body() << std::endl; std::string reply_to = m.reply_to(); http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/95c99503/examples/cpp/simple_send.cpp ---------------------------------------------------------------------- diff --git a/examples/cpp/simple_send.cpp b/examples/cpp/simple_send.cpp index 3a70651..594b7d6 100644 --- a/examples/cpp/simple_send.cpp +++ b/examples/cpp/simple_send.cpp @@ -47,8 +47,8 @@ class simple_send : public proton::handler { sender = c.open_sender(url); } - void on_sendable(proton::sender &sender) override { - while (sender.credit() && sent < total) { + void on_sendable(proton::sender &s) override { + while (s.credit() && sent < total) { proton::message msg; std::map<std::string, int> m; m["sequence"] = sent + 1; @@ -56,7 +56,7 @@ class simple_send : public proton::handler { msg.id(sent + 1); msg.body(m); - sender.send(msg); + s.send(msg); sent++; } } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/95c99503/examples/cpp/ssl.cpp ---------------------------------------------------------------------- diff --git a/examples/cpp/ssl.cpp b/examples/cpp/ssl.cpp index 6ecf2cc..f4e724d 100644 --- a/examples/cpp/ssl.cpp +++ b/examples/cpp/ssl.cpp @@ -41,7 +41,7 @@ using proton::ssl_certificate; bool using_OpenSSL(); std::string platform_CA(const std::string &base_name); ssl_certificate platform_certificate(const std::string &base_name, const std::string &passwd); -std::string cert_directory; +static std::string cert_directory; std::string find_CN(const std::string &); @@ -54,7 +54,7 @@ struct server_handler : public proton::handler { acceptor.close(); } - void on_message(proton::delivery &d, proton::message &m) override { + void on_message(proton::delivery &, proton::message &m) override { std::cout << m.body() << std::endl; } }; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/95c99503/examples/cpp/ssl_client_cert.cpp ---------------------------------------------------------------------- diff --git a/examples/cpp/ssl_client_cert.cpp b/examples/cpp/ssl_client_cert.cpp index 58e3e9e..0708d2c 100644 --- a/examples/cpp/ssl_client_cert.cpp +++ b/examples/cpp/ssl_client_cert.cpp @@ -43,8 +43,8 @@ using proton::sasl; bool using_OpenSSL(); std::string platform_CA(const std::string &base_name); ssl_certificate platform_certificate(const std::string &base_name, const std::string &passwd); -std::string cert_directory; -std::string find_CN(const std::string &); +static std::string cert_directory; +static std::string find_CN(const std::string &); struct server_handler : public proton::handler { @@ -64,7 +64,7 @@ struct server_handler : public proton::handler { inbound_listener.close(); } - void on_message(proton::delivery &d, proton::message &m) override { + void on_message(proton::delivery &, proton::message &m) override { std::cout << m.body() << std::endl; } }; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/95c99503/proton-c/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt index 8219256..afd4126 100644 --- a/proton-c/CMakeLists.txt +++ b/proton-c/CMakeLists.txt @@ -253,6 +253,10 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") set (CXX_WARNING_FLAGS "${WERROR} -pedantic -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-float-equal -Wno-padded -Wno-sign-conversion -Wno-switch-enum -Wno-weak-vtables -Wno-exit-time-destructors -Wno-global-constructors -Wno-shorten-64-to-32 -Wno-documentation -Wno-documentation-unknown-command -Wno-old-style-cast -Wno-missing-noreturn") endif() +# Make CXX_WARNING_FLAGS visible to examples. +set(CXX_WARNING_FLAGS "${CXX_WARNING_FLAGS}" PARENT_SCOPE) + + if (MSVC) set(CMAKE_DEBUG_POSTFIX "d") add_definitions( http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/95c99503/proton-c/bindings/cpp/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt index 2aec4e2..08da50d 100644 --- a/proton-c/bindings/cpp/CMakeLists.txt +++ b/proton-c/bindings/cpp/CMakeLists.txt @@ -24,6 +24,8 @@ include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/src") +add_definitions(${CXX_WARNING_FLAGS}) + set(qpid-proton-cpp-source ${qpid-proton-mt-source} src/acceptor.cpp @@ -90,7 +92,7 @@ endif() set_source_files_properties ( ${qpid-proton-cpp-source} PROPERTIES - COMPILE_FLAGS "${CXX_WARNING_FLAGS} ${LTO}" + COMPILE_FLAGS "${LTO}" ) add_library(qpid-proton-cpp SHARED ${qpid-proton-cpp-source}) http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/95c99503/proton-c/bindings/cpp/src/codec_test.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/codec_test.cpp b/proton-c/bindings/cpp/src/codec_test.cpp index ec5cf9a..293da17 100644 --- a/proton-c/bindings/cpp/src/codec_test.cpp +++ b/proton-c/bindings/cpp/src/codec_test.cpp @@ -1,5 +1,3 @@ -#ifndef CODEC_TEST_HPP -#define CODEC_TEST_HPP /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -23,6 +21,9 @@ #include <proton/types.hpp> #include <proton/data.hpp> +#include <proton/config.hpp> + +namespace { using namespace test; using namespace proton; @@ -47,6 +48,8 @@ template <class T> void uncodable_type_test() { ASSERT(!codec::is_encodable<T>::value); } +} + int main(int, char**) { int failed = 0; @@ -88,7 +91,7 @@ int main(int, char**) { RUN_TEST(failed, simple_type_test(static_cast<unsigned int>(42))); RUN_TEST(failed, simple_type_test(static_cast<unsigned long>(42))); -#if PN_HAS_LONG_LONG +#if PN_CPP_HAS_LONG_LONG RUN_TEST(failed, simple_type_test(static_cast<long>(42))); RUN_TEST(failed, simple_type_test(static_cast<signed long>(42))); RUN_TEST(failed, simple_type_test(static_cast<unsigned long>(42))); @@ -112,5 +115,3 @@ int main(int, char**) { return failed; } - -#endif // CODEC_TEST_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/95c99503/proton-c/bindings/cpp/src/engine_test.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/engine_test.cpp b/proton-c/bindings/cpp/src/engine_test.cpp index e070b50..7ae05b1 100644 --- a/proton-c/bindings/cpp/src/engine_test.cpp +++ b/proton-c/bindings/cpp/src/engine_test.cpp @@ -31,6 +31,8 @@ #define override #endif +namespace { + using namespace proton::io; using namespace proton; using namespace test; @@ -164,7 +166,7 @@ void test_endpoint_close() { ca.close(proton::error_condition("conn", "bad connection")); while (!cb.closed()) e.process(); ASSERT_EQUAL("conn: bad connection", cb.error().what()); - ASSERT_EQUAL(1, hb.connection_errors.size()); + ASSERT_EQUAL(1u, hb.connection_errors.size()); ASSERT_EQUAL("conn: bad connection", hb.connection_errors.front()); } @@ -176,12 +178,14 @@ void test_transport_close() { while (!e.b.connection().active()) e.process(); e.a.close(proton::error_condition("oops", "engine failure")); ASSERT(!e.a.dispatch()); // Final dispatch on a. - ASSERT_EQUAL(1, ha.transport_errors.size()); + ASSERT_EQUAL(1u, ha.transport_errors.size()); ASSERT_EQUAL("oops: engine failure", ha.transport_errors.front()); ASSERT_EQUAL(proton::error_condition("oops", "engine failure"),e.a.transport().error()); // But connectoin was never protocol closed. ASSERT(!e.a.connection().closed()); - ASSERT_EQUAL(0, ha.connection_errors.size()); + ASSERT_EQUAL(0u, ha.connection_errors.size()); +} + } int main(int, char**) { http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/95c99503/proton-c/bindings/cpp/src/interop_test.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/interop_test.cpp b/proton-c/bindings/cpp/src/interop_test.cpp index abe7cb8..bcadcfe 100644 --- a/proton-c/bindings/cpp/src/interop_test.cpp +++ b/proton-c/bindings/cpp/src/interop_test.cpp @@ -28,6 +28,8 @@ #include <streambuf> #include <iosfwd> +namespace { + using namespace std; using namespace proton; using namespace proton::codec; @@ -65,9 +67,9 @@ void test_decoder_primitves_exact() { ASSERT_EQUAL(42, get< ::uint16_t>(d)); try { get< ::uint16_t>(d); FAIL("got short as ushort"); } catch(conversion_error){} ASSERT_EQUAL(-42, get< ::int16_t>(d)); - ASSERT_EQUAL(12345, get< ::uint32_t>(d)); + ASSERT_EQUAL(12345u, get< ::uint32_t>(d)); ASSERT_EQUAL(-12345, get< ::int32_t>(d)); - ASSERT_EQUAL(12345, get< ::uint64_t>(d)); + ASSERT_EQUAL(12345u, get< ::uint64_t>(d)); ASSERT_EQUAL(-12345, get< ::int64_t>(d)); try { get<double>(d); FAIL("got float as double"); } catch(conversion_error){} ASSERT_EQUAL(0.125, get<float>(d)); @@ -91,7 +93,7 @@ void test_encoder_primitives() { ASSERT_EQUAL(read("primitives"), data); } -// TODO aconway 2015-06-11: interop test is not complete. +} int main(int argc, char** argv) { int failed = 0; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/95c99503/proton-c/bindings/cpp/src/message_test.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/message_test.cpp b/proton-c/bindings/cpp/src/message_test.cpp index 6da7921..d5ba474 100644 --- a/proton-c/bindings/cpp/src/message_test.cpp +++ b/proton-c/bindings/cpp/src/message_test.cpp @@ -25,11 +25,12 @@ #include <streambuf> #include <iosfwd> +namespace { + using namespace std; using namespace proton; using namespace test; - #define CHECK_STR(ATTR) \ m.ATTR(#ATTR); \ ASSERT_EQUAL(std::string(#ATTR), m.ATTR()) @@ -118,7 +119,6 @@ void test_message_maps() { ASSERT_EQUAL(m.message_annotations()[23], scalar("23")); message m2(m); - message::annotation_map& amap = m2.delivery_annotations(); ASSERT_EQUAL(m2.properties()["foo"], scalar(12)); ASSERT_EQUAL(m2.delivery_annotations()["bar"], scalar("xyz")); @@ -129,15 +129,17 @@ void test_message_maps() { m.message_annotations().erase(23); m2 = m; - ASSERT_EQUAL(1, m2.properties().size()); + ASSERT_EQUAL(1u, m2.properties().size()); ASSERT_EQUAL(m2.properties()["foo"], scalar("newfoo")); - ASSERT_EQUAL(2, m2.delivery_annotations().size()); + ASSERT_EQUAL(2u, m2.delivery_annotations().size()); ASSERT_EQUAL(m2.delivery_annotations()["bar"], scalar("xyz")); ASSERT_EQUAL(m2.delivery_annotations()[24], scalar(1000)); ASSERT(m2.message_annotations().empty()); } -int main(int argc, char** argv) { +} + +int main(int, char**) { int failed = 0; RUN_TEST(failed, test_message_properties()); RUN_TEST(failed, test_message_body()); http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/95c99503/proton-c/bindings/cpp/src/scalar_test.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/scalar_test.cpp b/proton-c/bindings/cpp/src/scalar_test.cpp index cd00d31..4183af3 100644 --- a/proton-c/bindings/cpp/src/scalar_test.cpp +++ b/proton-c/bindings/cpp/src/scalar_test.cpp @@ -31,6 +31,8 @@ #include <sstream> +namespace { + using namespace std; using namespace proton; using namespace test; @@ -60,7 +62,7 @@ template <class T> void type_test(T x, type_id tid, T y) { try { \ (void)(EXPR); \ FAIL("expected conversion_error: " #EXPR); \ - } catch (const conversion_error& e) {} + } catch (const conversion_error&) {} void coerce_test() { scalar a; @@ -80,7 +82,7 @@ void coerce_test() { ASSERT_MISMATCH(a.get<timestamp>(), TIMESTAMP, SHORT); ASSERT_MISMATCH(a.as_string(), STRING, SHORT); ASSERT_EQUAL(a.as_int(), 42); - ASSERT_EQUAL(a.as_uint(), 42); + ASSERT_EQUAL(a.as_uint(), 42u); ASSERT_EQUAL(a.as_double(), 42); a = int16_t(-42); @@ -101,7 +103,7 @@ void encode_decode_test() { void message_id_test() { ASSERT_EQUAL(23, message_id(23).as_int()); - ASSERT_EQUAL(23, message_id(23).get<uint64_t>()); + ASSERT_EQUAL(23u, message_id(23).get<uint64_t>()); ASSERT(message_id("foo") != message_id(binary("foo"))); ASSERT_EQUAL(scalar("foo"), message_id("foo")); ASSERT_EQUAL("foo", message_id("foo").as_string()); @@ -112,13 +114,15 @@ void message_id_test() { void annotation_key_test() { ASSERT_EQUAL(23, annotation_key(23).as_int()); - ASSERT_EQUAL(23, annotation_key(23).get<uint64_t>()); + ASSERT_EQUAL(23u, annotation_key(23).get<uint64_t>()); ASSERT_EQUAL("foo", annotation_key("foo").as_string()); ASSERT_EQUAL(scalar(symbol("foo")), annotation_key("foo")); } template <class T> T make(const char c) { T x; std::fill(x.begin(), x.end(), c); return x; } +} + int main(int, char**) { int failed = 0; RUN_TEST(failed, type_test(false, BOOLEAN, true)); http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/95c99503/proton-c/bindings/cpp/src/test_bits.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/test_bits.hpp b/proton-c/bindings/cpp/src/test_bits.hpp index 18298cb..47643ce 100644 --- a/proton-c/bindings/cpp/src/test_bits.hpp +++ b/proton-c/bindings/cpp/src/test_bits.hpp @@ -40,7 +40,7 @@ void assert_equal(const T& want, const U& got, const std::string& what) { throw fail(MSG(what << " " << want << " != " << got)); } -void assert_equalish(double want, double got, double delta, const std::string& what) +inline void assert_equalish(double want, double got, double delta, const std::string& what) { if (!(fabs(want-got) <= delta)) throw fail(MSG(what << " " << want << " !=~ " << got)); http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/95c99503/proton-c/bindings/cpp/src/value_test.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/value_test.cpp b/proton-c/bindings/cpp/src/value_test.cpp index 7b4940a..8fed16e 100644 --- a/proton-c/bindings/cpp/src/value_test.cpp +++ b/proton-c/bindings/cpp/src/value_test.cpp @@ -22,6 +22,7 @@ #include <proton/types.hpp> #include <proton/error.hpp> +namespace { using namespace std; using namespace proton; @@ -126,10 +127,10 @@ void get_coerce_test() { ASSERT_EQUAL(2, coerce<uint16_t>(value(uint8_t(2)))); ASSERT_EQUAL(-2, coerce<int16_t>(value(int8_t(-2)))); - ASSERT_EQUAL(3, coerce<uint32_t>(value(uint16_t(3)))); + ASSERT_EQUAL(3u, coerce<uint32_t>(value(uint16_t(3)))); ASSERT_EQUAL(-3, coerce<int32_t>(value(int16_t(-3)))); - ASSERT_EQUAL(4, coerce<uint64_t>(value(uint32_t(4)))); + ASSERT_EQUAL(4u, coerce<uint64_t>(value(uint32_t(4)))); ASSERT_EQUAL(-4, coerce<int64_t>(value(int32_t(-4)))); ASSERT_EQUALISH(1.2, coerce<float>(value(double(1.2))), 0.001); @@ -146,6 +147,7 @@ void get_coerce_test() { try { get<symbol>(value(std::string())); FAIL("string as symbol"); } catch (conversion_error) {} } +} int main(int, char**) { int failed = 0; @@ -183,7 +185,7 @@ int main(int, char**) { RUN_TEST(failed, simple_integral_test<unsigned short>()); RUN_TEST(failed, simple_integral_test<unsigned int>()); RUN_TEST(failed, simple_integral_test<unsigned long>()); -#if PN_HAS_LONG_LONG +#if PN_CPP_HAS_LONG_LONG RUN_TEST(failed, simple_integral_test<long long>()); RUN_TEST(failed, simple_integral_test<unsigned long long>()); #endif @@ -221,5 +223,6 @@ int main(int, char**) { #endif RUN_TEST(failed, get_coerce_test()); + RUN_TEST(failed, null_test()); return failed; } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/95c99503/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Terminus.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Terminus.java b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Terminus.java index ef09837..844dfa4 100644 --- a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Terminus.java +++ b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Terminus.java @@ -39,7 +39,7 @@ public abstract class Terminus Terminus() { } - + protected Terminus(Terminus other) { _address = other._address; _durable = other._durable; @@ -48,10 +48,10 @@ public abstract class Terminus _dynamic = other._dynamic; if (other._dynamicNodeProperties != null) { // TODO: Do we need to copy or can we make a simple reference? - _dynamicNodeProperties = new HashMap(other._dynamicNodeProperties); // yFIXME + _dynamicNodeProperties = new HashMap(other._dynamicNodeProperties); } if (other._capabilities != null) { - _capabilities = other._capabilities.clone(); // FIXME? + _capabilities = other._capabilities.clone(); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
