diff options
60 files changed, 325 insertions, 443 deletions
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f945ec82c1..6ebaf02b04 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -362,6 +362,7 @@ jobs: BUGSPLAT_USER: ${{ secrets.BUGSPLAT_USER }} BUGSPLAT_PASS: ${{ secrets.BUGSPLAT_PASS }} needs: build + if: needs.build.outputs.configuration == 'Release' runs-on: ubuntu-latest steps: - name: Download viewer exe diff --git a/autobuild.xml b/autobuild.xml index b90d94865a..c39a4cd9de 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -2371,11 +2371,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <key>archive</key> <map> <key>hash</key> - <string>a901a14066daf8c8796c8d2914917129427fd80b</string> + <string>226225ec049826c35adc5e897e0398ed64d4bedb</string> <key>hash_algorithm</key> <string>sha1</string> <key>url</key> - <string>https://github.com/secondlife/3p-tracy/releases/download/v0.10.0%2Br1/tracy-v0.10.0.9845715133-darwin64-9845715133.tar.zst</string> + <string>https://github.com/secondlife/3p-tracy/releases/download/v0.11.0%2Br1/tracy-v0.11.0.10376230034-darwin64-10376230034.tar.zst</string> </map> <key>name</key> <string>darwin64</string> @@ -2385,11 +2385,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <key>archive</key> <map> <key>hash</key> - <string>ca5fc66e3431278f20286261ffe85192bbd9a2ca</string> + <string>8c5429d1a1486f40cf7e5e88a232222d1fa4f78e</string> <key>hash_algorithm</key> <string>sha1</string> <key>url</key> - <string>https://github.com/secondlife/3p-tracy/releases/download/v0.10.0%2Br1/tracy-v0.10.0.9845715133-windows64-9845715133.tar.zst</string> + <string>https://github.com/secondlife/3p-tracy/releases/download/v0.11.0%2Br1/tracy-v0.11.0.10376230034-windows64-10376230034.tar.zst</string> </map> <key>name</key> <string>windows64</string> @@ -2399,11 +2399,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <key>archive</key> <map> <key>hash</key> - <string>e6f53d513c238ad599b75a8b5f94b8b0d1315438</string> + <string>ed0664a009aba1dcf1246d845839f524e857162e</string> <key>hash_algorithm</key> <string>sha1</string> <key>url</key> - <string>https://github.com/secondlife/3p-tracy/releases/download/v0.10.0%2Br1/tracy-v0.10.0.9845715133-linux64-9845715133.tar.zst</string> + <string>https://github.com/secondlife/3p-tracy/releases/download/v0.11.0%2Br1/tracy-v0.11.0.10376230034-linux64-10376230034.tar.zst</string> </map> <key>name</key> <string>linux64</string> @@ -2414,9 +2414,9 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <key>license_file</key> <string>LICENSES/tracy_license.txt</string> <key>copyright</key> - <string>Copyright (c) 2017-2022, Bartosz Taudul (wolf@nereid.pl)</string> + <string>Copyright (c) 2017-2024, Bartosz Taudul (wolf@nereid.pl)</string> <key>version</key> - <string>v0.10.0.9845715133</string> + <string>v0.11.0.10376230034</string> <key>name</key> <string>tracy</string> <key>canonical_repo</key> diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 4b3fa00fcf..5087c308ee 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -83,6 +83,7 @@ if (WINDOWS) /Oy- /fp:fast /MP + /permissive- ) # Nicky: x64 implies SSE2 diff --git a/indra/cmake/Tracy.cmake b/indra/cmake/Tracy.cmake index 32c02edb93..3339c51ba0 100644 --- a/indra/cmake/Tracy.cmake +++ b/indra/cmake/Tracy.cmake @@ -4,14 +4,26 @@ include(Prebuilt) include_guard() add_library( ll::tracy INTERFACE IMPORTED ) -set(USE_TRACY OFF CACHE BOOL "Use Tracy profiler.") +option(USE_TRACY "Use Tracy profiler." OFF) if (USE_TRACY) + option(USE_TRACY_ON_DEMAND "Use Tracy profiler." ON) + option(USE_TRACY_LOCAL_ONLY "Use Tracy profiler." OFF) + use_system_binary(tracy) use_prebuilt_binary(tracy) target_include_directories( ll::tracy SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/tracy) - target_link_libraries( ll::tracy INTERFACE TracyClient ) + + target_compile_definitions(ll::tracy INTERFACE -DTRACY_ENABLE=1 -DTRACY_ONLY_IPV4=1) + + if (USE_TRACY_ON_DEMAND) + target_compile_definitions(ll::tracy INTERFACE -DTRACY_ON_DEMAND=1) + endif () + + if (USE_TRACY_LOCAL_ONLY) + target_compile_definitions(ll::tracy INTERFACE -DTRACY_NO_BROADCAST=1 -DTRACY_ONLY_LOCALHOST=1) + endif () # See: indra/llcommon/llprofiler.h add_compile_definitions(LL_PROFILER_CONFIGURATION=3) diff --git a/indra/llappearance/llavatarappearancedefines.cpp b/indra/llappearance/llavatarappearancedefines.cpp index c69517cb22..580e6433c5 100644 --- a/indra/llappearance/llavatarappearancedefines.cpp +++ b/indra/llappearance/llavatarappearancedefines.cpp @@ -252,6 +252,7 @@ LLAvatarAppearanceDictionary::BakedEntry::BakedEntry(ETextureIndex tex_index, LLWearableType::EType t = (LLWearableType::EType)va_arg(argp,int); mWearables.push_back(t); } + va_end(argp); } ETextureIndex LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(EBakedTextureIndex index) const diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 8e43627a5f..165bfd52d5 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -267,6 +267,10 @@ if (DARWIN) list(APPEND llcommon_SOURCE_FILES llsys_objc.mm) endif (DARWIN) +if (USE_TRACY) + list(APPEND llcommon_SOURCE_FILES llprofiler.cpp) +endif () + list(APPEND llcommon_SOURCE_FILES ${llcommon_HEADER_FILES}) add_library (llcommon ${llcommon_SOURCE_FILES}) diff --git a/indra/llcommon/llallocator_heap_profile.cpp b/indra/llcommon/llallocator_heap_profile.cpp index 85e56b4db4..8cc44b6a01 100644 --- a/indra/llcommon/llallocator_heap_profile.cpp +++ b/indra/llcommon/llallocator_heap_profile.cpp @@ -28,13 +28,6 @@ #include "linden_common.h" #include "llallocator_heap_profile.h" -#if LL_MSVC -// disable warning about boost::lexical_cast returning uninitialized data -// when it fails to parse the string -#pragma warning (disable:4701) -#pragma warning (disable:4702) -#endif - #include <boost/algorithm/string/split.hpp> #include <boost/bind.hpp> #include <boost/lexical_cast.hpp> diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 6c3b9c9542..41c69ba194 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -55,6 +55,7 @@ #include "llsingleton.h" #include "llstl.h" #include "lltimer.h" +#include "llprofiler.h" // On Mac, got: // #error "Boost.Stacktrace requires `_Unwind_Backtrace` function. Define @@ -506,7 +507,7 @@ namespace LLError::TimeFunction mTimeFunction; Recorders mRecorders; - LLCoros::RMutex mRecorderMutex; + LL_PROFILE_MUTEX_NAMED(LLCoros::RMutex, mRecorderMutex, "Log Recorders"); int mShouldLogCallCounter; @@ -529,7 +530,6 @@ namespace mCrashFunction(NULL), mTimeFunction(NULL), mRecorders(), - mRecorderMutex(), mShouldLogCallCounter(0) { } @@ -1044,7 +1044,7 @@ namespace LLError return; } SettingsConfigPtr s = Globals::getInstance()->getSettingsConfig(); - std::unique_lock lock(s->mRecorderMutex); + std::unique_lock lock(s->mRecorderMutex); LL_PROFILE_MUTEX_LOCK(s->mRecorderMutex); s->mRecorders.push_back(recorder); } @@ -1055,7 +1055,7 @@ namespace LLError return; } SettingsConfigPtr s = Globals::getInstance()->getSettingsConfig(); - std::unique_lock lock(s->mRecorderMutex); + std::unique_lock lock(s->mRecorderMutex); LL_PROFILE_MUTEX_LOCK(s->mRecorderMutex); s->mRecorders.erase(std::remove(s->mRecorders.begin(), s->mRecorders.end(), recorder), s->mRecorders.end()); } @@ -1104,7 +1104,7 @@ namespace LLError std::shared_ptr<RECORDER> findRecorder() { SettingsConfigPtr s = Globals::getInstance()->getSettingsConfig(); - std::unique_lock lock(s->mRecorderMutex); + std::unique_lock lock(s->mRecorderMutex); LL_PROFILE_MUTEX_LOCK(s->mRecorderMutex); return findRecorderPos<RECORDER>(s).first; } @@ -1115,7 +1115,7 @@ namespace LLError bool removeRecorder() { SettingsConfigPtr s = Globals::getInstance()->getSettingsConfig(); - std::unique_lock lock(s->mRecorderMutex); + std::unique_lock lock(s->mRecorderMutex); LL_PROFILE_MUTEX_LOCK(s->mRecorderMutex); auto found = findRecorderPos<RECORDER>(s); if (found.first) { @@ -1221,7 +1221,7 @@ namespace std::string escaped_message; - std::unique_lock lock(s->mRecorderMutex); + std::unique_lock lock(s->mRecorderMutex); LL_PROFILE_MUTEX_LOCK(s->mRecorderMutex); for (LLError::RecorderPtr& r : s->mRecorders) { if (!r->enabled()) @@ -1280,24 +1280,21 @@ namespace } namespace { - // We need a couple different mutexes, but we want to use the same mechanism - // for both. Make getMutex() a template function with different instances - // for different MutexDiscriminator values. - enum MutexDiscriminator - { - LOG_MUTEX, - STACKS_MUTEX - }; // Some logging calls happen very early in processing -- so early that our // module-static variables aren't yet initialized. getMutex() wraps a // function-static LLMutex so that early calls can still have a valid // LLMutex instance. - template <MutexDiscriminator MTX> - LLMutex* getMutex() + auto getLogMutex() + { + // guaranteed to be initialized the first time control reaches here + static LL_PROFILE_MUTEX_NAMED(std::recursive_mutex, sLogMutex, "Log Mutex"); + return &sLogMutex; + } + auto getStacksMutex() { // guaranteed to be initialized the first time control reaches here - static LLMutex sMutex; - return &sMutex; + static LL_PROFILE_MUTEX_NAMED(std::recursive_mutex, sStacksMutex, "Stacks Mutex"); + return &sStacksMutex; } bool checkLevelMap(const LevelMap& map, const std::string& key, @@ -1347,8 +1344,8 @@ namespace LLError bool Log::shouldLog(CallSite& site) { LL_PROFILE_ZONE_SCOPED_CATEGORY_LOGGING; - LLMutexTrylock lock(getMutex<LOG_MUTEX>(), 5); - if (!lock.isLocked()) + std::unique_lock lock(*getLogMutex(), std::try_to_lock); LL_PROFILE_MUTEX_LOCK(*getLogMutex()); + if (!lock) { return false; } @@ -1392,8 +1389,8 @@ namespace LLError void Log::flush(const std::ostringstream& out, const CallSite& site) { LL_PROFILE_ZONE_SCOPED_CATEGORY_LOGGING; - LLMutexTrylock lock(getMutex<LOG_MUTEX>(),5); - if (!lock.isLocked()) + std::unique_lock lock(*getLogMutex(), std::try_to_lock); LL_PROFILE_MUTEX_LOCK(*getLogMutex()); + if (!lock) { return; } @@ -1523,8 +1520,8 @@ namespace LLError //static void LLCallStacks::push(const char* function, const int line) { - LLMutexTrylock lock(getMutex<STACKS_MUTEX>(), 5); - if (!lock.isLocked()) + std::unique_lock lock(*getStacksMutex(), std::try_to_lock); LL_PROFILE_MUTEX_LOCK(*getStacksMutex()); + if (!lock) { return; } @@ -1548,8 +1545,8 @@ namespace LLError //static void LLCallStacks::end(const std::ostringstream& out) { - LLMutexTrylock lock(getMutex<STACKS_MUTEX>(), 5); - if (!lock.isLocked()) + std::unique_lock lock(*getStacksMutex(), std::try_to_lock); LL_PROFILE_MUTEX_LOCK(*getStacksMutex()); + if (!lock) { return; } @@ -1565,8 +1562,8 @@ namespace LLError //static void LLCallStacks::print() { - LLMutexTrylock lock(getMutex<STACKS_MUTEX>(), 5); - if (!lock.isLocked()) + std::unique_lock lock(*getStacksMutex(), std::try_to_lock); LL_PROFILE_MUTEX_LOCK(*getStacksMutex()); + if (!lock) { return; } diff --git a/indra/llcommon/llevents.h b/indra/llcommon/llevents.h index f97fca0a32..4bf1fa07a2 100644 --- a/indra/llcommon/llevents.h +++ b/indra/llcommon/llevents.h @@ -38,16 +38,8 @@ #include <vector> #include <deque> #include <functional> -#if LL_WINDOWS - #pragma warning (push) - #pragma warning (disable : 4263) // boost::signals2::expired_slot::what() has const mismatch - #pragma warning (disable : 4264) -#endif -#include <boost/signals2.hpp> -#if LL_WINDOWS - #pragma warning (pop) -#endif +#include <boost/signals2.hpp> #include <boost/bind.hpp> #include <boost/utility.hpp> // noncopyable #include <boost/optional/optional.hpp> diff --git a/indra/llcommon/llfindlocale.cpp b/indra/llcommon/llfindlocale.cpp index ac52f90c9f..b4bcc80ac4 100644 --- a/indra/llcommon/llfindlocale.cpp +++ b/indra/llcommon/llfindlocale.cpp @@ -185,7 +185,7 @@ canonise_fl(FL_Locale *l) { #define RML(pn,sn) MAKELANGID(LANG_##pn, SUBLANG_##sn) struct IDToCode { LANGID id; - char* code; + const char* code; }; static const IDToCode both_to_code[] = { {ML(ENGLISH,US), "en_US.ISO_8859-1"}, diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h index 3232a0e219..92b26354a1 100644 --- a/indra/llcommon/llinstancetracker.h +++ b/indra/llcommon/llinstancetracker.h @@ -52,7 +52,7 @@ namespace LLInstanceTrackerPrivate struct StaticBase { // We need to be able to lock static data while manipulating it. - std::mutex mMutex; + LL_PROFILE_MUTEX_NAMED(std::mutex, mMutex, "InstanceTracker Data"); }; void logerrs(const char* cls, const std::string&, const std::string&, const std::string&); @@ -101,7 +101,8 @@ public: static size_t instanceCount() { - return LockStatic()->mMap.size(); + LockStatic lock; LL_PROFILE_MUTEX_LOCK(lock->mMutex); + return lock->mMap.size(); } // snapshot of std::pair<const KEY, std::shared_ptr<SUBCLASS>> pairs, for @@ -236,7 +237,7 @@ public: static ptr_t getInstance(const KEY& k) { - LockStatic lock; + LockStatic lock; LL_PROFILE_MUTEX_LOCK(lock->mMutex); const InstanceMap& map(lock->mMap); typename InstanceMap::const_iterator found = map.find(k); return (found == map.end()) ? NULL : found->second; @@ -252,19 +253,19 @@ protected: ptr_t ptr(static_cast<T*>(this), [](T*){}); // save corresponding weak_ptr for future reference mSelf = ptr; - LockStatic lock; + LockStatic lock; LL_PROFILE_MUTEX_LOCK(lock->mMutex); add_(lock, key, ptr); } public: virtual ~LLInstanceTracker() { - LockStatic lock; + LockStatic lock; LL_PROFILE_MUTEX_LOCK(lock->mMutex); remove_(lock); } protected: virtual void setKey(KEY key) { - LockStatic lock; + LockStatic lock; LL_PROFILE_MUTEX_LOCK(lock->mMutex); // Even though the shared_ptr we store in our map has a no-op deleter // for T itself, letting the use count decrement to 0 will still // delete the use-count object. Capture the shared_ptr we just removed @@ -376,7 +377,8 @@ public: static size_t instanceCount() { - return LockStatic()->mSet.size(); + LockStatic lock; LL_PROFILE_MUTEX_LOCK(lock->mMutex); + return lock->mSet.size(); } // snapshot of std::shared_ptr<SUBCLASS> pointers @@ -488,14 +490,16 @@ protected: // save corresponding weak_ptr for future reference mSelf = ptr; // Also store it in our class-static set to track this instance. - LockStatic()->mSet.emplace(ptr); + LockStatic lock; LL_PROFILE_MUTEX_LOCK(lock->mMutex); + lock->mSet.emplace(ptr); } public: virtual ~LLInstanceTracker() { // convert weak_ptr to shared_ptr because that's what we store in our // InstanceSet - LockStatic()->mSet.erase(mSelf.lock()); + LockStatic lock; LL_PROFILE_MUTEX_LOCK(lock->mMutex); + lock->mSet.erase(mSelf.lock()); } protected: LLInstanceTracker(const LLInstanceTracker& other): diff --git a/indra/llcommon/llprofiler.cpp b/indra/llcommon/llprofiler.cpp new file mode 100644 index 0000000000..bdddabf977 --- /dev/null +++ b/indra/llcommon/llprofiler.cpp @@ -0,0 +1,30 @@ +/** +* @file llprofiler.cpp +* @brief Implementation of llprofiler +* @author Rye Cogtail +* +* $LicenseInfo:firstyear=2024&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2024, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "linden_common.h" + +#include "TracyClient.cpp" diff --git a/indra/llcommon/llprofiler.h b/indra/llcommon/llprofiler.h index 732436cc4f..f6a4d24747 100644 --- a/indra/llcommon/llprofiler.h +++ b/indra/llcommon/llprofiler.h @@ -78,12 +78,6 @@ extern thread_local bool gProfilerEnabled; #if defined(LL_PROFILER_CONFIGURATION) && (LL_PROFILER_CONFIGURATION > LL_PROFILER_CONFIG_NONE) #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY || LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY_FAST_TIMER - #define TRACY_ENABLE 1 -// Normally these would be enabled but we want to be able to build any viewer with Tracy enabled and run the Tracy server on another machine -// They must be undefined in order to work across multiple machines -// #define TRACY_NO_BROADCAST 1 -// #define TRACY_ONLY_LOCALHOST 1 - #define TRACY_ONLY_IPV4 1 #include "tracy/Tracy.hpp" // Enable OpenGL profiling @@ -108,6 +102,12 @@ extern thread_local bool gProfilerEnabled; #define LL_PROFILE_ZONE_ERR(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0XFF0000 ) // RGB yellow #define LL_PROFILE_ZONE_INFO(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0X00FFFF ) // RGB cyan #define LL_PROFILE_ZONE_WARN(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0x0FFFF00 ) // RGB red + + #define LL_PROFILE_MUTEX(type, varname) TracyLockable(type, varname) + #define LL_PROFILE_MUTEX_NAMED(type, varname, desc) TracyLockableN(type, varname, desc) + #define LL_PROFILE_MUTEX_SHARED(type, varname) TracySharedLockable(type, varname) + #define LL_PROFILE_MUTEX_SHARED_NAMED(type, varname, desc) TracySharedLockableN(type, varname, desc) + #define LL_PROFILE_MUTEX_LOCK(varname) { auto& mutex = varname; LockMark(mutex); } #endif #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_FAST_TIMER #define LL_PROFILER_FRAME_END @@ -124,6 +124,12 @@ extern thread_local bool gProfilerEnabled; #define LL_PROFILE_ZONE_ERR(name) (void)(name); // Not supported #define LL_PROFILE_ZONE_INFO(name) (void)(name); // Not supported #define LL_PROFILE_ZONE_WARN(name) (void)(name); // Not supported + + #define LL_PROFILE_MUTEX(type, varname) type varname + #define LL_PROFILE_MUTEX_NAMED(type, varname, desc) type varname + #define LL_PROFILE_MUTEX_SHARED(type, varname) type varname + #define LL_PROFILE_MUTEX_SHARED_NAMED(type, varname, desc) type varname + #define LL_PROFILE_MUTEX_LOCK(varname) // LL_PROFILE_MUTEX_LOCK is a no-op when Tracy is disabled #endif #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY_FAST_TIMER #define LL_PROFILER_FRAME_END FrameMark @@ -139,6 +145,12 @@ extern thread_local bool gProfilerEnabled; #define LL_PROFILE_ZONE_ERR(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0XFF0000 ) // RGB yellow #define LL_PROFILE_ZONE_INFO(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0X00FFFF ) // RGB cyan #define LL_PROFILE_ZONE_WARN(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0x0FFFF00 ) // RGB red + + #define LL_PROFILE_MUTEX(type, varname) TracyLockable(type, varname) + #define LL_PROFILE_MUTEX_NAMED(type, varname, desc) TracyLockableN(type, varname, desc) + #define LL_PROFILE_MUTEX_SHARED(type, varname) TracySharedLockable(type, varname) + #define LL_PROFILE_MUTEX_SHARED_NAMED(type, varname, desc) TracySharedLockableN(type, varname, desc) + #define LL_PROFILE_MUTEX_LOCK(varname) { auto& mutex = varname; LockMark(mutex); } // see https://github.com/wolfpld/tracy/issues/575 #endif #else #define LL_PROFILER_FRAME_END diff --git a/indra/llcommon/llsdjson.cpp b/indra/llcommon/llsdjson.cpp index e95d2e6c1c..5d38e55686 100644 --- a/indra/llcommon/llsdjson.cpp +++ b/indra/llcommon/llsdjson.cpp @@ -35,16 +35,7 @@ #include "llerror.h" #include "../llmath/llmath.h" -#if LL_WINDOWS -#pragma warning (push) -#pragma warning (disable : 4702) // compiler thinks unreachable code -#endif #include <boost/json/src.hpp> -#if LL_WINDOWS -#pragma warning (pop) -#endif - - //========================================================================= LLSD LlsdFromJson(const boost::json::value& val) diff --git a/indra/llcommon/llsingleton.cpp b/indra/llcommon/llsingleton.cpp index d00e703a10..05dc3cde79 100644 --- a/indra/llcommon/llsingleton.cpp +++ b/indra/llcommon/llsingleton.cpp @@ -59,9 +59,8 @@ private: // it's safe to log -- which involves querying a different LLSingleton -- // which requires accessing the master list. typedef std::recursive_mutex mutex_t; - typedef std::unique_lock<mutex_t> lock_t; - - mutex_t mMutex; + LL_PROFILE_MUTEX_NAMED(mutex_t, mMutex, "Singleton MasterList"); + typedef std::unique_lock<decltype(mMutex)> lock_t; public: // Instantiate this to both obtain a reference to MasterList::instance() diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index 316831cd74..b5659e053c 100644 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -35,6 +35,8 @@ #include "lockstatic.h" #include "llthread.h" // on_main_thread() #include "llmainthreadtask.h" +#include "llprofiler.h" +#include "llerror.h" #ifdef LL_WINDOWS #pragma warning(push) @@ -298,7 +300,7 @@ private: // Use a recursive_mutex in case of constructor circularity. With a // non-recursive mutex, that would result in deadlock. typedef std::recursive_mutex mutex_t; - mutex_t mMutex; // LockStatic looks for mMutex + LL_PROFILE_MUTEX_NAMED(mutex_t, mMutex, "Singleton Data"); // LockStatic looks for mMutex EInitState mInitState{UNINITIALIZED}; DERIVED_TYPE* mInstance{nullptr}; @@ -420,7 +422,7 @@ protected: // deleteSingleton() to defend against manual deletion. When we moved // cleanup to deleteSingleton(), we hit crashes due to dangling // pointers in the MasterList. - LockStatic lk; + LockStatic lk; LL_PROFILE_MUTEX_LOCK(lk->mMutex); lk->mInstance = nullptr; lk->mInitState = DELETED; @@ -448,7 +450,7 @@ public: // Hold the lock while we call cleanupSingleton() and the destructor. // Our destructor also instantiates LockStatic, requiring a recursive // mutex. - LockStatic lk; + LockStatic lk; LL_PROFILE_MUTEX_LOCK(lk->mMutex); // of course, only cleanup and delete if there's something there if (lk->mInstance) { @@ -505,7 +507,7 @@ public: { // nested scope for 'lk' // In case racing threads call getInstance() at the same moment, // serialize the calls. - LockStatic lk; + LockStatic lk; LL_PROFILE_MUTEX_LOCK(lk->mMutex); switch (lk->mInitState) { @@ -595,7 +597,7 @@ public: static bool instanceExists() { // defend any access to sData from racing threads - LockStatic lk; + LockStatic lk; LL_PROFILE_MUTEX_LOCK(lk->mMutex); return lk->mInitState == INITIALIZED; } @@ -605,7 +607,7 @@ public: static bool wasDeleted() { // defend any access to sData from racing threads - LockStatic lk; + LockStatic lk; LL_PROFILE_MUTEX_LOCK(lk->mMutex); return lk->mInitState == DELETED; } }; @@ -644,7 +646,7 @@ private: // In case racing threads both call initParamSingleton() at the same // time, serialize them. One should initialize; the other should see // mInitState already set. - LockStatic lk; + LockStatic lk; LL_PROFILE_MUTEX_LOCK(lk->mMutex); // For organizational purposes this function shouldn't be called twice if (lk->mInitState != super::UNINITIALIZED) { @@ -708,7 +710,7 @@ public: { // In case racing threads call getInstance() at the same moment as // initParamSingleton(), serialize the calls. - LockStatic lk; + LockStatic lk; LL_PROFILE_MUTEX_LOCK(lk->mMutex); switch (lk->mInitState) { diff --git a/indra/llcommon/llstacktrace.cpp b/indra/llcommon/llstacktrace.cpp index bda3579f60..ca8f4299d9 100644 --- a/indra/llcommon/llstacktrace.cpp +++ b/indra/llcommon/llstacktrace.cpp @@ -33,10 +33,7 @@ #include <sstream> #include "llwin32headerslean.h" -#pragma warning (push) -#pragma warning (disable:4091) // a microsoft header has warnings. Very nice. #include <dbghelp.h> -#pragma warning (pop) typedef USHORT NTAPI RtlCaptureStackBackTrace_Function( IN ULONG frames_to_skip, diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index c57f8b1e96..505789f9ea 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -900,6 +900,11 @@ void HeapFree_deleter(void* ptr) } // anonymous namespace +unsigned long windows_get_last_error() +{ + return GetLastError(); +} + template<> std::wstring windows_message<std::wstring>(DWORD error) { diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index b69a068830..db716b1431 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -46,7 +46,6 @@ #endif #include <string.h> -#include <boost/scoped_ptr.hpp> const char LL_UNKNOWN_CHAR = '?'; class LLSD; @@ -832,8 +831,10 @@ template<> LL_COMMON_API std::wstring windows_message<std::wstring>(unsigned long error); /// Get Windows message string, implicitly calling GetLastError() +LL_COMMON_API unsigned long windows_get_last_error(); + template<typename STRING> -STRING windows_message() { return windows_message<STRING>(GetLastError()); } +STRING windows_message() { return windows_message<STRING>(windows_get_last_error()); } //@} diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp index 3b37365ec7..7aeabc3c4a 100644 --- a/indra/llcommon/lluuid.cpp +++ b/indra/llcommon/lluuid.cpp @@ -31,6 +31,7 @@ // ugh, this is ugly. We need to straighten out our linking for this library #pragma comment(lib, "IPHLPAPI.lib") #include <iphlpapi.h> +#include <nb30.h> #endif #include "llapp.h" diff --git a/indra/llcommon/tests/commonmisc_test.cpp b/indra/llcommon/tests/commonmisc_test.cpp index 0057a1f639..b1a284225e 100644 --- a/indra/llcommon/tests/commonmisc_test.cpp +++ b/indra/llcommon/tests/commonmisc_test.cpp @@ -46,12 +46,6 @@ #include "../test/lltut.h" - -#if LL_WINDOWS -// disable overflow warnings -#pragma warning(disable: 4307) -#endif - namespace tut { struct sd_data diff --git a/indra/llcorehttp/httprequest.cpp b/indra/llcorehttp/httprequest.cpp index 216d407deb..2aaf71f8a4 100644 --- a/indra/llcorehttp/httprequest.cpp +++ b/indra/llcorehttp/httprequest.cpp @@ -489,6 +489,7 @@ HttpStatus HttpRequest::createService() HttpRequestQueue::init(); HttpRequestQueue * rq = HttpRequestQueue::instanceOf(); HttpService::init(rq); + HTTPStats::createInstance(); has_inited = true; } @@ -502,6 +503,7 @@ HttpStatus HttpRequest::destroyService() if (has_inited) { + HTTPStats::deleteSingleton(); HttpService::term(); HttpRequestQueue::term(); has_inited = false; diff --git a/indra/llcorehttp/httpstats.h b/indra/llcorehttp/httpstats.h index f12e59da0c..5c0f26d34e 100644 --- a/indra/llcorehttp/httpstats.h +++ b/indra/llcorehttp/httpstats.h @@ -35,12 +35,12 @@ namespace LLCore { - class HTTPStats : public LLSingleton<HTTPStats> + class HTTPStats final : public LLSimpleton<HTTPStats> { - LLSINGLETON(HTTPStats); - virtual ~HTTPStats(); - public: + HTTPStats(); + ~HTTPStats(); + void resetStats(); typedef LLStatsAccumulator StatsAccumulator; diff --git a/indra/llfilesystem/lldiskcache.cpp b/indra/llfilesystem/lldiskcache.cpp index 86b1e2ac81..e780387f4e 100644 --- a/indra/llfilesystem/lldiskcache.cpp +++ b/indra/llfilesystem/lldiskcache.cpp @@ -39,15 +39,25 @@ #include "lldiskcache.h" + /** + * The prefix inserted at the start of a cache file filename to + * help identify it as a cache file. It's probably not required + * (just the presence in the cache folder is enough) but I am + * paranoid about the cache folder being set to something bad + * like the users' OS system dir by mistake or maliciously and + * this will help to offset any damage if that happens. + */ +static const std::string CACHE_FILENAME_PREFIX("sl_cache"); + +std::string LLDiskCache::sCacheDir; + LLDiskCache::LLDiskCache(const std::string cache_dir, const uintmax_t max_size_bytes, const bool enable_cache_debug_info) : - mCacheDir(cache_dir), mMaxSizeBytes(max_size_bytes), mEnableCacheDebugInfo(enable_cache_debug_info) { - mCacheFilenamePrefix = "sl_cache"; - + sCacheDir = cache_dir; LLFile::mkdir(cache_dir); } @@ -83,7 +93,7 @@ void LLDiskCache::purge() { if (mEnableCacheDebugInfo) { - LL_INFOS() << "Total dir size before purge is " << dirFileSize(mCacheDir) << LL_ENDL; + LL_INFOS() << "Total dir size before purge is " << dirFileSize(sCacheDir) << LL_ENDL; } boost::system::error_code ec; @@ -93,9 +103,9 @@ void LLDiskCache::purge() std::vector<file_info_t> file_info; #if LL_WINDOWS - std::wstring cache_path(utf8str_to_utf16str(mCacheDir)); + std::wstring cache_path(utf8str_to_utf16str(sCacheDir)); #else - std::string cache_path(mCacheDir); + std::string cache_path(sCacheDir); #endif if (boost::filesystem::is_directory(cache_path, ec) && !ec.failed()) { @@ -104,7 +114,7 @@ void LLDiskCache::purge() { if (boost::filesystem::is_regular_file(*iter, ec) && !ec.failed()) { - if ((*iter).path().string().find(mCacheFilenamePrefix) != std::string::npos) + if ((*iter).path().string().find(CACHE_FILENAME_PREFIX) != std::string::npos) { uintmax_t file_size = boost::filesystem::file_size(*iter, ec); if (ec.failed()) @@ -181,7 +191,7 @@ void LLDiskCache::purge() LL_INFOS() << line.str() << LL_ENDL; } - LL_INFOS() << "Total dir size after purge is " << dirFileSize(mCacheDir) << LL_ENDL; + LL_INFOS() << "Total dir size after purge is " << dirFileSize(sCacheDir) << LL_ENDL; LL_INFOS() << "Cache purge took " << execute_time << " ms to execute for " << file_info.size() << " files" << LL_ENDL; } } @@ -236,89 +246,9 @@ const std::string LLDiskCache::assetTypeToString(LLAssetType::EType at) return std::string("UNKNOWN"); } -const std::string LLDiskCache::metaDataToFilepath(const std::string id, - LLAssetType::EType at, - const std::string extra_info) +const std::string LLDiskCache::metaDataToFilepath(const std::string& id, LLAssetType::EType at) { - std::ostringstream file_path; - - file_path << mCacheDir; - file_path << gDirUtilp->getDirDelimiter(); - file_path << mCacheFilenamePrefix; - file_path << "_"; - file_path << id; - file_path << "_"; - file_path << (extra_info.empty() ? "0" : extra_info); - //file_path << "_"; - //file_path << assetTypeToString(at); // see SL-14210 Prune descriptive tag from new cache filenames - // for details of why it was removed. Note that if you put it - // back or change the format of the filename, the cache files - // files will be invalidated (and perhaps, more importantly, - // never deleted unless you delete them manually). - file_path << ".asset"; - - return file_path.str(); -} - -void LLDiskCache::updateFileAccessTime(const std::string file_path) -{ - /** - * Threshold in time_t units that is used to decide if the last access time - * time of the file is updated or not. Added as a precaution for the concern - * outlined in SL-14582 about frequent writes on older SSDs reducing their - * lifespan. I think this is the right place for the threshold value - rather - * than it being a pref - do comment on that Jira if you disagree... - * - * Let's start with 1 hour in time_t units and see how that unfolds - */ - const std::time_t time_threshold = 1 * 60 * 60; - - // current time - const std::time_t cur_time = std::time(nullptr); - - boost::system::error_code ec; -#if LL_WINDOWS - // file last write time - const std::time_t last_write_time = boost::filesystem::last_write_time(utf8str_to_utf16str(file_path), ec); - if (ec.failed()) - { - LL_WARNS() << "Failed to read last write time for cache file " << file_path << ": " << ec.message() << LL_ENDL; - return; - } - - // delta between cur time and last time the file was written - const std::time_t delta_time = cur_time - last_write_time; - - // we only write the new value if the time in time_threshold has elapsed - // before the last one - if (delta_time > time_threshold) - { - boost::filesystem::last_write_time(utf8str_to_utf16str(file_path), cur_time, ec); - } -#else - // file last write time - const std::time_t last_write_time = boost::filesystem::last_write_time(file_path, ec); - if (ec.failed()) - { - LL_WARNS() << "Failed to read last write time for cache file " << file_path << ": " << ec.message() << LL_ENDL; - return; - } - - // delta between cur time and last time the file was written - const std::time_t delta_time = cur_time - last_write_time; - - // we only write the new value if the time in time_threshold has elapsed - // before the last one - if (delta_time > time_threshold) - { - boost::filesystem::last_write_time(file_path, cur_time, ec); - } -#endif - - if (ec.failed()) - { - LL_WARNS() << "Failed to update last write time for cache file " << file_path << ": " << ec.message() << LL_ENDL; - } + return llformat("%s%s%s_%s_0.asset", sCacheDir.c_str(), gDirUtilp->getDirDelimiter().c_str(), CACHE_FILENAME_PREFIX.c_str(), id.c_str()); } const std::string LLDiskCache::getCacheInfo() @@ -326,7 +256,7 @@ const std::string LLDiskCache::getCacheInfo() std::ostringstream cache_info; F32 max_in_mb = (F32)mMaxSizeBytes / (1024.0f * 1024.0f); - F32 percent_used = ((F32)dirFileSize(mCacheDir) / (F32)mMaxSizeBytes) * 100.0f; + F32 percent_used = ((F32)dirFileSize(sCacheDir) / (F32)mMaxSizeBytes) * 100.0f; cache_info << std::fixed; cache_info << std::setprecision(1); @@ -346,9 +276,9 @@ void LLDiskCache::clearCache() */ boost::system::error_code ec; #if LL_WINDOWS - std::wstring cache_path(utf8str_to_utf16str(mCacheDir)); + std::wstring cache_path(utf8str_to_utf16str(sCacheDir)); #else - std::string cache_path(mCacheDir); + std::string cache_path(sCacheDir); #endif if (boost::filesystem::is_directory(cache_path, ec) && !ec.failed()) { @@ -357,7 +287,7 @@ void LLDiskCache::clearCache() { if (boost::filesystem::is_regular_file(*iter, ec) && !ec.failed()) { - if ((*iter).path().string().find(mCacheFilenamePrefix) != std::string::npos) + if ((*iter).path().string().find(CACHE_FILENAME_PREFIX) != std::string::npos) { boost::filesystem::remove(*iter, ec); if (ec.failed()) @@ -431,7 +361,7 @@ uintmax_t LLDiskCache::dirFileSize(const std::string dir) { if (boost::filesystem::is_regular_file(*iter, ec) && !ec.failed()) { - if ((*iter).path().string().find(mCacheFilenamePrefix) != std::string::npos) + if ((*iter).path().string().find(CACHE_FILENAME_PREFIX) != std::string::npos) { uintmax_t file_size = boost::filesystem::file_size(*iter, ec); if (!ec.failed()) diff --git a/indra/llfilesystem/lldiskcache.h b/indra/llfilesystem/lldiskcache.h index b60e74f8c9..62c19361fb 100644 --- a/indra/llfilesystem/lldiskcache.h +++ b/indra/llfilesystem/lldiskcache.h @@ -104,16 +104,9 @@ class LLDiskCache : * so many things had to be pushed back there to accomodate it, that I * decided to move it here. Still not sure that's completely right. */ - const std::string metaDataToFilepath(const std::string id, - LLAssetType::EType at, - const std::string extra_info); + static const std::string metaDataToFilepath(const std::string& id, + LLAssetType::EType at); - /** - * Update the "last write time" of a file to "now". This must be called whenever a - * file in the cache is read (not written) so that the last time the file was - * accessed is up to date (This is used in the mechanism for purging the cache) - */ - void updateFileAccessTime(const std::string file_path); /** * Purge the oldest items in the cache so that the combined size of all files @@ -170,17 +163,7 @@ class LLDiskCache : * setting could potentially point it at a non-cache directory (for example, * the Windows System dir) with disastrous results. */ - std::string mCacheDir; - - /** - * The prefix inserted at the start of a cache file filename to - * help identify it as a cache file. It's probably not required - * (just the presence in the cache folder is enough) but I am - * paranoid about the cache folder being set to something bad - * like the users' OS system dir by mistake or maliciously and - * this will help to offset any damage if that happens. - */ - std::string mCacheFilenamePrefix; + static std::string sCacheDir; /** * When enabled, displays additional debugging information in diff --git a/indra/llfilesystem/llfilesystem.cpp b/indra/llfilesystem/llfilesystem.cpp index 7d2a6bd6f5..b206aab7cf 100644 --- a/indra/llfilesystem/llfilesystem.cpp +++ b/indra/llfilesystem/llfilesystem.cpp @@ -34,6 +34,8 @@ #include "llfasttimer.h" #include "lldiskcache.h" +#include "boost/filesystem.hpp" + const S32 LLFileSystem::READ = 0x00000001; const S32 LLFileSystem::WRITE = 0x00000002; const S32 LLFileSystem::READ_WRITE = 0x00000003; // LLFileSystem::READ & LLFileSystem::WRITE @@ -56,9 +58,8 @@ LLFileSystem::LLFileSystem(const LLUUID& file_id, const LLAssetType::EType file_ { // build the filename (TODO: we do this in a few places - perhaps we should factor into a single function) std::string id; - mFileID.toString(id); - const std::string extra_info = ""; - const std::string filename = LLDiskCache::getInstance()->metaDataToFilepath(id, mFileType, extra_info); + mFileID.asString(); + const std::string filename = LLDiskCache::metaDataToFilepath(id, mFileType); // update the last access time for the file if it exists - this is required // even though we are reading and not writing because this is the @@ -67,7 +68,7 @@ LLFileSystem::LLFileSystem(const LLUUID& file_id, const LLAssetType::EType file_ bool exists = gDirUtilp->fileExists(filename); if (exists) { - LLDiskCache::getInstance()->updateFileAccessTime(filename); + updateFileAccessTime(filename); } } } @@ -82,8 +83,7 @@ bool LLFileSystem::getExists(const LLUUID& file_id, const LLAssetType::EType fil LL_PROFILE_ZONE_SCOPED; std::string id_str; file_id.toString(id_str); - const std::string extra_info = ""; - const std::string filename = LLDiskCache::getInstance()->metaDataToFilepath(id_str, file_type, extra_info); + const std::string filename = LLDiskCache::metaDataToFilepath(id_str, file_type); llifstream file(filename, std::ios::binary); if (file.is_open()) @@ -99,8 +99,7 @@ bool LLFileSystem::removeFile(const LLUUID& file_id, const LLAssetType::EType fi { std::string id_str; file_id.toString(id_str); - const std::string extra_info = ""; - const std::string filename = LLDiskCache::getInstance()->metaDataToFilepath(id_str, file_type, extra_info); + const std::string filename = LLDiskCache::metaDataToFilepath(id_str, file_type); LLFile::remove(filename.c_str(), suppress_error); @@ -113,12 +112,11 @@ bool LLFileSystem::renameFile(const LLUUID& old_file_id, const LLAssetType::ETyp { std::string old_id_str; old_file_id.toString(old_id_str); - const std::string extra_info = ""; - const std::string old_filename = LLDiskCache::getInstance()->metaDataToFilepath(old_id_str, old_file_type, extra_info); + const std::string old_filename = LLDiskCache::metaDataToFilepath(old_id_str, old_file_type); std::string new_id_str; new_file_id.toString(new_id_str); - const std::string new_filename = LLDiskCache::getInstance()->metaDataToFilepath(new_id_str, new_file_type, extra_info); + const std::string new_filename = LLDiskCache::metaDataToFilepath(new_id_str, new_file_type); // Rename needs the new file to not exist. LLFileSystem::removeFile(new_file_id, new_file_type, ENOENT); @@ -140,8 +138,7 @@ S32 LLFileSystem::getFileSize(const LLUUID& file_id, const LLAssetType::EType fi { std::string id_str; file_id.toString(id_str); - const std::string extra_info = ""; - const std::string filename = LLDiskCache::getInstance()->metaDataToFilepath(id_str, file_type, extra_info); + const std::string filename = LLDiskCache::metaDataToFilepath(id_str, file_type); S32 file_size = 0; llifstream file(filename, std::ios::binary); @@ -160,8 +157,7 @@ bool LLFileSystem::read(U8* buffer, S32 bytes) std::string id; mFileID.toString(id); - const std::string extra_info = ""; - const std::string filename = LLDiskCache::getInstance()->metaDataToFilepath(id, mFileType, extra_info); + const std::string filename = LLDiskCache::metaDataToFilepath(id, mFileType); llifstream file(filename, std::ios::binary); if (file.is_open()) @@ -205,8 +201,7 @@ bool LLFileSystem::write(const U8* buffer, S32 bytes) { std::string id_str; mFileID.toString(id_str); - const std::string extra_info = ""; - const std::string filename = LLDiskCache::getInstance()->metaDataToFilepath(id_str, mFileType, extra_info); + const std::string filename = LLDiskCache::metaDataToFilepath(id_str, mFileType); bool success = false; @@ -325,3 +320,64 @@ bool LLFileSystem::remove() return true; } + +void LLFileSystem::updateFileAccessTime(const std::string& file_path) +{ + /** + * Threshold in time_t units that is used to decide if the last access time + * time of the file is updated or not. Added as a precaution for the concern + * outlined in SL-14582 about frequent writes on older SSDs reducing their + * lifespan. I think this is the right place for the threshold value - rather + * than it being a pref - do comment on that Jira if you disagree... + * + * Let's start with 1 hour in time_t units and see how that unfolds + */ + const std::time_t time_threshold = 1 * 60 * 60; + + // current time + const std::time_t cur_time = std::time(nullptr); + + boost::system::error_code ec; +#if LL_WINDOWS + // file last write time + const std::time_t last_write_time = boost::filesystem::last_write_time(utf8str_to_utf16str(file_path), ec); + if (ec.failed()) + { + LL_WARNS() << "Failed to read last write time for cache file " << file_path << ": " << ec.message() << LL_ENDL; + return; + } + + // delta between cur time and last time the file was written + const std::time_t delta_time = cur_time - last_write_time; + + // we only write the new value if the time in time_threshold has elapsed + // before the last one + if (delta_time > time_threshold) + { + boost::filesystem::last_write_time(utf8str_to_utf16str(file_path), cur_time, ec); + } +#else + // file last write time + const std::time_t last_write_time = boost::filesystem::last_write_time(file_path, ec); + if (ec.failed()) + { + LL_WARNS() << "Failed to read last write time for cache file " << file_path << ": " << ec.message() << LL_ENDL; + return; + } + + // delta between cur time and last time the file was written + const std::time_t delta_time = cur_time - last_write_time; + + // we only write the new value if the time in time_threshold has elapsed + // before the last one + if (delta_time > time_threshold) + { + boost::filesystem::last_write_time(file_path, cur_time, ec); + } +#endif + + if (ec.failed()) + { + LL_WARNS() << "Failed to update last write time for cache file " << file_path << ": " << ec.message() << LL_ENDL; + } +} diff --git a/indra/llfilesystem/llfilesystem.h b/indra/llfilesystem/llfilesystem.h index ea1b9cf3a1..983e452981 100644 --- a/indra/llfilesystem/llfilesystem.h +++ b/indra/llfilesystem/llfilesystem.h @@ -53,6 +53,13 @@ class LLFileSystem bool rename(const LLUUID& new_id, const LLAssetType::EType new_type); bool remove(); + /** + * Update the "last write time" of a file to "now". This must be called whenever a + * file in the cache is read (not written) so that the last time the file was + * accessed is up to date (This is used in the mechanism for purging the cache) + */ + void updateFileAccessTime(const std::string& file_path); + static bool getExists(const LLUUID& file_id, const LLAssetType::EType file_type); static bool removeFile(const LLUUID& file_id, const LLAssetType::EType file_type, int suppress_error = 0); static bool renameFile(const LLUUID& old_file_id, const LLAssetType::EType old_file_type, diff --git a/indra/llimage/llimagejpeg.h b/indra/llimage/llimagejpeg.h index add6657117..012b87a42d 100644 --- a/indra/llimage/llimagejpeg.h +++ b/indra/llimage/llimagejpeg.h @@ -31,7 +31,6 @@ #include "llimage.h" -#include "llwin32headerslean.h" extern "C" { #ifdef LL_USESYSTEMLIBS # include <jpeglib.h> diff --git a/indra/llinventory/llinventorytype.cpp b/indra/llinventory/llinventorytype.cpp index 3dd1a5638d..8fa8983d3c 100644 --- a/indra/llinventory/llinventorytype.cpp +++ b/indra/llinventory/llinventorytype.cpp @@ -53,6 +53,7 @@ struct InventoryEntry : public LLDictionaryEntry LLAssetType::EType t = (LLAssetType::EType)va_arg(argp,int); mAssetTypes.push_back(t); } + va_end(argp); } const std::string mHumanName; diff --git a/indra/llmath/llsimdtypes.h b/indra/llmath/llsimdtypes.h index 11462170fb..a407f51029 100644 --- a/indra/llmath/llsimdtypes.h +++ b/indra/llmath/llsimdtypes.h @@ -33,20 +33,6 @@ typedef __m128 LLQuad; - -#if LL_WINDOWS -#pragma warning(push) -#pragma warning( disable : 4800 3 ) // Disable warning about casting int to bool for this class. -#if defined(_MSC_VER) && (_MSC_VER < 1500) -// VC++ 2005 is missing these intrinsics -// __forceinline is MSVC specific and attempts to override compiler inlining judgment. This is so -// even in debug builds this call is a NOP. -__forceinline const __m128 _mm_castsi128_ps( const __m128i a ) { return reinterpret_cast<const __m128&>(a); } -__forceinline const __m128i _mm_castps_si128( const __m128 a ) { return reinterpret_cast<const __m128i&>(a); } -#endif // _MSC_VER - -#endif // LL_WINDOWS - class LLBool32 { public: @@ -63,10 +49,6 @@ private: int m_bool{ 0 }; }; -#if LL_WINDOWS -#pragma warning(pop) -#endif - class LLSimdScalar { public: diff --git a/indra/llmessage/llblowfishcipher.cpp b/indra/llmessage/llblowfishcipher.cpp index ed036e396d..3973565e22 100644 --- a/indra/llmessage/llblowfishcipher.cpp +++ b/indra/llmessage/llblowfishcipher.cpp @@ -88,7 +88,7 @@ U32 LLBlowfishCipher::encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) src_len)) { LL_WARNS() << "LLBlowfishCipher::encrypt EVP_EncryptUpdate failure" << LL_ENDL; - goto ERROR; + goto BF_ENCRYPT_ERROR; } // There may be some final data left to encrypt if the input is @@ -96,14 +96,14 @@ U32 LLBlowfishCipher::encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) if (!EVP_EncryptFinal_ex(context, (unsigned char*)(dst + output_len), &temp_len)) { LL_WARNS() << "LLBlowfishCipher::encrypt EVP_EncryptFinal failure" << LL_ENDL; - goto ERROR; + goto BF_ENCRYPT_ERROR; } output_len += temp_len; EVP_CIPHER_CTX_free(context); return output_len; -ERROR: +BF_ENCRYPT_ERROR: EVP_CIPHER_CTX_free(context); return 0; } diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index 3e84eeffc2..4f47f16e33 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -24,10 +24,8 @@ * $/LicenseInfo$ */ -#if LL_MSVC -#pragma warning (disable : 4263) -#pragma warning (disable : 4264) -#endif +#include "linden_common.h" + #include "dae.h" #include "dom/domAsset.h" #include "dom/domBind_material.h" @@ -48,10 +46,6 @@ #include "dom/domScale.h" #include "dom/domTranslate.h" #include "dom/domVisual_scene.h" -#if LL_MSVC -#pragma warning (default : 4263) -#pragma warning (default : 4264) -#endif #include "lldaeloader.h" #include "llsdserialize.h" diff --git a/indra/llprimitive/tests/llmediaentry_test.cpp b/indra/llprimitive/tests/llmediaentry_test.cpp index e8f40d1ffd..414df66680 100644 --- a/indra/llprimitive/tests/llmediaentry_test.cpp +++ b/indra/llprimitive/tests/llmediaentry_test.cpp @@ -26,14 +26,9 @@ #include "linden_common.h" #include "lltut.h" -#if LL_WINDOWS -#pragma warning (push) -#pragma warning (disable : 4702) // boost::lexical_cast generates this warning -#endif + #include <boost/lexical_cast.hpp> -#if LL_WINDOWS -#pragma warning (pop) -#endif + #include "llstring.h" #include "llsdutil.h" #include "llsdserialize.h" diff --git a/indra/llui/llspellcheck.cpp b/indra/llui/llspellcheck.cpp index 16ffd352cf..e15616a16b 100644 --- a/indra/llui/llspellcheck.cpp +++ b/indra/llui/llspellcheck.cpp @@ -42,19 +42,13 @@ static const std::string DICT_FILE_USER = "user_dictionaries.xml"; LLSpellChecker::settings_change_signal_t LLSpellChecker::sSettingsChangeSignal; LLSpellChecker::LLSpellChecker() - : mHunspell(NULL) { + // Load initial dictionary information + refreshDictionaryMap(); } LLSpellChecker::~LLSpellChecker() { - delete mHunspell; -} - -void LLSpellChecker::initSingleton() -{ - // Load initial dictionary information - refreshDictionaryMap(); } bool LLSpellChecker::checkSpelling(const std::string& word) const @@ -300,8 +294,7 @@ void LLSpellChecker::initHunspell(const std::string& dict_language) { if (mHunspell) { - delete mHunspell; - mHunspell = NULL; + mHunspell.reset(); mDictLanguage.clear(); mDictFile.clear(); mIgnoreList.clear(); @@ -322,11 +315,11 @@ void LLSpellChecker::initHunspell(const std::string& dict_language) const std::string filename_dic = dict_entry["name"].asString() + ".dic"; if ( (gDirUtilp->fileExists(user_path + filename_aff)) && (gDirUtilp->fileExists(user_path + filename_dic)) ) { - mHunspell = new Hunspell((user_path + filename_aff).c_str(), (user_path + filename_dic).c_str()); + mHunspell = std::make_unique<Hunspell>((user_path + filename_aff).c_str(), (user_path + filename_dic).c_str()); } else if ( (gDirUtilp->fileExists(app_path + filename_aff)) && (gDirUtilp->fileExists(app_path + filename_dic)) ) { - mHunspell = new Hunspell((app_path + filename_aff).c_str(), (app_path + filename_dic).c_str()); + mHunspell = std::make_unique<Hunspell>((app_path + filename_aff).c_str(), (app_path + filename_dic).c_str()); } if (!mHunspell) { diff --git a/indra/llui/llspellcheck.h b/indra/llui/llspellcheck.h index e4d8a12ef1..9df2f94085 100644 --- a/indra/llui/llspellcheck.h +++ b/indra/llui/llspellcheck.h @@ -34,12 +34,12 @@ class Hunspell; -class LLSpellChecker : public LLSingleton<LLSpellChecker> +class LLSpellChecker : public LLSimpleton<LLSpellChecker> { - LLSINGLETON(LLSpellChecker); +public: + LLSpellChecker(); ~LLSpellChecker(); -public: void addToCustomDictionary(const std::string& word); void addToIgnoreList(const std::string& word); bool checkSpelling(const std::string& word) const; @@ -47,7 +47,6 @@ public: protected: void addToDictFile(const std::string& dict_path, const std::string& word); void initHunspell(const std::string& dict_language); - void initSingleton() override; public: typedef std::list<std::string> dict_list_t; @@ -77,7 +76,7 @@ public: static boost::signals2::connection setSettingsChangeCallback(const settings_change_signal_t::slot_type& cb); protected: - Hunspell* mHunspell; + std::unique_ptr<Hunspell> mHunspell; std::string mDictLanguage; std::string mDictFile; dict_list_t mDictSecondary; diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 8d46422c09..e36dae3955 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -54,6 +54,7 @@ #include "llmenubutton.h" #include "llloadingindicator.h" #include "llwindow.h" +#include "llspellcheck.h" // for registration #include "llfiltereditor.h" @@ -157,6 +158,7 @@ mRootView(NULL), mHelpImpl(NULL) { LLRender2D::createInstance(image_provider); + LLSpellChecker::createInstance(); if ((get_ptr_in_map(mSettingGroups, std::string("config")) == NULL) || (get_ptr_in_map(mSettingGroups, std::string("floater")) == NULL) || @@ -198,6 +200,7 @@ mHelpImpl(NULL) LLUI::~LLUI() { + LLSpellChecker::deleteSingleton(); LLRender2D::deleteSingleton(); } diff --git a/indra/llwindow/lldxhardware.cpp b/indra/llwindow/lldxhardware.cpp index 392a67b5ce..4bc069c5a4 100644 --- a/indra/llwindow/lldxhardware.cpp +++ b/indra/llwindow/lldxhardware.cpp @@ -441,7 +441,7 @@ std::string LLDXHardware::getDriverVersionWMI(EGPUVendor vendor) return mDriverVersion; } -void get_wstring(IDxDiagContainer* containerp, WCHAR* wszPropName, WCHAR* wszPropValue, int outputSize) +void get_wstring(IDxDiagContainer* containerp, const WCHAR* wszPropName, WCHAR* wszPropValue, int outputSize) { HRESULT hr; VARIANT var; @@ -472,7 +472,7 @@ void get_wstring(IDxDiagContainer* containerp, WCHAR* wszPropName, WCHAR* wszPro VariantClear( &var ); } -std::string get_string(IDxDiagContainer *containerp, WCHAR *wszPropName) +std::string get_string(IDxDiagContainer *containerp, const WCHAR *wszPropName) { WCHAR wszPropValue[256]; get_wstring(containerp, wszPropName, wszPropValue, 256); @@ -1059,7 +1059,7 @@ LLSD LLDXHardware::getDisplayInfo() // Dump the string as an int into the structure char *stopstring; - ret["VRAM"] = strtol(ram_str.c_str(), &stopstring, 10); + ret["VRAM"] = LLSD::Integer(strtol(ram_str.c_str(), &stopstring, 10)); std::string device_name = get_string(device_containerp, L"szDescription"); ret["DeviceName"] = device_name; std::string device_driver= get_string(device_containerp, L"szDriverVersion"); diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 94762db5c5..76abf5eaa2 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -805,8 +805,8 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, size_t name_len = strlen(display_device.DeviceName ); size_t desc_len = strlen(display_device.DeviceString); - CHAR *name = name_len ? display_device.DeviceName : "???"; - CHAR *desc = desc_len ? display_device.DeviceString : "???"; + const CHAR *name = name_len ? display_device.DeviceName : "???"; + const CHAR *desc = desc_len ? display_device.DeviceString : "???"; sprintf(text, "Display Device %d: %s, %s", display_index, name, desc); LL_INFOS("Window") << text << LL_ENDL; diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h index 344352e980..4f54a9d705 100644 --- a/indra/llxml/llcontrol.h +++ b/indra/llxml/llcontrol.h @@ -36,32 +36,8 @@ #include <vector> -// *NOTE: boost::visit_each<> generates warning 4675 on .net 2003 -// Disable the warning for the boost includes. -#if LL_WINDOWS -# if (_MSC_VER >= 1300 && _MSC_VER < 1400) -# pragma warning(push) -# pragma warning( disable : 4675 ) -# endif -#endif - #include <boost/bind.hpp> - -#if LL_WINDOWS - #pragma warning (push) - #pragma warning (disable : 4263) // boost::signals2::expired_slot::what() has const mismatch - #pragma warning (disable : 4264) -#endif #include <boost/signals2.hpp> -#if LL_WINDOWS - #pragma warning (pop) -#endif - -#if LL_WINDOWS -# if (_MSC_VER >= 1300 && _MSC_VER < 1400) -# pragma warning(pop) -# endif -#endif class LLVector3; class LLVector3d; diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index fbaf4e559f..7a9f3a46b5 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1776,6 +1776,7 @@ if (WINDOWS) --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" "--openal=${USE_OPENAL}" + "--tracy=${USE_TRACY}" --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=$<CONFIG> "--channel=${VIEWER_CHANNEL}" @@ -1836,6 +1837,7 @@ if (WINDOWS) --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" "--openal=${USE_OPENAL}" + "--tracy=${USE_TRACY}" --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=$<CONFIG> "--channel=${VIEWER_CHANNEL}" @@ -1985,6 +1987,7 @@ if (LINUX) --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" "--openal=${USE_OPENAL}" + "--tracy=${USE_TRACY}" --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} "--channel=${VIEWER_CHANNEL}" @@ -2012,6 +2015,7 @@ if (LINUX) --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" "--openal=${USE_OPENAL}" + "--tracy=${USE_TRACY}" --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} "--channel=${VIEWER_CHANNEL}" @@ -2087,6 +2091,7 @@ if (DARWIN) --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" "--openal=${USE_OPENAL}" + "--tracy=${USE_TRACY}" --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=$<CONFIG> --bundleid=${MACOSX_BUNDLE_GUI_IDENTIFIER} @@ -2121,6 +2126,7 @@ if (DARWIN) --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" "--openal=${USE_OPENAL}" + "--tracy=${USE_TRACY}" --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=$<CONFIG> "--channel=${VIEWER_CHANNEL}" diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 66082d317a..946d674e8b 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -66,11 +66,6 @@ #include "llavatarpropertiesprocessor.h" -#if LL_MSVC -// disable boost::lexical_cast warning -#pragma warning (disable:4702) -#endif - namespace { const S32 BAKE_RETRY_MAX_COUNT = 5; diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 262ab439b4..b75d02a8a7 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -269,11 +269,6 @@ using namespace LL; #include "glib.h" #endif // (LL_LINUX) && LL_GTK -#if LL_MSVC -// disable boost::lexical_cast warning -#pragma warning (disable:4702) -#endif - static LLAppViewerListener sAppViewerListener(LLAppViewer::instance); ////// Windows-specific includes to the bottom - nasty defines in these pollute the preprocessor @@ -806,6 +801,20 @@ bool LLAppViewer::init() LLUIImageList::getInstance(), ui_audio_callback, deferred_ui_audio_callback); + + if (gSavedSettings.getBOOL("SpellCheck")) + { + std::list<std::string> dict_list; + std::string dict_setting = gSavedSettings.getString("SpellCheckDictionary"); + boost::split(dict_list, dict_setting, boost::is_any_of(std::string(","))); + if (!dict_list.empty()) + { + LLSpellChecker::setUseSpellCheck(dict_list.front()); + dict_list.pop_front(); + LLSpellChecker::instance().setSecondaryDictionaries(dict_list); + } + } + LL_INFOS("InitInfo") << "UI initialized." << LL_ENDL ; // NOW LLUI::getLanguage() should work. gDirUtilp must know the language @@ -1270,6 +1279,7 @@ bool LLAppViewer::init() //LLSimpleton creations LLEnvironment::createInstance(); LLWorld::createInstance(); + LLViewerStatsRecorder::createInstance(); LLSelectMgr::createInstance(); LLViewerCamera::createInstance(); LL::GLTFSceneManager::createInstance(); @@ -1611,7 +1621,7 @@ bool LLAppViewer::doFrame() { LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df gMeshRepo"); - gMeshRepo.update() ; + gMeshRepo.update() ; } if(!total_work_pending) //pause texture fetching threads if nothing to process. @@ -2152,6 +2162,7 @@ bool LLAppViewer::cleanup() LL::GLTFSceneManager::deleteSingleton(); LLEnvironment::deleteSingleton(); LLSelectMgr::deleteSingleton(); + LLViewerStatsRecorder::deleteSingleton(); LLViewerEventRecorder::deleteSingleton(); LLWorld::deleteSingleton(); LLVoiceClient::deleteSingleton(); @@ -2799,19 +2810,6 @@ bool LLAppViewer::initConfiguration() gSavedSettings.getString("Language")); } - if (gSavedSettings.getBOOL("SpellCheck")) - { - std::list<std::string> dict_list; - std::string dict_setting = gSavedSettings.getString("SpellCheckDictionary"); - boost::split(dict_list, dict_setting, boost::is_any_of(std::string(","))); - if (!dict_list.empty()) - { - LLSpellChecker::setUseSpellCheck(dict_list.front()); - dict_list.pop_front(); - LLSpellChecker::instance().setSecondaryDictionaries(dict_list); - } - } - if (gNonInteractive) { tempSetControl("AllowMultipleViewers", "true"); diff --git a/indra/newview/llcommandlineparser.cpp b/indra/newview/llcommandlineparser.cpp index f301af9511..f21bae9805 100644 --- a/indra/newview/llcommandlineparser.cpp +++ b/indra/newview/llcommandlineparser.cpp @@ -28,26 +28,12 @@ #include "llcommandlineparser.h" #include "llexception.h" -// *NOTE: The boost::lexical_cast generates -// the warning C4701(local used with out assignment) in VC7.1. -// Disable the warning for the boost includes. -#if _MSC_VER -# pragma warning(push) -# pragma warning( disable : 4701 ) -#else -// NOTE: For the other platforms? -#endif - #include <boost/program_options.hpp> #include <boost/lexical_cast.hpp> #include <boost/bind.hpp> #include <boost/tokenizer.hpp> #include <boost/assign/list_of.hpp> -#if _MSC_VER -# pragma warning(pop) -#endif - #include "llsdserialize.h" #include "llerror.h" #include "stringize.h" diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 76d3e3e049..d53b36e59f 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -55,19 +55,8 @@ #include "llcorehttputil.h" #include "lluiusage.h" - -#if LL_MSVC -#pragma warning(push) -// disable boost::lexical_cast warning -#pragma warning (disable:4702) -#endif - #include <boost/lexical_cast.hpp> -#if LL_MSVC -#pragma warning(pop) // Restore all warnings to the previous state -#endif - const U32 MAX_CACHED_GROUPS = 20; // diff --git a/indra/newview/llimprocessing.cpp b/indra/newview/llimprocessing.cpp index e24274650d..c1e68e0288 100644 --- a/indra/newview/llimprocessing.cpp +++ b/indra/newview/llimprocessing.cpp @@ -58,10 +58,6 @@ #include "llworld.h" #include "boost/lexical_cast.hpp" -#if LL_MSVC -// disable boost::lexical_cast warning -#pragma warning (disable:4702) -#endif extern void on_new_message(const LLSD& msg); diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index 329fb881e3..bf49f33049 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -42,19 +42,7 @@ #include <boost/algorithm/string/trim.hpp> #include <boost/algorithm/string/replace.hpp> #include <boost/regex.hpp> - -#if LL_MSVC -#pragma warning(push) -// disable warning about boost::lexical_cast unreachable code -// when it fails to parse the string -#pragma warning (disable:4702) -#endif - #include <boost/date_time/gregorian/gregorian.hpp> -#if LL_MSVC -#pragma warning(pop) // Restore all warnings to the previous state -#endif - #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/date_time/local_time_adjustor.hpp> diff --git a/indra/newview/llmediadataclient.cpp b/indra/newview/llmediadataclient.cpp index 0f3e0306af..83a6e66019 100644 --- a/indra/newview/llmediadataclient.cpp +++ b/indra/newview/llmediadataclient.cpp @@ -29,11 +29,6 @@ #include "llmediadataclient.h" #include "llviewercontrol.h" -#if LL_MSVC -// disable boost::lexical_cast warning -#pragma warning (disable:4702) -#endif - #include <algorithm> #include <boost/lexical_cast.hpp> diff --git a/indra/newview/llsecapi.h b/indra/newview/llsecapi.h index 5cc78d09dc..ceea11cc34 100644 --- a/indra/newview/llsecapi.h +++ b/indra/newview/llsecapi.h @@ -35,6 +35,7 @@ #include "llexception.h" #ifdef LL_WINDOWS +#pragma warning (push) #pragma warning(disable:4250) #endif // LL_WINDOWS @@ -549,5 +550,8 @@ void registerSecHandler(const std::string& handler_type, extern LLPointer<LLSecAPIHandler> gSecAPIHandler; +#ifdef LL_WINDOWS +#pragma warning (pop) +#endif // LL_WINDOWS #endif // LL_SECAPI_H diff --git a/indra/newview/llsechandler_basic.h b/indra/newview/llsechandler_basic.h index 1484c6d0e1..2dffe84775 100644 --- a/indra/newview/llsechandler_basic.h +++ b/indra/newview/llsechandler_basic.h @@ -28,6 +28,11 @@ #ifndef LLSECHANDLER_BASIC #define LLSECHANDLER_BASIC +#ifdef LL_WINDOWS +#pragma warning (push) +#pragma warning(disable:4250) +#endif // LL_WINDOWS + #include "llsecapi.h" #include <vector> #include <openssl/x509.h> @@ -346,6 +351,10 @@ protected: bool valueCompareLLSD(const LLSD& lhs, const LLSD& rhs); +#ifdef LL_WINDOWS +#pragma warning (pop) +#endif // LL_WINDOWS + #endif // LLSECHANDLER_BASIC diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index b993ba16d5..7cefa21125 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1285,7 +1285,6 @@ bool idle_startup() // // Initialize classes w/graphics stuff. // - LLViewerStatsRecorder::instance(); // Since textures work in threads LLSurface::initClasses(); display_startup(); diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index 787ea02e4c..7543fb3743 100644 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -524,7 +524,7 @@ void LLViewerJoystick::initDevice(LLSD &guid) #endif } -bool LLViewerJoystick::initDevice(void * preffered_device /*LPDIRECTINPUTDEVICE8*/, std::string &name, LLSD &guid) +bool LLViewerJoystick::initDevice(void * preffered_device /*LPDIRECTINPUTDEVICE8*/, const std::string &name, const LLSD &guid) { #if LIB_NDOF mLastDeviceUUID = guid; diff --git a/indra/newview/llviewerjoystick.h b/indra/newview/llviewerjoystick.h index b459987c68..c989615653 100644 --- a/indra/newview/llviewerjoystick.h +++ b/indra/newview/llviewerjoystick.h @@ -56,7 +56,7 @@ public: void init(bool autoenable); void initDevice(LLSD &guid); bool initDevice(void * preffered_device /*LPDIRECTINPUTDEVICE8*/); - bool initDevice(void * preffered_device /*LPDIRECTINPUTDEVICE8*/, std::string &name, LLSD &guid); + bool initDevice(void * preffered_device /*LPDIRECTINPUTDEVICE8*/, const std::string &name, const LLSD &guid); void terminate(); void updateStatus(); diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h index 8398cd8a54..6561f0d644 100644 --- a/indra/newview/llviewerprecompiledheaders.h +++ b/indra/newview/llviewerprecompiledheaders.h @@ -37,11 +37,6 @@ #include "linden_common.h" -// Work around stupid Microsoft STL warning -#ifdef LL_WINDOWS -#pragma warning (disable : 4702) // warning C4702: unreachable code -#endif - #include <algorithm> #include <deque> #include <functional> diff --git a/indra/newview/llviewerstatsrecorder.cpp b/indra/newview/llviewerstatsrecorder.cpp index 88edb96fbb..58065ecce5 100644 --- a/indra/newview/llviewerstatsrecorder.cpp +++ b/indra/newview/llviewerstatsrecorder.cpp @@ -27,16 +27,13 @@ #include "llviewerprecompiledheaders.h" #include "llviewerstatsrecorder.h" - #include "llcontrol.h" #include "llfile.h" +#include "llviewercontrol.h" #include "llviewerregion.h" #include "llviewerobject.h" #include "llworld.h" -extern LLControlGroup gSavedSettings; - -LLViewerStatsRecorder* LLViewerStatsRecorder::sInstance = NULL; LLViewerStatsRecorder::LLViewerStatsRecorder() : mStatsFile(NULL), mTimer(), @@ -48,11 +45,6 @@ LLViewerStatsRecorder::LLViewerStatsRecorder() : mMaxDuration(300.f), mSkipSaveIfZeros(false) { - if (NULL != sInstance) - { - LL_ERRS() << "Attempted to create multiple instances of LLViewerStatsRecorder!" << LL_ENDL; - } - sInstance = this; clearStats(); } diff --git a/indra/newview/llviewerstatsrecorder.h b/indra/newview/llviewerstatsrecorder.h index ecc321c0a8..2108f49dc3 100644 --- a/indra/newview/llviewerstatsrecorder.h +++ b/indra/newview/llviewerstatsrecorder.h @@ -38,13 +38,12 @@ class LLMutex; class LLViewerObject; -class LLViewerStatsRecorder : public LLSingleton<LLViewerStatsRecorder> +class LLViewerStatsRecorder : public LLSimpleton<LLViewerStatsRecorder> { - LLSINGLETON(LLViewerStatsRecorder); +public: + LLViewerStatsRecorder(); LOG_CLASS(LLViewerStatsRecorder); ~LLViewerStatsRecorder(); - - public: // Enable/disable stats recording. This is broken down into two // flags so we can record stats without writing them to the log // file. This is useful to analyzing updates for scene loading. @@ -140,8 +139,6 @@ private: void closeStatsFile(); void makeStatsFileName(); - static LLViewerStatsRecorder* sInstance; - LLFILE * mStatsFile; // File to write data into std::string mStatsFileName; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 57f7734fea..00a7325db2 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -24,12 +24,6 @@ * $/LicenseInfo$ */ -#if LL_MSVC -// disable warning about boost::lexical_cast returning uninitialized data -// when it fails to parse the string -#pragma warning (disable:4701) -#endif - #include "llviewerprecompiledheaders.h" #include "llvoavatarself.h" @@ -69,11 +63,6 @@ #include "llcorehttputil.h" #include "lluiusage.h" -#if LL_MSVC -// disable boost::lexical_cast warning -#pragma warning (disable:4702) -#endif - #include <boost/lexical_cast.hpp> LLPointer<LLVOAvatarSelf> gAgentAvatarp = NULL; diff --git a/indra/newview/llwindebug.h b/indra/newview/llwindebug.h index d2801c86e1..770584c88d 100644 --- a/indra/newview/llwindebug.h +++ b/indra/newview/llwindebug.h @@ -30,10 +30,7 @@ #include "stdtypes.h" #include "llwin32headerslean.h" -#pragma warning (push) -#pragma warning (disable:4091) // a microsoft header has warnings. Very nice. #include <dbghelp.h> -#pragma warning (pop) class LLWinDebug: public LLSingleton<LLWinDebug> diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 91a9347449..b2f9654eb3 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -586,6 +586,10 @@ class Windows_x86_64_Manifest(ViewerManifest): self.path("BugSplat64.dll") self.path("BugSplatRc64.dll") + if self.args['tracy'] == 'ON': + with self.prefix(src=os.path.join(pkgdir, 'bin')): + self.path("tracy-profiler.exe") + self.path(src="licenses-win32.txt", dst="licenses.txt") self.path("featuretable.txt") self.path("cube.dae") @@ -1372,6 +1376,7 @@ if __name__ == "__main__": dict(name='bugsplat', description="""BugSplat database to which to post crashes, if BugSplat crash reporting is desired""", default=''), dict(name='openal', description="""Indication openal libraries are needed""", default='OFF'), + dict(name='tracy', description="""Indication tracy profiler is enabled""", default='OFF'), ] try: main(extra=extra_arguments) diff --git a/indra/test/test.cpp b/indra/test/test.cpp index 6c4a1f43b4..233eee5c31 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -53,16 +53,8 @@ # include "ctype_workaround.h" #endif -#if LL_MSVC -#pragma warning (push) -#pragma warning (disable : 4702) // warning C4702: unreachable code -#endif #include <boost/iostreams/tee.hpp> #include <boost/iostreams/stream.hpp> -#if LL_MSVC -#pragma warning (pop) -#endif - #include <boost/scoped_ptr.hpp> #include <boost/shared_ptr.hpp> #include <boost/make_shared.hpp> diff --git a/indra/viewer_components/login/lllogin.cpp b/indra/viewer_components/login/lllogin.cpp index 48fecb4f22..53bf97a47e 100644 --- a/indra/viewer_components/login/lllogin.cpp +++ b/indra/viewer_components/login/lllogin.cpp @@ -28,13 +28,6 @@ #include "llsd.h" #include "llsdutil.h" -/*==========================================================================*| -#ifdef LL_WINDOWS - // non-virtual destructor warning, boost::statechart does this intentionally. - #pragma warning (disable : 4265) -#endif -|*==========================================================================*/ - #include "lllogin.h" #include <boost/bind.hpp> |