NO-JIRA: c++: Enable -Werror -pedantic -Weverything for clang++ compiler, fix warnings.
- #if with undefined macro - old style casts (converted to enum conversions and const_cast) - sign/precision in implicit conversions - unused parameters - redundant default and break statements. - drop noexcept/throw() Following warnings are disabled, some may be worth enabling: -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 Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/fd52a332 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/fd52a332 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/fd52a332 Branch: refs/heads/go1 Commit: fd52a332f5392d64dec66fee9cbe4accc798a84d Parents: 213eef9 Author: Alan Conway <[email protected]> Authored: Mon Dec 28 14:48:32 2015 -0500 Committer: Alan Conway <[email protected]> Committed: Mon Dec 28 15:10:11 2015 -0500 ---------------------------------------------------------------------- cpp.cmake | 6 ---- proton-c/CMakeLists.txt | 3 +- proton-c/bindings/cpp/include/proton/config.hpp | 34 ++++++-------------- proton-c/bindings/cpp/include/proton/data.hpp | 2 +- .../bindings/cpp/include/proton/decoder.hpp | 2 +- .../bindings/cpp/include/proton/encoder.hpp | 2 +- proton-c/bindings/cpp/include/proton/error.hpp | 5 +-- .../bindings/cpp/include/proton/event_loop.hpp | 2 +- .../bindings/cpp/include/proton/message.hpp | 4 +-- .../bindings/cpp/include/proton/message_id.hpp | 1 + proton-c/bindings/cpp/include/proton/object.hpp | 4 +-- proton-c/bindings/cpp/include/proton/ssl.hpp | 4 --- proton-c/bindings/cpp/include/proton/types.hpp | 2 +- proton-c/bindings/cpp/include/proton/url.hpp | 2 +- proton-c/bindings/cpp/src/atom.cpp | 9 +++--- proton-c/bindings/cpp/src/connector.cpp | 10 +++--- proton-c/bindings/cpp/src/container_impl.cpp | 2 +- proton-c/bindings/cpp/src/contexts.cpp | 12 +++---- proton-c/bindings/cpp/src/contexts.hpp | 4 +-- proton-c/bindings/cpp/src/data.cpp | 2 +- proton-c/bindings/cpp/src/decoder.cpp | 9 +++--- proton-c/bindings/cpp/src/encoder.cpp | 8 ++--- proton-c/bindings/cpp/src/engine.cpp | 4 +-- proton-c/bindings/cpp/src/error.cpp | 4 +-- proton-c/bindings/cpp/src/event.cpp | 1 + proton-c/bindings/cpp/src/handler.cpp | 2 +- proton-c/bindings/cpp/src/message.cpp | 12 +++---- proton-c/bindings/cpp/src/message_test.cpp | 2 +- proton-c/bindings/cpp/src/messaging_adapter.cpp | 8 ++--- proton-c/bindings/cpp/src/messaging_event.cpp | 3 +- proton-c/bindings/cpp/src/messaging_handler.cpp | 2 +- proton-c/bindings/cpp/src/proton_bits.cpp | 4 +-- proton-c/bindings/cpp/src/proton_bits.hpp | 4 +-- proton-c/bindings/cpp/src/proton_event.cpp | 1 - proton-c/bindings/cpp/src/proton_handler.cpp | 2 +- proton-c/bindings/cpp/src/ssl.cpp | 2 +- proton-c/bindings/cpp/src/ssl_domain.cpp | 7 ++-- proton-c/bindings/cpp/src/terminus.cpp | 14 ++++---- proton-c/bindings/cpp/src/types.cpp | 13 ++++---- proton-c/bindings/cpp/src/url.cpp | 2 +- 40 files changed, 95 insertions(+), 121 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/cpp.cmake ---------------------------------------------------------------------- diff --git a/cpp.cmake b/cpp.cmake index 09d1e98..0998546 100644 --- a/cpp.cmake +++ b/cpp.cmake @@ -31,10 +31,4 @@ if (CMAKE_CXX_COMPILER) if (HAS_STD_PTR) add_definitions(-DPN_HAS_STD_PTR=1) endif() - - # Check for boost - find_path(BOOST_INCLUDE_DIR boost/shared_ptr.hpp PATH_SUFFIXES include) - if (BOOST_INCLUDE_DIR) - add_definitions(-DPN_HAS_BOOST=1) - endif() endif() http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt index d897951..3d2f457 100644 --- a/proton-c/CMakeLists.txt +++ b/proton-c/CMakeLists.txt @@ -218,7 +218,7 @@ if (CMAKE_COMPILER_IS_GNUCC) endif (ENABLE_WARNING_ERROR) set (COMPILE_WARNING_FLAGS "${WERROR} -Wall -pedantic-errors") # C++ allow "%z" format specifier and variadic macros - set (CXX_WARNING_FLAGS "${COMPILE_WARNING_FLAGS} -Wno-format -Wno-variadic-macros" CACHE STRING "C++ warning flags") + set (CXX_WARNING_FLAGS "${COMPILE_WARNING_FLAGS} -Wno-format -Wno-variadic-macros") if (NOT BUILD_WITH_CXX) set (COMPILE_WARNING_FLAGS "${COMPILE_WARNING_FLAGS} -Wstrict-prototypes") set (COMPILE_LANGUAGE_FLAGS "-std=c99") @@ -246,6 +246,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") if (ENABLE_WARNING_ERROR) set (WERROR "-Werror") endif (ENABLE_WARNING_ERROR) + 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") endif() if (MSVC) http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/include/proton/config.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/config.hpp b/proton-c/bindings/cpp/include/proton/config.hpp index 9237138..4d3dff9 100644 --- a/proton-c/bindings/cpp/include/proton/config.hpp +++ b/proton-c/bindings/cpp/include/proton/config.hpp @@ -27,40 +27,24 @@ * Otherwise they can be enabled or disabled separately with -D on the compile line. */ -#if ((defined(__cplusplus) && __cplusplus >= 201100)) - +#ifndef PN_HAS_CPP11 +#if (defined(__cplusplus) && __cplusplus >= 201100) #define PN_HAS_CPP11 1 +#else +#define PN_HAS_CPP11 0 +#endif +#endif #ifndef PN_HAS_STD_PTR -#define PN_HAS_STD_PTR 1 +#define PN_HAS_STD_PTR PN_HAS_CPP11 #endif #ifndef PN_HAS_LONG_LONG -#define PN_HAS_LONG_LONG 1 +#define PN_HAS_LONG_LONG PN_HAS_CPP11 #endif #ifndef PN_HAS_STATIC_ASSERT -#define PN_HAS_STATIC_ASSERT 1 -#endif - -#ifndef PN_NOEXCEPT -#define PN_NOEXCEPT noexcept -#endif - -#else // C++11 - -#ifndef PN_NOEXCEPT -#define PN_NOEXCEPT -#endif - -#endif // C++11 - -#if defined(BOOST_VERSION) - -#ifndef PN_HAS_BOOST -#define PN_HAS_BOOST 1 -#endif - +#define PN_HAS_STATIC_ASSERT PN_HAS_CPP11 #endif #endif // CONFIG_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/include/proton/data.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/data.hpp b/proton-c/bindings/cpp/include/proton/data.hpp index 5ffd93d..37e1a61 100644 --- a/proton-c/bindings/cpp/include/proton/data.hpp +++ b/proton-c/bindings/cpp/include/proton/data.hpp @@ -39,7 +39,7 @@ class data; class data : public object<pn_data_t> { public: data(pn_data_t* d) : object<pn_data_t>(d) {} - + data(const data& d) : object<pn_data_t>(d) {} data& operator=(const data&); PN_CPP_EXTERN static data create(); http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/include/proton/decoder.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/decoder.hpp b/proton-c/bindings/cpp/include/proton/decoder.hpp index a4d9a11..3073989 100644 --- a/proton-c/bindings/cpp/include/proton/decoder.hpp +++ b/proton-c/bindings/cpp/include/proton/decoder.hpp @@ -48,7 +48,7 @@ class data; class message_id; /** Raised by decoder operations on error.*/ -struct decode_error : public error { PN_CPP_EXTERN explicit decode_error(const std::string&) throw(); }; +struct decode_error : public error { PN_CPP_EXTERN explicit decode_error(const std::string&); }; /** Skips a value with `dec >> skip()`. */ struct skip{}; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/include/proton/encoder.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/encoder.hpp b/proton-c/bindings/cpp/include/proton/encoder.hpp index c5eb064..940064d 100644 --- a/proton-c/bindings/cpp/include/proton/encoder.hpp +++ b/proton-c/bindings/cpp/include/proton/encoder.hpp @@ -48,7 +48,7 @@ class data; class message_id; /** Raised by encoder operations on error */ -struct encode_error : public error { PN_CPP_EXTERN explicit encode_error(const std::string&) throw(); }; +struct encode_error : public error { PN_CPP_EXTERN explicit encode_error(const std::string&); }; /** * Stream-like encoder from C++ values to AMQP values. http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/include/proton/error.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/error.hpp b/proton-c/bindings/cpp/include/proton/error.hpp index 001cbc6..d2f57c6 100644 --- a/proton-c/bindings/cpp/include/proton/error.hpp +++ b/proton-c/bindings/cpp/include/proton/error.hpp @@ -23,15 +23,16 @@ */ #include <stdexcept> #include <string> +#include "proton/config.hpp" #include "proton/export.hpp" namespace proton { /** Functions in the proton namespace throw a subclass of proton::error on error. */ -struct error : public std::runtime_error { PN_CPP_EXTERN explicit error(const std::string&) throw(); }; +struct error : public std::runtime_error { PN_CPP_EXTERN explicit error(const std::string&); }; /** Raised if timeout expires */ -struct timeout_error : public error { PN_CPP_EXTERN explicit timeout_error(const std::string&) throw(); }; +struct timeout_error : public error { PN_CPP_EXTERN explicit timeout_error(const std::string&); }; } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/include/proton/event_loop.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/event_loop.hpp b/proton-c/bindings/cpp/include/proton/event_loop.hpp index fcc83d8..dcf9670 100644 --- a/proton-c/bindings/cpp/include/proton/event_loop.hpp +++ b/proton-c/bindings/cpp/include/proton/event_loop.hpp @@ -31,7 +31,7 @@ namespace proton { */ class event_loop { public: - PN_CPP_EXTERN virtual ~event_loop() {} + PN_CPP_EXTERN virtual ~event_loop(); /// The AMQP container-id associated with this event loop. /// Any connections managed by this event loop will have this container id. http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/include/proton/message.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/message.hpp b/proton-c/bindings/cpp/include/proton/message.hpp index b132f5f..52195aa 100644 --- a/proton-c/bindings/cpp/include/proton/message.hpp +++ b/proton-c/bindings/cpp/include/proton/message.hpp @@ -242,9 +242,9 @@ class message * * @return the group sequence for the message */ - PN_CPP_EXTERN uint32_t sequence() const; + PN_CPP_EXTERN int32_t sequence() const; /** Get the group sequence for a message. */ - PN_CPP_EXTERN void sequence(uint32_t); + PN_CPP_EXTERN void sequence(int32_t); private: pn_message_t *message_; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/include/proton/message_id.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/message_id.hpp b/proton-c/bindings/cpp/include/proton/message_id.hpp index 8e0adf1..4734dff 100644 --- a/proton-c/bindings/cpp/include/proton/message_id.hpp +++ b/proton-c/bindings/cpp/include/proton/message_id.hpp @@ -29,6 +29,7 @@ namespace proton { class message_id : public comparable<message_id> { public: message_id() {} + message_id(const message_id& x) : value_(x.value_) {} message_id(const uint64_t& x) : value_(x) {} message_id(const amqp_uuid& x) : value_(x) {} message_id(const amqp_binary& x) : value_(x) {} http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/include/proton/object.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/object.hpp b/proton-c/bindings/cpp/include/proton/object.hpp index a2457bb..e98a956 100644 --- a/proton-c/bindings/cpp/include/proton/object.hpp +++ b/proton-c/bindings/cpp/include/proton/object.hpp @@ -40,11 +40,11 @@ template <class T> class pn_ptr : public comparable<pn_ptr<T> >, private pn_ptr_ pn_ptr(T* p) : ptr_(p) { incref(ptr_); } pn_ptr(const pn_ptr& o) : ptr_(o.ptr_) { incref(ptr_); } -#ifdef PN_HAS_CPP11 +#if PN_HAS_CPP11 pn_ptr(pn_ptr&& o) : ptr_(0) { std::swap(ptr_, o.ptr_); } #endif - ~pn_ptr() { decref(ptr_); }; + ~pn_ptr() { decref(ptr_); } pn_ptr& operator=(pn_ptr o) { std::swap(ptr_, o.ptr_); return *this; } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/include/proton/ssl.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/ssl.hpp b/proton-c/bindings/cpp/include/proton/ssl.hpp index 579a57f..b3757dc 100644 --- a/proton-c/bindings/cpp/include/proton/ssl.hpp +++ b/proton-c/bindings/cpp/include/proton/ssl.hpp @@ -102,8 +102,6 @@ class server_domain : private ssl_domain { /** A server domain restricted to available anonymous cipher suites on the platform. */ PN_CPP_EXTERN server_domain(); - PN_CPP_EXTERN ~server_domain(); - private: // Bring pn_domain into scope and allow connection_options to use it using ssl_domain::pn_domain; @@ -119,8 +117,6 @@ class client_domain : private ssl_domain { /** A client domain restricted to available anonymous cipher suites on the platform. */ PN_CPP_EXTERN client_domain(); - PN_CPP_EXTERN ~client_domain(); - private: // Bring pn_domain into scope and allow connection_options to use it using ssl_domain::pn_domain; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/include/proton/types.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/types.hpp b/proton-c/bindings/cpp/include/proton/types.hpp index 262f352..75bb226 100644 --- a/proton-c/bindings/cpp/include/proton/types.hpp +++ b/proton-c/bindings/cpp/include/proton/types.hpp @@ -69,7 +69,7 @@ enum type_id { /// Raised when there is a type mismatch, with the expected and actual type ID. struct type_mismatch : public error { - PN_CPP_EXTERN explicit type_mismatch(type_id want, type_id got, const std::string& =std::string()) throw(); + PN_CPP_EXTERN explicit type_mismatch(type_id want, type_id got, const std::string& =std::string()); type_id want; ///< Expected type_id type_id got; ///< Actual type_id }; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/include/proton/url.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/url.hpp b/proton-c/bindings/cpp/include/proton/url.hpp index 4f586cb..c2d273b 100644 --- a/proton-c/bindings/cpp/include/proton/url.hpp +++ b/proton-c/bindings/cpp/include/proton/url.hpp @@ -29,7 +29,7 @@ namespace proton { /// Thrown if URL parsing fails. struct url_error : public error { - PN_CPP_EXTERN explicit url_error(const std::string&) throw(); + PN_CPP_EXTERN explicit url_error(const std::string&); }; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/src/atom.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/atom.cpp b/proton-c/bindings/cpp/src/atom.cpp index 64d3c88..034b22c 100644 --- a/proton-c/bindings/cpp/src/atom.cpp +++ b/proton-c/bindings/cpp/src/atom.cpp @@ -38,7 +38,7 @@ atom::atom(uint32_t x) { atom_.u.as_uint = x; atom_.type = PN_UINT; } atom::atom(int32_t x) { atom_.u.as_int = x; atom_.type = PN_INT; } atom::atom(uint64_t x) { atom_.u.as_ulong = x; atom_.type = PN_ULONG; } atom::atom(int64_t x) { atom_.u.as_long = x; atom_.type = PN_LONG; } -atom::atom(wchar_t x) { atom_.u.as_char = x; atom_.type = PN_CHAR; } +atom::atom(wchar_t x) { atom_.u.as_char = pn_char_t(x); atom_.type = PN_CHAR; } atom::atom(float x) { atom_.u.as_float = x; atom_.type = PN_FLOAT; } atom::atom(double x) { atom_.u.as_double = x; atom_.type = PN_DOUBLE; } atom::atom(amqp_timestamp x) { atom_.u.as_timestamp = x; atom_.type = PN_TIMESTAMP; } @@ -65,7 +65,7 @@ void atom::get(uint16_t& x) const { ok(PN_USHORT); x = atom_.u.as_ushort; } void atom::get(int16_t& x) const { ok(PN_SHORT); x = atom_.u.as_short; } void atom::get(uint32_t& x) const { ok(PN_UINT); x = atom_.u.as_uint; } void atom::get(int32_t& x) const { ok(PN_INT); x = atom_.u.as_int; } -void atom::get(wchar_t& x) const { ok(PN_CHAR); x = atom_.u.as_char; } +void atom::get(wchar_t& x) const { ok(PN_CHAR); x = wchar_t(atom_.u.as_char); } void atom::get(uint64_t& x) const { ok(PN_ULONG); x = atom_.u.as_ulong; } void atom::get(int64_t& x) const { ok(PN_LONG); x = atom_.u.as_long; } void atom::get(amqp_timestamp& x) const { ok(PN_TIMESTAMP); x = atom_.u.as_timestamp; } @@ -81,7 +81,8 @@ void atom::get(amqp_binary& x) const { ok(PN_BINARY); x = str_; } void atom::get(std::string& x) const { x = get<amqp_string>(); } int64_t atom::as_int() const { - if (type_id_floating_point(type())) return as_double(); + if (type_id_floating_point(type())) + return int64_t(as_double()); switch (atom_.type) { case PN_BOOL: return atom_.u.as_bool; case PN_UBYTE: return atom_.u.as_ubyte; @@ -91,7 +92,7 @@ int64_t atom::as_int() const { case PN_UINT: return atom_.u.as_uint; case PN_INT: return atom_.u.as_int; case PN_CHAR: return atom_.u.as_char; - case PN_ULONG: return atom_.u.as_ulong; + case PN_ULONG: return int64_t(atom_.u.as_ulong); case PN_LONG: return atom_.u.as_long; default: throw type_mismatch(LONG, type(), "cannot convert"); } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/src/connector.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/connector.cpp b/proton-c/bindings/cpp/src/connector.cpp index e2bb802..9469496 100644 --- a/proton-c/bindings/cpp/src/connector.cpp +++ b/proton-c/bindings/cpp/src/connector.cpp @@ -68,23 +68,23 @@ void connector::connect() { if (!address_.password().empty()) connection_.password(address_.password()); t.bind(connection_); - pn_decref((void *)pnt); + pn_decref(pnt); // Apply options to the new transport. options_.apply(connection_); transport_configured_ = true; } -void connector::on_connection_local_open(event &e) { +void connector::on_connection_local_open(event &) { connect(); } -void connector::on_connection_remote_open(event &e) { +void connector::on_connection_remote_open(event &) { if (reconnect_timer_) { reconnect_timer_->reset(); } } -void connector::on_connection_init(event &e) { +void connector::on_connection_init(event &) { } void connector::on_transport_tail_closed(event &e) { @@ -116,7 +116,7 @@ void connector::on_transport_closed(event &e) { connection_ = 0; } -void connector::on_timer_task(event &e) { +void connector::on_timer_task(event &) { connect(); } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/src/container_impl.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/container_impl.cpp b/proton-c/bindings/cpp/src/container_impl.cpp index e3c7c2c..b6e057e 100644 --- a/proton-c/bindings/cpp/src/container_impl.cpp +++ b/proton-c/bindings/cpp/src/container_impl.cpp @@ -107,7 +107,7 @@ class override_handler : public handler container_impl_.configure_server_connection(c); } } - pn_handler_dispatch(base_handler.get(), cevent, (pn_event_type_t) type); + pn_handler_dispatch(base_handler.get(), cevent, pn_event_type_t(type)); } }; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/src/contexts.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/contexts.cpp b/proton-c/bindings/cpp/src/contexts.cpp index 08187a2..0d48aa6 100644 --- a/proton-c/bindings/cpp/src/contexts.cpp +++ b/proton-c/bindings/cpp/src/contexts.cpp @@ -37,7 +37,6 @@ namespace proton { namespace { void cpp_context_finalize(void* v) { reinterpret_cast<context*>(v)->~context(); } #define CID_cpp_context CID_pn_object -#define cpp_context_reify pn_object_reify #define cpp_context_initialize NULL #define cpp_context_finalize cpp_context_finalize #define cpp_context_hashcode NULL @@ -46,14 +45,10 @@ void cpp_context_finalize(void* v) { reinterpret_cast<context*>(v)->~context(); pn_class_t cpp_context_class = PN_CLASS(cpp_context); // Handles +#pragma GCC diagnostic ignored "-Wold-style-cast" PN_HANDLE(CONNECTION_CONTEXT) PN_HANDLE(CONTAINER_CONTEXT) PN_HANDLE(LISTENER_CONTEXT) -} - -context::~context() {} -void *context::alloc(size_t n) { return pn_object_new(&cpp_context_class, n); } -pn_class_t* context::pn_class() { return &cpp_context_class; } void set_context(pn_record_t* record, pn_handle_t handle, const pn_class_t *clazz, void* value) { @@ -66,6 +61,11 @@ T* get_context(pn_record_t* record, pn_handle_t handle) { return reinterpret_cast<T*>(pn_record_get(record, handle)); } +} + +context::~context() {} +void *context::alloc(size_t n) { return pn_object_new(&cpp_context_class, n); } +pn_class_t* context::pn_class() { return &cpp_context_class; } connection_context& connection_context::get(pn_connection_t* c) { connection_context* ctx = http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/src/contexts.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/contexts.hpp b/proton-c/bindings/cpp/src/contexts.hpp index 9bfd2d4..bb35bdf 100644 --- a/proton-c/bindings/cpp/src/contexts.hpp +++ b/proton-c/bindings/cpp/src/contexts.hpp @@ -41,14 +41,14 @@ class container_impl; // contexts are pn_objects managed by pn reference counts. class context { public: + virtual ~context(); + // Allocate a default-constructed T as a proton object. T must be a subclass of context. template <class T> static T *create() { return new(alloc(sizeof(T))) T(); } // Allocate a copy-constructed T as a proton object. T must be a subclass of context. template <class T> static T *create(const T& x) { return new(alloc(sizeof(T))) T(x); } - virtual ~context(); - static pn_class_t* pn_class(); private: http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/src/data.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/data.cpp b/proton-c/bindings/cpp/src/data.cpp index e0ae9bc..7b6aad0 100644 --- a/proton-c/bindings/cpp/src/data.cpp +++ b/proton-c/bindings/cpp/src/data.cpp @@ -87,7 +87,7 @@ int compare_container(data& a, data& b) { int cmp = compare(sa.is_described, sb.is_described); if (cmp) return cmp; // Lexical sort (including descriptor if there is one) - size_t min_size = std::min(sa.size, sb.size) + int(sa.is_described); + size_t min_size = std::min(sa.size, sb.size) + size_t(sa.is_described); for (size_t i = 0; i < min_size; ++i) { cmp = compare_next(a, b); if (cmp) return cmp; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/src/decoder.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/decoder.cpp b/proton-c/bindings/cpp/src/decoder.cpp index 0c6a464..20d0461 100644 --- a/proton-c/bindings/cpp/src/decoder.cpp +++ b/proton-c/bindings/cpp/src/decoder.cpp @@ -34,8 +34,7 @@ namespace proton { * to be returned by the decoder. * */ -static const std::string prefix("decode: "); -decode_error::decode_error(const std::string& msg) throw() : error(prefix+msg) {} +decode_error::decode_error(const std::string& msg) : error("decode: "+msg) {} namespace { struct save_state { @@ -64,7 +63,7 @@ void decoder::decode(const char* i, size_t size) { save_state ss(pn_object()); const char* end = i + size; while (i < end) { - i += check(pn_data_decode(pn_object(), i, end - i)); + i += check(pn_data_decode(pn_object(), i, size_t(end - i))); } } @@ -103,7 +102,7 @@ type_id pre_get(pn_data_t* data) { template <class T, class U> void extract(pn_data_t* data, T& value, U (*get)(pn_data_t*)) { save_state ss(data); bad_type(type_id_of<T>::value, pre_get(data)); - value = get(data); + value = T(get(data)); ss.cancel(); // No error, no rewind } @@ -305,7 +304,7 @@ decoder operator>>(decoder d0, amqp_float& value) { save_state ss(d); switch (pre_get(d)) { case FLOAT: value = pn_data_get_float(d); break; - case DOUBLE: value = pn_data_get_double(d); break; + case DOUBLE: value = float(pn_data_get_double(d)); break; default: bad_type(FLOAT, type_id(pn_data_type(d))); } ss.cancel(); http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/src/encoder.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/encoder.cpp b/proton-c/bindings/cpp/src/encoder.cpp index 3624821..327426a 100644 --- a/proton-c/bindings/cpp/src/encoder.cpp +++ b/proton-c/bindings/cpp/src/encoder.cpp @@ -30,7 +30,7 @@ namespace proton { static const std::string prefix("encode: "); -encode_error::encode_error(const std::string& msg) throw() : error(prefix+msg) {} +encode_error::encode_error(const std::string& msg) : error(prefix+msg) {} namespace { struct save_state { @@ -41,7 +41,7 @@ struct save_state { void cancel() { data = 0; } }; -void check(int result, pn_data_t* data) { +void check(long result, pn_data_t* data) { if (result < 0) throw encode_error(error_str(pn_data_error(data), result)); } @@ -53,12 +53,12 @@ bool encoder::encode(char* buffer, size_t& size) { if (result == PN_OVERFLOW) { result = pn_data_encoded_size(pn_object()); if (result >= 0) { - size = result; + size = size_t(result); return false; } } check(result, pn_object()); - size = result; + size = size_t(result); ss.cancel(); // Don't restore state, all is well. pn_data_clear(pn_object()); return true; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/src/engine.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/engine.cpp b/proton-c/bindings/cpp/src/engine.cpp index da3d0d9..14d3ba1 100644 --- a/proton-c/bindings/cpp/src/engine.cpp +++ b/proton-c/bindings/cpp/src/engine.cpp @@ -71,7 +71,7 @@ buffer<char> engine::input() { ssize_t n = pn_transport_capacity(impl_->transport); if (n <= 0) return buffer<char>(); - return buffer<char>(pn_transport_tail(impl_->transport), n); + return buffer<char>(pn_transport_tail(impl_->transport), size_t(n)); } void engine::close_input() { @@ -106,7 +106,7 @@ buffer<const char> engine::output() { ssize_t n = pn_transport_pending(impl_->transport); if (n <= 0) return buffer<const char>(); - return buffer<const char>(pn_transport_head(impl_->transport), n); + return buffer<const char>(pn_transport_head(impl_->transport), size_t(n)); } void engine::sent(size_t n) { http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/src/error.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/error.cpp b/proton-c/bindings/cpp/src/error.cpp index 615c22c..980d6c0 100644 --- a/proton-c/bindings/cpp/src/error.cpp +++ b/proton-c/bindings/cpp/src/error.cpp @@ -23,8 +23,8 @@ namespace proton { static const std::string prefix("proton: "); -error::error(const std::string& msg) throw() : std::runtime_error(prefix+msg) {} +error::error(const std::string& msg) : std::runtime_error(prefix+msg) {} -timeout_error::timeout_error(const std::string& msg) throw() : error(msg) {} +timeout_error::timeout_error(const std::string& msg) : error(msg) {} } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/src/event.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/event.cpp b/proton-c/bindings/cpp/src/event.cpp index 54cbbc7..2a35ee8 100644 --- a/proton-c/bindings/cpp/src/event.cpp +++ b/proton-c/bindings/cpp/src/event.cpp @@ -77,4 +77,5 @@ class message &event::message() const { throw error(MSG("No message associated with event")); } +event_loop::~event_loop() {} // FIXME aconway 2015-12-28: move } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/src/handler.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/handler.cpp b/proton-c/bindings/cpp/src/handler.cpp index e73ee24..f40ee1f 100644 --- a/proton-c/bindings/cpp/src/handler.cpp +++ b/proton-c/bindings/cpp/src/handler.cpp @@ -28,7 +28,7 @@ namespace proton { handler::handler() {} handler::~handler() {} -void handler::on_unhandled(event &e) {} +void handler::on_unhandled(event &) {} void handler::add_child_handler(handler &e) { children_.push_back(&e); http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/src/message.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/message.cpp b/proton-c/bindings/cpp/src/message.cpp index cb29029..c2fcd00 100644 --- a/proton-c/bindings/cpp/src/message.cpp +++ b/proton-c/bindings/cpp/src/message.cpp @@ -40,7 +40,7 @@ message::message() : message_(::pn_message()) {} message::message(const message &m) : message_(::pn_message()) { *this = m; } -#if PN_HAS_CPP11 +#if defined(PN_HAS_CPP11) && PN_HAS_CPP11 message::message(message &&m) : message_(::pn_message()) { swap(m); } #endif @@ -301,7 +301,7 @@ void message::encode(std::string &s) const { if (sz < 512) sz = 512; while (true) { s.resize(sz); - int err = pn_message_encode(message_, (char *) s.data(), &sz); + int err = pn_message_encode(message_, const_cast<char*>(s.data()), &sz); if (err) { if (err != PN_OVERFLOW) check(err); @@ -326,8 +326,8 @@ void message::decode(const std::string &s) { void message::decode(proton::link link, proton::delivery delivery) { std::string buf; buf.resize(delivery.pending()); - ssize_t n = link.recv((char *) buf.data(), buf.size()); - if (n != (ssize_t) buf.size()) throw error(MSG("link read failure")); + ssize_t n = link.recv(const_cast<char *>(buf.data()), buf.size()); + if (n != ssize_t(buf.size())) throw error(MSG("link read failure")); clear(); decode(buf); link.advance(); @@ -348,7 +348,7 @@ void message::first_acquirer(bool b) { pn_message_set_first_acquirer(message_, b uint32_t message::delivery_count() const { return pn_message_get_delivery_count(message_); } void message::delivery_count(uint32_t d) { pn_message_set_delivery_count(message_, d); } -uint32_t message::sequence() const { return pn_message_get_group_sequence(message_); } -void message::sequence(uint32_t d) { pn_message_set_group_sequence(message_, d); } +int32_t message::sequence() const { return pn_message_get_group_sequence(message_); } +void message::sequence(int32_t d) { pn_message_set_group_sequence(message_, d); } } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/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 ecdea75..54995c0 100644 --- a/proton-c/bindings/cpp/src/message_test.cpp +++ b/proton-c/bindings/cpp/src/message_test.cpp @@ -84,6 +84,6 @@ void test_message() { int main(int argc, char** argv) { int failed = 0; - RUN_TEST(failed, test_message); + RUN_TEST(failed, test_message()); return failed; } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/src/messaging_adapter.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/messaging_adapter.cpp b/proton-c/bindings/cpp/src/messaging_adapter.cpp index cf90754..d66189c 100644 --- a/proton-c/bindings/cpp/src/messaging_adapter.cpp +++ b/proton-c/bindings/cpp/src/messaging_adapter.cpp @@ -33,9 +33,9 @@ #include "proton/message.h" namespace proton { -messaging_adapter::messaging_adapter(messaging_handler &delegate_) : - messaging_handler(true, delegate_.prefetch_, delegate_.auto_settle_, delegate_.auto_accept_, delegate_.peer_close_iserror_), - delegate_(delegate_) +messaging_adapter::messaging_adapter(messaging_handler &delegate) : + messaging_handler(true, delegate.prefetch_, delegate.auto_settle_, delegate.auto_accept_, delegate.peer_close_iserror_), + delegate_(delegate) {} @@ -276,7 +276,7 @@ void messaging_adapter::on_link_close(event &e) { on_link_error(e); } -void messaging_adapter::on_unhandled(event &e) { +void messaging_adapter::on_unhandled(event &) { } } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/src/messaging_event.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/messaging_event.cpp b/proton-c/bindings/cpp/src/messaging_event.cpp index b360299..6574a55 100644 --- a/proton-c/bindings/cpp/src/messaging_event.cpp +++ b/proton-c/bindings/cpp/src/messaging_event.cpp @@ -141,7 +141,6 @@ void messaging_event::dispatch(handler &h) { default: throw error(MSG("Unknown messaging event type " << type_)); - break; } } else { h.on_unhandled(*this); @@ -177,8 +176,8 @@ std::string messaging_event::name() const { case TRANSACTION_COMMIT: return "TRANSACTION_COMMIT"; case TRANSACTION_DECLARE: return "TRANSACTION_DECLARE"; case TIMER: return "TIMER"; - default: return "UNKNOWN"; } + return "unknown"; } } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/src/messaging_handler.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/messaging_handler.cpp b/proton-c/bindings/cpp/src/messaging_handler.cpp index 2f7383f..b68ece5 100644 --- a/proton-c/bindings/cpp/src/messaging_handler.cpp +++ b/proton-c/bindings/cpp/src/messaging_handler.cpp @@ -40,7 +40,7 @@ class c_flow_controller : public proton_handler void redirect(event &e) { proton_event *pne = dynamic_cast<proton_event *>(&e); - pn_handler_dispatch(flowcontroller, pne->pn_event(), (pn_event_type_t) pne->type()); + pn_handler_dispatch(flowcontroller, pne->pn_event(), pn_event_type_t(pne->type())); } virtual void on_link_local_open(event &e) { redirect(e); } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/src/proton_bits.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/proton_bits.cpp b/proton-c/bindings/cpp/src/proton_bits.cpp index 269b7d6..0d41da8 100644 --- a/proton-c/bindings/cpp/src/proton_bits.cpp +++ b/proton-c/bindings/cpp/src/proton_bits.cpp @@ -23,7 +23,7 @@ #include <proton/object.h> #include "proton_bits.hpp" -std::string error_str(int code) { +std::string error_str(long code) { switch (code) { case 0: return "ok"; @@ -39,7 +39,7 @@ std::string error_str(int code) { } } -std::string error_str(pn_error_t* err, int code) { +std::string error_str(pn_error_t* err, long code) { if (err && pn_error_code(err)) { const char* text = pn_error_text(err); return text ? std::string(text) : error_str(pn_error_code(err)); http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/src/proton_bits.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/proton_bits.hpp b/proton-c/bindings/cpp/src/proton_bits.hpp index d615c0f..6ba0848 100644 --- a/proton-c/bindings/cpp/src/proton_bits.hpp +++ b/proton-c/bindings/cpp/src/proton_bits.hpp @@ -28,10 +28,10 @@ * Assorted internal proton utilities. */ -std::string error_str(int code); +std::string error_str(long code); /** Print the error string from pn_error_t, or from code if pn_error_t has no error. */ -std::string error_str(pn_error_t*, int code=0); +std::string error_str(pn_error_t*, long code=0); /** Make a void* inspectable via operator <<. */ struct inspectable { void* value; inspectable(void* o) : value(o) {} }; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/src/proton_event.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/proton_event.cpp b/proton-c/bindings/cpp/src/proton_event.cpp index 1278d33..ce61921 100644 --- a/proton-c/bindings/cpp/src/proton_event.cpp +++ b/proton-c/bindings/cpp/src/proton_event.cpp @@ -153,7 +153,6 @@ void proton_event::dispatch(handler &h) { case PN_SELECTABLE_FINAL: handler->on_selectable_final(*this); break; default: throw error(MSG("Invalid Proton event type " << type_)); - break; } } else { h.on_unhandled(*this); http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/src/proton_handler.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/proton_handler.cpp b/proton-c/bindings/cpp/src/proton_handler.cpp index 7080d39..37030c9 100644 --- a/proton-c/bindings/cpp/src/proton_handler.cpp +++ b/proton-c/bindings/cpp/src/proton_handler.cpp @@ -68,6 +68,6 @@ void proton_handler::on_selectable_expired(event &e) { on_unhandled(e); } void proton_handler::on_selectable_error(event &e) { on_unhandled(e); } void proton_handler::on_selectable_final(event &e) { on_unhandled(e); } -void proton_handler::on_unhandled(event &e) {} +void proton_handler::on_unhandled(event &) {} } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/src/ssl.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/ssl.cpp b/proton-c/bindings/cpp/src/ssl.cpp index 4c9138e..1596e38 100644 --- a/proton-c/bindings/cpp/src/ssl.cpp +++ b/proton-c/bindings/cpp/src/ssl.cpp @@ -45,7 +45,7 @@ std::string ssl::protocol() const { } ssl::resume_status_t ssl::resume_status() const { - return (ssl::resume_status_t) pn_ssl_resume_status(object_); + return ssl::resume_status_t(pn_ssl_resume_status(object_)); } void ssl::peer_hostname(const std::string &hostname) { http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/src/ssl_domain.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/ssl_domain.cpp b/proton-c/bindings/cpp/src/ssl_domain.cpp index d6c427b..95fc552 100644 --- a/proton-c/bindings/cpp/src/ssl_domain.cpp +++ b/proton-c/bindings/cpp/src/ssl_domain.cpp @@ -96,19 +96,17 @@ server_domain::server_domain( if (pn_ssl_domain_set_trusted_ca_db(dom, trust_db.c_str())) throw error(MSG("SSL trust store initialization failure for " << trust_db)); const std::string &db = advertise_db.empty() ? trust_db : advertise_db; - if (pn_ssl_domain_set_peer_authentication(dom, (pn_ssl_verify_mode_t) mode, db.c_str())) + if (pn_ssl_domain_set_peer_authentication(dom, pn_ssl_verify_mode_t(mode), db.c_str())) throw error(MSG("SSL server configuration failure requiring client certificates using " << db)); } server_domain::server_domain() : ssl_domain(true) {} -server_domain::~server_domain() {} - namespace { void client_setup(pn_ssl_domain_t *dom, const std::string &trust_db, ssl::verify_mode_t mode) { if (pn_ssl_domain_set_trusted_ca_db(dom, trust_db.c_str())) throw error(MSG("SSL trust store initialization failure for " << trust_db)); - if (pn_ssl_domain_set_peer_authentication(dom, (pn_ssl_verify_mode_t) mode, NULL)) + if (pn_ssl_domain_set_peer_authentication(dom, pn_ssl_verify_mode_t(mode), NULL)) throw error(MSG("SSL client verify mode failure")); } } @@ -124,7 +122,6 @@ client_domain::client_domain(ssl_certificate &cert, const std::string &trust_db, } client_domain::client_domain() : ssl_domain(false) {} -client_domain::~client_domain() {} ssl_certificate::ssl_certificate(const std::string &main, const std::string &extra) : certdb_main_(main), certdb_extra_(extra), pw_set_(false) {} http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/src/terminus.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/terminus.cpp b/proton-c/bindings/cpp/src/terminus.cpp index def6aa9..1a8ed8a 100644 --- a/proton-c/bindings/cpp/src/terminus.cpp +++ b/proton-c/bindings/cpp/src/terminus.cpp @@ -25,27 +25,27 @@ namespace proton { terminus::type_t terminus::type() const { - return (type_t) pn_terminus_get_type(object_); + return type_t(pn_terminus_get_type(object_)); } void terminus::type(type_t type) { - pn_terminus_set_type(object_, (pn_terminus_type_t) type); + pn_terminus_set_type(object_, pn_terminus_type_t(type)); } terminus::expiry_policy_t terminus::expiry_policy() const { - return (expiry_policy_t) pn_terminus_get_type(object_); + return expiry_policy_t(pn_terminus_get_type(object_)); } void terminus::expiry_policy(expiry_policy_t policy) { - pn_terminus_set_expiry_policy(object_, (pn_expiry_policy_t) policy); + pn_terminus_set_expiry_policy(object_, pn_expiry_policy_t(policy)); } terminus::distribution_mode_t terminus::distribution_mode() const { - return (distribution_mode_t) pn_terminus_get_type(object_); + return distribution_mode_t(pn_terminus_get_type(object_)); } void terminus::distribution_mode(distribution_mode_t mode) { - pn_terminus_set_distribution_mode(object_, (pn_distribution_mode_t) mode); + pn_terminus_set_distribution_mode(object_, pn_distribution_mode_t(mode)); } std::string terminus::address() const { @@ -58,7 +58,7 @@ void terminus::address(const std::string &addr) { } bool terminus::dynamic() const { - return (type_t) pn_terminus_is_dynamic(object_); + return type_t(pn_terminus_is_dynamic(object_)); } void terminus::dynamic(bool d) { http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/src/types.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/types.cpp b/proton-c/bindings/cpp/src/types.cpp index 713f15d..d8e40ce 100644 --- a/proton-c/bindings/cpp/src/types.cpp +++ b/proton-c/bindings/cpp/src/types.cpp @@ -28,11 +28,12 @@ namespace proton { namespace { inline std::ostream& print_segment(std::ostream& o, const amqp_uuid& u, size_t begin, size_t end, const char* sep="") { - for (const char* p = &u[begin]; p < &u[end]; ++p) o << std::setw(2) << std::setfill('0') << ((int)*p & 0xff); + for (const char* p = &u[begin]; p < &u[end]; ++p) + o << std::setw(2) << std::setfill('0') << (int(*p) & 0xff); return o << sep; } -std::string mismatch_message(type_id want, type_id got, const std::string& msg=std::string()) throw() +std::string mismatch_message(type_id want, type_id got, const std::string& msg=std::string()) { std::ostringstream s; s << "type mismatch: want " << type_name(want) << " got " << type_name(got); @@ -42,7 +43,7 @@ std::string mismatch_message(type_id want, type_id got, const std::string& msg=s } type_mismatch::type_mismatch(type_id want_, type_id got_, const std::string &msg) - throw() : error(mismatch_message(want_, got_, msg)), want(want_), got(got_) + : error(mismatch_message(want_, got_, msg)), want(want_), got(got_) {} @@ -90,12 +91,12 @@ std::string type_name(type_id t) { case ARRAY: return "array"; case LIST: return "list"; case MAP: return "map"; - default: return "unknown"; } + return "unknown"; } -bool type_id_signed_int(type_id t) { return t == BYTE || t == SHORT || t == INT || t == LONG; } -bool type_id_unsigned_int(type_id t) { return t == UBYTE || t == USHORT || t == UINT || t == ULONG; } +static bool type_id_signed_int(type_id t) { return t == BYTE || t == SHORT || t == INT || t == LONG; } +static bool type_id_unsigned_int(type_id t) { return t == UBYTE || t == USHORT || t == UINT || t == ULONG; } bool type_id_integral(type_id t) { return t == BOOLEAN || t == CHAR || type_id_unsigned_int(t) || type_id_signed_int(t); } bool type_id_floating_point(type_id t) { return t == FLOAT || t == DOUBLE; } bool type_id_decimal(type_id t) { return t == DECIMAL32 || t == DECIMAL64 || t == DECIMAL128; } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd52a332/proton-c/bindings/cpp/src/url.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/url.cpp b/proton-c/bindings/cpp/src/url.cpp index ec02e53..f6158dd 100644 --- a/proton-c/bindings/cpp/src/url.cpp +++ b/proton-c/bindings/cpp/src/url.cpp @@ -26,7 +26,7 @@ namespace proton { -url_error::url_error(const std::string& s) throw() : error(s) {} +url_error::url_error(const std::string& s) : error(s) {} namespace { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
