mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-01-09 06:41:07 +08:00
c++23: Replace Common::Unreachable with std::unreachable
Requires at least GCC 12, Clang 15, MSVC 19.32, or AppleClang 14.0.3.
This commit is contained in:
parent
cc0ce62e7f
commit
b9e352c18c
@ -157,7 +157,6 @@ add_library(common
|
||||
TraversalClient.h
|
||||
TraversalProto.h
|
||||
TypeUtils.h
|
||||
Unreachable.h
|
||||
UPnP.cpp
|
||||
UPnP.h
|
||||
VariantUtil.h
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
// Copyright 2024 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Common/CommonFuncs.h"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
// TODO C++23: Replace with std::unreachable.
|
||||
[[noreturn]] inline void Unreachable()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
Crash();
|
||||
#elif defined(_MSC_VER) && !defined(__clang__)
|
||||
__assume(false);
|
||||
#else
|
||||
__builtin_unreachable();
|
||||
#endif
|
||||
}
|
||||
} // namespace Common
|
||||
@ -5,10 +5,10 @@
|
||||
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
#include <utility>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/FloatUtils.h"
|
||||
#include "Common/Unreachable.h"
|
||||
#include "Core/PowerPC/Gekko.h"
|
||||
#include "Core/PowerPC/Interpreter/Interpreter_FPUtils.h"
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
@ -81,7 +81,7 @@ void ConvertToInteger(PowerPC::PowerPCState& ppc_state, UGeckoInstruction inst,
|
||||
rounded = std::floor(b);
|
||||
break;
|
||||
default:
|
||||
Common::Unreachable();
|
||||
std::unreachable();
|
||||
}
|
||||
|
||||
if (std::isnan(b))
|
||||
|
||||
@ -3,11 +3,12 @@
|
||||
|
||||
#include "Core/PowerPC/JitArm64/Jit.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "Common/Arm64Emitter.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Config/Config.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Common/Unreachable.h"
|
||||
|
||||
#include "Core/Config/SessionSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
@ -343,7 +344,7 @@ void JitArm64::ps_sel(UGeckoInstruction inst)
|
||||
else if (d == c)
|
||||
m_float_emit.BIF(VD, VB, V0);
|
||||
else
|
||||
Common::Unreachable();
|
||||
std::unreachable();
|
||||
}
|
||||
|
||||
ASSERT_MSG(DYNA_REC, singles == (fpr.IsSingle(a) && fpr.IsSingle(b) && fpr.IsSingle(c)),
|
||||
|
||||
@ -20,7 +20,6 @@
|
||||
#include "Common/IOFile.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Common/Unreachable.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/Debugger/DebugInterface.h"
|
||||
@ -558,7 +557,7 @@ bool PPCSymbolDB::LoadMap(const Core::CPUThreadGuard& guard, std::string filenam
|
||||
break;
|
||||
default:
|
||||
// Should never happen
|
||||
Common::Unreachable();
|
||||
std::unreachable();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -176,7 +176,6 @@
|
||||
<ClInclude Include="Common\TraversalClient.h" />
|
||||
<ClInclude Include="Common\TraversalProto.h" />
|
||||
<ClInclude Include="Common\TypeUtils.h" />
|
||||
<ClInclude Include="Common\Unreachable.h" />
|
||||
<ClInclude Include="Common\UPnP.h" />
|
||||
<ClInclude Include="Common\VariantUtil.h" />
|
||||
<ClInclude Include="Common\Version.h" />
|
||||
|
||||
@ -34,7 +34,6 @@
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/IOFile.h"
|
||||
#include "Common/Unreachable.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/Debugger/BranchWatch.h"
|
||||
@ -1217,7 +1216,7 @@ QMenu* BranchWatchDialog::GetTableContextMenu(const QModelIndex& index) const
|
||||
return m_mnu_table_context_symbol;
|
||||
}
|
||||
static_assert(Column::NumberOfColumns == 8);
|
||||
Common::Unreachable();
|
||||
std::unreachable();
|
||||
}
|
||||
|
||||
void BranchWatchDialog::RefreshVisibleContextMenuActions(bool core_initialized) const
|
||||
|
||||
@ -6,12 +6,12 @@
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
|
||||
#include <QBrush>
|
||||
|
||||
#include "Common/Assert.h"
|
||||
#include "Common/GekkoDisassembler.h"
|
||||
#include "Common/Unreachable.h"
|
||||
#include "Core/Debugger/BranchWatch.h"
|
||||
#include "Core/PowerPC/PPCSymbolDB.h"
|
||||
|
||||
@ -352,7 +352,7 @@ QVariant BranchWatchTableModel::DisplayRoleData(const QModelIndex& index) const
|
||||
return QString::number(kv->second.total_hits);
|
||||
}
|
||||
static_assert(Column::NumberOfColumns == 8);
|
||||
Common::Unreachable();
|
||||
std::unreachable();
|
||||
}
|
||||
|
||||
QVariant BranchWatchTableModel::FontRoleData(const QModelIndex& index) const
|
||||
@ -402,7 +402,7 @@ QVariant BranchWatchTableModel::TextAlignmentRoleData(const QModelIndex& index)
|
||||
return QVariant::fromValue(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
}
|
||||
static_assert(Column::NumberOfColumns == 8);
|
||||
Common::Unreachable();
|
||||
std::unreachable();
|
||||
}
|
||||
|
||||
QVariant BranchWatchTableModel::ForegroundRoleData(const QModelIndex& index) const
|
||||
@ -495,5 +495,5 @@ QVariant BranchWatchTableModel::SortRoleData(const QModelIndex& index) const
|
||||
return qulonglong{kv->second.total_hits};
|
||||
}
|
||||
static_assert(Column::NumberOfColumns == 8);
|
||||
Common::Unreachable();
|
||||
std::unreachable();
|
||||
}
|
||||
|
||||
@ -5,9 +5,9 @@
|
||||
|
||||
#include <array>
|
||||
#include <span>
|
||||
#include <utility>
|
||||
|
||||
#include "Common/Assert.h"
|
||||
#include "Common/Unreachable.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/PowerPC/JitInterface.h"
|
||||
#include "Core/PowerPC/PPCSymbolDB.h"
|
||||
@ -284,7 +284,7 @@ QVariant JitBlockTableModel::DisplayRoleData(const QModelIndex& index) const
|
||||
}
|
||||
}
|
||||
static_assert(Column::NumberOfColumns == 14);
|
||||
Common::Unreachable();
|
||||
std::unreachable();
|
||||
}
|
||||
|
||||
QVariant JitBlockTableModel::TextAlignmentRoleData(const QModelIndex& index) const
|
||||
@ -310,7 +310,7 @@ QVariant JitBlockTableModel::TextAlignmentRoleData(const QModelIndex& index) con
|
||||
return QVariant::fromValue(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
}
|
||||
static_assert(Column::NumberOfColumns == 14);
|
||||
Common::Unreachable();
|
||||
std::unreachable();
|
||||
}
|
||||
|
||||
QVariant JitBlockTableModel::SortRoleData(const QModelIndex& index) const
|
||||
@ -358,7 +358,7 @@ QVariant JitBlockTableModel::SortRoleData(const QModelIndex& index) const
|
||||
return static_cast<double>(profile_data->time_spent.count()) / profile_data->run_count;
|
||||
}
|
||||
static_assert(Column::NumberOfColumns == 14);
|
||||
Common::Unreachable();
|
||||
std::unreachable();
|
||||
}
|
||||
|
||||
QVariant JitBlockTableModel::data(const QModelIndex& index, int role) const
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user