From 0b1259a0847b3d6f2d0d1f2af0ec4e25d7c3551b Mon Sep 17 00:00:00 2001 From: callum_linden Date: Tue, 9 Dec 2014 17:29:07 -0800 Subject: no implicit conversion from ofsteam to bool in VS2013!!!! --- indra/llcommon/llerror.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 22cd861c72..8119b14887 100755 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -126,7 +126,7 @@ namespace { mFile.close(); } - bool okay() { return mFile; } + bool okay() { return mFile.good(); } virtual void recordMessage(LLError::ELevel level, const std::string& message) -- cgit v1.2.3 From 3d94afafb530b9841c151a24799a08f064b70ede Mon Sep 17 00:00:00 2001 From: callum_linden Date: Wed, 10 Dec 2014 08:56:13 -0800 Subject: Fix for build problems with LLTrace::AccumulatorBuffer copy ctor in VS2013 (only) --- indra/llcommon/lltraceaccumulators.h | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 42fad8a793..6e048535e3 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -62,16 +62,16 @@ namespace LLTrace {} public: - - AccumulatorBuffer(const AccumulatorBuffer& other = *getDefaultBuffer()) - : mStorageSize(0), - mStorage(NULL) - { - resize(sNextStorageSlot); - for (S32 i = 0; i < sNextStorageSlot; i++) - { - mStorage[i] = other.mStorage[i]; - } + AccumulatorBuffer() + : mStorageSize(0), + mStorage(NULL) + { + const AccumulatorBuffer& other = *getDefaultBuffer(); + resize(sNextStorageSlot); + for (S32 i = 0; i < sNextStorageSlot; i++) + { + mStorage[i] = other.mStorage[i]; + } } ~AccumulatorBuffer() @@ -93,6 +93,18 @@ namespace LLTrace return mStorage[index]; } + + AccumulatorBuffer(const AccumulatorBuffer& other) + : mStorageSize(0), + mStorage(NULL) + { + resize(sNextStorageSlot); + for (S32 i = 0; i < sNextStorageSlot; i++) + { + mStorage[i] = other.mStorage[i]; + } + } + void addSamples(const AccumulatorBuffer& other, EBufferAppendType append_type) { llassert(mStorageSize >= sNextStorageSlot && other.mStorageSize >= sNextStorageSlot); -- cgit v1.2.3 From 0f1cf6e40542e0992f6988e67b75b2f74ba4142b Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 10 Dec 2014 12:20:33 -0500 Subject: Clarify for VS 2013 that an operator bool() method returns bool. For some reason VS 2013 (unlike its predecessors and other current compilers) needs us to explicitly convert an operator bool() method's return expression to bool. :-P --- indra/llcommon/lleventcoro.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/lleventcoro.h b/indra/llcommon/lleventcoro.h index f55b74ac7e..abbeeaa373 100755 --- a/indra/llcommon/lleventcoro.h +++ b/indra/llcommon/lleventcoro.h @@ -67,7 +67,7 @@ public: LLEventPumpOrPumpName() {} operator LLEventPump& () const { return *mPump; } LLEventPump& getPump() const { return *mPump; } - operator bool() const { return mPump; } + operator bool() const { return bool(mPump); } bool operator!() const { return ! mPump; } private: -- cgit v1.2.3 From a2bb483f2d56362e5ea77b8e6471cc0f03740956 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 11 Dec 2014 13:12:20 -0500 Subject: Disambiguate a few ensure() calls. These were of the form ensure(std::string, something convertible to bool). Not sure what the ambiguity was, but ensure(std::string, bool(something)) works better. --- indra/llcommon/tests/llprocess_test.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index e4e766d51b..5ba343b183 100755 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -85,7 +85,7 @@ static std::string readfile(const std::string& pathname, const std::string& desc } std::ifstream inf(pathname.c_str()); std::string output; - tut::ensure(STRINGIZE("No output " << use_desc), std::getline(inf, output)); + tut::ensure(STRINGIZE("No output " << use_desc), bool(std::getline(inf, output))); std::string more; while (std::getline(inf, more)) { @@ -154,7 +154,7 @@ struct PythonProcessLauncher void launch() { mPy = LLProcess::create(mParams); - tut::ensure(STRINGIZE("Couldn't launch " << mDesc << " script"), mPy); + tut::ensure(STRINGIZE("Couldn't launch " << mDesc << " script"), bool(mPy)); } /// Run Python script and wait for it to complete. @@ -873,7 +873,7 @@ namespace tut std::string threw; \ /* Both the following calls should work. */ \ (PROCESS).GETPIPE(VALID); \ - ensure(#GETOPTPIPE "(" #VALID ") failed", (PROCESS).GETOPTPIPE(VALID)); \ + ensure(#GETOPTPIPE "(" #VALID ") failed", bool((PROCESS).GETOPTPIPE(VALID))); \ /* pass obviously bogus PIPESLOT */ \ CATCH_IN(threw, LLProcess::NoPipe, (PROCESS).GETPIPE(LLProcess::FILESLOT(4))); \ ensure_contains("didn't reject bad slot", threw, "no slot"); \ -- cgit v1.2.3 From eae38f7d57be5576199294b501e082c6d850473c Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 12 Dec 2014 13:46:41 -0800 Subject: Eliminate use of boost::lambda with boost::function (Trac #10864). https://svn.boost.org/trac/boost/ticket/10864 I've used boost::lambda with boost::function in a number of creative ways over the years. But the clang 6 shipped with Xcode 6 seems to have somehow broken lambda + function in Boost 1.57. boost::phoenix is a partial workaround. Sadly, lambda's comma-operator overload doesn't seem to be supported, necessitating a couple ugly workarounds. With real lambdas now supported by current compilers, I'm sure the Boost community has little incentive to repair the lambda + function problem. Presumably we'll be able to use such features ourselves Real Soon Now... --- indra/llcommon/tests/llleap_test.cpp | 10 ++++---- indra/llcommon/tests/llsdserialize_test.cpp | 40 ++++++++++++++++------------- 2 files changed, 27 insertions(+), 23 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp index 9ea822cb8d..653b043de4 100755 --- a/indra/llcommon/tests/llleap_test.cpp +++ b/indra/llcommon/tests/llleap_test.cpp @@ -17,7 +17,7 @@ // std headers // external library headers #include -#include +#include #include // other Linden headers #include "../test/lltut.h" @@ -109,7 +109,7 @@ namespace tut llleap_data(): reader(".py", // This logic is adapted from vita.viewerclient.receiveEvent() - boost::lambda::_1 << + boost::phoenix::placeholders::arg1 << "import re\n" "import os\n" "import sys\n" @@ -403,7 +403,7 @@ namespace tut AckAPI api; Result result; NamedTempFile script("py", - boost::lambda::_1 << + boost::phoenix::placeholders::arg1 << "from " << reader_module << " import *\n" // make a request on our little API "request(pump='" << api.getName() << "', data={})\n" @@ -441,7 +441,7 @@ namespace tut ReqIDAPI api; Result result; NamedTempFile script("py", - boost::lambda::_1 << + boost::phoenix::placeholders::arg1 << "import sys\n" "from " << reader_module << " import *\n" // Note that since reader imports llsd, this @@ -484,7 +484,7 @@ namespace tut ReqIDAPI api; Result result; NamedTempFile script("py", - boost::lambda::_1 << + boost::phoenix::placeholders::arg1 << "import sys\n" "from " << reader_module << " import *\n" // Generate a very large string value. diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp index b5893135ea..afd4e7c8c1 100755 --- a/indra/llcommon/tests/llsdserialize_test.cpp +++ b/indra/llcommon/tests/llsdserialize_test.cpp @@ -46,9 +46,9 @@ typedef U32 uint32_t; #include "boost/range.hpp" #include "boost/foreach.hpp" #include "boost/function.hpp" -#include "boost/lambda/lambda.hpp" -#include "boost/lambda/bind.hpp" -namespace lambda = boost::lambda; +#include "boost/phoenix/bind/bind_function.hpp" +#include "boost/phoenix/core/argument.hpp" +using namespace boost::phoenix; #include "../llsd.h" #include "../llsdserialize.h" @@ -1612,6 +1612,20 @@ namespace tut "print 'Running on', sys.platform\n"); } + // helper for test<3> + static void writeLLSDArray(std::ostream& out, const LLSD& array) + { + BOOST_FOREACH(LLSD item, llsd::inArray(array)) + { + LLSDSerialize::toNotation(item, out); + // It's important to separate with newlines because Python's llsd + // module doesn't support parsing from a file stream, only from a + // string, so we have to know how much of the file to read into a + // string. + out << '\n'; + } + } + template<> template<> void TestPythonCompatibleObject::test<3>() { @@ -1639,26 +1653,16 @@ namespace tut " assert False, 'Too many data items'\n"; // Create an llsdXXXXXX file containing 'data' serialized to - // notation. It's important to separate with newlines because Python's - // llsd module doesn't support parsing from a file stream, only from a - // string, so we have to know how much of the file to read into a - // string. + // notation. NamedTempFile file("llsd", // NamedTempFile's boost::function constructor // takes a callable. To this callable it passes the // std::ostream with which it's writing the - // NamedTempFile. This lambda-based expression - // first calls LLSD::Serialize() with that ostream, - // then streams a newline to it, etc. - (lambda::bind(LLSDSerialize::toNotation, cdata[0], lambda::_1), - lambda::_1 << '\n', - lambda::bind(LLSDSerialize::toNotation, cdata[1], lambda::_1), - lambda::_1 << '\n', - lambda::bind(LLSDSerialize::toNotation, cdata[2], lambda::_1), - lambda::_1 << '\n')); + // NamedTempFile. + bind(writeLLSDArray, placeholders::arg1, cdata)); python("read C++ notation", - lambda::_1 << + placeholders::arg1 << import_llsd << "def parse_each(iterable):\n" " for item in iterable:\n" @@ -1679,7 +1683,7 @@ namespace tut NamedTempFile file("llsd", ""); python("write Python notation", - lambda::_1 << + placeholders::arg1 << "from __future__ import with_statement\n" << import_llsd << "DATA = [\n" -- cgit v1.2.3 From e6a7ce08ed368e31c495156b5146a5f256583669 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 12 Dec 2014 17:21:24 -0500 Subject: fix dos line endings --- indra/llcommon/lltraceaccumulators.h | 40 ++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 6e048535e3..6f27b97dff 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -62,16 +62,16 @@ namespace LLTrace {} public: - AccumulatorBuffer() - : mStorageSize(0), - mStorage(NULL) - { - const AccumulatorBuffer& other = *getDefaultBuffer(); - resize(sNextStorageSlot); - for (S32 i = 0; i < sNextStorageSlot; i++) - { - mStorage[i] = other.mStorage[i]; - } + AccumulatorBuffer() + : mStorageSize(0), + mStorage(NULL) + { + const AccumulatorBuffer& other = *getDefaultBuffer(); + resize(sNextStorageSlot); + for (S32 i = 0; i < sNextStorageSlot; i++) + { + mStorage[i] = other.mStorage[i]; + } } ~AccumulatorBuffer() @@ -94,16 +94,16 @@ namespace LLTrace } - AccumulatorBuffer(const AccumulatorBuffer& other) - : mStorageSize(0), - mStorage(NULL) - { - resize(sNextStorageSlot); - for (S32 i = 0; i < sNextStorageSlot; i++) - { - mStorage[i] = other.mStorage[i]; - } - } + AccumulatorBuffer(const AccumulatorBuffer& other) + : mStorageSize(0), + mStorage(NULL) + { + resize(sNextStorageSlot); + for (S32 i = 0; i < sNextStorageSlot; i++) + { + mStorage[i] = other.mStorage[i]; + } + } void addSamples(const AccumulatorBuffer& other, EBufferAppendType append_type) { -- cgit v1.2.3 From 1bd8a67dcbc2645565a2b95fa1424ffd0eb8d538 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 16 Dec 2014 13:54:29 -0500 Subject: Isolate #pragma clang to __clang__ compilations. It's very irritating that Visual Studio produces a warning for unrecognized #pragmas, which we then merrily turn into an error -- #pragma is inherently compiler-specific! --- indra/llcommon/tests/llerror_test.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/tests/llerror_test.cpp b/indra/llcommon/tests/llerror_test.cpp index fee9492618..f51279e817 100755 --- a/indra/llcommon/tests/llerror_test.cpp +++ b/indra/llcommon/tests/llerror_test.cpp @@ -38,7 +38,9 @@ namespace { +#ifdef __clang__ # pragma clang diagnostic ignored "-Wunused-function" +#endif void test_that_error_h_includes_enough_things_to_compile_a_message() { LL_INFOS() << "!" << LL_ENDL; -- cgit v1.2.3 From 3b7d3cb1ea8c6f5f51d727732bbff8a6d89f3d33 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 16 Dec 2014 15:17:24 -0500 Subject: For one use case, boost::bind() better than boost::phoenix::bind(). We use boost::phoenix::placeholders::arg1 to imply a whole lambda expression, replacing boost::lambda. But to bind a plain function in a more straightforward way, seems classic boost::bind() works while boost::phoenix::bind() does not. --- indra/llcommon/tests/llsdserialize_test.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp index afd4e7c8c1..6fbb9abfc0 100755 --- a/indra/llcommon/tests/llsdserialize_test.cpp +++ b/indra/llcommon/tests/llsdserialize_test.cpp @@ -46,6 +46,7 @@ typedef U32 uint32_t; #include "boost/range.hpp" #include "boost/foreach.hpp" #include "boost/function.hpp" +#include "boost/bind.hpp" #include "boost/phoenix/bind/bind_function.hpp" #include "boost/phoenix/core/argument.hpp" using namespace boost::phoenix; @@ -1659,7 +1660,7 @@ namespace tut // takes a callable. To this callable it passes the // std::ostream with which it's writing the // NamedTempFile. - bind(writeLLSDArray, placeholders::arg1, cdata)); + boost::bind(writeLLSDArray, _1, cdata)); python("read C++ notation", placeholders::arg1 << -- cgit v1.2.3