diff options
| author | Erik Kundiman <erik@megapahit.org> | 2025-12-04 13:58:12 +0800 |
|---|---|---|
| committer | Erik Kundiman <erik@megapahit.org> | 2025-12-04 16:48:50 +0800 |
| commit | e3a35af2c676fb211ff7d01a79eb1a3299bc82f3 (patch) | |
| tree | 0ff7a0a15d1a53850399250b65f0a2a42f7bbf22 /indra/llcommon | |
| parent | ac052bed7f9f97efc63f0a0322214d4dcdcd5664 (diff) | |
| parent | c4ec3d866082d588de671e833413474d7ab19524 (diff) | |
Merge remote-tracking branch 'secondlife/release/2026.01' into 2026.01
Diffstat (limited to 'indra/llcommon')
40 files changed, 226 insertions, 258 deletions
diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp index 04aba817f8..51c814a387 100644 --- a/indra/llcommon/llapr.cpp +++ b/indra/llcommon/llapr.cpp @@ -154,7 +154,7 @@ LLVolatileAPRPool::LLVolatileAPRPool(bool is_local, apr_pool_t *parent, apr_size //create mutex if(!is_local) //not a local apr_pool, that is: shared by multiple threads. { - mMutexp.reset(new std::mutex()); + mMutexp = std::make_unique<std::mutex>(); } } diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 13597d56a4..d9f1a31575 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -33,7 +33,6 @@ #include <sys/param.h> // Need PATH_MAX in APR headers... #endif -#include <boost/noncopyable.hpp> #include "llwin32headers.h" #include "apr_thread_proc.h" #include "apr_getopt.h" @@ -146,7 +145,7 @@ private: // 2, a global pool. // -class LL_COMMON_API LLAPRFile : boost::noncopyable +class LL_COMMON_API LLAPRFile { // make this non copyable since a copy closes the file private: @@ -154,9 +153,12 @@ private: LLVolatileAPRPool *mCurrentFilePoolp ; //currently in use apr_pool, could be one of them: sAPRFilePoolp, or a temp pool. public: - LLAPRFile() ; + LLAPRFile(); LLAPRFile(const std::string& filename, apr_int32_t flags, LLVolatileAPRPool* pool = NULL); - ~LLAPRFile() ; + ~LLAPRFile(); + + LLAPRFile(const LLAPRFile&) = delete; + LLAPRFile& operator=(const LLAPRFile&) = delete; apr_status_t open(const std::string& filename, apr_int32_t flags, LLVolatileAPRPool* pool = NULL, S32* sizep = NULL); apr_status_t open(const std::string& filename, apr_int32_t flags, bool use_global_pool); //use gAPRPoolp. diff --git a/indra/llcommon/llcallbacklist.h b/indra/llcommon/llcallbacklist.h index d6c415f7c5..036e575117 100644 --- a/indra/llcommon/llcallbacklist.h +++ b/indra/llcommon/llcallbacklist.h @@ -27,8 +27,9 @@ #ifndef LL_LLCALLBACKLIST_H #define LL_LLCALLBACKLIST_H -#include "llstl.h" -#include <boost/function.hpp> +#include "stdtypes.h" + +#include <functional> #include <list> class LLCallbackList @@ -59,8 +60,8 @@ protected: callback_list_t mCallbackList; }; -typedef boost::function<void ()> nullary_func_t; -typedef boost::function<bool ()> bool_func_t; +typedef std::function<void ()> nullary_func_t; +typedef std::function<bool ()> bool_func_t; // Call a given callable once in idle loop. void doOnIdleOneTime(nullary_func_t callable); diff --git a/indra/llcommon/llcoros.h b/indra/llcommon/llcoros.h index c3820ae987..9df52b6ed5 100644 --- a/indra/llcommon/llcoros.h +++ b/indra/llcommon/llcoros.h @@ -37,7 +37,7 @@ #include "mutex.h" #include "llsingleton.h" #include "llinstancetracker.h" -#include <boost/function.hpp> +#include <functional> #include <string> #include <exception> #include <queue> @@ -112,7 +112,7 @@ public: /// stuck with the term "coroutine." typedef boost::fibers::fiber coro; /// Canonical callable type - typedef boost::function<void()> callable_t; + typedef std::function<void()> callable_t; /** * Create and start running a new coroutine with specified name. The name diff --git a/indra/llcommon/lldeadmantimer.h b/indra/llcommon/lldeadmantimer.h index 3f10420d41..19d65b78b6 100644 --- a/indra/llcommon/lldeadmantimer.h +++ b/indra/llcommon/lldeadmantimer.h @@ -99,13 +99,10 @@ public: /// during updates. If false, cpu usage data isn't /// collected and will be zero if queried. LLDeadmanTimer(F64 horizon, bool inc_cpu); + ~LLDeadmanTimer() = default; - ~LLDeadmanTimer() - {} - -private: - LLDeadmanTimer(const LLDeadmanTimer &); // Not defined - void operator=(const LLDeadmanTimer &); // Not defined + LLDeadmanTimer(const LLDeadmanTimer &) = delete; + LLDeadmanTimer& operator=(const LLDeadmanTimer&) = delete; public: /// Get the current time. Zero-basis for this time diff --git a/indra/llcommon/lldependencies.h b/indra/llcommon/lldependencies.h index 47b6fedc7d..a1b5c83caf 100644 --- a/indra/llcommon/lldependencies.h +++ b/indra/llcommon/lldependencies.h @@ -30,6 +30,7 @@ #if ! defined(LL_LLDEPENDENCIES_H) #define LL_LLDEPENDENCIES_H +#include <functional> #include <string> #include <vector> #include <set> @@ -38,7 +39,6 @@ #include <boost/iterator/transform_iterator.hpp> #include <boost/iterator/indirect_iterator.hpp> #include <boost/range/iterator_range.hpp> -#include <boost/function.hpp> #include <boost/bind.hpp> #include "llexception.h" @@ -217,7 +217,7 @@ class LLDependencies: public LLDependenciesBase /// We have various ways to get the dependencies for a given DepNode. /// Rather than having to restate each one for 'after' and 'before' /// separately, pass a dep_selector so we can apply each to either. - typedef boost::function<const typename DepNode::dep_set&(const DepNode&)> dep_selector; + typedef std::function<const typename DepNode::dep_set&(const DepNode&)> dep_selector; public: LLDependencies() {} @@ -340,7 +340,7 @@ private: public: /// iterator over value_type entries - typedef boost::transform_iterator<boost::function<value_type(DepNodeMapEntry&)>, + typedef boost::transform_iterator<std::function<value_type(DepNodeMapEntry&)>, typename DepNodeMap::iterator> iterator; /// range over value_type entries typedef boost::iterator_range<iterator> range; @@ -352,7 +352,7 @@ public: } /// iterator over const_value_type entries - typedef boost::transform_iterator<boost::function<const_value_type(const DepNodeMapEntry&)>, + typedef boost::transform_iterator<std::function<const_value_type(const DepNodeMapEntry&)>, typename DepNodeMap::const_iterator> const_iterator; /// range over const_value_type entries typedef boost::iterator_range<const_iterator> const_range; @@ -364,7 +364,7 @@ public: } /// iterator over stored NODEs - typedef boost::transform_iterator<boost::function<NODE&(DepNodeMapEntry&)>, + typedef boost::transform_iterator<std::function<NODE&(DepNodeMapEntry&)>, typename DepNodeMap::iterator> node_iterator; /// range over stored NODEs typedef boost::iterator_range<node_iterator> node_range; @@ -380,7 +380,7 @@ public: } /// const iterator over stored NODEs - typedef boost::transform_iterator<boost::function<const NODE&(const DepNodeMapEntry&)>, + typedef boost::transform_iterator<std::function<const NODE&(const DepNodeMapEntry&)>, typename DepNodeMap::const_iterator> const_node_iterator; /// const range over stored NODEs typedef boost::iterator_range<const_node_iterator> const_node_range; @@ -396,7 +396,7 @@ public: } /// const iterator over stored KEYs - typedef boost::transform_iterator<boost::function<const KEY&(const DepNodeMapEntry&)>, + typedef boost::transform_iterator<std::function<const KEY&(const DepNodeMapEntry&)>, typename DepNodeMap::const_iterator> const_key_iterator; /// const range over stored KEYs typedef boost::iterator_range<const_key_iterator> const_key_range; diff --git a/indra/llcommon/lldoubledispatch.h b/indra/llcommon/lldoubledispatch.h index 25039c3e9c..ad4dc57d58 100644 --- a/indra/llcommon/lldoubledispatch.h +++ b/indra/llcommon/lldoubledispatch.h @@ -30,9 +30,7 @@ #define LL_LLDOUBLEDISPATCH_H #include <list> -#include <boost/function.hpp> -#include <boost/bind.hpp> -#include <boost/ref.hpp> +#include <functional> /** * This class supports function calls which are virtual on the dynamic type of @@ -156,9 +154,9 @@ public: insert(t1, t2, func); if (symmetrical) { - // Use boost::bind() to construct a param-swapping thunk. Don't + // Use std::bind() to construct a param-swapping thunk. Don't // forget to reverse the parameters too. - insert(t2, t1, boost::bind(func, _2, _1)); + insert(t2, t1, std::bind(func, std::placeholders::_2, std::placeholders::_1)); } } @@ -193,7 +191,7 @@ public: insert(Type<Type1>(), Type<Type2>(), func, insertion); if (symmetrical) { - insert(Type<Type2>(), Type<Type1>(), boost::bind(func, _2, _1), insertion); + insert(Type<Type2>(), Type<Type1>(), std::bind(func, std::placeholders::_2, std::placeholders::_1), insertion); } } @@ -271,8 +269,8 @@ private: typename DispatchTable::iterator find(const ParamBaseType& param1, const ParamBaseType& param2) { return std::find_if(mDispatch.begin(), mDispatch.end(), - boost::bind(&EntryBase::matches, _1, - boost::ref(param1), boost::ref(param2))); + std::bind(&EntryBase::matches, std::placeholders::_1, + std::ref(param1), std::ref(param2))); } /// Look up the first matching entry. diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 3411e9c6bb..b14464382b 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -527,8 +527,8 @@ namespace mFileLevelMap(), mTagLevelMap(), mUniqueLogMessages(), - mCrashFunction(NULL), - mTimeFunction(NULL), + mCrashFunction(nullptr), + mTimeFunction(nullptr), mRecorders(), mShouldLogCallCounter(0) { @@ -1231,7 +1231,7 @@ namespace std::ostringstream message_stream; - if (r->wantsTime() && s->mTimeFunction != NULL) + if (r->wantsTime() && s->mTimeFunction != nullptr) { message_stream << s->mTimeFunction(); } diff --git a/indra/llcommon/llerrorcontrol.h b/indra/llcommon/llerrorcontrol.h index 0a7b3d2046..d254fa5407 100644 --- a/indra/llcommon/llerrorcontrol.h +++ b/indra/llcommon/llerrorcontrol.h @@ -31,7 +31,7 @@ #include "llerror.h" #include "llpointer.h" #include "llrefcount.h" -#include "boost/function.hpp" +#include <functional> #include <string> class LLSD; @@ -92,7 +92,7 @@ namespace LLError Control functions. */ - typedef boost::function<void(const std::string&)> FatalFunction; + typedef std::function<void(const std::string&)> FatalFunction; LL_COMMON_API void setFatalFunction(const FatalFunction&); // The fatal function will be called after an message of LEVEL_ERROR diff --git a/indra/llcommon/lleventdispatcher.h b/indra/llcommon/lleventdispatcher.h index 4c3c0f3414..97a60e2829 100644 --- a/indra/llcommon/lleventdispatcher.h +++ b/indra/llcommon/lleventdispatcher.h @@ -33,9 +33,7 @@ #define LL_LLEVENTDISPATCHER_H #include <boost/fiber/fss.hpp> -#include <boost/function_types/is_member_function_pointer.hpp> #include <boost/function_types/is_nonmember_callable_builtin.hpp> -#include <boost/hof/is_invocable.hpp> // until C++17, when we get std::is_invocable #include <boost/iterator/transform_iterator.hpp> #include <functional> // std::function #include <memory> // std::unique_ptr @@ -99,7 +97,7 @@ public: template <typename CALLABLE, typename=typename std::enable_if< - boost::hof::is_invocable<CALLABLE, LLSD>::value + std::is_invocable<CALLABLE, LLSD>::value >::type> void add(const std::string& name, const std::string& desc, @@ -295,9 +293,8 @@ public: * converted to the corresponding parameter type using LLSDParam. */ template <typename CALLABLE, - typename=typename std::enable_if< - ! boost::hof::is_invocable<CALLABLE, LLSD>() - >::type> + typename=typename std::enable_if_t< + ! std::is_invocable<CALLABLE, LLSD>()>> void add(const std::string& name, const std::string& desc, CALLABLE&& f) @@ -318,7 +315,7 @@ public: */ template<typename Method, typename InstanceGetter, typename = typename std::enable_if< - boost::function_types::is_member_function_pointer<Method>::value && + std::is_member_function_pointer<Method>::value && ! std::is_convertible<InstanceGetter, LLSD>::value >::type> void add(const std::string& name, const std::string& desc, Method f, @@ -338,7 +335,7 @@ public: template<typename Function, typename = typename std::enable_if< boost::function_types::is_nonmember_callable_builtin<Function>::value && - ! boost::hof::is_invocable<Function, LLSD>::value + ! std::is_invocable<Function, LLSD>::value >::type> void add(const std::string& name, const std::string& desc, Function f, const LLSD& params, const LLSD& defaults=LLSD()); @@ -364,7 +361,7 @@ public: */ template<typename Method, typename InstanceGetter, typename = typename std::enable_if< - boost::function_types::is_member_function_pointer<Method>::value && + std::is_member_function_pointer<Method>::value && ! std::is_convertible<InstanceGetter, LLSD>::value >::type> void add(const std::string& name, const std::string& desc, Method f, diff --git a/indra/llcommon/lleventfilter.h b/indra/llcommon/lleventfilter.h index d8c7e15a27..8b917c23be 100644 --- a/indra/llcommon/lleventfilter.h +++ b/indra/llcommon/lleventfilter.h @@ -33,7 +33,8 @@ #include "stdtypes.h" #include "lltimer.h" #include "llsdutil.h" -#include <boost/function.hpp> + +#include <functional> class LLEventTimer; class LLDate; @@ -92,8 +93,8 @@ public: /// construct and connect LLEventTimeoutBase(LLEventPump& source); - /// Callable, can be constructed with boost::bind() - typedef boost::function<void()> Action; + /// Callable, can be constructed with std::bind() + typedef std::function<void()> Action; /** * Start countdown timer for the specified number of @a seconds. Forward diff --git a/indra/llcommon/llevents.cpp b/indra/llcommon/llevents.cpp index 3c6743eac9..9a5324b598 100644 --- a/indra/llcommon/llevents.cpp +++ b/indra/llcommon/llevents.cpp @@ -44,7 +44,6 @@ #include <cmath> #include <cctype> // external library headers -#include <boost/range/iterator_range.hpp> #if LL_WINDOWS #pragma warning (push) #pragma warning (disable : 4701) // compiler thinks might use uninitialized var, but no diff --git a/indra/llcommon/llevents.h b/indra/llcommon/llevents.h index 4bf1fa07a2..18c05a0081 100644 --- a/indra/llcommon/llevents.h +++ b/indra/llcommon/llevents.h @@ -41,11 +41,7 @@ #include <boost/signals2.hpp> #include <boost/bind.hpp> -#include <boost/utility.hpp> // noncopyable #include <boost/optional/optional.hpp> -#include <boost/visit_each.hpp> -#include <boost/ref.hpp> // reference_wrapper -#include <boost/type_traits/is_pointer.hpp> #include <boost/static_assert.hpp> #include "llsd.h" #include "llsingleton.h" diff --git a/indra/llcommon/llhandle.h b/indra/llcommon/llhandle.h index ceea1d9c48..fd7d32e79a 100644 --- a/indra/llcommon/llhandle.h +++ b/indra/llcommon/llhandle.h @@ -31,8 +31,6 @@ #include "llrefcount.h" #include "llexception.h" #include <stdexcept> -#include <boost/type_traits/is_convertible.hpp> -#include <boost/utility/enable_if.hpp> #include <boost/throw_exception.hpp> /** @@ -90,7 +88,7 @@ public: LLHandle() : mTombStone(getDefaultTombStone()) {} template<typename U> - LLHandle(const LLHandle<U>& other, typename boost::enable_if< typename boost::is_convertible<U*, T*> >::type* dummy = 0) + LLHandle(const LLHandle<U>& other, typename std::enable_if_t<std::is_convertible_v<U*, T*>>* dummy = 0) : mTombStone(other.mTombStone) {} @@ -199,7 +197,7 @@ public: } template <typename U> - LLHandle<U> getDerivedHandle(typename boost::enable_if< typename boost::is_convertible<U*, T*> >::type* dummy = 0) const + LLHandle<U> getDerivedHandle(typename std::enable_if_t<std::is_convertible_v<U*, T*> >* dummy = 0) const { LLHandle<U> downcast_handle; downcast_handle.mTombStone = getHandle().mTombStone; diff --git a/indra/llcommon/llinitdestroyclass.h b/indra/llcommon/llinitdestroyclass.h index 2354c9f2ed..7cc9c6b930 100644 --- a/indra/llcommon/llinitdestroyclass.h +++ b/indra/llcommon/llinitdestroyclass.h @@ -37,7 +37,7 @@ #define LL_LLINITDESTROYCLASS_H #include "llsingleton.h" -#include <boost/function.hpp> +#include <functional> #include <typeinfo> #include <vector> #include <utility> // std::pair @@ -50,7 +50,7 @@ class LLCallbackRegistry { public: - typedef boost::function<void()> func_t; + typedef std::function<void()> func_t; void registerCallback(const std::string& name, const func_t& func) { diff --git a/indra/llcommon/llinitparam.h b/indra/llcommon/llinitparam.h index 32d7b17034..b01ea0bfb1 100644 --- a/indra/llcommon/llinitparam.h +++ b/indra/llcommon/llinitparam.h @@ -28,11 +28,12 @@ #ifndef LL_LLPARAM_H #define LL_LLPARAM_H +#include <functional> +#include <type_traits> #include <vector> #include <list> +#include <unordered_map> #include <boost/function.hpp> -#include <boost/type_traits/is_convertible.hpp> -#include <boost/type_traits/is_enum.hpp> #include <boost/unordered_map.hpp> #include "llerror.h" @@ -105,6 +106,26 @@ namespace LLTypeTags }; } +namespace ll +{ + // Primary template: general case is false + template<typename T> + struct is_std_function : std::false_type + { + }; + + // Specialization for std::function + // R is the return type, Args is a parameter pack for argument types + template<typename R, typename... Args> + struct is_std_function<std::function<R(Args...)>> : std::true_type + { + }; + + // Helper variable template for convenience (C++14 onwards) + template<typename T> + constexpr bool is_std_function_v = is_std_function<T>::value; +} + namespace LLInitParam { // used to indicate no matching value to a given name when parsing @@ -114,7 +135,7 @@ namespace LLInitParam // wraps comparison operator between any 2 values of the same type // specialize to handle cases where equality isn't defined well, or at all - template <typename T, bool IS_BOOST_FUNCTION = boost::is_convertible<T, boost::function_base>::value > + template <typename T, bool IS_BOOST_FUNCTION = std::is_constructible_v<T, boost::function_base> || ll::is_std_function_v<T>> struct ParamCompare { static bool equals(const T &a, const T &b) @@ -123,7 +144,7 @@ namespace LLInitParam } }; - // boost function types are not comparable + // boost and std function types are not comparable template<typename T> struct ParamCompare<T, true> { @@ -474,7 +495,7 @@ namespace LLInitParam typedef bool (*parser_read_func_t)(Parser& parser, void* output); typedef bool (*parser_write_func_t)(Parser& parser, const void*, name_stack_t&); - typedef boost::function<void (name_stack_t&, S32, S32, const possible_values_t*)> parser_inspect_func_t; + typedef std::function<void (name_stack_t&, S32, S32, const possible_values_t*)> parser_inspect_func_t; typedef std::map<const std::type_info*, parser_read_func_t> parser_read_func_map_t; typedef std::map<const std::type_info*, parser_write_func_t> parser_write_func_map_t; @@ -491,7 +512,7 @@ namespace LLInitParam virtual ~Parser(); - template <typename T> bool readValue(T& param, typename boost::disable_if<boost::is_enum<T> >::type* dummy = 0) + template <typename T> bool readValue(T& param, typename std::enable_if_t<!std::is_enum_v<T>>* dummy = 0) { parser_read_func_map_t::iterator found_it = mParserReadFuncs->find(&typeid(T)); if (found_it != mParserReadFuncs->end()) @@ -502,7 +523,7 @@ namespace LLInitParam return false; } - template <typename T> bool readValue(T& param, typename boost::enable_if<boost::is_enum<T> >::type* dummy = 0) + template <typename T> bool readValue(T& param, typename std::enable_if_t<std::is_enum_v<T> >* dummy = 0) { parser_read_func_map_t::iterator found_it = mParserReadFuncs->find(&typeid(T)); if (found_it != mParserReadFuncs->end()) diff --git a/indra/llcommon/llleap.cpp b/indra/llcommon/llleap.cpp index ada6b9519e..1614cc6e57 100644 --- a/indra/llcommon/llleap.cpp +++ b/indra/llcommon/llleap.cpp @@ -61,7 +61,7 @@ public: // Pass it a callback to our connect() method, so it can send events // from a particular LLEventPump to the plugin without having to know // this class or method name. - mListener(new LLLeapListener( + mListener(std::make_unique<LLLeapListener>( [this](LLEventPump& pump, const std::string& listener) { return connect(pump, listener); })) { diff --git a/indra/llcommon/llleaplistener.h b/indra/llcommon/llleaplistener.h index cad4543d02..f5587d1d68 100644 --- a/indra/llcommon/llleaplistener.h +++ b/indra/llcommon/llleaplistener.h @@ -13,10 +13,9 @@ #define LL_LLLEAPLISTENER_H #include "lleventapi.h" +#include <functional> #include <map> #include <string> -#include <boost/function.hpp> -#include <boost/ptr_container/ptr_map.hpp> /// Listener class implementing LLLeap query/control operations. /// See https://jira.lindenlab.com/jira/browse/DEV-31978. @@ -31,7 +30,7 @@ public: * define the signature for a function that will perform that, and make * our constructor accept such a function. */ - typedef boost::function<LLBoundListener(LLEventPump&, const std::string& listener)> + typedef std::function<LLBoundListener(LLEventPump&, const std::string& listener)> ConnectFunc; LLLeapListener(const ConnectFunc& connect); ~LLLeapListener(); diff --git a/indra/llcommon/llmutex.h b/indra/llcommon/llmutex.h index 62943845a5..f3615a1270 100644 --- a/indra/llcommon/llmutex.h +++ b/indra/llcommon/llmutex.h @@ -29,7 +29,6 @@ #include "stdtypes.h" #include "llthread.h" -#include <boost/noncopyable.hpp> #include "mutex.h" #include <shared_mutex> @@ -249,7 +248,7 @@ private: * The constructor handles the lock, and the destructor handles * the unlock. Instances of this class are <b>not</b> thread safe. */ -class LL_COMMON_API LLScopedLock : private boost::noncopyable +class LL_COMMON_API LLScopedLock { public: /** @@ -265,6 +264,12 @@ public: */ ~LLScopedLock(); + /* + * @brief Non-copyable constructor and operator + */ + LLScopedLock(const LLScopedLock&) = delete; + LLScopedLock& operator=(const LLScopedLock&) = delete; + /** * @brief Check lock. */ diff --git a/indra/llcommon/llpounceable.h b/indra/llcommon/llpounceable.h index 0421ce966a..e86098f20b 100644 --- a/indra/llcommon/llpounceable.h +++ b/indra/llcommon/llpounceable.h @@ -36,13 +36,13 @@ #define LL_LLPOUNCEABLE_H #include "llsingleton.h" -#include <boost/noncopyable.hpp> #include <boost/call_traits.hpp> -#include <boost/type_traits/remove_pointer.hpp> #include <boost/utility/value_init.hpp> #include <boost/unordered_map.hpp> #include <boost/signals2/signal.hpp> +#include <type_traits> + // Forward declare the user template, since we want to be able to point to it // in some of its implementation classes. template <typename T, class TAG> @@ -139,7 +139,7 @@ private: // LLPounceable<T> is for an LLPounceable instance on the heap or the stack. // LLPounceable<T, LLPounceableStatic> is for a static LLPounceable instance. template <typename T, class TAG=LLPounceableQueue> -class LLPounceable: public boost::noncopyable +class LLPounceable { private: typedef LLPounceableTraits<T, TAG> traits; @@ -158,9 +158,13 @@ public: mEmpty(empty) {} + // Non-copyable + LLPounceable(const LLPounceable&) = delete; + LLPounceable& operator=(const LLPounceable&) = delete; + // make read access to mHeld as cheap and transparent as possible operator T () const { return mHeld; } - typename boost::remove_pointer<T>::type operator*() const { return *mHeld; } + typename std::remove_pointer<T>::type operator*() const { return *mHeld; } typename boost::call_traits<T>::value_type operator->() const { return mHeld; } // uncomment 'explicit' as soon as we allow C++11 compilation /*explicit*/ operator bool() const { return bool(mHeld); } diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 2800cc5608..3120fa0100 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -457,7 +457,8 @@ public: ("slot", LLSD::Integer(mIndex)) ("name", whichfile(mIndex)) ("desc", mDesc) - ("eof", state == CLOSED)); + ("eof", state == CLOSED) + ("exhst", state == EXHAUSTED)); } return false; @@ -528,18 +529,9 @@ LLProcess::LLProcess(const LLSDOrParams& params): // preserve existing semantics, we promise that mAttached defaults to the // same setting as mAutokill. mAttached(params.attached.isProvided()? params.attached : params.autokill), - mPool(NULL), - mPipes(NSLOTS) + mPool(NULL) { - // Hmm, when you construct a ptr_vector with a size, it merely reserves - // space, it doesn't actually make it that big. Explicitly make it bigger. - // Because of ptr_vector's odd semantics, have to push_back(0) the right - // number of times! resize() wants to default-construct new BasePipe - // instances, which fails because it's pure virtual. But because of the - // constructor call, these push_back() calls should require no new - // allocation. - for (size_t i = 0; i < mPipes.capacity(); ++i) - mPipes.push_back(0); + mPipes.resize(NSLOTS); if (! params.validateBlock(true)) { @@ -763,11 +755,11 @@ LLProcess::LLProcess(const LLSDOrParams& params): apr_file_t* pipe(mProcess.*(members[i])); if (i == STDIN) { - mPipes.replace(i, new WritePipeImpl(desc, pipe)); + mPipes[i] = std::make_unique<WritePipeImpl>(desc, pipe); } else { - mPipes.replace(i, new ReadPipeImpl(desc, pipe, FILESLOT(i))); + mPipes[i] = std::make_unique<ReadPipeImpl>(desc, pipe, FILESLOT(i)); } // Removed temporaily for Xcode 7 build tests: error was: // "error: expression with side effects will be evaluated despite @@ -1075,14 +1067,14 @@ PIPETYPE* LLProcess::getPipePtr(std::string& error, FILESLOT slot) error = STRINGIZE(mDesc << " has no slot " << slot); return NULL; } - if (mPipes.is_null(slot)) + if (!mPipes[slot]) { error = STRINGIZE(mDesc << ' ' << whichfile(slot) << " not a monitored pipe"); return NULL; } // Make sure we dynamic_cast in pointer domain so we can test, rather than // accepting runtime's exception. - PIPETYPE* ppipe = dynamic_cast<PIPETYPE*>(&mPipes[slot]); + PIPETYPE* ppipe = dynamic_cast<PIPETYPE*>(mPipes[slot].get()); if (! ppipe) { error = STRINGIZE(mDesc << ' ' << whichfile(slot) << " not a " << typeid(PIPETYPE).name()); diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index 52b5e0f562..773a3e97f4 100644 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h @@ -31,9 +31,7 @@ #include "llsdparam.h" #include "llexception.h" #include "apr_thread_proc.h" -#include <boost/ptr_container/ptr_vector.hpp> #include <boost/optional.hpp> -#include <boost/noncopyable.hpp> #include <iosfwd> // std::ostream #if LL_WINDOWS @@ -67,7 +65,7 @@ typedef std::shared_ptr<LLProcess> LLProcessPtr; * indra/llcommon/tests/llprocess_test.cpp for an example of waiting for * child-process termination in a standalone test context. */ -class LL_COMMON_API LLProcess: public boost::noncopyable +class LL_COMMON_API LLProcess { LOG_CLASS(LLProcess); public: @@ -547,6 +545,10 @@ public: static std::string basename(const std::string& path); static std::string getline(std::istream&); + // Non-copyable + LLProcess(const LLProcess&) = delete; + LLProcess& operator=(const LLProcess&) = delete; + private: /// constructor is private: use create() instead LLProcess(const LLSDOrParams& params); @@ -569,7 +571,7 @@ private: bool mAutokill, mAttached; Status mStatus; // explicitly want this ptr_vector to be able to store NULLs - typedef boost::ptr_vector< boost::nullable<BasePipe> > PipeVector; + typedef std::vector<std::unique_ptr<BasePipe>> PipeVector; PipeVector mPipes; apr_pool_t* mPool; }; diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp index 2b6e4be1c8..bb3a35a1e3 100644 --- a/indra/llcommon/llprocessor.cpp +++ b/indra/llcommon/llprocessor.cpp @@ -764,34 +764,7 @@ private: } } - // *NOTE:Mani - I didn't find any docs that assure me that machdep.cpu.feature_bits will always be - // The feature bits I think it is. Here's a test: -#ifndef LL_RELEASE_FOR_DOWNLOAD - #if defined(__i386__) && defined(__PIC__) - /* %ebx may be the PIC register. */ - #define __cpuid(level, a, b, c, d) \ - __asm__ ("xchgl\t%%ebx, %1\n\t" \ - "cpuid\n\t" \ - "xchgl\t%%ebx, %1\n\t" \ - : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ - : "0" (level)) - #else - #define __cpuid(level, a, b, c, d) \ - __asm__ ("cpuid\n\t" \ - : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ - : "0" (level)) - #endif - -#if __i386__ || __x86_64__ - unsigned int eax, ebx, ecx, edx; - __cpuid(0x1, eax, ebx, ecx, edx); - if(feature_infos[0] != (S32)edx) - { - LL_WARNS() << "machdep.cpu.feature_bits doesn't match expected cpuid result!" << LL_ENDL; - } -#endif // __i386__ || __x86_64__ -#endif // LL_RELEASE_FOR_DOWNLOAD - + // @TODO: Audit our usage of machdep.cpu.feature_bits. uint64_t ext_feature_info = getSysctlInt64("machdep.cpu.extfeature_bits"); S32 *ext_feature_infos = (S32*)(&ext_feature_info); diff --git a/indra/llcommon/llprocinfo.h b/indra/llcommon/llprocinfo.h index 5955799812..0fc8b9dbe4 100644 --- a/indra/llcommon/llprocinfo.h +++ b/indra/llcommon/llprocinfo.h @@ -51,10 +51,10 @@ public: typedef U64 time_type; /// Relative microseconds private: - LLProcInfo(); // Not defined - ~LLProcInfo(); // Not defined - LLProcInfo(const LLProcInfo &); // Not defined - void operator=(const LLProcInfo &); // Not defined + LLProcInfo() = delete; + ~LLProcInfo() = delete; + LLProcInfo(const LLProcInfo&) = delete; + LLProcInfo& operator=(const LLProcInfo&) = delete; public: /// Get accumulated system and user CPU time in diff --git a/indra/llcommon/llptrto.cpp b/indra/llcommon/llptrto.cpp index c4528a47a7..adf636c4d2 100644 --- a/indra/llcommon/llptrto.cpp +++ b/indra/llcommon/llptrto.cpp @@ -31,10 +31,9 @@ // associated header #include "llptrto.h" // STL headers +#include <type_traits> // std headers // external library headers -#include <boost/type_traits/is_same.hpp> -#include <boost/static_assert.hpp> // other Linden headers #include "llmemory.h" @@ -76,27 +75,27 @@ public: int main(int argc, char *argv[]) { // test LLPtrTo<> - BOOST_STATIC_ASSERT((boost::is_same<LLPtrTo<RCFoo>::type, LLPointer<RCFoo> >::value)); - BOOST_STATIC_ASSERT((boost::is_same<LLPtrTo<RCSubFoo>::type, LLPointer<RCSubFoo> >::value)); - BOOST_STATIC_ASSERT((boost::is_same<LLPtrTo<TSRCFoo>::type, LLPointer<TSRCFoo> >::value)); - BOOST_STATIC_ASSERT((boost::is_same<LLPtrTo<Bar>::type, Bar*>::value)); - BOOST_STATIC_ASSERT((boost::is_same<LLPtrTo<SubBar>::type, SubBar*>::value)); - BOOST_STATIC_ASSERT((boost::is_same<LLPtrTo<int>::type, int*>::value)); + static_assert((std::is_same_v<LLPtrTo<RCFoo>::type, LLPointer<RCFoo> >)); + static_assert((std::is_same_v<LLPtrTo<RCSubFoo>::type, LLPointer<RCSubFoo> >)); + static_assert((std::is_same_v<LLPtrTo<TSRCFoo>::type, LLPointer<TSRCFoo> >)); + static_assert((std::is_same_v<LLPtrTo<Bar>::type, Bar*>)); + static_assert((std::is_same_v<LLPtrTo<SubBar>::type, SubBar*>)); + static_assert((std::is_same_v<LLPtrTo<int>::type, int*>)); // Test LLRemovePointer<>. Note that we remove both pointer variants from // each kind of type, regardless of whether the variant makes sense. - BOOST_STATIC_ASSERT((boost::is_same<LLRemovePointer<RCFoo*>::type, RCFoo>::value)); - BOOST_STATIC_ASSERT((boost::is_same<LLRemovePointer< LLPointer<RCFoo> >::type, RCFoo>::value)); - BOOST_STATIC_ASSERT((boost::is_same<LLRemovePointer<RCSubFoo*>::type, RCSubFoo>::value)); - BOOST_STATIC_ASSERT((boost::is_same<LLRemovePointer< LLPointer<RCSubFoo> >::type, RCSubFoo>::value)); - BOOST_STATIC_ASSERT((boost::is_same<LLRemovePointer<TSRCFoo*>::type, TSRCFoo>::value)); - BOOST_STATIC_ASSERT((boost::is_same<LLRemovePointer< LLPointer<TSRCFoo> >::type, TSRCFoo>::value)); - BOOST_STATIC_ASSERT((boost::is_same<LLRemovePointer<Bar*>::type, Bar>::value)); - BOOST_STATIC_ASSERT((boost::is_same<LLRemovePointer< LLPointer<Bar> >::type, Bar>::value)); - BOOST_STATIC_ASSERT((boost::is_same<LLRemovePointer<SubBar*>::type, SubBar>::value)); - BOOST_STATIC_ASSERT((boost::is_same<LLRemovePointer< LLPointer<SubBar> >::type, SubBar>::value)); - BOOST_STATIC_ASSERT((boost::is_same<LLRemovePointer<int*>::type, int>::value)); - BOOST_STATIC_ASSERT((boost::is_same<LLRemovePointer< LLPointer<int> >::type, int>::value)); + static_assert((std::is_same_v<LLRemovePointer<RCFoo*>::type, RCFoo>)); + static_assert((std::is_same_v<LLRemovePointer< LLPointer<RCFoo> >::type, RCFoo>)); + static_assert((std::is_same_v<LLRemovePointer<RCSubFoo*>::type, RCSubFoo>)); + static_assert((std::is_same_v<LLRemovePointer< LLPointer<RCSubFoo> >::type, RCSubFoo>)); + static_assert((std::is_same_v<LLRemovePointer<TSRCFoo*>::type, TSRCFoo>)); + static_assert((std::is_same_v<LLRemovePointer< LLPointer<TSRCFoo> >::type, TSRCFoo>)); + static_assert((std::is_same_v<LLRemovePointer<Bar*>::type, Bar>)); + static_assert((std::is_same_v<LLRemovePointer< LLPointer<Bar> >::type, Bar>)); + static_assert((std::is_same_v<LLRemovePointer<SubBar*>::type, SubBar>)); + static_assert((std::is_same_v<LLRemovePointer< LLPointer<SubBar> >::type, SubBar>)); + static_assert((std::is_same_v<LLRemovePointer<int*>::type, int>)); + static_assert((std::is_same_v<LLRemovePointer< LLPointer<int> >::type, int>)); return 0; } diff --git a/indra/llcommon/llptrto.h b/indra/llcommon/llptrto.h index b57a1ee7f4..24e312559e 100644 --- a/indra/llcommon/llptrto.h +++ b/indra/llcommon/llptrto.h @@ -35,8 +35,6 @@ #include "llrefcount.h" // LLRefCount #include <boost/intrusive_ptr.hpp> #include <boost/shared_ptr.hpp> -#include <boost/type_traits/is_base_of.hpp> -#include <boost/type_traits/remove_pointer.hpp> #include <memory> // std::shared_ptr, std::unique_ptr #include <type_traits> @@ -58,14 +56,14 @@ struct LLPtrTo /// specialize for subclasses of LLRefCount template <class T> -struct LLPtrTo<T, typename std::enable_if< boost::is_base_of<LLRefCount, T>::value >::type> +struct LLPtrTo<T, typename std::enable_if< std::is_base_of<LLRefCount, T>::value >::type> { typedef LLPointer<T> type; }; /// specialize for subclasses of LLThreadSafeRefCount template <class T> -struct LLPtrTo<T, typename std::enable_if< boost::is_base_of<LLThreadSafeRefCount, T>::value >::type> +struct LLPtrTo<T, typename std::enable_if< std::is_base_of<LLThreadSafeRefCount, T>::value >::type> { typedef LLPointer<T> type; }; @@ -76,7 +74,7 @@ struct LLPtrTo<T, typename std::enable_if< boost::is_base_of<LLThreadSafeRefCoun template <typename PTRTYPE> struct LLRemovePointer { - typedef typename boost::remove_pointer<PTRTYPE>::type type; + typedef typename std::remove_pointer<PTRTYPE>::type type; }; /// specialize for LLPointer<SOMECLASS> diff --git a/indra/llcommon/llqueuedthread.h b/indra/llcommon/llqueuedthread.h index 02d3a96fcc..de50b8ae95 100644 --- a/indra/llcommon/llqueuedthread.h +++ b/indra/llcommon/llqueuedthread.h @@ -117,11 +117,11 @@ public: virtual ~LLQueuedThread(); virtual void shutdown(); -private: // No copy constructor or copy assignment - LLQueuedThread(const LLQueuedThread&); - LLQueuedThread& operator=(const LLQueuedThread&); + LLQueuedThread(const LLQueuedThread&) = delete; + LLQueuedThread& operator=(const LLQueuedThread&) = delete; +private: virtual bool runCondition(void); virtual void run(void); virtual void startThread(void); diff --git a/indra/llcommon/llrefcount.h b/indra/llcommon/llrefcount.h index 3a253d8fa6..93ca7d1d00 100644 --- a/indra/llcommon/llrefcount.h +++ b/indra/llcommon/llrefcount.h @@ -26,7 +26,6 @@ #ifndef LLREFCOUNT_H #define LLREFCOUNT_H -#include <boost/noncopyable.hpp> #include <boost/intrusive_ptr.hpp> #include "llatomic.h" diff --git a/indra/llcommon/llsdparam.cpp b/indra/llcommon/llsdparam.cpp index 3ae153a67c..caaac3d762 100644 --- a/indra/llcommon/llsdparam.cpp +++ b/indra/llcommon/llsdparam.cpp @@ -30,7 +30,6 @@ // Project includes #include "llsdparam.h" #include "llsdutil.h" -#include "boost/bind.hpp" static LLInitParam::Parser::parser_read_func_map_t sReadFuncs; static LLInitParam::Parser::parser_write_func_map_t sWriteFuncs; @@ -43,8 +42,6 @@ static const LLSD NO_VALUE_MARKER; LLParamSDParser::LLParamSDParser() : Parser(sReadFuncs, sWriteFuncs, sInspectFuncs) { - using boost::bind; - if (sReadFuncs.empty()) { registerParserFuncs<LLInitParam::Flag>(readFlag, &LLParamSDParser::writeFlag); @@ -97,7 +94,7 @@ void LLParamSDParser::readSD(const LLSD& sd, LLInitParam::BaseBlock& block, bool mNameStack.clear(); setParseSilently(silent); - LLParamSDParserUtilities::readSDValues(boost::bind(&LLParamSDParser::submit, this, boost::ref(block), _1, _2), sd, mNameStack); + LLParamSDParserUtilities::readSDValues(std::bind(&LLParamSDParser::submit, this, std::ref(block), std::placeholders::_1, std::placeholders::_2), sd, mNameStack); //readSDValues(sd, block); } @@ -276,14 +273,14 @@ void LLParamSDParserUtilities::readSDValues(read_sd_cb_t cb, const LLSD& sd, LLI } else if (sd.isUndefined()) { - if (!cb.empty()) + if (cb != nullptr) { cb(NO_VALUE_MARKER, stack); } } else { - if (!cb.empty()) + if (cb != nullptr) { cb(sd, stack); } @@ -333,7 +330,7 @@ namespace LLInitParam if (!p.writeValue<LLSD>(mValue, name_stack_range)) { // otherwise read from LLSD value and serialize out to parser (which could be LLSD, XUI, etc) - LLParamSDParserUtilities::readSDValues(boost::bind(&serializeElement, boost::ref(p), _1, _2), mValue, name_stack_range); + LLParamSDParserUtilities::readSDValues(std::bind(&serializeElement, std::ref(p), std::placeholders::_1, std::placeholders::_2), mValue, name_stack_range); } return true; } diff --git a/indra/llcommon/llsdparam.h b/indra/llcommon/llsdparam.h index 21ebb9a258..447ba02327 100644 --- a/indra/llcommon/llsdparam.h +++ b/indra/llcommon/llsdparam.h @@ -29,14 +29,14 @@ #define LL_LLSDPARAM_H #include "llinitparam.h" -#include "boost/function.hpp" +#include <functional> #include "llfasttimer.h" struct LL_COMMON_API LLParamSDParserUtilities { static LLSD& getSDWriteNode(LLSD& input, LLInitParam::Parser::name_stack_range_t& name_stack_range); - typedef boost::function<void (const LLSD&, LLInitParam::Parser::name_stack_t&)> read_sd_cb_t; + typedef std::function<void (const LLSD&, LLInitParam::Parser::name_stack_t&)> read_sd_cb_t; static void readSDValues(read_sd_cb_t cb, const LLSD& sd, LLInitParam::Parser::name_stack_t& stack); static void readSDValues(read_sd_cb_t cb, const LLSD& sd); }; diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index b5659e053c..3fba8602ee 100644 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -25,7 +25,6 @@ #ifndef LLSINGLETON_H #define LLSINGLETON_H -#include <boost/noncopyable.hpp> #include <boost/unordered_set.hpp> #include <initializer_list> #include <list> @@ -43,11 +42,14 @@ #pragma warning(disable : 4506) // no definition for inline function #endif -class LLSingletonBase: private boost::noncopyable +class LLSingletonBase { public: class MasterList; + LLSingletonBase(const LLSingletonBase&) = delete; + LLSingletonBase& operator=(const LLSingletonBase&) = delete; + private: // All existing LLSingleton instances are tracked in this master list. typedef std::list<LLSingletonBase*> list_t; diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 2e579a4d2d..4023294fff 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -1239,9 +1239,9 @@ void LLStringUtilBase<T>::getTokens(const string_type& string, std::vector<strin // (unless there ARE no escapes). std::unique_ptr< LLStringUtilBaseImpl::InString<T> > instrp; if (escapes.empty()) - instrp.reset(new LLStringUtilBaseImpl::InString<T>(string.begin(), string.end())); + instrp = std::make_unique<LLStringUtilBaseImpl::InString<T>>(string.begin(), string.end()); else - instrp.reset(new LLStringUtilBaseImpl::InEscString<T>(string.begin(), string.end(), escapes)); + instrp = std::make_unique<LLStringUtilBaseImpl::InEscString<T>>(string.begin(), string.end(), escapes); LLStringUtilBaseImpl::getTokens(*instrp, tokens, drop_delims, keep_delims, quotes); } diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index edc891f5ec..542de4ee67 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -51,9 +51,6 @@ #include <boost/circular_buffer.hpp> #include <boost/lexical_cast.hpp> #include <boost/range.hpp> -#include <boost/utility/enable_if.hpp> -#include <boost/type_traits/is_integral.hpp> -#include <boost/type_traits/is_float.hpp> #include "llfasttimer.h" using namespace llsd; @@ -727,7 +724,7 @@ public: // Store every integer type as LLSD::Integer. template <class T> void add(const LLSD::String& name, const T& value, - typename boost::enable_if<boost::is_integral<T> >::type* = 0) + typename std::enable_if_t<std::is_integral_v<T> >* = 0) { mStats[name] = LLSD::Integer(value); } @@ -735,7 +732,7 @@ public: // Store every floating-point type as LLSD::Real. template <class T> void add(const LLSD::String& name, const T& value, - typename boost::enable_if<boost::is_float<T> >::type* = 0) + typename std::enable_if_t<std::is_floating_point_v<T> >* = 0) { mStats[name] = LLSD::Real(value); } diff --git a/indra/llcommon/lltreeiterators.h b/indra/llcommon/lltreeiterators.h index cef501b987..cc13955d2f 100644 --- a/indra/llcommon/lltreeiterators.h +++ b/indra/llcommon/lltreeiterators.h @@ -60,10 +60,10 @@ #define LL_LLTREEITERATORS_H #include "llptrto.h" +#include <functional> #include <vector> #include <deque> #include <boost/iterator/iterator_facade.hpp> -#include <boost/function.hpp> #include <boost/static_assert.hpp> namespace LLTreeIter @@ -93,7 +93,7 @@ protected: typedef typename LLPtrTo<NODE>::type ptr_type; /// function that advances from this node to next accepts a node pointer /// and returns another - typedef boost::function<ptr_type(const ptr_type&)> func_type; + typedef std::function<ptr_type(const ptr_type&)> func_type; typedef SELFTYPE self_type; }; @@ -330,7 +330,7 @@ protected: typedef typename super::ptr_type ptr_type; // The func_type is different for this: from a NODE pointer, we must // obtain a CHILDITER. - typedef boost::function<CHILDITER(const ptr_type&)> func_type; + typedef std::function<CHILDITER(const ptr_type&)> func_type; private: typedef std::vector<ptr_type> list_type; public: @@ -435,7 +435,7 @@ protected: typedef typename super::ptr_type ptr_type; // The func_type is different for this: from a NODE pointer, we must // obtain a CHILDITER. - typedef boost::function<CHILDITER(const ptr_type&)> func_type; + typedef std::function<CHILDITER(const ptr_type&)> func_type; private: // Upon reaching a given node in our pending list, we need to know whether // we've already pushed that node's children, so we must associate a bool @@ -574,7 +574,7 @@ protected: typedef typename super::ptr_type ptr_type; // The func_type is different for this: from a NODE pointer, we must // obtain a CHILDITER. - typedef boost::function<CHILDITER(const ptr_type&)> func_type; + typedef std::function<CHILDITER(const ptr_type&)> func_type; private: // We need a FIFO queue rather than a LIFO stack. Use a deque rather than // a vector, since vector can't implement pop_front() efficiently. diff --git a/indra/llcommon/lluriparser.cpp b/indra/llcommon/lluriparser.cpp index 33a48d970d..1d246bb70e 100644 --- a/indra/llcommon/lluriparser.cpp +++ b/indra/llcommon/lluriparser.cpp @@ -33,7 +33,7 @@ LLUriParser::LLUriParser(const std::string& u) : mTmpScheme(false), mNormalizedT { if (u.find("://") == std::string::npos) { - mNormalizedUri = "http://"; + mNormalizedUri = "https://"; mTmpScheme = true; } diff --git a/indra/llcommon/tests/lldependencies_test.cpp b/indra/llcommon/tests/lldependencies_test.cpp index 84eb41b5fe..2fea92e3b7 100644 --- a/indra/llcommon/tests/lldependencies_test.cpp +++ b/indra/llcommon/tests/lldependencies_test.cpp @@ -31,7 +31,6 @@ #include <string> // std headers // external library headers -#include <boost/assign/list_of.hpp> // Precompiled header #include "linden_common.h" // associated header @@ -106,8 +105,6 @@ std::ostream& operator<<(std::ostream& out, const std::set<ENTRY>& set) /***************************************************************************** * Other helpers *****************************************************************************/ -using boost::assign::list_of; - typedef LLDependencies<> StringDeps; typedef StringDeps::KeyList StringList; @@ -165,7 +162,7 @@ namespace tut // The quick brown fox jumps over the lazy yellow dog. // (note, "The" and "the" are distinct, else this test wouldn't work) deps.add("lazy"); - ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy"))); + ensure_equals(sorted_keys(deps), StringList{"lazy"}); deps.add("jumps"); ensure("found lazy", deps.get("lazy")); ensure("not found dog.", ! deps.get("dog.")); @@ -175,24 +172,23 @@ namespace tut // A change to the implementation of boost::topological_sort() would // be an acceptable reason, and you can simply update the expected // test output. - ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("jumps"))); - deps.add("The", 0, empty, list_of("fox")("dog.")); + ensure_equals(sorted_keys(deps), StringList{ "lazy", "jumps" }); + deps.add("The", 0, empty, { "fox", "dog." }); // Test key accessors ensure("empty before deps for missing key", is_empty(deps.get_before_range("bogus"))); ensure("empty before deps for jumps", is_empty(deps.get_before_range("jumps"))); - ensure_equals(instance_from_range< std::set<std::string> >(deps.get_before_range("The")), - make< std::set<std::string> >(list_of("dog.")("fox"))); + ensure_equals(instance_from_range< std::set<std::string> >(deps.get_before_range("The")), std::set<std::string>{ "dog.", "fox" }); // resume building dependencies - ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("jumps")("The"))); - deps.add("the", 0, list_of("The")); - ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("jumps")("The")("the"))); - deps.add("fox", 0, list_of("The"), list_of("jumps")); - ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("The")("the")("fox")("jumps"))); - deps.add("the", 0, list_of("The")); // same, see if cache works - ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("The")("the")("fox")("jumps"))); - deps.add("jumps", 0, empty, list_of("over")); // update jumps deps - ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("The")("the")("fox")("jumps"))); -/*==========================================================================*| + ensure_equals(sorted_keys(deps), StringList{ "lazy", "jumps", "The" }); + deps.add("the", 0, { "The" }); + ensure_equals(sorted_keys(deps), StringList{ "lazy", "jumps", "The", "the" }); + deps.add("fox", 0, { "The" }, { "jumps" }); + ensure_equals(sorted_keys(deps), StringList{ "lazy", "The", "the", "fox", "jumps" }); + deps.add("the", 0, { "The" }); // same, see if cache works + ensure_equals(sorted_keys(deps), StringList{ "lazy", "The", "the", "fox", "jumps" }); + deps.add("jumps", 0, empty, { "over" }); // update jumps deps + ensure_equals(sorted_keys(deps), StringList{ "lazy", "The", "the", "fox", "jumps" }); + /*==========================================================================*| // It drives me nuts that this test doesn't work in the test // framework, because -- for reasons unknown -- running the test // framework on Mac OS X 10.5 Leopard and Windows XP Pro, the catch @@ -216,22 +212,21 @@ namespace tut deps.remove("over"); } |*==========================================================================*/ - deps.add("dog.", 0, list_of("yellow")("lazy")); - ensure_equals(instance_from_range< std::set<std::string> >(deps.get_after_range("dog.")), - make< std::set<std::string> >(list_of("lazy")("yellow"))); - ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("The")("the")("fox")("jumps")("dog."))); - deps.add("quick", 0, list_of("The"), list_of("fox")("brown")); - ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("The")("the")("quick")("fox")("jumps")("dog."))); - deps.add("over", 0, list_of("jumps"), list_of("yellow")("the")); - ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("The")("quick")("fox")("jumps")("over")("the")("dog."))); - deps.add("yellow", 0, list_of("the"), list_of("lazy")); - ensure_equals(sorted_keys(deps), make<StringList>(list_of("The")("quick")("fox")("jumps")("over")("the")("yellow")("lazy")("dog."))); + deps.add("dog.", 0, { "yellow", "lazy" }); + ensure_equals(instance_from_range< std::set<std::string> >(deps.get_after_range("dog.")), std::set<std::string>{ "lazy", "yellow" }); + ensure_equals(sorted_keys(deps), StringList{ "lazy", "The", "the", "fox", "jumps", "dog." }); + deps.add("quick", 0, { "The" }, { "fox", "brown" }); + ensure_equals(sorted_keys(deps), StringList{ "lazy", "The", "the", "quick", "fox", "jumps", "dog." }); + deps.add("over", 0, { "jumps" }, { "yellow", "the" }); + ensure_equals(sorted_keys(deps), StringList{ "lazy", "The", "quick", "fox", "jumps", "over", "the", "dog." }); + deps.add("yellow", 0, { "the" }, { "lazy" }); + ensure_equals(sorted_keys(deps), StringList{ "The", "quick", "fox", "jumps", "over", "the", "yellow", "lazy", "dog." }); deps.add("brown"); // By now the dependencies are pretty well in place. A change to THIS // order should be viewed with suspicion. - ensure_equals(sorted_keys(deps), make<StringList>(list_of("The")("quick")("brown")("fox")("jumps")("over")("the")("yellow")("lazy")("dog."))); + ensure_equals(sorted_keys(deps), StringList{ "The", "quick", "brown", "fox", "jumps", "over", "the", "yellow", "lazy", "dog." }); - StringList keys(make<StringList>(list_of("The")("brown")("dog.")("fox")("jumps")("lazy")("over")("quick")("the")("yellow"))); + StringList keys(StringList{ "The", "brown", "dog.", "fox", "jumps", "lazy", "over", "quick", "the", "yellow" }); ensure_equals(instance_from_range<StringList>(deps.get_key_range()), keys); #if (! defined(__GNUC__)) || (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ > 3) // This is the succinct way, works on modern compilers @@ -255,9 +250,9 @@ namespace tut typedef LLDependencies<std::string, int> NameIndexDeps; NameIndexDeps nideps; const NameIndexDeps& const_nideps(nideps); - nideps.add("def", 2, list_of("ghi")); + nideps.add("def", 2, { "ghi" }); nideps.add("ghi", 3); - nideps.add("abc", 1, list_of("def")); + nideps.add("abc", 1, { "def" }); NameIndexDeps::range range(nideps.get_range()); ensure_equals(range.begin()->first, "abc"); ensure_equals(range.begin()->second, 1); @@ -269,20 +264,20 @@ namespace tut ensure_equals(const_iterator->first, "def"); ensure_equals(const_iterator->second, 2); // NameIndexDeps::node_range node_range(nideps.get_node_range()); -// ensure_equals(instance_from_range<std::vector<int> >(node_range), make< std::vector<int> >(list_of(1)(2)(3))); +// ensure_equals(instance_from_range<std::vector<int> >(node_range), make< std::vector<int> >(list_of(1,2,3))); // *node_range.begin() = 0; // *node_range.begin() = 1; NameIndexDeps::const_node_range const_node_range(const_nideps.get_node_range()); - ensure_equals(instance_from_range<std::vector<int> >(const_node_range), make< std::vector<int> >(list_of(1)(2)(3))); + ensure_equals(instance_from_range<std::vector<int>>(const_node_range), std::vector<int>{ 1, 2, 3 }); NameIndexDeps::const_key_range const_key_range(const_nideps.get_key_range()); - ensure_equals(instance_from_range<StringList>(const_key_range), make<StringList>(list_of("abc")("def")("ghi"))); + ensure_equals(instance_from_range<StringList>(const_key_range), StringList{ "abc", "def", "ghi" }); NameIndexDeps::sorted_range sorted(const_nideps.sort()); NameIndexDeps::sorted_iterator sortiter(sorted.begin()); ensure_equals(sortiter->first, "ghi"); ensure_equals(sortiter->second, 3); // test all iterator-flavored versions of get_after_range() - StringList def(make<StringList>(list_of("def"))); + StringList def{"def"}; ensure("empty abc before list", is_empty(nideps.get_before_range(nideps.get_range().begin()))); ensure_equals(instance_from_range<StringList>(nideps.get_after_range(nideps.get_range().begin())), def); @@ -296,7 +291,6 @@ namespace tut def); // advance from "ghi" to "def", which must come after "ghi" ++sortiter; - ensure_equals(instance_from_range<StringList>(const_nideps.get_after_range(sortiter)), - make<StringList>(list_of("ghi"))); + ensure_equals(instance_from_range<StringList>(const_nideps.get_after_range(sortiter)), StringList{ "ghi" }); } } // namespace tut diff --git a/indra/llcommon/tests/lleventdispatcher_test.cpp b/indra/llcommon/tests/lleventdispatcher_test.cpp index 44f772e322..8b206f7b14 100644 --- a/indra/llcommon/tests/lleventdispatcher_test.cpp +++ b/indra/llcommon/tests/lleventdispatcher_test.cpp @@ -33,7 +33,6 @@ #include <stdexcept> #include <boost/bind.hpp> -#include <boost/function.hpp> #include <boost/range.hpp> #include <boost/lambda/lambda.hpp> diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index 13422612d6..d3d8e54d45 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/function.hpp> #include <boost/algorithm/string/find_iterator.hpp> #include <boost/algorithm/string/finder.hpp> // other Linden headers @@ -126,6 +125,8 @@ void waitfor(LLProcess& proc, int timeout=60) { yield(); } + // Pump once more after the process exits to flush any final events such as EOF. + yield(0); std::string msg = "process took longer than " + std::to_string(timeout) + " seconds to terminate"; tut::ensure(msg, i < timeout); } @@ -137,6 +138,8 @@ void waitfor(LLProcess::handle h, const std::string& desc, int timeout=60) { yield(); } + // Pump once more after the process exits to flush any final events such as EOF. + yield(0); std::string msg = "process took longer than " + std::to_string(timeout) + " seconds to terminate"; tut::ensure(msg, i < timeout); } @@ -260,9 +263,12 @@ static std::string python_out(const std::string& desc, const CONTENT& script) } /// Create a temporary directory and clean it up later. -class NamedTempDir: public boost::noncopyable +class NamedTempDir { public: + NamedTempDir(const NamedTempDir&) = delete; + NamedTempDir& operator=(const NamedTempDir&) = delete; + NamedTempDir(): mPath(NamedTempFile::temp_path()), mCreated(boost::filesystem::create_directories(mPath)) @@ -1091,8 +1097,11 @@ namespace tut ensure_equals("bad child exit code", py.mPy->getStatus().mData, 0); } - struct EventListener: public boost::noncopyable + struct EventListener { + EventListener(const EventListener&) = delete; + EventListener& operator=(const EventListener&) = delete; + EventListener(LLEventPump& pump) { mConnection = @@ -1203,8 +1212,8 @@ namespace tut { set_test_name("ReadPipe \"eof\" event"); PythonProcessLauncher py(get_test_name(), - "from __future__ import print_function\n" - "print('Hello from Python!')\n"); + "import time\n" + "time.sleep(1.5)\n"); py.mParams.files.add(LLProcess::FileParam()); // stdin py.mParams.files.add(LLProcess::FileParam("pipe")); // stdout py.launch(); diff --git a/indra/llcommon/tests/llstring_test.cpp b/indra/llcommon/tests/llstring_test.cpp index b68c63a15f..6a2c967363 100644 --- a/indra/llcommon/tests/llstring_test.cpp +++ b/indra/llcommon/tests/llstring_test.cpp @@ -28,13 +28,10 @@ #include "linden_common.h" -#include <boost/assign/list_of.hpp> #include "../llstring.h" #include "StringVec.h" // must come BEFORE lltut.h #include "../test/lltut.h" -using boost::assign::list_of; - namespace tut { struct string_index @@ -763,14 +760,14 @@ namespace tut ensure_equals("only delims", LLStringUtil::getTokens(" \r\n ", " \r\n"), StringVec()); ensure_equals("sequence of delims", - LLStringUtil::getTokens(",,, one ,,,", ","), list_of("one")); + LLStringUtil::getTokens(",,, one ,,,", ","), StringVec{"one"}); // nat considers this a dubious implementation side effect, but I'd // hate to change it now... ensure_equals("noncontiguous tokens", - LLStringUtil::getTokens(", ,, , one ,,,", ","), list_of("")("")("one")); + LLStringUtil::getTokens(", ,, , one ,,,", ","), StringVec{ "", "", "one" }); ensure_equals("space-padded tokens", - LLStringUtil::getTokens(", one , two ,", ","), list_of("one")("two")); - ensure_equals("no delims", LLStringUtil::getTokens("one", ","), list_of("one")); + LLStringUtil::getTokens(", one , two ,", ","), StringVec{"one", "two"}); + ensure_equals("no delims", LLStringUtil::getTokens("one", ","), StringVec{ "one" }); } // Shorthand for verifying that getTokens() behaves the same when you @@ -817,39 +814,33 @@ namespace tut ensure_getTokens("only delims", " \r\n ", " \r\n", "", StringVec()); ensure_getTokens("sequence of delims", - ",,, one ,,,", ", ", "", list_of("one")); + ",,, one ,,,", ", ", "", StringVec{"one"}); // Note contrast with the case in the previous method ensure_getTokens("noncontiguous tokens", - ", ,, , one ,,,", ", ", "", list_of("one")); + ", ,, , one ,,,", ", ", "", StringVec{"one"}); ensure_getTokens("space-padded tokens", ", one , two ,", ", ", "", - list_of("one")("two")); - ensure_getTokens("no delims", "one", ",", "", list_of("one")); + StringVec{"one", "two"}); + ensure_getTokens("no delims", "one", ",", "", StringVec{ "one" }); // drop_delims vs. keep_delims ensure_getTokens("arithmetic", - " ab+def / xx* yy ", " ", "+-*/", - list_of("ab")("+")("def")("/")("xx")("*")("yy")); + " ab+def / xx* yy ", " ", "+-*/", { "ab", "+", "def", "/", "xx", "*", "yy" }); // quotes ensure_getTokens("no quotes", - "She said, \"Don't go.\"", " ", ",", "", - list_of("She")("said")(",")("\"Don't")("go.\"")); + "She said, \"Don't go.\"", " ", ",", "", { "She", "said", ",", "\"Don't", "go.\"" }); ensure_getTokens("quotes", - "She said, \"Don't go.\"", " ", ",", "\"", - list_of("She")("said")(",")("Don't go.")); + "She said, \"Don't go.\"", " ", ",", "\"", { "She", "said", ",", "Don't go." }); ensure_getTokens("quotes and delims", "run c:/'Documents and Settings'/someone", " ", "", "'", - list_of("run")("c:/Documents and Settings/someone")); + { "run", "c:/Documents and Settings/someone" }); ensure_getTokens("unmatched quote", - "baby don't leave", " ", "", "'", - list_of("baby")("don't")("leave")); + "baby don't leave", " ", "", "'", { "baby", "don't", "leave" }); ensure_getTokens("adjacent quoted", - "abc'def \"ghi'\"jkl' mno\"pqr", " ", "", "\"'", - list_of("abcdef \"ghijkl' mnopqr")); + "abc'def \"ghi'\"jkl' mno\"pqr", " ", "", "\"'", { "abcdef \"ghijkl' mnopqr" }); ensure_getTokens("quoted empty string", - "--set SomeVar ''", " ", "", "'", - list_of("--set")("SomeVar")("")); + "--set SomeVar ''", " ", "", "'", { "--set", "SomeVar", "" }); // escapes // Don't use backslash as an escape for these tests -- you'll go nuts @@ -857,15 +848,12 @@ namespace tut // something else! ensure_equals("escaped delims", LLStringUtil::getTokens("^ a - dog^-gone^ phrase", " ", "-", "", "^"), - list_of(" a")("-")("dog-gone phrase")); + StringVec{ " a", "-", "dog-gone phrase" }); ensure_equals("escaped quotes", LLStringUtil::getTokens("say: 'this isn^'t w^orking'.", " ", "", "'", "^"), - list_of("say:")("this isn't working.")); + StringVec{ "say:", "this isn't working." }); ensure_equals("escaped escape", - LLStringUtil::getTokens("want x^^2", " ", "", "", "^"), - list_of("want")("x^2")); - ensure_equals("escape at end", - LLStringUtil::getTokens("it's^ up there^", " ", "", "'", "^"), - list_of("it's up")("there^")); + LLStringUtil::getTokens("want x^^2", " ", "", "", "^"), StringVec{ "want", "x^2" }); + ensure_equals("escape at end", LLStringUtil::getTokens("it's^ up there^", " ", "", "'", "^"), StringVec{ "it's up", "there^" }); } } diff --git a/indra/llcommon/tests/lltreeiterators_test.cpp b/indra/llcommon/tests/lltreeiterators_test.cpp index 7a2adfd8ba..6734596d25 100644 --- a/indra/llcommon/tests/lltreeiterators_test.cpp +++ b/indra/llcommon/tests/lltreeiterators_test.cpp @@ -32,6 +32,7 @@ // STL headers // std headers +#include <functional> #include <iostream> #include <sstream> #include <string> @@ -915,7 +916,7 @@ struct WalkExpected<LLTreeIter::BFS>: public Expected template <class NODE, typename CHILDITER> typename LLPtrTo<NODE>::type get_B2b(const typename LLPtrTo<NODE>::type& root, - const boost::function<CHILDITER(const typename LLPtrTo<NODE>::type&)>& child_begin) + const std::function<CHILDITER(const typename LLPtrTo<NODE>::type&)>& child_begin) { typedef typename LLPtrTo<NODE>::type NodePtr; CHILDITER Bi(child_begin(root)); |
