From 4fc71e97089d5113a2dc7bb22c5ae2b498aebf16 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 6 Sep 2015 02:39:35 -0400 Subject: [PATCH 1/2] Common: Remove StdMakeUnique.h --- Source/Core/Common/Common.vcxproj | 1 - Source/Core/Common/Common.vcxproj.filters | 1 - Source/Core/Common/StdMakeUnique.h | 82 ------------------- Source/Core/Core/Boot/Boot_ELF.cpp | 4 +- Source/Core/Core/Boot/Boot_WiiWAD.cpp | 1 - Source/Core/Core/HW/EXI_DeviceAGP.cpp | 3 +- Source/Core/Core/HW/EXI_DeviceGecko.cpp | 4 +- Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp | 3 +- Source/Core/Core/HW/GCMemcardDirectory.cpp | 4 +- Source/Core/Core/HW/GCMemcardRaw.cpp | 3 +- Source/Core/Core/HW/SI_DeviceGBA.cpp | 2 +- Source/Core/Core/HW/WiiSaveCrypted.cpp | 2 +- .../Core/IPC_HLE/WII_IPC_HLE_Device_es.cpp | 2 +- Source/Core/Core/NetPlayServer.cpp | 2 +- Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp | 1 - Source/Core/Core/PowerPC/JitILCommon/IR.cpp | 1 - Source/Core/DolphinQt/AboutDialog.cpp | 2 +- Source/Core/DolphinQt/GameList/GameGrid.cpp | 4 +- Source/Core/DolphinQt/GameList/GameTree.cpp | 5 +- Source/Core/DolphinQt/MainWindow.cpp | 3 +- Source/Core/DolphinQt/SystemInfo.cpp | 2 +- Source/Core/DolphinWX/GameListCtrl.cpp | 1 - 22 files changed, 25 insertions(+), 108 deletions(-) delete mode 100644 Source/Core/Common/StdMakeUnique.h diff --git a/Source/Core/Common/Common.vcxproj b/Source/Core/Common/Common.vcxproj index 9303e37939..ec67edf054 100644 --- a/Source/Core/Common/Common.vcxproj +++ b/Source/Core/Common/Common.vcxproj @@ -75,7 +75,6 @@ - diff --git a/Source/Core/Common/Common.vcxproj.filters b/Source/Core/Common/Common.vcxproj.filters index 712122b3d1..64c29fb0ab 100644 --- a/Source/Core/Common/Common.vcxproj.filters +++ b/Source/Core/Common/Common.vcxproj.filters @@ -46,7 +46,6 @@ - diff --git a/Source/Core/Common/StdMakeUnique.h b/Source/Core/Common/StdMakeUnique.h deleted file mode 100644 index b3e38649d8..0000000000 --- a/Source/Core/Common/StdMakeUnique.h +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2014 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#pragma once - -// VS 2013 defines __cplusplus as 199711L but has std::make_unique. -#if __cplusplus > 201103L || _MSC_VER >= 1800 -#include -#else - -// Implementation of C++14 std::make_unique, which is not supported by all the -// compilers we care about yet. -// -// NOTE: This code is based on the libc++ implementation of std::make_unique. -// -// Copyright (c) 2009-2014 by the libc++ contributors. -// -// 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 without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// 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. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. - -#include -#include -#include - -namespace std -{ - -struct unspecified {}; - -template -struct unique_if -{ - typedef std::unique_ptr unique_single; -}; - -template -struct unique_if -{ - typedef std::unique_ptr unique_array_unknown_bound; -}; - -template -struct unique_if -{ - typedef void unique_array_known_bound; -}; - -template -inline typename unique_if::unique_single make_unique(Args&&... args) -{ - return std::unique_ptr(new T(std::forward(args)...)); -} - -template -inline typename unique_if::unique_array_unknown_bound make_unique(size_t n) -{ - typedef typename std::remove_extent::type U; - return std::unique_ptr(new U[n]()); -} - -template -typename unique_if::unique_array_known_bound make_unique(Args&&...) = delete; - -} // namespace std - -#endif // __cplusplus diff --git a/Source/Core/Core/Boot/Boot_ELF.cpp b/Source/Core/Core/Boot/Boot_ELF.cpp index 7f09fa7f2a..447e6f6f7b 100644 --- a/Source/Core/Core/Boot/Boot_ELF.cpp +++ b/Source/Core/Core/Boot/Boot_ELF.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. -#include "Common/FileUtil.h" -#include "Common/StdMakeUnique.h" +#include +#include "Common/FileUtil.h" #include "Core/Boot/Boot.h" #include "Core/Boot/ElfReader.h" #include "Core/HLE/HLE.h" diff --git a/Source/Core/Core/Boot/Boot_WiiWAD.cpp b/Source/Core/Core/Boot/Boot_WiiWAD.cpp index 66f2ed2b7d..a267227f49 100644 --- a/Source/Core/Core/Boot/Boot_WiiWAD.cpp +++ b/Source/Core/Core/Boot/Boot_WiiWAD.cpp @@ -8,7 +8,6 @@ #include "Common/CommonPaths.h" #include "Common/FileUtil.h" #include "Common/NandPaths.h" -#include "Common/StdMakeUnique.h" #include "Core/ConfigManager.h" #include "Core/PatchEngine.h" diff --git a/Source/Core/Core/HW/EXI_DeviceAGP.cpp b/Source/Core/Core/HW/EXI_DeviceAGP.cpp index c166ce4aca..e4ebe433f1 100644 --- a/Source/Core/Core/HW/EXI_DeviceAGP.cpp +++ b/Source/Core/Core/HW/EXI_DeviceAGP.cpp @@ -2,10 +2,11 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include + #include "Common/ChunkFile.h" #include "Common/FileUtil.h" #include "Common/MemoryUtil.h" -#include "Common/StdMakeUnique.h" #include "Core/ConfigManager.h" #include "Core/Core.h" #include "Core/HW/EXI_Device.h" diff --git a/Source/Core/Core/HW/EXI_DeviceGecko.cpp b/Source/Core/Core/HW/EXI_DeviceGecko.cpp index a189568ae7..c475b817c6 100644 --- a/Source/Core/Core/HW/EXI_DeviceGecko.cpp +++ b/Source/Core/Core/HW/EXI_DeviceGecko.cpp @@ -2,9 +2,11 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include +#include + #include "Common/ChunkFile.h" #include "Common/CommonFuncs.h" -#include "Common/StdMakeUnique.h" #include "Common/StringUtil.h" #include "Common/Thread.h" #include "Core/Core.h" diff --git a/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp b/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp index 722b69f153..0a154f3a43 100644 --- a/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp +++ b/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp @@ -2,11 +2,12 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include + #include "Common/ChunkFile.h" #include "Common/CommonTypes.h" #include "Common/FileUtil.h" #include "Common/NandPaths.h" -#include "Common/StdMakeUnique.h" #include "Common/StringUtil.h" #include "Core/ConfigManager.h" #include "Core/Core.h" diff --git a/Source/Core/Core/HW/GCMemcardDirectory.cpp b/Source/Core/Core/HW/GCMemcardDirectory.cpp index 99e680c14e..4a630a4c03 100644 --- a/Source/Core/Core/HW/GCMemcardDirectory.cpp +++ b/Source/Core/Core/HW/GCMemcardDirectory.cpp @@ -1,12 +1,14 @@ // Copyright 2014 Dolphin Emulator Project // Licensed under GPLv2+ // Refer to the license.txt file included. + #include +#include + #include "Common/ChunkFile.h" #include "Common/CommonTypes.h" #include "Common/FileSearch.h" #include "Common/FileUtil.h" -#include "Common/StdMakeUnique.h" #include "Common/Thread.h" #include "Core/ConfigManager.h" #include "Core/Core.h" diff --git a/Source/Core/Core/HW/GCMemcardRaw.cpp b/Source/Core/Core/HW/GCMemcardRaw.cpp index b1494d2e65..c3c41a8347 100644 --- a/Source/Core/Core/HW/GCMemcardRaw.cpp +++ b/Source/Core/Core/HW/GCMemcardRaw.cpp @@ -3,9 +3,10 @@ // Refer to the license.txt file included. #include +#include + #include "Common/ChunkFile.h" #include "Common/FileUtil.h" -#include "Common/StdMakeUnique.h" #include "Common/Thread.h" #include "Core/ConfigManager.h" #include "Core/Core.h" diff --git a/Source/Core/Core/HW/SI_DeviceGBA.cpp b/Source/Core/Core/HW/SI_DeviceGBA.cpp index 9850f2d0ed..f80dd5a56a 100644 --- a/Source/Core/Core/HW/SI_DeviceGBA.cpp +++ b/Source/Core/Core/HW/SI_DeviceGBA.cpp @@ -2,12 +2,12 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include #include #include #include "Common/CommonFuncs.h" #include "Common/Flag.h" -#include "Common/StdMakeUnique.h" #include "Common/Thread.h" #include "Common/Logging/Log.h" #include "Core/ConfigManager.h" diff --git a/Source/Core/Core/HW/WiiSaveCrypted.cpp b/Source/Core/Core/HW/WiiSaveCrypted.cpp index beae07402d..80b230f8a1 100644 --- a/Source/Core/Core/HW/WiiSaveCrypted.cpp +++ b/Source/Core/Core/HW/WiiSaveCrypted.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -21,7 +22,6 @@ #include "Common/FileUtil.h" #include "Common/MathUtil.h" #include "Common/NandPaths.h" -#include "Common/StdMakeUnique.h" #include "Common/StringUtil.h" #include "Common/Crypto/ec.h" diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_es.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_es.cpp index 3567b25aba..01a7279e6b 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_es.cpp +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_es.cpp @@ -36,13 +36,13 @@ // need to include this before polarssl/aes.h, // otherwise we may not get __STDC_FORMAT_MACROS #include +#include #include #include "Common/ChunkFile.h" #include "Common/CommonPaths.h" #include "Common/FileUtil.h" #include "Common/NandPaths.h" -#include "Common/StdMakeUnique.h" #include "Common/StringUtil.h" #include "Core/ConfigManager.h" #include "Core/ec_wii.h" diff --git a/Source/Core/Core/NetPlayServer.cpp b/Source/Core/Core/NetPlayServer.cpp index 2a48d37f7e..7ed283a4c0 100644 --- a/Source/Core/Core/NetPlayServer.cpp +++ b/Source/Core/Core/NetPlayServer.cpp @@ -2,12 +2,12 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include #include #include #include "Common/ENetUtil.h" #include "Common/FileUtil.h" #include "Common/IniFile.h" -#include "Common/StdMakeUnique.h" #include "Common/StringUtil.h" #include "Core/ConfigManager.h" #include "Core/NetPlayClient.h" //for NetPlayUI diff --git a/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp b/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp index a2901f01c2..036e765145 100644 --- a/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp +++ b/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp @@ -11,7 +11,6 @@ #include "Common/Common.h" #include "Common/FileUtil.h" #include "Common/Intrinsics.h" -#include "Common/StdMakeUnique.h" #include "Common/StringUtil.h" #include "Core/PatchEngine.h" #include "Core/HLE/HLE.h" diff --git a/Source/Core/Core/PowerPC/JitILCommon/IR.cpp b/Source/Core/Core/PowerPC/JitILCommon/IR.cpp index c96dfcea93..824ce44d87 100644 --- a/Source/Core/Core/PowerPC/JitILCommon/IR.cpp +++ b/Source/Core/Core/PowerPC/JitILCommon/IR.cpp @@ -127,7 +127,6 @@ TODO (in no particular order): #include #include "Common/FileUtil.h" -#include "Common/StdMakeUnique.h" #include "Common/StringUtil.h" #include "Core/Core.h" #include "Core/CoreTiming.h" diff --git a/Source/Core/DolphinQt/AboutDialog.cpp b/Source/Core/DolphinQt/AboutDialog.cpp index c9beca3d10..55f18377cc 100644 --- a/Source/Core/DolphinQt/AboutDialog.cpp +++ b/Source/Core/DolphinQt/AboutDialog.cpp @@ -2,13 +2,13 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include #include #include #include "ui_AboutDialog.h" #include "Common/Common.h" -#include "Common/StdMakeUnique.h" #include "DolphinQt/AboutDialog.h" #include "DolphinQt/Utils/Utils.h" diff --git a/Source/Core/DolphinQt/GameList/GameGrid.cpp b/Source/Core/DolphinQt/GameList/GameGrid.cpp index ebce076ccb..8bf92087bd 100644 --- a/Source/Core/DolphinQt/GameList/GameGrid.cpp +++ b/Source/Core/DolphinQt/GameList/GameGrid.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. -#include "ui_GameGrid.h" +#include -#include "Common/StdMakeUnique.h" +#include "ui_GameGrid.h" #include "DolphinQt/GameList/GameGrid.h" diff --git a/Source/Core/DolphinQt/GameList/GameTree.cpp b/Source/Core/DolphinQt/GameList/GameTree.cpp index b218d6072f..68dda6a419 100644 --- a/Source/Core/DolphinQt/GameList/GameTree.cpp +++ b/Source/Core/DolphinQt/GameList/GameTree.cpp @@ -2,12 +2,11 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include + #include "ui_GameTree.h" -#include "Common/StdMakeUnique.h" - #include "DolphinQt/GameList/GameTree.h" - #include "DolphinQt/Utils/Resources.h" #include "DolphinQt/Utils/Utils.h" diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index c842c27158..4c371678e5 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include #include #include #include @@ -10,8 +11,6 @@ #include "ui_MainWindow.h" -#include "Common/StdMakeUnique.h" - #include "Core/BootManager.h" #include "Core/ConfigManager.h" #include "Core/HW/ProcessorInterface.h" diff --git a/Source/Core/DolphinQt/SystemInfo.cpp b/Source/Core/DolphinQt/SystemInfo.cpp index 1d27324779..ba2764593c 100644 --- a/Source/Core/DolphinQt/SystemInfo.cpp +++ b/Source/Core/DolphinQt/SystemInfo.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include #include #include #include @@ -10,7 +11,6 @@ #include "Common/Common.h" #include "Common/CPUDetect.h" -#include "Common/StdMakeUnique.h" #include "DolphinQt/SystemInfo.h" #include "DolphinQt/Utils/Utils.h" diff --git a/Source/Core/DolphinWX/GameListCtrl.cpp b/Source/Core/DolphinWX/GameListCtrl.cpp index a386485ce3..b2a6e49a82 100644 --- a/Source/Core/DolphinWX/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/GameListCtrl.cpp @@ -31,7 +31,6 @@ #include "Common/FileSearch.h" #include "Common/FileUtil.h" #include "Common/MathUtil.h" -#include "Common/StdMakeUnique.h" #include "Common/StringUtil.h" #include "Common/SysConf.h" #include "Core/ConfigManager.h" From 8b027f6ed79fb6c51f3511b8faecd199c7802f1d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 6 Sep 2015 04:10:40 -0400 Subject: [PATCH 2/2] CMakeLists: Bump C++ compilation from gnu++0x to c++1y --- CMakeLists.txt | 2 +- Source/Core/Core/MemTools.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ab2e6a64d4..291efeed84 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -867,7 +867,7 @@ add_custom_command(TARGET unittests POST_BUILD COMMAND ${CMAKE_CTEST_COMMAND}) ######################################## # Start compiling our code # -add_definitions(-std=gnu++0x) +add_definitions(-std=c++1y) # These aren't actually needed for C11/C++11 # but some dependencies require them (LLVM, libav). diff --git a/Source/Core/Core/MemTools.cpp b/Source/Core/Core/MemTools.cpp index 2c1f688d5b..5f96356e69 100644 --- a/Source/Core/Core/MemTools.cpp +++ b/Source/Core/Core/MemTools.cpp @@ -190,7 +190,7 @@ static void ExceptionThread(mach_port_t port) msg_out.flavor = 0; msg_out.new_stateCnt = 0; } - msg_out.Head.msgh_size = offsetof(typeof(msg_out), new_state) + msg_out.new_stateCnt * sizeof(natural_t); + msg_out.Head.msgh_size = offsetof(__typeof__(msg_out), new_state) + msg_out.new_stateCnt * sizeof(natural_t); send_msg = &msg_out.Head; send_size = msg_out.Head.msgh_size;