From ae0b3149badf369eb2b1f10aba830eef8b4af9b4 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 23 Feb 2017 16:49:49 -0500 Subject: DRTVWR-418: Fix a round of compile errors surfaced by -std=c++11. These are mostly things that were in fact erroneous, but accepted by older compilers. This changeset has not yet been built with Visual Studio 2013 or Linux gcc, even with -std=c++11. This changeset has not been built *without* -std=c++11. It should be used in conjunction with a corresponding change to LL_BUILD_DARWIN_BASE_SWITCHES in viewer-build-variables/variables. This is a work in progress. We do not assert that this changeset completes the work needed to turn on -std=c++11, even on the Mac. --- indra/llcommon/lleventdispatcher.h | 4 ++-- indra/llcommon/llpreprocessor.h | 10 +++------- indra/llcommon/tests/llsdserialize_test.cpp | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/lleventdispatcher.h b/indra/llcommon/lleventdispatcher.h index 7acc61de4e..9e1244ef5b 100644 --- a/indra/llcommon/lleventdispatcher.h +++ b/indra/llcommon/lleventdispatcher.h @@ -47,13 +47,13 @@ // namespace) that a global 'nil' macro breaks badly. #if defined(nil) // Capture the value of the macro 'nil', hoping int is an appropriate type. -static const int nil_(nil); +static const auto nil_(nil); // Now forget the macro. #undef nil // Finally, reintroduce 'nil' as a properly-scoped alias for the previously- // defined const 'nil_'. Make it static since otherwise it produces duplicate- // symbol link errors later. -static const int& nil(nil_); +static const auto& nil(nil_); #endif #include diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h index 3698d9db44..2879038c36 100644 --- a/indra/llcommon/llpreprocessor.h +++ b/indra/llcommon/llpreprocessor.h @@ -192,13 +192,9 @@ # define LL_COMMON_API #endif // LL_COMMON_LINK_SHARED -#if LL_WINDOWS -#define LL_TYPEOF(exp) decltype(exp) -#elif LL_LINUX -#define LL_TYPEOF(exp) typeof(exp) -#elif LL_DARWIN -#define LL_TYPEOF(exp) typeof(exp) -#endif +// With C++11, decltype() is standard. We no longer need a platform-dependent +// macro to get the type of an expression. +#define LL_TYPEOF(expr) decltype(expr) #define LL_TO_STRING_HELPER(x) #x #define LL_TO_STRING(x) LL_TO_STRING_HELPER(x) diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp index 81b930e1e2..8836230640 100644 --- a/indra/llcommon/tests/llsdserialize_test.cpp +++ b/indra/llcommon/tests/llsdserialize_test.cpp @@ -1553,7 +1553,7 @@ namespace tut params.executable = PYTHON; params.args.add(scriptfile.getName()); LLProcessPtr py(LLProcess::create(params)); - ensure(STRINGIZE("Couldn't launch " << desc << " script"), py); + ensure(STRINGIZE("Couldn't launch " << desc << " script"), bool(py)); // Implementing timeout would mean messing with alarm() and // catching SIGALRM... later maybe... int status(0); -- cgit v1.2.3