diff --git a/.travis.yml b/.travis.yml index 8ad368aaeb..b2fee5e40b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,8 @@ matrix: - libxtst-dev - libxrandr-dev - libglew-dev + - libc++-dev + - libstdc++-4.8-dev - env: CXX_COMPILER=clang++-3.6 CC_COMPILER=clang-3.6 BUILD_TYPE=Release WITH_FFMPEG=ON WITH_FFMPEG_JOBS=1 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bb8b669591..f68a758ae3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -386,6 +386,7 @@ else() # Linux sm_add_compile_flag("${SM_EXE_NAME}" "-stdlib=libc++") set_target_properties("${SM_EXE_NAME}" PROPERTIES LINK_FLAGS "-stdlib=libc++") + sm_add_compile_flag("jsoncpp" "-stdlib=libc++") endif() endif() diff --git a/src/NoteData.h b/src/NoteData.h index c08ae6e7f9..9a294ceac6 100644 --- a/src/NoteData.h +++ b/src/NoteData.h @@ -382,7 +382,13 @@ public: /** @brief Allow a quick way to swap notedata. */ namespace std { - template<> inline void swap( NoteData &nd1, NoteData &nd2 ){ nd1.swap( nd2 ); } + template<> inline void swap( NoteData &nd1, NoteData &nd2 ) +#if !defined(_MSC_VER) + noexcept(is_nothrow_move_constructible::value && is_nothrow_move_assignable::value) +#endif + { + nd1.swap( nd2 ); + } } #endif diff --git a/src/arch/ArchHooks/ArchHooks.h b/src/arch/ArchHooks/ArchHooks.h index d1b6d5fcac..123a320343 100644 --- a/src/arch/ArchHooks/ArchHooks.h +++ b/src/arch/ArchHooks/ArchHooks.h @@ -1,6 +1,8 @@ #ifndef ARCH_HOOKS_H #define ARCH_HOOKS_H +#include + struct lua_State; class ArchHooks { @@ -41,7 +43,7 @@ public: /** * @brief Setup the rendering threads for concurrency. - * + * * The priority of the concurrent rendering thread may need to be boosted * on some schedulers. */ @@ -52,7 +54,7 @@ public: * @return true if the user wants to quit, false otherwise. */ static bool UserQuit() { return g_bQuitting; } static void SetUserQuit() { g_bQuitting = true; } - + /* * Returns true if the user wants to toggle windowed mode and atomically clears * the boolean. @@ -86,13 +88,13 @@ public: */ static int64_t GetMicrosecondsSinceStart( bool bAccurate ); - /* - * Add file search paths, higher priority first. + /* + * Add file search paths, higher priority first. */ static void MountInitialFilesystems( const RString &sDirOfExecutable ); - /* - * Add file search paths for user-writable directories. + /* + * Add file search paths for user-writable directories. */ static void MountUserFilesystems( const RString &sDirOfExecutable ); @@ -117,10 +119,10 @@ public: virtual bool GoToURL( RString sUrl ); virtual float GetDisplayAspectRatio() = 0; - + /** @brief Fetch the contents of the system clipboard. */ virtual RString GetClipboard(); - + // Lua void PushSelf( lua_State *L ); void RegisterWithLua(); @@ -146,7 +148,7 @@ extern ArchHooks *HOOKS; // global and accessible from anywhere in our program * @author Glenn Maynard, Chris Danford (c) 2003-2004 * @section LICENSE * All rights reserved. - * + * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -156,7 +158,7 @@ extern ArchHooks *HOOKS; // global and accessible from anywhere in our program * copyright notice(s) and this permission notice appear in all copies of * the Software and that both the above copyright notice(s) and this * permission notice appear in supporting documentation. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF diff --git a/src/archutils/Unix/AssertionHandler.cpp b/src/archutils/Unix/AssertionHandler.cpp index 8e14e8ad6d..92a34c0bcc 100644 --- a/src/archutils/Unix/AssertionHandler.cpp +++ b/src/archutils/Unix/AssertionHandler.cpp @@ -46,18 +46,28 @@ extern "C" void __assert_perror_fail( int errnum, const char *file, unsigned int /* Catch unhandled C++ exceptions. Note that this works in g++ even with -fno-exceptions, in * which case it'll be called if any exceptions are thrown at all. */ -#include void UnexpectedExceptionHandler() { - type_info *pException = abi::__cxa_current_exception_type(); - char const *pName = pException->name(); - int iStatus = -1; - char *pDem = abi::__cxa_demangle( pName, 0, 0, &iStatus ); - - const RString error = ssprintf("Unhandled exception: %s", iStatus? pName:pDem); + std::exception_ptr exptr = std::current_exception(); + try + { + std::rethrow_exception(exptr); + } + catch (std::exception &ex) + { #if defined(CRASH_HANDLER) - sm_crash( error ); + const RString error = ssprintf("Unhandled exception: %s", ex.what()); + sm_crash( error ); #endif + } + // TODO: Don't throw anything not subclassing std::exception + catch(...) + { +#if defined(CRASH_HANDLER) + const RString error = ssprintf("Unknown exception."); + sm_crash( error ); +#endif + } } void InstallExceptionHandler() @@ -68,7 +78,7 @@ void InstallExceptionHandler() /* * (c) 2003-2004 Glenn Maynard * All rights reserved. - * + * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -78,7 +88,7 @@ void InstallExceptionHandler() * copyright notice(s) and this permission notice appear in all copies of * the Software and that both the above copyright notice(s) and this * permission notice appear in supporting documentation. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF