diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2024-04-24 18:45:54 +0300 |
---|---|---|
committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2024-04-24 18:45:54 +0300 |
commit | 428f21cf795f440f69a772b314f877ea0c6d4741 (patch) | |
tree | bc9cea56b8e236f52df392084552018c387cff2c /indra/llcommon | |
parent | 09454c53a48e88a9cdd54f68ac507694a766b213 (diff) | |
parent | d98fc504a1d4bc292ba86acdda053c8b4598a193 (diff) |
Merge branch 'main' into marchcat/x-merge
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/lldoubledispatch.h | 2 | ||||
-rw-r--r-- | indra/llcommon/llerror.cpp | 8 | ||||
-rw-r--r-- | indra/llcommon/llerrorcontrol.h | 2 | ||||
-rw-r--r-- | indra/llcommon/llevents.cpp | 20 | ||||
-rw-r--r-- | indra/llcommon/llevents.h | 5 | ||||
-rw-r--r-- | indra/llcommon/llinitparam.h | 2 | ||||
-rw-r--r-- | indra/llcommon/llleap.cpp | 4 | ||||
-rw-r--r-- | indra/llcommon/llmemory.cpp | 30 | ||||
-rw-r--r-- | indra/llcommon/llprocess.cpp | 9 | ||||
-rw-r--r-- | indra/llcommon/llprocess.h | 2 | ||||
-rw-r--r-- | indra/llcommon/llrun.h | 2 | ||||
-rw-r--r-- | indra/llcommon/llsdutil.h | 6 | ||||
-rw-r--r-- | indra/llcommon/llsingleton.cpp | 3 | ||||
-rw-r--r-- | indra/llcommon/llstring.h | 2 | ||||
-rw-r--r-- | indra/llcommon/llsys.cpp | 10 | ||||
-rw-r--r-- | indra/llcommon/tests/llerror_test.cpp | 30 | ||||
-rw-r--r-- | indra/llcommon/tests/lleventcoro_test.cpp | 8 | ||||
-rw-r--r-- | indra/llcommon/tests/llinstancetracker_test.cpp | 4 | ||||
-rw-r--r-- | indra/llcommon/tests/llprocess_test.cpp | 5 | ||||
-rw-r--r-- | indra/llcommon/tests/llstreamqueue_test.cpp | 9 | ||||
-rw-r--r-- | indra/llcommon/tests/lltreeiterators_test.cpp | 23 | ||||
-rw-r--r-- | indra/llcommon/tests/wrapllerrs.h | 4 |
22 files changed, 91 insertions, 99 deletions
diff --git a/indra/llcommon/lldoubledispatch.h b/indra/llcommon/lldoubledispatch.h index 8ed295b6f1..ce6731e864 100644 --- a/indra/llcommon/lldoubledispatch.h +++ b/indra/llcommon/lldoubledispatch.h @@ -255,7 +255,7 @@ private: }; /// shared_ptr manages Entry lifespan for us - typedef boost::shared_ptr<EntryBase> EntryPtr; + typedef std::shared_ptr<EntryBase> EntryPtr; /// use a @c list to make it easy to insert typedef std::list<EntryPtr> DispatchTable; DispatchTable mDispatch; diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 3de641fcba..0f48ce16b2 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -1070,7 +1070,7 @@ namespace LLError // // NOTE!!! Requires external mutex lock!!! template <typename RECORDER> - std::pair<boost::shared_ptr<RECORDER>, Recorders::iterator> + std::pair<std::shared_ptr<RECORDER>, Recorders::iterator> findRecorderPos(SettingsConfigPtr &s) { // Since we promise to return an iterator, use a classic iterator @@ -1081,7 +1081,7 @@ namespace LLError // *it is a RecorderPtr, a shared_ptr<Recorder>. Use a // dynamic_pointer_cast to try to downcast to test if it's also a // shared_ptr<RECORDER>. - auto ptr = boost::dynamic_pointer_cast<RECORDER>(*it); + auto ptr = std::dynamic_pointer_cast<RECORDER>(*it); if (ptr) { // found the entry we want @@ -1101,7 +1101,7 @@ namespace LLError // shared_ptr might be empty (operator!() returns true) if there was no // such RECORDER subclass instance in mRecorders. template <typename RECORDER> - boost::shared_ptr<RECORDER> findRecorder() + std::shared_ptr<RECORDER> findRecorder() { SettingsConfigPtr s = Globals::getInstance()->getSettingsConfig(); LLMutexLock lock(&s->mRecorderMutex); @@ -1134,7 +1134,7 @@ namespace LLError if (!file_name.empty()) { - boost::shared_ptr<RecordToFile> recordToFile(new RecordToFile(file_name)); + std::shared_ptr<RecordToFile> recordToFile(new RecordToFile(file_name)); if (recordToFile->okay()) { addRecorder(recordToFile); diff --git a/indra/llcommon/llerrorcontrol.h b/indra/llcommon/llerrorcontrol.h index 57f10b7895..77b187a80f 100644 --- a/indra/llcommon/llerrorcontrol.h +++ b/indra/llcommon/llerrorcontrol.h @@ -174,7 +174,7 @@ namespace LLError bool mWantsMultiline; }; - typedef boost::shared_ptr<Recorder> RecorderPtr; + typedef std::shared_ptr<Recorder> RecorderPtr; /** * Instantiate GenericRecorder with a callable(level, message) to get diff --git a/indra/llcommon/llevents.cpp b/indra/llcommon/llevents.cpp index 1a305ec3dc..70931f3a65 100644 --- a/indra/llcommon/llevents.cpp +++ b/indra/llcommon/llevents.cpp @@ -211,12 +211,21 @@ void LLEventPumps::clear() } } -void LLEventPumps::reset() +void LLEventPumps::reset(bool log_pumps) { // Reset every known LLEventPump instance. Leave it up to each instance to // decide what to do with the reset() call. + if (log_pumps) + { + LL_INFOS() << "Resetting " << (S32)mPumpMap.size() << " pumps" << LL_ENDL; + } + for (PumpMap::value_type& pair : mPumpMap) { + if (log_pumps) + { + LL_INFOS() << "Resetting pump " << pair.first << LL_ENDL; + } pair.second->reset(); } } @@ -373,9 +382,11 @@ std::string LLEventPump::inventName(const std::string& pfx) void LLEventPump::clear() { + LLMutexLock lock(&mConnectionListMutex); // Destroy the original LLStandardSignal instance, replacing it with a // whole new one. mSignal = std::make_shared<LLStandardSignal>(); + mConnections.clear(); } @@ -383,6 +394,7 @@ void LLEventPump::reset() { // Resetting mSignal is supposed to disconnect everything on its own // But due to crash on 'reset' added explicit cleanup to get more data + LLMutexLock lock(&mConnectionListMutex); ConnectionMap::const_iterator iter = mConnections.begin(); ConnectionMap::const_iterator end = mConnections.end(); while (iter!=end) @@ -407,6 +419,8 @@ LLBoundListener LLEventPump::listen_impl(const std::string& name, const LLEventL return LLBoundListener(); } + LLMutexLock lock(&mConnectionListMutex); + float nodePosition = 1.0; // if the supplied name is empty we are not interested in the ordering mechanism @@ -566,8 +580,9 @@ LLBoundListener LLEventPump::listen_impl(const std::string& name, const LLEventL return bound; } -LLBoundListener LLEventPump::getListener(const std::string& name) const +LLBoundListener LLEventPump::getListener(const std::string& name) { + LLMutexLock lock(&mConnectionListMutex); ConnectionMap::const_iterator found = mConnections.find(name); if (found != mConnections.end()) { @@ -579,6 +594,7 @@ LLBoundListener LLEventPump::getListener(const std::string& name) const void LLEventPump::stopListening(const std::string& name) { + LLMutexLock lock(&mConnectionListMutex); ConnectionMap::iterator found = mConnections.find(name); if (found != mConnections.end()) { diff --git a/indra/llcommon/llevents.h b/indra/llcommon/llevents.h index c1dbf4392f..bebcfacdcb 100644 --- a/indra/llcommon/llevents.h +++ b/indra/llcommon/llevents.h @@ -332,7 +332,7 @@ public: * Reset all known LLEventPump instances * workaround for DEV-35406 crash on shutdown */ - void reset(); + void reset(bool log_pumps = false); private: friend class LLEventPump; @@ -558,7 +558,7 @@ public: /// Get the LLBoundListener associated with the passed name (dummy /// LLBoundListener if not found) - virtual LLBoundListener getListener(const std::string& name) const; + virtual LLBoundListener getListener(const std::string& name); /** * Instantiate one of these to block an existing connection: * @code @@ -601,6 +601,7 @@ private: LLHandle<LLEventPumps> mRegistry; std::string mName; + LLMutex mConnectionListMutex; protected: virtual LLBoundListener listen_impl(const std::string& name, const LLEventListener&, diff --git a/indra/llcommon/llinitparam.h b/indra/llcommon/llinitparam.h index 9edc7e40f3..e0d0ab9ac7 100644 --- a/indra/llcommon/llinitparam.h +++ b/indra/llcommon/llinitparam.h @@ -627,7 +627,7 @@ namespace LLInitParam UserData* mUserData; }; - typedef boost::shared_ptr<ParamDescriptor> ParamDescriptorPtr; + typedef std::shared_ptr<ParamDescriptor> ParamDescriptorPtr; // each derived Block class keeps a static data structure maintaining offsets to various params class LL_COMMON_API BlockDescriptor diff --git a/indra/llcommon/llleap.cpp b/indra/llcommon/llleap.cpp index 8f88e728ce..b2b1162f63 100644 --- a/indra/llcommon/llleap.cpp +++ b/indra/llcommon/llleap.cpp @@ -462,10 +462,10 @@ private: LLProcessPtr mChild; LLTempBoundListener mStdinConnection, mStdoutConnection, mStdoutDataConnection, mStderrConnection; - boost::scoped_ptr<LLEventPump::Blocker> mBlocker; + std::unique_ptr<LLEventPump::Blocker> mBlocker; LLProcess::ReadPipe::size_type mExpect; LLError::RecorderPtr mRecorder; - boost::scoped_ptr<LLLeapListener> mListener; + std::unique_ptr<LLLeapListener> mListener; }; // These must follow the declaration of LLLeapImpl, so they may as well be last. diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index 7cdf7254ff..574b9b8b3b 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -38,6 +38,7 @@ #include <mach/mach_host.h> #elif LL_LINUX # include <unistd.h> +# include <sys/resource.h> #endif #include "llmemory.h" @@ -273,33 +274,16 @@ U64 LLMemory::getCurrentRSS() U64 LLMemory::getCurrentRSS() { - static const char statPath[] = "/proc/self/stat"; - LLFILE *fp = LLFile::fopen(statPath, "r"); - U64 rss = 0; + struct rusage usage; - if (fp == NULL) - { - LL_WARNS() << "couldn't open " << statPath << LL_ENDL; + if (getrusage(RUSAGE_SELF, &usage) != 0) { + // Error handling code could be here return 0; } - // Eee-yew! See Documentation/filesystems/proc.txt in your - // nearest friendly kernel tree for details. - - { - int ret = fscanf(fp, "%*d (%*[^)]) %*c %*d %*d %*d %*d %*d %*d %*d " - "%*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %Lu", - &rss); - if (ret != 1) - { - LL_WARNS() << "couldn't parse contents of " << statPath << LL_ENDL; - rss = 0; - } - } - - fclose(fp); - - return rss; + // ru_maxrss (since Linux 2.6.32) + // This is the maximum resident set size used (in kilobytes). + return usage.ru_maxrss * 1024; } #else diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 0d65762284..0d6a147da3 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -36,7 +36,6 @@ #include "llevents.h" #include "llexception.h" -#include <boost/foreach.hpp> #include <boost/bind.hpp> #include <boost/asio/streambuf.hpp> #include <boost/asio/buffers_iterator.hpp> @@ -587,7 +586,7 @@ LLProcess::LLProcess(const LLSDOrParams& params): // apr_procattr_child_err_set()), or accepting a filename, opening it and // passing that apr_file_t (simple <, >, 2> redirect emulation). std::vector<apr_int32_t> select; - BOOST_FOREACH(const FileParam& fparam, params.files) + for (const FileParam& fparam : params.files) { // Every iteration, we're going to append an item to 'select'. At the // top of the loop, its size() is, in effect, an index. Use that to @@ -684,7 +683,7 @@ LLProcess::LLProcess(const LLSDOrParams& params): argv.push_back(params.executable().c_str()); // Add arguments. See above remarks about c_str(). - BOOST_FOREACH(const std::string& arg, params.args) + for (const std::string& arg : params.args) { argv.push_back(arg.c_str()); } @@ -961,7 +960,7 @@ void LLProcess::handle_status(int reason, int status) // only be performed if in fact we're going to produce the log message. LL_DEBUGS("LLProcess") << empty; std::string reason_str; - BOOST_FOREACH(const ReasonCode& rcp, reasons) + for (const ReasonCode& rcp : reasons) { if (reason == rcp.code) { @@ -1151,7 +1150,7 @@ std::ostream& operator<<(std::ostream& out, const LLProcess::Params& params) out << "cd " << LLStringUtil::quote(params.cwd) << ": "; } out << LLStringUtil::quote(params.executable); - BOOST_FOREACH(const std::string& arg, params.args) + for (const std::string& arg : params.args) { out << ' ' << LLStringUtil::quote(arg); } diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index 0842f2eb07..c57821bf52 100644 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h @@ -51,7 +51,7 @@ class LLEventPump; class LLProcess; /// LLProcess instances are created on the heap by static factory methods and /// managed by ref-counted pointers. -typedef boost::shared_ptr<LLProcess> LLProcessPtr; +typedef std::shared_ptr<LLProcess> LLProcessPtr; /** * LLProcess handles launching an external process with specified command line diff --git a/indra/llcommon/llrun.h b/indra/llcommon/llrun.h index d610f86234..42e3d9b47a 100644 --- a/indra/llcommon/llrun.h +++ b/indra/llcommon/llrun.h @@ -48,7 +48,7 @@ public: /** * @brief The pointer to a runnable. */ - typedef boost::shared_ptr<LLRunnable> run_ptr_t; + typedef std::shared_ptr<LLRunnable> run_ptr_t; /** * @brief The handle for use in the API. diff --git a/indra/llcommon/llsdutil.h b/indra/llcommon/llsdutil.h index ad54d1b0be..fdcc052bd0 100644 --- a/indra/llcommon/llsdutil.h +++ b/indra/llcommon/llsdutil.h @@ -478,9 +478,9 @@ namespace llsd { /***************************************************************************** -* BOOST_FOREACH() helpers for LLSD +* range-based for-loop helpers for LLSD *****************************************************************************/ -/// Usage: BOOST_FOREACH(LLSD item, inArray(someLLSDarray)) { ... } +/// Usage: for (LLSD item : inArray(someLLSDarray)) { ... } class inArray { public: @@ -503,7 +503,7 @@ private: /// MapEntry is what you get from dereferencing an LLSD::map_[const_]iterator. typedef std::map<LLSD::String, LLSD>::value_type MapEntry; -/// Usage: BOOST_FOREACH([const] MapEntry& e, inMap(someLLSDmap)) { ... } +/// Usage: for([const] MapEntry& e : inMap(someLLSDmap)) { ... } class inMap { public: diff --git a/indra/llcommon/llsingleton.cpp b/indra/llcommon/llsingleton.cpp index 6b1986d0e9..5f1a89670e 100644 --- a/indra/llcommon/llsingleton.cpp +++ b/indra/llcommon/llsingleton.cpp @@ -32,7 +32,6 @@ #include "lldependencies.h" #include "llexception.h" #include "llcoros.h" -#include <boost/foreach.hpp> #include <algorithm> #include <iostream> // std::cerr in dire emergency #include <sstream> @@ -411,7 +410,7 @@ void LLSingletonBase::cleanup_() void LLSingletonBase::deleteAll() { // It's essential to traverse these in dependency order. - BOOST_FOREACH(LLSingletonBase* sp, dep_sort()) + for (LLSingletonBase* sp : dep_sort()) { // Capture the class name first: in case of exception, don't count on // being able to extract it later. diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index a8d910298c..5e622dc6c1 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -1215,7 +1215,7 @@ void LLStringUtilBase<T>::getTokens(const string_type& string, std::vector<strin { // This overload must deal with escapes. Delegate that to InEscString // (unless there ARE no escapes). - boost::scoped_ptr< LLStringUtilBaseImpl::InString<T> > instrp; + std::unique_ptr< LLStringUtilBaseImpl::InString<T> > instrp; if (escapes.empty()) instrp.reset(new LLStringUtilBaseImpl::InString<T>(string.begin(), string.end())); else diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index b72fde9264..02cae908fa 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -49,7 +49,6 @@ #include "llsdutil.h" #include <boost/bind.hpp> #include <boost/circular_buffer.hpp> -#include <boost/foreach.hpp> #include <boost/lexical_cast.hpp> #include <boost/range.hpp> #include <boost/utility/enable_if.hpp> @@ -905,9 +904,9 @@ void LLMemoryInfo::stream(std::ostream& s) const // Max key length size_t key_width(0); - BOOST_FOREACH(const MapEntry& pair, inMap(mStatsMap)) + for (const auto& [key, value] : inMap(mStatsMap)) { - size_t len(pair.first.length()); + size_t len(key.length()); if (len > key_width) { key_width = len; @@ -915,10 +914,9 @@ void LLMemoryInfo::stream(std::ostream& s) const } // Now stream stats - BOOST_FOREACH(const MapEntry& pair, inMap(mStatsMap)) + for (const auto& [key, value] : inMap(mStatsMap)) { - s << pfx << std::setw(narrow<size_t>(key_width+1)) << (pair.first + ':') << ' '; - LLSD value(pair.second); + s << pfx << std::setw(narrow<size_t>(key_width+1)) << (key + ':') << ' '; if (value.isInteger()) s << std::setw(12) << value.asInteger(); else if (value.isReal()) diff --git a/indra/llcommon/tests/llerror_test.cpp b/indra/llcommon/tests/llerror_test.cpp index 148c18aabe..b4cdbdc6bf 100644 --- a/indra/llcommon/tests/llerror_test.cpp +++ b/indra/llcommon/tests/llerror_test.cpp @@ -153,27 +153,27 @@ namespace tut int countMessages() { - return boost::dynamic_pointer_cast<TestRecorder>(mRecorder)->countMessages(); + return std::dynamic_pointer_cast<TestRecorder>(mRecorder)->countMessages(); } void clearMessages() { - boost::dynamic_pointer_cast<TestRecorder>(mRecorder)->clearMessages(); + std::dynamic_pointer_cast<TestRecorder>(mRecorder)->clearMessages(); } void setWantsTime(bool t) { - boost::dynamic_pointer_cast<TestRecorder>(mRecorder)->showTime(t); + std::dynamic_pointer_cast<TestRecorder>(mRecorder)->showTime(t); } void setWantsMultiline(bool t) { - boost::dynamic_pointer_cast<TestRecorder>(mRecorder)->showMultiline(t); + std::dynamic_pointer_cast<TestRecorder>(mRecorder)->showMultiline(t); } std::string message(int n) { - return boost::dynamic_pointer_cast<TestRecorder>(mRecorder)->message(n); + return std::dynamic_pointer_cast<TestRecorder>(mRecorder)->message(n); } void ensure_message_count(int expectedCount) @@ -497,12 +497,12 @@ namespace void testLogName(LLError::RecorderPtr recorder, LogFromFunction f, const std::string& class_name = "") { - boost::dynamic_pointer_cast<tut::TestRecorder>(recorder)->clearMessages(); + std::dynamic_pointer_cast<tut::TestRecorder>(recorder)->clearMessages(); std::string name = f(false); f(true); - std::string messageWithoutName = boost::dynamic_pointer_cast<tut::TestRecorder>(recorder)->message(0); - std::string messageWithName = boost::dynamic_pointer_cast<tut::TestRecorder>(recorder)->message(1); + std::string messageWithoutName = std::dynamic_pointer_cast<tut::TestRecorder>(recorder)->message(0); + std::string messageWithName = std::dynamic_pointer_cast<tut::TestRecorder>(recorder)->message(1); ensure_has(name + " logged without name", messageWithoutName, name); @@ -691,13 +691,13 @@ namespace tut LL_INFOS() << "boo" << LL_ENDL; ensure_message_field_equals(0, MSG_FIELD, "boo"); - ensure_equals("alt recorder count", boost::dynamic_pointer_cast<TestRecorder>(altRecorder)->countMessages(), 1); - ensure_contains("alt recorder message 0", boost::dynamic_pointer_cast<TestRecorder>(altRecorder)->message(0), "boo"); + ensure_equals("alt recorder count", std::dynamic_pointer_cast<TestRecorder>(altRecorder)->countMessages(), 1); + ensure_contains("alt recorder message 0", std::dynamic_pointer_cast<TestRecorder>(altRecorder)->message(0), "boo"); LLError::setTimeFunction(roswell); LLError::RecorderPtr anotherRecorder(new TestRecorder()); - boost::dynamic_pointer_cast<TestRecorder>(anotherRecorder)->showTime(true); + std::dynamic_pointer_cast<TestRecorder>(anotherRecorder)->showTime(true); LLError::addRecorder(anotherRecorder); LL_INFOS() << "baz" << LL_ENDL; @@ -705,10 +705,10 @@ namespace tut std::string when = roswell(); ensure_message_does_not_contain(1, when); - ensure_equals("alt recorder count", boost::dynamic_pointer_cast<TestRecorder>(altRecorder)->countMessages(), 2); - ensure_does_not_contain("alt recorder message 1", boost::dynamic_pointer_cast<TestRecorder>(altRecorder)->message(1), when); - ensure_equals("another recorder count", boost::dynamic_pointer_cast<TestRecorder>(anotherRecorder)->countMessages(), 1); - ensure_contains("another recorder message 0", boost::dynamic_pointer_cast<TestRecorder>(anotherRecorder)->message(0), when); + ensure_equals("alt recorder count", std::dynamic_pointer_cast<TestRecorder>(altRecorder)->countMessages(), 2); + ensure_does_not_contain("alt recorder message 1", std::dynamic_pointer_cast<TestRecorder>(altRecorder)->message(1), when); + ensure_equals("another recorder count", std::dynamic_pointer_cast<TestRecorder>(anotherRecorder)->countMessages(), 1); + ensure_contains("another recorder message 0", std::dynamic_pointer_cast<TestRecorder>(anotherRecorder)->message(0), when); LLError::removeRecorder(altRecorder); LLError::removeRecorder(anotherRecorder); diff --git a/indra/llcommon/tests/lleventcoro_test.cpp b/indra/llcommon/tests/lleventcoro_test.cpp index 032923a108..01104545c6 100644 --- a/indra/llcommon/tests/lleventcoro_test.cpp +++ b/indra/llcommon/tests/lleventcoro_test.cpp @@ -101,7 +101,7 @@ namespace tut int which; LLTestApp testApp; - void explicit_wait(boost::shared_ptr<LLCoros::Promise<std::string>>& cbp); + void explicit_wait(std::shared_ptr<LLCoros::Promise<std::string>>& cbp); void waitForEventOn1(); void coroPump(); void postAndWait1(); @@ -111,7 +111,7 @@ namespace tut typedef coroutine_group::object object; coroutine_group coroutinegrp("coroutine"); - void test_data::explicit_wait(boost::shared_ptr<LLCoros::Promise<std::string>>& cbp) + void test_data::explicit_wait(std::shared_ptr<LLCoros::Promise<std::string>>& cbp) { BEGIN { @@ -127,7 +127,7 @@ namespace tut // For test purposes, instead of handing 'callback' (or an // adapter) off to some I/O subsystem, we'll just pass it back to // our caller. - cbp = boost::make_shared<LLCoros::Promise<std::string>>(); + cbp = std::make_shared<LLCoros::Promise<std::string>>(); LLCoros::Future<std::string> future = LLCoros::getFuture(*cbp); // calling get() on the future causes us to suspend @@ -146,7 +146,7 @@ namespace tut DEBUG; // Construct the coroutine instance that will run explicit_wait. - boost::shared_ptr<LLCoros::Promise<std::string>> respond; + std::shared_ptr<LLCoros::Promise<std::string>> respond; LLCoros::instance().launch("test<1>", [this, &respond](){ explicit_wait(respond); }); mSync.bump(); diff --git a/indra/llcommon/tests/llinstancetracker_test.cpp b/indra/llcommon/tests/llinstancetracker_test.cpp index 5daa29adf4..95af9c2a50 100644 --- a/indra/llcommon/tests/llinstancetracker_test.cpp +++ b/indra/llcommon/tests/llinstancetracker_test.cpp @@ -94,7 +94,7 @@ namespace tut ensure("couldn't find stack Keyed", bool(found)); ensure_equals("found wrong Keyed instance", found.get(), &one); { - boost::scoped_ptr<Keyed> two(new Keyed("two")); + std::unique_ptr<Keyed> two(new Keyed("two")); ensure_equals(Keyed::instanceCount(), 2); auto found = Keyed::getInstance("two"); ensure("couldn't find heap Keyed", bool(found)); @@ -118,7 +118,7 @@ namespace tut std::weak_ptr<Unkeyed> found = one.getWeak(); ensure(! found.expired()); { - boost::scoped_ptr<Unkeyed> two(new Unkeyed); + std::unique_ptr<Unkeyed> two(new Unkeyed); ensure_equals(Unkeyed::instanceCount(), 2); } ensure_equals(Unkeyed::instanceCount(), 1); diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index b6b297b8d7..628f046f55 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -21,7 +21,6 @@ // external library headers #include "llapr.h" #include "apr_thread_proc.h" -#include <boost/foreach.hpp> #include <boost/function.hpp> #include <boost/algorithm/string/find_iterator.hpp> #include <boost/algorithm/string/finder.hpp> @@ -323,7 +322,7 @@ namespace tut { /*==========================================================================*| std::string reason_str; - BOOST_FOREACH(const ReasonCode& rcp, reasons) + for (const ReasonCode& rcp : reasons) { if (reason == rcp.code) { @@ -554,7 +553,7 @@ namespace tut catch (const failure&) { std::cout << "History:\n"; - BOOST_FOREACH(const Item& item, history) + for (const Item& item : history) { std::string what(item.what); if ((! what.empty()) && what[what.length() - 1] == '\n') diff --git a/indra/llcommon/tests/llstreamqueue_test.cpp b/indra/llcommon/tests/llstreamqueue_test.cpp index 050ad5c5bf..8af057328b 100644 --- a/indra/llcommon/tests/llstreamqueue_test.cpp +++ b/indra/llcommon/tests/llstreamqueue_test.cpp @@ -15,9 +15,6 @@ #include "llstreamqueue.h" // STL headers #include <vector> -// std headers -// external library headers -#include <boost/foreach.hpp> // other Linden headers #include "../test/lltut.h" #include "stringize.h" @@ -133,7 +130,7 @@ namespace tut std::streamsize leave(5); // len("craft") above std::streamsize skip(total - leave); std::streamsize written(0); - BOOST_FOREACH(const std::string& block, blocks) + for (const std::string& block : blocks) { written += strq.write(&block[0], block.length()); ensure_equals("size() after write()", strq.size(), written); @@ -152,7 +149,7 @@ namespace tut { set_test_name("concatenate blocks"); std::string blocks[] = { "abcd", "efghij", "klmnopqrs" }; - BOOST_FOREACH(const std::string& block, blocks) + for (const std::string& block : blocks) { strq.write(&block[0], block.length()); } @@ -170,7 +167,7 @@ namespace tut { set_test_name("split blocks"); std::string blocks[] = { "abcdefghijklm", "nopqrstuvwxyz" }; - BOOST_FOREACH(const std::string& block, blocks) + for (const std::string& block : blocks) { strq.write(&block[0], block.length()); } diff --git a/indra/llcommon/tests/lltreeiterators_test.cpp b/indra/llcommon/tests/lltreeiterators_test.cpp index 1d619867d4..b9c7a70c07 100644 --- a/indra/llcommon/tests/lltreeiterators_test.cpp +++ b/indra/llcommon/tests/lltreeiterators_test.cpp @@ -38,7 +38,6 @@ // external library headers #include <boost/bind.hpp> #include <boost/range/iterator_range.hpp> -#include <boost/foreach.hpp> // associated header #include "../lltreeiterators.h" @@ -402,7 +401,7 @@ private: * * Example: * @code - * BOOST_FOREACH(TreeNodePtr node, getRootRange<LLTreeIter::UP>(somenode)) + * for (TreeNodePtr node : getRootRange<LLTreeIter::UP>(somenode)) * { * std::cout << node->name() << '\n'; * } @@ -424,7 +423,7 @@ getRootRange(const TreeNodePtr& node) * * Example: * @code - * BOOST_FOREACH(TreeNodePtr node, getWalkRange<LLTreeIter::DFS_PRE>(root)) + * for (TreeNodePtr node : getWalkRange<LLTreeIter::DFS_PRE>(root)) * { * std::cout << node->name() << '\n'; * } @@ -520,7 +519,7 @@ public: * * Example usage: * @code - * BOOST_FOREACH(EnhancedTreeNodePtr node, somenode->getRootRange<LLTreeIter::UP>()) + * for (EnhancedTreeNodePtr node : somenode->getRootRange<LLTreeIter::UP>()) * { * std::cout << node->name() << '\n'; * } @@ -564,7 +563,7 @@ public: * * Example usage: * @code - * BOOST_FOREACH(EnhancedTreeNodePtr node, somenode->getWalkRange<LLTreeIter::DFS_PRE>()) + * for (EnhancedTreeNodePtr node : somenode->getWalkRange<LLTreeIter::DFS_PRE>()) * { * std::cout << node->name() << '\n'; * } @@ -644,7 +643,7 @@ LLLinkedIter<PlainTree> PlainTree_child_end(PlainTree* node) * * Example: * @code - * BOOST_FOREACH(PlainTree* node, getRootRange<LLTreeIter::UP>(somenode)) + * for (PlainTree* node : getRootRange<LLTreeIter::UP>(somenode)) * { * std::cout << node->name() << '\n'; * } @@ -668,7 +667,7 @@ getRootRange(PlainTree* node) * * Example: * @code - * BOOST_FOREACH(PlainTree* node, getWalkRange<LLTreeIter::DFS_PRE>(root)) + * for (PlainTree* node : getWalkRange<LLTreeIter::DFS_PRE>(root)) * { * std::cout << node->name() << '\n'; * } @@ -1103,18 +1102,18 @@ namespace tut // This test function illustrates the looping techniques described in the // comments for the getRootRange() free function, the // EnhancedTreeNode::root_range template and the - // EnhancedTreeNode::getRootRange() method. Obviously the BOOST_FOREACH() + // EnhancedTreeNode::getRootRange() method. Obviously the for() // forms are more succinct. TreeNodePtr tnroot(example_tree<TreeNode>()); TreeNodePtr tnB2b(get_B2b<TreeNode, TreeNode::child_iterator> (tnroot, boost::bind(&TreeNode::child_begin, _1))); - std::string desc1("BOOST_FOREACH(TreeNodePr, getRootRange<LLTreeIter::UP>(tnB2b))"); + std::string desc1("for (TreeNodePr : getRootRange<LLTreeIter::UP>(tnB2b))"); // std::cout << desc1 << "\n"; // Although we've commented out the output statement, ensure that the // loop construct is still valid, as promised by the getRootRange() // documentation. - BOOST_FOREACH(TreeNodePtr node, getRootRange<LLTreeIter::UP>(tnB2b)) + for (TreeNodePtr node : getRootRange<LLTreeIter::UP>(tnB2b)) { // std::cout << node->name() << '\n'; } @@ -1137,9 +1136,9 @@ namespace tut // std::cout << (*ri)->name() << '\n'; } - std::string desc2("BOOST_FOREACH(EnhancedTreeNodePtr node, etnB2b->getRootRange<LLTreeIter::UP>())"); + std::string desc2("for (EnhancedTreeNodePtr node : etnB2b->getRootRange<LLTreeIter::UP>())"); // std::cout << desc2 << '\n'; - BOOST_FOREACH(EnhancedTreeNodePtr node, etnB2b->getRootRange<LLTreeIter::UP>()) + for (EnhancedTreeNodePtr node : etnB2b->getRootRange<LLTreeIter::UP>()) { // std::cout << node->name() << '\n'; } diff --git a/indra/llcommon/tests/wrapllerrs.h b/indra/llcommon/tests/wrapllerrs.h index d657b329bb..6978c296b3 100644 --- a/indra/llcommon/tests/wrapllerrs.h +++ b/indra/llcommon/tests/wrapllerrs.h @@ -218,12 +218,12 @@ public: /// for the sought string. std::string messageWith(const std::string& search, bool required=true) { - return boost::dynamic_pointer_cast<CaptureLogRecorder>(mRecorder)->messageWith(search, required); + return std::dynamic_pointer_cast<CaptureLogRecorder>(mRecorder)->messageWith(search, required); } std::ostream& streamto(std::ostream& out) const { - return boost::dynamic_pointer_cast<CaptureLogRecorder>(mRecorder)->streamto(out); + return std::dynamic_pointer_cast<CaptureLogRecorder>(mRecorder)->streamto(out); } friend inline std::ostream& operator<<(std::ostream& out, const CaptureLog& self) |