You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2014/04/03 21:52:00 UTC

svn commit: r1584361 - in /qpid/branches/0.28/qpid/cpp/src: qpid/broker/ qpid/client/ qpid/ha/ qpid/sys/ qpid/sys/posix/ qpid/sys/rdma/ tests/ tests/legacystore/jrnl/

Author: astitcher
Date: Thu Apr  3 19:52:00 2014
New Revision: 1584361

URL: http://svn.apache.org/r1584361
Log:
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.

Modified:
    qpid/branches/0.28/qpid/cpp/src/qpid/broker/DirectExchange.cpp
    qpid/branches/0.28/qpid/cpp/src/qpid/broker/Exchange.cpp
    qpid/branches/0.28/qpid/cpp/src/qpid/broker/Message.cpp
    qpid/branches/0.28/qpid/cpp/src/qpid/broker/Observers.h
    qpid/branches/0.28/qpid/cpp/src/qpid/client/SessionBase_0_10.cpp
    qpid/branches/0.28/qpid/cpp/src/qpid/ha/hash.h
    qpid/branches/0.28/qpid/cpp/src/qpid/sys/Waitable.h
    qpid/branches/0.28/qpid/cpp/src/qpid/sys/posix/Thread.cpp
    qpid/branches/0.28/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.cpp
    qpid/branches/0.28/qpid/cpp/src/tests/legacystore/jrnl/_ut_jdir.cpp
    qpid/branches/0.28/qpid/cpp/src/tests/legacystore/jrnl/_ut_jinf.cpp
    qpid/branches/0.28/qpid/cpp/src/tests/msg_group_test.cpp
    qpid/branches/0.28/qpid/cpp/src/tests/qpid-receive.cpp
    qpid/branches/0.28/qpid/cpp/src/tests/qpid-send.cpp

Modified: qpid/branches/0.28/qpid/cpp/src/qpid/broker/DirectExchange.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/0.28/qpid/cpp/src/qpid/broker/DirectExchange.cpp?rev=1584361&r1=1584360&r2=1584361&view=diff
==============================================================================
--- qpid/branches/0.28/qpid/cpp/src/qpid/broker/DirectExchange.cpp (original)
+++ qpid/branches/0.28/qpid/cpp/src/qpid/broker/DirectExchange.cpp Thu Apr  3 19:52:00 2014
@@ -63,7 +63,7 @@ bool DirectExchange::bind(Queue::shared_
         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;

Modified: qpid/branches/0.28/qpid/cpp/src/qpid/broker/Exchange.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/0.28/qpid/cpp/src/qpid/broker/Exchange.cpp?rev=1584361&r1=1584360&r2=1584361&view=diff
==============================================================================
--- qpid/branches/0.28/qpid/cpp/src/qpid/broker/Exchange.cpp (original)
+++ qpid/branches/0.28/qpid/cpp/src/qpid/broker/Exchange.cpp Thu Apr  3 19:52:00 2014
@@ -204,13 +204,13 @@ Exchange::Exchange(const string& _name, 
         }
     }
 
-    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");
     }

Modified: qpid/branches/0.28/qpid/cpp/src/qpid/broker/Message.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/0.28/qpid/cpp/src/qpid/broker/Message.cpp?rev=1584361&r1=1584360&r2=1584361&view=diff
==============================================================================
--- qpid/branches/0.28/qpid/cpp/src/qpid/broker/Message.cpp (original)
+++ qpid/branches/0.28/qpid/cpp/src/qpid/broker/Message.cpp Thu Apr  3 19:52:00 2014
@@ -254,7 +254,7 @@ const Message::Encoding& Message::getEnc
 }
 Message::operator bool() const
 {
-    return encoding;
+    return !!encoding;
 }
 
 std::string Message::getContent() const

Modified: qpid/branches/0.28/qpid/cpp/src/qpid/broker/Observers.h
URL: http://svn.apache.org/viewvc/qpid/branches/0.28/qpid/cpp/src/qpid/broker/Observers.h?rev=1584361&r1=1584360&r2=1584361&view=diff
==============================================================================
--- qpid/branches/0.28/qpid/cpp/src/qpid/broker/Observers.h (original)
+++ qpid/branches/0.28/qpid/cpp/src/qpid/broker/Observers.h Thu Apr  3 19:52:00 2014
@@ -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;

Modified: qpid/branches/0.28/qpid/cpp/src/qpid/client/SessionBase_0_10.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/0.28/qpid/cpp/src/qpid/client/SessionBase_0_10.cpp?rev=1584361&r1=1584360&r2=1584361&view=diff
==============================================================================
--- qpid/branches/0.28/qpid/cpp/src/qpid/client/SessionBase_0_10.cpp (original)
+++ qpid/branches/0.28/qpid/cpp/src/qpid/client/SessionBase_0_10.cpp Thu Apr  3 19:52:00 2014
@@ -73,7 +73,7 @@ uint32_t SessionBase_0_10::timeout(uint3
 
 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()
 {

Modified: qpid/branches/0.28/qpid/cpp/src/qpid/ha/hash.h
URL: http://svn.apache.org/viewvc/qpid/branches/0.28/qpid/cpp/src/qpid/ha/hash.h?rev=1584361&r1=1584360&r2=1584361&view=diff
==============================================================================
--- qpid/branches/0.28/qpid/cpp/src/qpid/ha/hash.h (original)
+++ qpid/branches/0.28/qpid/cpp/src/qpid/ha/hash.h Thu Apr  3 19:52:00 2014
@@ -51,6 +51,10 @@ template <class T> inline std::size_t ha
     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);
 }

Modified: qpid/branches/0.28/qpid/cpp/src/qpid/sys/Waitable.h
URL: http://svn.apache.org/viewvc/qpid/branches/0.28/qpid/cpp/src/qpid/sys/Waitable.h?rev=1584361&r1=1584360&r2=1584361&view=diff
==============================================================================
--- qpid/branches/0.28/qpid/cpp/src/qpid/sys/Waitable.h (original)
+++ qpid/branches/0.28/qpid/cpp/src/qpid/sys/Waitable.h Thu Apr  3 19:52:00 2014
@@ -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;

Modified: qpid/branches/0.28/qpid/cpp/src/qpid/sys/posix/Thread.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/0.28/qpid/cpp/src/qpid/sys/posix/Thread.cpp?rev=1584361&r1=1584360&r2=1584361&view=diff
==============================================================================
--- qpid/branches/0.28/qpid/cpp/src/qpid/sys/posix/Thread.cpp (original)
+++ qpid/branches/0.28/qpid/cpp/src/qpid/sys/posix/Thread.cpp Thu Apr  3 19:52:00 2014
@@ -55,7 +55,7 @@ Thread::Thread(Runnable* runnable) : imp
 Thread::Thread(Runnable& runnable) : impl(new ThreadPrivate(&runnable)) {}
 
 Thread::operator bool() {
-    return impl;
+    return !!impl;
 }
 
 bool Thread::operator==(const Thread& t) const {

Modified: qpid/branches/0.28/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/0.28/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.cpp?rev=1584361&r1=1584360&r2=1584361&view=diff
==============================================================================
--- qpid/branches/0.28/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.cpp (original)
+++ qpid/branches/0.28/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.cpp Thu Apr  3 19:52:00 2014
@@ -330,7 +330,7 @@ namespace Rdma {
     {}
 
     ConnectionEvent::operator bool() const {
-        return event;
+        return !!event;
     }
 
     ::rdma_cm_event_type ConnectionEvent::getEventType() const {

Modified: qpid/branches/0.28/qpid/cpp/src/tests/legacystore/jrnl/_ut_jdir.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/0.28/qpid/cpp/src/tests/legacystore/jrnl/_ut_jdir.cpp?rev=1584361&r1=1584360&r2=1584361&view=diff
==============================================================================
--- qpid/branches/0.28/qpid/cpp/src/tests/legacystore/jrnl/_ut_jdir.cpp (original)
+++ qpid/branches/0.28/qpid/cpp/src/tests/legacystore/jrnl/_ut_jdir.cpp Thu Apr  3 19:52:00 2014
@@ -76,7 +76,7 @@ void create_jdat_file(const char* dirnam
     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();
 }

Modified: qpid/branches/0.28/qpid/cpp/src/tests/legacystore/jrnl/_ut_jinf.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/0.28/qpid/cpp/src/tests/legacystore/jrnl/_ut_jinf.cpp?rev=1584361&r1=1584360&r2=1584361&view=diff
==============================================================================
--- qpid/branches/0.28/qpid/cpp/src/tests/legacystore/jrnl/_ut_jinf.cpp (original)
+++ qpid/branches/0.28/qpid/cpp/src/tests/legacystore/jrnl/_ut_jinf.cpp Thu Apr  3 19:52:00 2014
@@ -360,7 +360,7 @@ QPID_AUTO_TEST_CASE(analyze_owi_in_non_a
             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_mi
             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
 

Modified: qpid/branches/0.28/qpid/cpp/src/tests/msg_group_test.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/0.28/qpid/cpp/src/tests/msg_group_test.cpp?rev=1584361&r1=1584360&r2=1584361&view=diff
==============================================================================
--- qpid/branches/0.28/qpid/cpp/src/tests/msg_group_test.cpp (original)
+++ qpid/branches/0.28/qpid/cpp/src/tests/msg_group_test.cpp Thu Apr  3 19:52:00 2014
@@ -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 {

Modified: qpid/branches/0.28/qpid/cpp/src/tests/qpid-receive.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/0.28/qpid/cpp/src/tests/qpid-receive.cpp?rev=1584361&r1=1584360&r2=1584361&view=diff
==============================================================================
--- qpid/branches/0.28/qpid/cpp/src/tests/qpid-receive.cpp (original)
+++ qpid/branches/0.28/qpid/cpp/src/tests/qpid-receive.cpp Thu Apr  3 19:52:00 2014
@@ -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 {

Modified: qpid/branches/0.28/qpid/cpp/src/tests/qpid-send.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/0.28/qpid/cpp/src/tests/qpid-send.cpp?rev=1584361&r1=1584360&r2=1584361&view=diff
==============================================================================
--- qpid/branches/0.28/qpid/cpp/src/tests/qpid-send.cpp (original)
+++ qpid/branches/0.28/qpid/cpp/src/tests/qpid-send.cpp Thu Apr  3 19:52:00 2014
@@ -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 C
   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;
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org