Skip to content

Commit

Permalink
Merge pull request #6446 from lioncash/assert-param
Browse files Browse the repository at this point in the history
Assert: Remove unused parameter from DEBUG_ASSERT
  • Loading branch information
leoetlino committed Mar 16, 2018
2 parents 328585e + 75f5fcd commit 76eee70
Show file tree
Hide file tree
Showing 28 changed files with 86 additions and 91 deletions.
3 changes: 1 addition & 2 deletions Source/Core/Common/Arm64Emitter.cpp
Expand Up @@ -210,8 +210,7 @@ bool IsImmLogical(uint64_t value, unsigned int width, unsigned int* n, unsigned
int multiplier_idx = CountLeadingZeros(d, kXRegSizeInBits) - 57;

// Ensure that the index to the multipliers array is within bounds.
DEBUG_ASSERT(DYNA_REC,
(multiplier_idx >= 0) && (static_cast<size_t>(multiplier_idx) < multipliers.size()));
DEBUG_ASSERT((multiplier_idx >= 0) && (static_cast<size_t>(multiplier_idx) < multipliers.size()));

uint64_t multiplier = multipliers[multiplier_idx];
uint64_t candidate = (b - a) * multiplier;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Common/Assert.h
Expand Up @@ -61,7 +61,7 @@
__LINE__, __FILE__); \
} while (0)

#define DEBUG_ASSERT(_t_, _a_) \
#define DEBUG_ASSERT(_a_) \
do \
{ \
if (MAX_LOGLEVEL >= LogTypes::LOG_LEVELS::LDEBUG) \
Expand Down
8 changes: 4 additions & 4 deletions Source/Core/Common/x64Emitter.cpp
Expand Up @@ -187,8 +187,8 @@ void OpArg::WriteREX(XEmitter* emit, int opBits, int bits, int customOp) const
{
emit->Write8(op);
// Check the operation doesn't access AH, BH, CH, or DH.
DEBUG_ASSERT(DYNA_REC, (offsetOrBaseReg & 0x100) == 0);
DEBUG_ASSERT(DYNA_REC, (customOp & 0x100) == 0);
DEBUG_ASSERT((offsetOrBaseReg & 0x100) == 0);
DEBUG_ASSERT((customOp & 0x100) == 0);
}
}

Expand Down Expand Up @@ -553,7 +553,7 @@ void XEmitter::RET_FAST()
// The first sign of decadence: optimized NOPs.
void XEmitter::NOP(size_t size)
{
DEBUG_ASSERT(DYNA_REC, (int)size > 0);
DEBUG_ASSERT((int)size > 0);
while (true)
{
switch (size)
Expand Down Expand Up @@ -1587,7 +1587,7 @@ void XEmitter::CMP_or_TEST(int bits, const OpArg& a1, const OpArg& a2)
void XEmitter::MOV_sum(int bits, X64Reg dest, const OpArg& a1, const OpArg& a2)
{
// This stomps on flags, so ensure they aren't locked
DEBUG_ASSERT(DYNA_REC, !flags_locked);
DEBUG_ASSERT(!flags_locked);

// Zero shortcuts (note that this can generate no code in the case where a1 == dest && a2 == zero
// or a2 == dest && a1 == zero)
Expand Down
24 changes: 12 additions & 12 deletions Source/Core/Common/x64Emitter.h
Expand Up @@ -156,64 +156,64 @@ struct OpArg

u64 Imm64() const
{
DEBUG_ASSERT(DYNA_REC, scale == SCALE_IMM64);
DEBUG_ASSERT(scale == SCALE_IMM64);
return (u64)offset;
}
u32 Imm32() const
{
DEBUG_ASSERT(DYNA_REC, scale == SCALE_IMM32);
DEBUG_ASSERT(scale == SCALE_IMM32);
return (u32)offset;
}
u16 Imm16() const
{
DEBUG_ASSERT(DYNA_REC, scale == SCALE_IMM16);
DEBUG_ASSERT(scale == SCALE_IMM16);
return (u16)offset;
}
u8 Imm8() const
{
DEBUG_ASSERT(DYNA_REC, scale == SCALE_IMM8);
DEBUG_ASSERT(scale == SCALE_IMM8);
return (u8)offset;
}

s64 SImm64() const
{
DEBUG_ASSERT(DYNA_REC, scale == SCALE_IMM64);
DEBUG_ASSERT(scale == SCALE_IMM64);
return (s64)offset;
}
s32 SImm32() const
{
DEBUG_ASSERT(DYNA_REC, scale == SCALE_IMM32);
DEBUG_ASSERT(scale == SCALE_IMM32);
return (s32)offset;
}
s16 SImm16() const
{
DEBUG_ASSERT(DYNA_REC, scale == SCALE_IMM16);
DEBUG_ASSERT(scale == SCALE_IMM16);
return (s16)offset;
}
s8 SImm8() const
{
DEBUG_ASSERT(DYNA_REC, scale == SCALE_IMM8);
DEBUG_ASSERT(scale == SCALE_IMM8);
return (s8)offset;
}

OpArg AsImm64() const
{
DEBUG_ASSERT(DYNA_REC, IsImm());
DEBUG_ASSERT(IsImm());
return OpArg((u64)offset, SCALE_IMM64);
}
OpArg AsImm32() const
{
DEBUG_ASSERT(DYNA_REC, IsImm());
DEBUG_ASSERT(IsImm());
return OpArg((u32)offset, SCALE_IMM32);
}
OpArg AsImm16() const
{
DEBUG_ASSERT(DYNA_REC, IsImm());
DEBUG_ASSERT(IsImm());
return OpArg((u16)offset, SCALE_IMM16);
}
OpArg AsImm8() const
{
DEBUG_ASSERT(DYNA_REC, IsImm());
DEBUG_ASSERT(IsImm());
return OpArg((u8)offset, SCALE_IMM8);
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/HW/DVD/DVDInterface.cpp
Expand Up @@ -535,7 +535,7 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)

if (s_DISR.BREAK)
{
DEBUG_ASSERT(DVDINTERFACE, 0);
DEBUG_ASSERT(0);
}

UpdateInterrupts();
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/HW/EXI/EXI.cpp
Expand Up @@ -107,7 +107,7 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
{
for (int i = 0; i < MAX_EXI_CHANNELS; ++i)
{
DEBUG_ASSERT(EXPANSIONINTERFACE, g_Channels[i] != nullptr);
DEBUG_ASSERT(g_Channels[i] != nullptr);
// Each channel has 5 32 bit registers assigned to it. We offset the
// base that we give to each channel for registration.
//
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/HW/EXI/EXI_Channel.cpp
Expand Up @@ -172,7 +172,7 @@ void CEXIChannel::AddDevice(const TEXIDevices device_type, const int device_num)
void CEXIChannel::AddDevice(std::unique_ptr<IEXIDevice> device, const int device_num,
bool notify_presence_changed)
{
DEBUG_ASSERT(EXPANSIONINTERFACE, device_num < NUM_DEVICES);
DEBUG_ASSERT(device_num < NUM_DEVICES);

// Replace it with the new one
m_devices[device_num] = std::move(device);
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/HW/EXI/EXI_DeviceAD16.cpp
Expand Up @@ -39,7 +39,7 @@ void CEXIAD16::TransferByte(u8& byte)
switch (m_position)
{
case 1:
DEBUG_ASSERT(EXPANSIONINTERFACE, byte == 0x00);
DEBUG_ASSERT(byte == 0x00);
break; // just skip
case 2:
byte = m_ad16_register.U8[0];
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Core/HW/MMIO.h
Expand Up @@ -210,13 +210,13 @@ class Mapping
template <>
inline u64 Mapping::Read<u64>(u32 addr)
{
DEBUG_ASSERT(MEMMAP, 0);
DEBUG_ASSERT(0);
return 0;
}

template <>
inline void Mapping::Write(u32 addr, u64 val)
{
DEBUG_ASSERT(MEMMAP, 0);
DEBUG_ASSERT(0);
}
}
2 changes: 1 addition & 1 deletion Source/Core/Core/HW/WiimoteReal/IOhidapi.cpp
Expand Up @@ -134,7 +134,7 @@ int WiimoteHidapi::IORead(u8* buf)

int WiimoteHidapi::IOWrite(const u8* buf, size_t len)
{
DEBUG_ASSERT(WIIMOTE, buf[0] == (WR_SET_REPORT | BT_OUTPUT));
DEBUG_ASSERT(buf[0] == (WR_SET_REPORT | BT_OUTPUT));
int result = hid_write(m_handle, buf + 1, len - 1);
if (result == -1)
{
Expand Down
14 changes: 7 additions & 7 deletions Source/Core/Core/IOS/FS/FS.cpp
Expand Up @@ -230,7 +230,7 @@ IPCCommandResult FS::GetStats(const IOCtlRequest& request)

IPCCommandResult FS::CreateDirectory(const IOCtlRequest& request)
{
DEBUG_ASSERT(IOS_FILEIO, request.buffer_out_size == 0);
DEBUG_ASSERT(request.buffer_out_size == 0);
u32 Addr = request.buffer_in;

u32 OwnerID = Memory::Read_U32(Addr);
Expand Down Expand Up @@ -377,7 +377,7 @@ IPCCommandResult FS::GetAttribute(const IOCtlRequest& request)

IPCCommandResult FS::DeleteFile(const IOCtlRequest& request)
{
DEBUG_ASSERT(IOS_FILEIO, request.buffer_out_size == 0);
DEBUG_ASSERT(request.buffer_out_size == 0);
int Offset = 0;

const std::string wii_path = Memory::GetString(request.buffer_in + Offset, 64);
Expand Down Expand Up @@ -407,7 +407,7 @@ IPCCommandResult FS::DeleteFile(const IOCtlRequest& request)

IPCCommandResult FS::RenameFile(const IOCtlRequest& request)
{
DEBUG_ASSERT(IOS_FILEIO, request.buffer_out_size == 0);
DEBUG_ASSERT(request.buffer_out_size == 0);
int Offset = 0;

const std::string wii_path = Memory::GetString(request.buffer_in + Offset, 64);
Expand Down Expand Up @@ -454,7 +454,7 @@ IPCCommandResult FS::RenameFile(const IOCtlRequest& request)

IPCCommandResult FS::CreateFile(const IOCtlRequest& request)
{
DEBUG_ASSERT(IOS_FILEIO, request.buffer_out_size == 0);
DEBUG_ASSERT(request.buffer_out_size == 0);

u32 Addr = request.buffer_in;
u32 OwnerID = Memory::Read_U32(Addr);
Expand Down Expand Up @@ -600,9 +600,9 @@ IPCCommandResult FS::ReadDirectory(const IOCtlVRequest& request)

IPCCommandResult FS::GetUsage(const IOCtlVRequest& request)
{
DEBUG_ASSERT(IOS_FILEIO, request.io_vectors.size() == 2);
DEBUG_ASSERT(IOS_FILEIO, request.io_vectors[0].size == 4);
DEBUG_ASSERT(IOS_FILEIO, request.io_vectors[1].size == 4);
DEBUG_ASSERT(request.io_vectors.size() == 2);
DEBUG_ASSERT(request.io_vectors[0].size == 4);
DEBUG_ASSERT(request.io_vectors[1].size == 4);

// this command sucks because it asks of the number of used
// fsBlocks and inodes
Expand Down
12 changes: 6 additions & 6 deletions Source/Core/Core/IOS/USB/Bluetooth/BTEmu.cpp
Expand Up @@ -171,8 +171,8 @@ IPCCommandResult BluetoothEmu::IOCtlV(const IOCtlVRequest& request)
const auto* acl_header =
reinterpret_cast<hci_acldata_hdr_t*>(Memory::GetPointer(ctrl.data_address));

DEBUG_ASSERT(IOS_WIIMOTE, HCI_BC_FLAG(acl_header->con_handle) == HCI_POINT2POINT);
DEBUG_ASSERT(IOS_WIIMOTE, HCI_PB_FLAG(acl_header->con_handle) == HCI_PACKET_START);
DEBUG_ASSERT(HCI_BC_FLAG(acl_header->con_handle) == HCI_POINT2POINT);
DEBUG_ASSERT(HCI_PB_FLAG(acl_header->con_handle) == HCI_PACKET_START);

SendToDevice(HCI_CON_HANDLE(acl_header->con_handle),
Memory::GetPointer(ctrl.data_address + sizeof(hci_acldata_hdr_t)),
Expand Down Expand Up @@ -437,9 +437,9 @@ bool BluetoothEmu::SendEventInquiryResponse()
if (m_WiiMotes.empty())
return false;

DEBUG_ASSERT(IOS_WIIMOTE, sizeof(SHCIEventInquiryResult) - 2 +
(m_WiiMotes.size() * sizeof(hci_inquiry_response)) <
256);
DEBUG_ASSERT(sizeof(SHCIEventInquiryResult) - 2 +
(m_WiiMotes.size() * sizeof(hci_inquiry_response)) <
256);

SQueuedEvent Event(static_cast<u32>(sizeof(SHCIEventInquiryResult) +
m_WiiMotes.size() * sizeof(hci_inquiry_response)),
Expand Down Expand Up @@ -701,7 +701,7 @@ bool BluetoothEmu::SendEventReadRemoteVerInfo(u16 _connectionHandle)

void BluetoothEmu::SendEventCommandComplete(u16 opcode, const void* data, u32 data_size)
{
DEBUG_ASSERT(IOS_WIIMOTE, (sizeof(SHCIEventCommand) - 2 + data_size) < 256);
DEBUG_ASSERT((sizeof(SHCIEventCommand) - 2 + data_size) < 256);

SQueuedEvent event(sizeof(SHCIEventCommand) + data_size, 0);

Expand Down
36 changes: 18 additions & 18 deletions Source/Core/Core/IOS/USB/Bluetooth/WiimoteDevice.cpp
Expand Up @@ -393,17 +393,17 @@ void WiimoteDevice::ReceiveConnectionResponse(u8 _Ident, u8* _pData, u32 _Size)
{
l2cap_con_rsp_cp* rsp = (l2cap_con_rsp_cp*)_pData;

DEBUG_ASSERT(IOS_WIIMOTE, _Size == sizeof(l2cap_con_rsp_cp));
DEBUG_ASSERT(_Size == sizeof(l2cap_con_rsp_cp));

DEBUG_LOG(IOS_WIIMOTE, "[L2CAP] ReceiveConnectionResponse");
DEBUG_LOG(IOS_WIIMOTE, " DCID: 0x%04x", rsp->dcid);
DEBUG_LOG(IOS_WIIMOTE, " SCID: 0x%04x", rsp->scid);
DEBUG_LOG(IOS_WIIMOTE, " Result: 0x%04x", rsp->result);
DEBUG_LOG(IOS_WIIMOTE, " Status: 0x%04x", rsp->status);

DEBUG_ASSERT(IOS_WIIMOTE, rsp->result == L2CAP_SUCCESS);
DEBUG_ASSERT(IOS_WIIMOTE, rsp->status == L2CAP_NO_INFO);
DEBUG_ASSERT(IOS_WIIMOTE, DoesChannelExist(rsp->scid));
DEBUG_ASSERT(rsp->result == L2CAP_SUCCESS);
DEBUG_ASSERT(rsp->status == L2CAP_NO_INFO);
DEBUG_ASSERT(DoesChannelExist(rsp->scid));

SChannel& rChannel = m_Channel[rsp->scid];
rChannel.DCID = rsp->dcid;
Expand All @@ -420,9 +420,9 @@ void WiimoteDevice::ReceiveConfigurationReq(u8 _Ident, u8* _pData, u32 _Size)
u32 Offset = 0;
l2cap_cfg_req_cp* pCommandConfigReq = (l2cap_cfg_req_cp*)_pData;

DEBUG_ASSERT(IOS_WIIMOTE, pCommandConfigReq->flags ==
0x00); // 1 means that the options are send in multi-packets
DEBUG_ASSERT(IOS_WIIMOTE, DoesChannelExist(pCommandConfigReq->dcid));
// Flags being 1 means that the options are sent in multi-packets
DEBUG_ASSERT(pCommandConfigReq->flags == 0x00);
DEBUG_ASSERT(DoesChannelExist(pCommandConfigReq->dcid));

SChannel& rChannel = m_Channel[pCommandConfigReq->dcid];

Expand Down Expand Up @@ -453,7 +453,7 @@ void WiimoteDevice::ReceiveConfigurationReq(u8 _Ident, u8* _pData, u32 _Size)
{
case L2CAP_OPT_MTU:
{
DEBUG_ASSERT(IOS_WIIMOTE, pOptions->length == L2CAP_OPT_MTU_SIZE);
DEBUG_ASSERT(pOptions->length == L2CAP_OPT_MTU_SIZE);
l2cap_cfg_opt_val_t* pMTU = (l2cap_cfg_opt_val_t*)&_pData[Offset];
rChannel.MTU = pMTU->mtu;
DEBUG_LOG(IOS_WIIMOTE, " MTU: 0x%04x", pMTU->mtu);
Expand All @@ -462,7 +462,7 @@ void WiimoteDevice::ReceiveConfigurationReq(u8 _Ident, u8* _pData, u32 _Size)

case L2CAP_OPT_FLUSH_TIMO:
{
DEBUG_ASSERT(IOS_WIIMOTE, pOptions->length == L2CAP_OPT_FLUSH_TIMO_SIZE);
DEBUG_ASSERT(pOptions->length == L2CAP_OPT_FLUSH_TIMO_SIZE);
l2cap_cfg_opt_val_t* pFlushTimeOut = (l2cap_cfg_opt_val_t*)&_pData[Offset];
rChannel.FlushTimeOut = pFlushTimeOut->flush_timo;
DEBUG_LOG(IOS_WIIMOTE, " FlushTimeOut: 0x%04x", pFlushTimeOut->flush_timo);
Expand Down Expand Up @@ -500,7 +500,7 @@ void WiimoteDevice::ReceiveConfigurationResponse(u8 _Ident, u8* _pData, u32 _Siz
DEBUG_LOG(IOS_WIIMOTE, " Flags: 0x%04x", rsp->flags);
DEBUG_LOG(IOS_WIIMOTE, " Result: 0x%04x", rsp->result);

DEBUG_ASSERT(IOS_WIIMOTE, rsp->result == L2CAP_SUCCESS);
DEBUG_ASSERT(rsp->result == L2CAP_SUCCESS);

// update state machine
SChannel& rChannel = m_Channel[rsp->scid];
Expand Down Expand Up @@ -579,7 +579,7 @@ void WiimoteDevice::SendDisconnectRequest(u16 scid)

void WiimoteDevice::SendConfigurationRequest(u16 scid, u16 MTU, u16 FlushTimeOut)
{
DEBUG_ASSERT(IOS_WIIMOTE, DoesChannelExist(scid));
DEBUG_ASSERT(DoesChannelExist(scid));
SChannel& rChannel = m_Channel[scid];

u8 Buffer[1024];
Expand Down Expand Up @@ -653,12 +653,12 @@ void WiimoteDevice::SDPSendServiceSearchResponse(u16 cid, u16 TransactionID,
// verify block... we handle search pattern for HID service only
{
CBigEndianBuffer buffer(pServiceSearchPattern);
DEBUG_ASSERT(IOS_WIIMOTE, buffer.Read8(0) == SDP_SEQ8); // data sequence
DEBUG_ASSERT(IOS_WIIMOTE, buffer.Read8(1) == 0x03); // sequence size
DEBUG_ASSERT(buffer.Read8(0) == SDP_SEQ8); // data sequence
DEBUG_ASSERT(buffer.Read8(1) == 0x03); // sequence size

// HIDClassID
DEBUG_ASSERT(IOS_WIIMOTE, buffer.Read8(2) == 0x19);
DEBUG_ASSERT(IOS_WIIMOTE, buffer.Read16(3) == 0x1124);
DEBUG_ASSERT(buffer.Read8(2) == 0x19);
DEBUG_ASSERT(buffer.Read16(3) == 0x1124);
}

u8 DataFrame[1000];
Expand Down Expand Up @@ -722,7 +722,7 @@ static int ParseAttribList(u8* pAttribIDList, u16& _startID, u16& _endID)

if (MAX_LOGLEVEL >= LogTypes::LOG_LEVELS::LDEBUG)
{
DEBUG_ASSERT(IOS_WIIMOTE, sequence == SDP_SEQ8);
DEBUG_ASSERT(sequence == SDP_SEQ8);
(void)seqSize;
}

Expand Down Expand Up @@ -798,7 +798,7 @@ void WiimoteDevice::HandleSDP(u16 cid, u8* _pData, u32 _Size)
{
WARN_LOG(IOS_WIIMOTE, "!!! SDP_ServiceSearchRequest !!!");

DEBUG_ASSERT(IOS_WIIMOTE, _Size == 13);
DEBUG_ASSERT(_Size == 13);

u16 TransactionID = buffer.Read16(1);
u8* pServiceSearchPattern = buffer.GetPointer(5);
Expand Down Expand Up @@ -889,7 +889,7 @@ void WiimoteDevice::ReceiveL2capData(u16 scid, const void* _pData, u32 _Size)
Offset += sizeof(l2cap_hdr_t);

// Check if we are already reporting on this channel
DEBUG_ASSERT(IOS_WIIMOTE, DoesChannelExist(scid));
DEBUG_ASSERT(DoesChannelExist(scid));
SChannel& rChannel = m_Channel[scid];

// Add an additional 4 byte header to the Wiimote report
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/IOS/USB/Bluetooth/WiimoteHIDAttr.cpp
Expand Up @@ -94,7 +94,7 @@ const u8* GetAttribPacket(u32 serviceHandle, u32 cont, u32& _size)

if (serviceHandle == 0x10001)
{
DEBUG_ASSERT(IOS_WIIMOTE, cont == 0x00);
DEBUG_ASSERT(cont == 0x00);
_size = sizeof(packet4_0x10001);
return packet4_0x10001;
}
Expand Down

0 comments on commit 76eee70

Please sign in to comment.