diff options
author | Andrew Stitcher <astitcher@apache.org> | 2014-04-02 21:23:45 +0000 |
---|---|---|
committer | Andrew Stitcher <astitcher@apache.org> | 2014-04-02 21:23:45 +0000 |
commit | 631a175a87b57f2e7fd087458156d7efe9f46edc (patch) | |
tree | cb329497aab97aecf4b95ff95207e341b624257c | |
parent | a7a3046130ea56bf17089de3a55da4f5efd26596 (diff) | |
download | qpid-python-631a175a87b57f2e7fd087458156d7efe9f46edc.tar.gz |
QPID-5659: Fixes to compile with C++11 (needed to compile with clang on FreeBSD 10)
- shared_ptr no longer has a default conversion to bool.
- Change in default destructor semantics: by default destructors are now
not allowed to throw exceptions.
- stringstream no longer has a default conversion to string.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1584199 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/cpp/src/qpid/broker/DirectExchange.cpp | 2 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/broker/Exchange.cpp | 4 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/broker/Message.cpp | 2 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/broker/Observers.h | 2 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/client/SessionBase_0_10.cpp | 2 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/ha/hash.h | 4 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/sys/Waitable.h | 8 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/sys/posix/Thread.cpp | 2 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/sys/rdma/rdma_wrap.cpp | 2 | ||||
-rw-r--r-- | qpid/cpp/src/tests/legacystore/jrnl/_ut_jdir.cpp | 2 | ||||
-rw-r--r-- | qpid/cpp/src/tests/legacystore/jrnl/_ut_jinf.cpp | 4 | ||||
-rw-r--r-- | qpid/cpp/src/tests/msg_group_test.cpp | 3 | ||||
-rw-r--r-- | qpid/cpp/src/tests/qpid-receive.cpp | 3 | ||||
-rw-r--r-- | qpid/cpp/src/tests/qpid-send.cpp | 5 |
14 files changed, 26 insertions, 19 deletions
diff --git a/qpid/cpp/src/qpid/broker/DirectExchange.cpp b/qpid/cpp/src/qpid/broker/DirectExchange.cpp index 65c8287d4f..be66bc2e5f 100644 --- a/qpid/cpp/src/qpid/broker/DirectExchange.cpp +++ b/qpid/cpp/src/qpid/broker/DirectExchange.cpp @@ -63,7 +63,7 @@ bool DirectExchange::bind(Queue::shared_ptr queue, const string& routingKey, con fedOp = args->getAsString(qpidFedOp); fedTags = args->getAsString(qpidFedTags); fedOrigin = args->getAsString(qpidFedOrigin); - exclusiveBinding = args->get(qpidExclusiveBinding); // only direct exchanges take exclusive bindings + exclusiveBinding = !!args->get(qpidExclusiveBinding); // only direct exchanges take exclusive bindings } bool propagate = false; diff --git a/qpid/cpp/src/qpid/broker/Exchange.cpp b/qpid/cpp/src/qpid/broker/Exchange.cpp index 3e545b63fd..cfd31a16c1 100644 --- a/qpid/cpp/src/qpid/broker/Exchange.cpp +++ b/qpid/cpp/src/qpid/broker/Exchange.cpp @@ -204,13 +204,13 @@ Exchange::Exchange(const string& _name, bool _durable, bool _autodelete, const q } } - sequence = _args.get(qpidMsgSequence); + sequence = !!_args.get(qpidMsgSequence); if (sequence) { QPID_LOG(debug, "Configured exchange " << _name << " with Msg sequencing"); args.setInt64(std::string(qpidSequenceCounter), sequenceNo); } - ive = _args.get(qpidIVE); + ive = !!_args.get(qpidIVE); if (ive) { QPID_LOG(debug, "Configured exchange " << _name << " with Initial Value"); } diff --git a/qpid/cpp/src/qpid/broker/Message.cpp b/qpid/cpp/src/qpid/broker/Message.cpp index 6585466056..3f7419acbc 100644 --- a/qpid/cpp/src/qpid/broker/Message.cpp +++ b/qpid/cpp/src/qpid/broker/Message.cpp @@ -254,7 +254,7 @@ const Message::Encoding& Message::getEncoding() const } Message::operator bool() const { - return encoding; + return !!encoding; } std::string Message::getContent() const diff --git a/qpid/cpp/src/qpid/broker/Observers.h b/qpid/cpp/src/qpid/broker/Observers.h index c33cb444dc..efed377b33 100644 --- a/qpid/cpp/src/qpid/broker/Observers.h +++ b/qpid/cpp/src/qpid/broker/Observers.h @@ -80,7 +80,7 @@ class Observers } template <class T> static bool isA(const ObserverPtr&o) { - return boost::dynamic_pointer_cast<T>(o); + return !!boost::dynamic_pointer_cast<T>(o); } mutable sys::Mutex myLock; diff --git a/qpid/cpp/src/qpid/client/SessionBase_0_10.cpp b/qpid/cpp/src/qpid/client/SessionBase_0_10.cpp index e114b7aacc..2de6c601a1 100644 --- a/qpid/cpp/src/qpid/client/SessionBase_0_10.cpp +++ b/qpid/cpp/src/qpid/client/SessionBase_0_10.cpp @@ -73,7 +73,7 @@ uint32_t SessionBase_0_10::timeout(uint32_t seconds) { return impl->setTimeout(s SessionId SessionBase_0_10::getId() const { return impl->getId(); } -bool SessionBase_0_10::isValid() const { return impl; } +bool SessionBase_0_10::isValid() const { return !!impl; } Connection SessionBase_0_10::getConnection() { diff --git a/qpid/cpp/src/qpid/ha/hash.h b/qpid/cpp/src/qpid/ha/hash.h index 8a7f3c00fe..17f99fb666 100644 --- a/qpid/cpp/src/qpid/ha/hash.h +++ b/qpid/cpp/src/qpid/ha/hash.h @@ -51,6 +51,10 @@ template <class T> inline std::size_t hashValue(T* v) { return x + (x >> 3); } +template <class T> inline std::size_t hashValue(boost::shared_ptr<T> v) { + return hashValue(v.get()); +} + template <class T> inline void hashCombine(std::size_t& seed, const T& v) { seed ^= hashValue(v) + 0x9e3779b9 + (seed<<6) + (seed>>2); } diff --git a/qpid/cpp/src/qpid/sys/Waitable.h b/qpid/cpp/src/qpid/sys/Waitable.h index 8f6bd17049..479465a59a 100644 --- a/qpid/cpp/src/qpid/sys/Waitable.h +++ b/qpid/cpp/src/qpid/sys/Waitable.h @@ -25,6 +25,12 @@ #include "qpid/sys/ExceptionHolder.h" #include <assert.h> +#if __cplusplus >=201103L +#define DESTRUCTOR_THROWS noexcept(false) +#else +#define DESTRUCTOR_THROWS +#endif + namespace qpid { namespace sys { @@ -101,7 +107,7 @@ class Waitable : public Monitor { struct ExCheck { const ExceptionHolder& exception; ExCheck(const ExceptionHolder& e) : exception(e) { e.raise(); } - ~ExCheck() { exception.raise(); } + ~ExCheck() DESTRUCTOR_THROWS { exception.raise(); } }; size_t waiters; diff --git a/qpid/cpp/src/qpid/sys/posix/Thread.cpp b/qpid/cpp/src/qpid/sys/posix/Thread.cpp index a1d6396763..2075e1dfbc 100644 --- a/qpid/cpp/src/qpid/sys/posix/Thread.cpp +++ b/qpid/cpp/src/qpid/sys/posix/Thread.cpp @@ -55,7 +55,7 @@ Thread::Thread(Runnable* runnable) : impl(new ThreadPrivate(runnable)) {} Thread::Thread(Runnable& runnable) : impl(new ThreadPrivate(&runnable)) {} Thread::operator bool() { - return impl; + return !!impl; } bool Thread::operator==(const Thread& t) const { diff --git a/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.cpp b/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.cpp index 889ee9ff75..39c7cc2ab4 100644 --- a/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.cpp +++ b/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.cpp @@ -330,7 +330,7 @@ namespace Rdma { {} ConnectionEvent::operator bool() const { - return event; + return !!event; } ::rdma_cm_event_type ConnectionEvent::getEventType() const { diff --git a/qpid/cpp/src/tests/legacystore/jrnl/_ut_jdir.cpp b/qpid/cpp/src/tests/legacystore/jrnl/_ut_jdir.cpp index 842ea5c9ef..b55d5ff8ef 100644 --- a/qpid/cpp/src/tests/legacystore/jrnl/_ut_jdir.cpp +++ b/qpid/cpp/src/tests/legacystore/jrnl/_ut_jdir.cpp @@ -76,7 +76,7 @@ void create_jdat_file(const char* dirname, const char* base_filename, u_int32_t file_hdr fh(RHM_JDAT_FILE_MAGIC, RHM_JDAT_VERSION, 0, first_rid, fid, 0x200, true); ofstream of(fn.str().c_str(), ofstream::out | ofstream::trunc); if (!of.good()) - BOOST_FAIL("Unable to open journal data file " << fn << " for writing."); + BOOST_FAIL("Unable to open journal data file " << fn.str() << " for writing."); of.write((const char*)&fh, sizeof(file_hdr)); of.close(); } diff --git a/qpid/cpp/src/tests/legacystore/jrnl/_ut_jinf.cpp b/qpid/cpp/src/tests/legacystore/jrnl/_ut_jinf.cpp index c6377c2287..f239139306 100644 --- a/qpid/cpp/src/tests/legacystore/jrnl/_ut_jinf.cpp +++ b/qpid/cpp/src/tests/legacystore/jrnl/_ut_jinf.cpp @@ -360,7 +360,7 @@ QPID_AUTO_TEST_CASE(analyze_owi_in_non_ae_journal) try { ji.analyze(); - BOOST_FAIL("Failed to detect irregular OWI flag in non-ae journal file \"" << fn << "\""); + BOOST_FAIL("Failed to detect irregular OWI flag in non-ae journal file \"" << fn.str() << "\""); } catch (const jexception& e) {} // ignore - expected @@ -389,7 +389,7 @@ QPID_AUTO_TEST_CASE(analyze_owi_in_ae_min_size_journal) try { ji.analyze(); - BOOST_FAIL("Failed to detect irregular OWI flag in min-sized ae journal file \"" << fn << "\""); + BOOST_FAIL("Failed to detect irregular OWI flag in min-sized ae journal file \"" << fn.str() << "\""); } catch (const jexception& e) {} // ignore - expected diff --git a/qpid/cpp/src/tests/msg_group_test.cpp b/qpid/cpp/src/tests/msg_group_test.cpp index 4f54e3ee53..ca87197ff3 100644 --- a/qpid/cpp/src/tests/msg_group_test.cpp +++ b/qpid/cpp/src/tests/msg_group_test.cpp @@ -130,8 +130,7 @@ struct Options : public qpid::Options if (messages == 0) throw qpid::Exception("The message count cannot be zero."); qpid::log::Logger::instance().configure(log); if (help) { - std::ostringstream msg; - std::cout << msg << *this << std::endl << std::endl + std::cout << *this << std::endl << std::endl << "Verifies the behavior of grouped messages." << std::endl; return false; } else { diff --git a/qpid/cpp/src/tests/qpid-receive.cpp b/qpid/cpp/src/tests/qpid-receive.cpp index ab26d3d9b5..fb1db05d99 100644 --- a/qpid/cpp/src/tests/qpid-receive.cpp +++ b/qpid/cpp/src/tests/qpid-receive.cpp @@ -136,8 +136,7 @@ struct Options : public qpid::Options if (address.empty()) throw qpid::Exception("Address must be specified!"); qpid::log::Logger::instance().configure(log); if (help) { - std::ostringstream msg; - std::cout << msg << *this << std::endl << std::endl + std::cout << *this << std::endl << std::endl << "Drains messages from the specified address" << std::endl; return false; } else { diff --git a/qpid/cpp/src/tests/qpid-send.cpp b/qpid/cpp/src/tests/qpid-send.cpp index 5414abb892..78702f7a85 100644 --- a/qpid/cpp/src/tests/qpid-send.cpp +++ b/qpid/cpp/src/tests/qpid-send.cpp @@ -165,8 +165,7 @@ struct Options : public qpid::Options if (address.empty()) throw qpid::Exception("Address must be specified!"); qpid::log::Logger::instance().configure(log); if (help) { - std::ostringstream msg; - std::cout << msg << *this << std::endl << std::endl + std::cout << *this << std::endl << std::endl << "Drains messages from the specified address" << std::endl; return false; } else { @@ -241,7 +240,7 @@ class GetlineContentGenerator : public ContentGenerator { public: virtual bool setContent(Message& msg) { string content; - bool got = getline(std::cin, content); + bool got = !!getline(std::cin, content); if (got) msg.setContentObject(content); return got; } |