Skip to content
Permalink
Browse files

Merge pull request #6273 from leoetlino/c++17

Enable C++17
  • Loading branch information...
leoetlino committed May 5, 2019
2 parents 99a4ca8 + 9133e8f commit 5d52b6ff095a4f8285ae757745ab0285bad47b9e
Showing with 118 additions and 3,629 deletions.
  1. +3 −3 CMakeLists.txt
  2. +1 −0 Source/Android/app/build.gradle
  3. +3 −20 Source/CMakeLists.txt
  4. +5 −5 Source/Core/AudioCommon/Mixer.cpp
  5. +0 −45 Source/Core/Common/Compat/in_place.h
  6. +0 −907 Source/Core/Common/Compat/optional
  7. +0 −2,523 Source/Core/Common/Compat/variant
  8. +0 −9 Source/Core/Common/Compiler.h
  9. +1 −1 Source/Core/Common/Crypto/ec.cpp
  10. +8 −14 Source/Core/Common/MathUtil.h
  11. +3 −2 Source/Core/Core/DSP/DSPAccelerator.cpp
  12. +4 −3 Source/Core/Core/HW/DSPHLE/UCodes/AX.cpp
  13. +4 −4 Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h
  14. +5 −4 Source/Core/Core/HW/DSPHLE/UCodes/AXWii.cpp
  15. +4 −3 Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp
  16. +3 −3 Source/Core/Core/HW/DSPHLE/UCodes/Zelda.h
  17. +2 −3 Source/Core/Core/HW/GCMemcard/GCMemcard.cpp
  18. +2 −2 Source/Core/Core/HW/SI/SI_DeviceGBA.cpp
  19. +4 −3 Source/Core/Core/HW/StreamADPCM.cpp
  20. +2 −2 Source/Core/Core/HW/VideoInterface.cpp
  21. +5 −4 Source/Core/Core/HW/WiimoteEmu/Dynamics.cpp
  22. +1 −0 Source/Core/Core/HW/WiimoteEmu/Extension/Nunchuk.cpp
  23. +3 −3 Source/Core/Core/HW/WiimoteEmu/MotionPlus.cpp
  24. +1 −1 Source/Core/Core/IOS/WFS/WFSI.cpp
  25. +2 −1 Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp
  26. +5 −8 Source/Core/Core/PowerPC/JitArm64/JitArm64_RegCache.cpp
  27. +1 −1 Source/Core/DolphinQt/RenderWidget.cpp
  28. +3 −3 Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.cpp
  29. +3 −2 Source/Core/InputCommon/ControllerEmu/StickGate.cpp
  30. +2 −2 Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.cpp
  31. +1 −0 Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp
  32. +1 −0 Source/Core/VideoBackends/D3D/Render.cpp
  33. +1 −1 Source/Core/VideoBackends/Software/EfbInterface.cpp
  34. +1 −1 Source/Core/VideoBackends/Software/Rasterizer.cpp
  35. +3 −3 Source/Core/VideoBackends/Software/Tev.cpp
  36. +6 −7 Source/Core/VideoBackends/Software/TransformUnit.cpp
  37. +4 −4 Source/Core/VideoBackends/Vulkan/SwapChain.cpp
  38. +8 −6 Source/Core/VideoCommon/BPFunctions.cpp
  39. +3 −2 Source/Core/VideoCommon/RenderBase.cpp
  40. +1 −1 Source/Core/VideoCommon/TextureCacheBase.cpp
  41. +9 −10 Source/Core/VideoCommon/TextureDecoder_Common.cpp
  42. +0 −1 Source/Core/VideoCommon/TextureDecoder_x64.cpp
  43. +0 −12 Source/UnitTests/Common/MathUtilTest.cpp
@@ -1,7 +1,7 @@
########################################
# General setup
#
cmake_minimum_required(VERSION 3.5.0)
cmake_minimum_required(VERSION 3.10)
set(CMAKE_OSX_ARCHITECTURES "x86_64")
# Minimum OS X version.
# This is inserted into the Info.plist as well.
@@ -203,8 +203,8 @@ endif()


# Enforce minimum GCC version
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
message(FATAL_ERROR "Dolphin requires at least GCC 6.0 (found ${CMAKE_CXX_COMPILER_VERSION})")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
message(FATAL_ERROR "Dolphin requires at least GCC 7.0 (found ${CMAKE_CXX_COMPILER_VERSION})")
endif()

if(CMAKE_GENERATOR MATCHES "Ninja")
@@ -60,6 +60,7 @@ android {
externalNativeBuild {
cmake {
path "../../../CMakeLists.txt"
version "3.10.2"
}
}

@@ -9,26 +9,9 @@ if(CMAKE_SYSTEM_NAME MATCHES "Windows")
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
endif()

if(CMAKE_C_COMPILER_ID MATCHES "MSVC")
# enable the latest C++ standard feature set,
# and also disable MSVC specific extensions
# to be even more standards compliant.
check_and_add_flag(CPPLATEST /std:c++latest)
check_and_add_flag(STANDARD_COMPLIANCE /permissive-)
else()
# Enable C++17, but fall back to C++14 if it isn't available.
# CMAKE_CXX_STANDARD cannot be used here because we require C++14 or newer, not any standard.
check_and_add_flag(CXX17 -std=c++17)
if(NOT FLAG_CXX_CXX17)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()

# These compat headers must not be in the include path when building with MSVC,
# because it currently does not support __has_include_next / #include_next.
include_directories(SYSTEM Core/Common/Compat)
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# These aren't actually needed for C11/C++11
# but some dependencies require them (LLVM, libav).
@@ -4,13 +4,13 @@

#include "AudioCommon/Mixer.h"

#include <algorithm>
#include <cmath>
#include <cstring>

#include "Common/ChunkFile.h"
#include "Common/CommonTypes.h"
#include "Common/Logging/Log.h"
#include "Common/MathUtil.h"
#include "Common/Swap.h"
#include "Core/ConfigManager.h"

@@ -86,14 +86,14 @@ unsigned int Mixer::MixerFifo::Mix(short* samples, unsigned int numSamples,
int sampleL = ((l1 << 16) + (l2 - l1) * (u16)m_frac) >> 16;
sampleL = (sampleL * lvolume) >> 8;
sampleL += samples[currentSample + 1];
samples[currentSample + 1] = MathUtil::Clamp(sampleL, -32767, 32767);
samples[currentSample + 1] = std::clamp(sampleL, -32767, 32767);

s16 r1 = Common::swap16(m_buffer[(indexR + 1) & INDEX_MASK]); // current
s16 r2 = Common::swap16(m_buffer[(indexR2 + 1) & INDEX_MASK]); // next
int sampleR = ((r1 << 16) + (r2 - r1) * (u16)m_frac) >> 16;
sampleR = (sampleR * rvolume) >> 8;
sampleR += samples[currentSample];
samples[currentSample] = MathUtil::Clamp(sampleR, -32767, 32767);
samples[currentSample] = std::clamp(sampleR, -32767, 32767);

m_frac += ratio;
indexR += 2 * (u16)(m_frac >> 16);
@@ -111,8 +111,8 @@ unsigned int Mixer::MixerFifo::Mix(short* samples, unsigned int numSamples,
s[1] = (s[1] * lvolume) >> 8;
for (; currentSample < numSamples * 2; currentSample += 2)
{
int sampleR = MathUtil::Clamp(s[0] + samples[currentSample + 0], -32767, 32767);
int sampleL = MathUtil::Clamp(s[1] + samples[currentSample + 1], -32767, 32767);
int sampleR = std::clamp(s[0] + samples[currentSample + 0], -32767, 32767);
int sampleL = std::clamp(s[1] + samples[currentSample + 1], -32767, 32767);

samples[currentSample + 0] = sampleR;
samples[currentSample + 1] = sampleL;

This file was deleted.

0 comments on commit 5d52b6f

Please sign in to comment.
You can’t perform that action at this time.