Linux: Fixed warnings (and enabled no-parentheses warning)

This commit is contained in:
Sour 2018-06-25 15:13:32 -04:00
parent bb5794ffdf
commit 669113710a
22 changed files with 38 additions and 38 deletions

View File

@ -308,14 +308,13 @@ void Assembler::AssembleInstruction(LineData &lineData, uint16_t &instructionAdd
if(lineData.OpCode.compare(opName[i]) == 0) {
bool modeMatch = opMode == lineData.Mode;
if(!modeMatch) {
if(lineData.Mode == AddrMode::Imp && opMode == AddrMode::Acc ||
lineData.Mode == AddrMode::IndY && opMode == AddrMode::IndYW ||
lineData.Mode == AddrMode::AbsY && opMode == AddrMode::AbsYW ||
lineData.Mode == AddrMode::AbsX && opMode == AddrMode::AbsXW) {
if((lineData.Mode == AddrMode::Imp && opMode == AddrMode::Acc) ||
(lineData.Mode == AddrMode::IndY && opMode == AddrMode::IndYW) ||
(lineData.Mode == AddrMode::AbsY && opMode == AddrMode::AbsYW) ||
(lineData.Mode == AddrMode::AbsX && opMode == AddrMode::AbsXW)) {
modeMatch = true;
} else if(lineData.Mode == AddrMode::Abs && opMode == AddrMode::Rel ||
lineData.Mode == AddrMode::Imm && opMode == AddrMode::Rel) {
} else if((lineData.Mode == AddrMode::Abs && opMode == AddrMode::Rel) ||
(lineData.Mode == AddrMode::Imm && opMode == AddrMode::Rel)) {
if(lineData.OperandSize == 2) {
if(lineData.Mode == AddrMode::Imm) {
//Hardcoded jump values must be 1-byte

View File

@ -45,8 +45,8 @@ protected:
switch(_exRegs[0] & 0x03) {
case 0:
case 1: SelectChrPage8x(0, (_exRegs[2] & 0x3F) << 3); break;
case 2: SelectChrPage8x(0, ((_exRegs[2] & 0x3E) | _exRegs[4] & 0x01) << 3); break;
case 3: SelectChrPage8x(0, ((_exRegs[2] & 0x3C) | _exRegs[4] & 0x03) << 3); break;
case 2: SelectChrPage8x(0, ((_exRegs[2] & 0x3E) | (_exRegs[4] & 0x01)) << 3); break;
case 3: SelectChrPage8x(0, ((_exRegs[2] & 0x3C) | (_exRegs[4] & 0x03)) << 3); break;
}
} else {
uint8_t base, mask;

View File

@ -23,9 +23,9 @@ bool Breakpoint::Matches(uint32_t memoryAddr, AddressTypeInfo &info)
return (int32_t)memoryAddr >= _startAddr && (int32_t)memoryAddr <= _endAddr;
}
} else if(
_memoryType == DebugMemoryType::PrgRom && info.Type == AddressType::PrgRom ||
_memoryType == DebugMemoryType::WorkRam && info.Type == AddressType::WorkRam ||
_memoryType == DebugMemoryType::SaveRam && info.Type == AddressType::SaveRam
(_memoryType == DebugMemoryType::PrgRom && info.Type == AddressType::PrgRom) ||
(_memoryType == DebugMemoryType::WorkRam && info.Type == AddressType::WorkRam) ||
(_memoryType == DebugMemoryType::SaveRam && info.Type == AddressType::SaveRam)
) {
if(_endAddr == -1) {
return info.Address == _startAddr;
@ -50,9 +50,9 @@ bool Breakpoint::Matches(uint32_t memoryAddr, PpuAddressTypeInfo &info)
return (int32_t)memoryAddr >= _startAddr && (int32_t)memoryAddr <= _endAddr;
}
} else if(
_memoryType == DebugMemoryType::ChrRam && info.Type == PpuAddressType::ChrRam ||
_memoryType == DebugMemoryType::ChrRom && info.Type == PpuAddressType::ChrRom ||
_memoryType == DebugMemoryType::PaletteMemory && info.Type == PpuAddressType::PaletteRam
(_memoryType == DebugMemoryType::ChrRam && info.Type == PpuAddressType::ChrRam) ||
(_memoryType == DebugMemoryType::ChrRom && info.Type == PpuAddressType::ChrRom) ||
(_memoryType == DebugMemoryType::PaletteMemory && info.Type == PpuAddressType::PaletteRam)
) {
if(_endAddr == -1) {
return info.Address == _startAddr;

View File

@ -323,8 +323,8 @@ void Debugger::ProcessBreakpoints(BreakpointType type, OperationInfo &operationI
Breakpoint &breakpoint = breakpoints[i];
if(
type == BreakpointType::Global ||
!isPpuBreakpoint && breakpoint.Matches(operationInfo.Address, info) ||
isPpuBreakpoint && breakpoint.Matches(operationInfo.Address, ppuInfo)
(!isPpuBreakpoint && breakpoint.Matches(operationInfo.Address, info)) ||
(isPpuBreakpoint && breakpoint.Matches(operationInfo.Address, ppuInfo))
) {
if(!breakpoint.HasCondition()) {
processBreakpoint(breakpoint);

View File

@ -532,7 +532,7 @@ string Disassembler::GetCode(AddressTypeInfo &addressInfo, uint32_t endAddr, uin
isVerifiedData = addressInfo.Type == AddressType::PrgRom && cdl->IsData(addr&mask);
info = infoRef.get();
if(!info && (disassembleUnidentifiedData && !isVerifiedData || disassembleVerifiedData && isVerifiedData)) {
if(!info && ((disassembleUnidentifiedData && !isVerifiedData) || (disassembleVerifiedData && isVerifiedData))) {
dataType = isVerifiedData ? DataType::VerifiedData : (addressInfo.Type == AddressType::PrgRom ? DataType::UnidentifiedData : DataType::VerifiedCode);
info = new DisassemblyInfo(source + (addr & mask), false);
} else if(info) {

View File

@ -136,7 +136,7 @@ protected:
int width = GetCharWidth(c);
int rowOffset = (c == 'y' || c == 'g' || c == 'p' || c == 'q') ? 1 : 0;
for(int j = 0; j < 8; j++) {
uint8_t rowData = (j == 7 && rowOffset == 0 || j == 0 && rowOffset == 1) ? 0 : _font[ch * 8 + 1 + j - rowOffset];
uint8_t rowData = ((j == 7 && rowOffset == 0) || (j == 0 && rowOffset == 1)) ? 0 : _font[ch * 8 + 1 + j - rowOffset];
for(int i = 0; i < width; i++) {
int drawFg = (rowData >> (7 - i)) & 0x01;
DrawPixel(x + i, y + j, drawFg ? _color : _backColor);

View File

@ -61,7 +61,7 @@ bool ExpressionEvaluator::CheckSpecialTokens(string expression, size_t &pos, str
size_t len = expression.size();
do {
char c = std::tolower(expression[pos]);
if(c >= 'a' && c <= 'z' || c >= '0' && c <= '9' || c == '_' || c == '@') {
if((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '_' || c == '@') {
//Only letters, numbers and underscore are allowed in code labels
token += c;
pos++;

View File

@ -332,7 +332,7 @@ void FDS::UpdateCrc(uint8_t value)
void FDS::WriteRegister(uint16_t addr, uint8_t value)
{
if(!_diskRegEnabled && addr >= 0x4024 && addr <= 0x4026 || !_soundRegEnabled && addr >= 0x4040) {
if((!_diskRegEnabled && addr >= 0x4024 && addr <= 0x4026) || (!_soundRegEnabled && addr >= 0x4040)) {
return;
}

View File

@ -49,7 +49,7 @@ protected:
//Hack for Super 3-in-1
BaseMapper::SelectCHRPage(slot, page | ((_exRegs[3] & 0x80) << 1), memoryType);
} else {
if(slot < 4 && _chrMode == 0 || slot >= 4 && _chrMode == 1) {
if((slot < 4 && _chrMode == 0) || (slot >= 4 && _chrMode == 1)) {
page |= 0x100;
}
BaseMapper::SelectCHRPage(slot, page, memoryType);

View File

@ -73,7 +73,7 @@ protected:
uint8_t regNumber = ((((addr >> 12) & 0x07) - 3) << 1) + ((addr >> 1) & 0x01);
bool lowBits = (addr & 0x01) == 0x00;
if(lowBits) {
_vrcChrRegs[regNumber] = (_vrcChrRegs[regNumber] & 0xF0) | value & 0x0F;
_vrcChrRegs[regNumber] = (_vrcChrRegs[regNumber] & 0xF0) | (value & 0x0F);
} else {
_vrcChrRegs[regNumber] = (_vrcChrRegs[regNumber] & 0x0F) | ((value & 0x0F) << 4);
}

View File

@ -27,7 +27,7 @@ protected:
SelectPRGPage(1, (prgPage & 0xFE) + 1);
}
SelectCHRPage(0, addr & 0x3F | highBit);
SelectCHRPage(0, (addr & 0x3F) | highBit);
SetMirroringType(addr & 0x2000 ? MirroringType::Horizontal : MirroringType::Vertical);
}

View File

@ -27,11 +27,11 @@ protected:
if(_regs[0] & 0x40) {
//NINA-03 mode
SelectPRGPage(0, (_regs[0] & 0x0E) | (_regs[1] & 0x01));
SelectCHRPage(0, ((_regs[0] << 2) & 0x38) | (_regs[1] >> 4) & 0x07);
SelectCHRPage(0, ((_regs[0] << 2) & 0x38) | ((_regs[1] >> 4) & 0x07));
} else {
//CNROM mode
SelectPRGPage(0, _regs[0] & 0x0F);
SelectCHRPage(0, ((_regs[0] << 2) & 0x3C) | (_regs[1] >> 4) & 0x03);
SelectCHRPage(0, ((_regs[0] << 2) & 0x3C) | ((_regs[1] >> 4) & 0x03));
}
SetMirroringType(_regs[0] & 0x80 ? MirroringType::Horizontal : MirroringType::Vertical);

View File

@ -91,7 +91,7 @@ public:
//Copy protection stuff - based on FCEUX's implementation
switch(addr & 0x7700) {
case 0x5100:
return _registers[3] | _registers[1] | _registers[0] | _registers[2] ^ 0xFF;
return _registers[3] | _registers[1] | _registers[0] | (_registers[2] ^ 0xFF);
case 0x5500:
if(_toggle) {

View File

@ -327,7 +327,7 @@ void NsfMapper::WriteRegister(uint16_t addr, uint8_t value)
_fdsAudio.WriteRegister(addr, value);
} else if((_nsfHeader.SoundChips & NsfSoundChips::MMC5) && addr >= 0x5000 && addr <= 0x5015) {
_mmc5Audio.WriteRegister(addr, value);
} else if((_nsfHeader.SoundChips & NsfSoundChips::Namco) && (addr >= 0x4800 && addr <= 0x4FFF || addr >= 0xF800 && addr <= 0xFFFF)) {
} else if((_nsfHeader.SoundChips & NsfSoundChips::Namco) && ((addr >= 0x4800 && addr <= 0x4FFF) || (addr >= 0xF800 && addr <= 0xFFFF))) {
_namcoAudio.WriteRegister(addr, value);
//Technically we should call this, but doing so breaks some NSFs

View File

@ -16,7 +16,7 @@ protected:
void WriteRegister(uint16_t addr, uint8_t value) override
{
SelectPRGPage(0, (value >> 4) & 0x07);
SelectCHRPage(0, value & 0x07 | ((value & 0x80) >> 4));
SelectCHRPage(0, (value & 0x07) | ((value & 0x80) >> 4));
SetMirroringType((value & 0x08) == 0x08 ? MirroringType::ScreenBOnly : MirroringType::ScreenAOnly);
}
};

View File

@ -107,11 +107,11 @@ protected:
break;
case 0xE:
_irqCounter = _irqCounter & 0xFF00 | value;
_irqCounter = (_irqCounter & 0xFF00) | value;
break;
case 0xF:
_irqCounter = _irqCounter & 0xFF | (value << 8);
_irqCounter = (_irqCounter & 0xFF) | (value << 8);
break;
}
break;

View File

@ -64,7 +64,7 @@ protected:
void WriteRegister(uint16_t addr, uint8_t value) override
{
addr = addr & 0xF000 | (addr & 0x2A ? 0x02 : 0) | (addr & 0x15 ? 0x01 : 0);
addr = (addr & 0xF000) | (addr & 0x2A ? 0x02 : 0) | (addr & 0x15 ? 0x01 : 0);
if(addr >= 0x9000 && addr <= 0x9001) {
switch(value) {

View File

@ -38,7 +38,7 @@ protected:
virtual uint8_t ReadRegister(uint16_t addr) override
{
return MemoryManager::GetOpenBus() & 0xCF | (_state << 4);
return (MemoryManager::GetOpenBus() & 0xCF) | (_state << 4);
}
void WriteRegister(uint16_t addr, uint8_t value) override

View File

@ -93,6 +93,7 @@ protected:
//Attribute fetches
uint8_t bank;
switch(GetMirroringType()) {
default:
case MirroringType::ScreenAOnly: bank = 0; break;
case MirroringType::ScreenBOnly: bank = 1; break;
case MirroringType::Horizontal: bank = (addr & 0x800) ? 1 : 0; break;

View File

@ -85,7 +85,6 @@ namespace Mesen.GUI.Debugger.Controls
this.txtColor.Text = _paletteRam[paletteIndex].ToString("X2");
this.txtPaletteAddress.Text = (0x3F00 + paletteIndex).ToString("X4");
Color selectedColor = Color.FromArgb(_palettePixelData[paletteIndex]);
this.txtColorCodeHex.Text = GetHexColorString();
this.txtColorCodeRgb.Text = GetRgbColorString();

View File

@ -33,8 +33,8 @@ std::shared_ptr<LinuxGameController> LinuxGameController::GetController(int devi
return nullptr;
}
if(libevdev_has_event_type(device, EV_KEY) && libevdev_has_event_code(device, EV_KEY, BTN_GAMEPAD) ||
libevdev_has_event_type(device, EV_ABS) && libevdev_has_event_code(device, EV_ABS, ABS_X)) {
if((libevdev_has_event_type(device, EV_KEY) && libevdev_has_event_code(device, EV_KEY, BTN_GAMEPAD)) ||
(libevdev_has_event_type(device, EV_ABS) && libevdev_has_event_code(device, EV_ABS, ABS_X))) {
MessageManager::Log(std::string("[Input Connected] Name: ") + libevdev_get_name(device) + " Vendor: " + std::to_string(libevdev_get_id_vendor(device)) + " Product: " + std::to_string(libevdev_get_id_product(device)));
return std::shared_ptr<LinuxGameController>(new LinuxGameController(deviceID, fd, device));
} else {
@ -67,7 +67,8 @@ LinuxGameController::LinuxGameController(int deviceID, int fileDescriptor, libev
timeout.tv_sec = 0;
timeout.tv_usec = 100000;
if(rc = select((int)_fd+1, &readSet, nullptr, nullptr, &timeout)) {
rc = select((int)_fd+1, &readSet, nullptr, nullptr, &timeout);
if(rc) {
do {
struct input_event ev;
rc = libevdev_next_event(_device, LIBEVDEV_READ_FLAG_NORMAL, &ev);

View File

@ -32,7 +32,7 @@ else
PROFILE_USE_FLAG = -fprofile-instr-use=$(CURDIR)/PGOHelper/pgo.profdata
endif
GCCOPTIONS=-fPIC -Wall --std=c++14 -O3 $(MESENFLAGS) -Wno-parentheses -Wno-switch
GCCOPTIONS=-fPIC -Wall --std=c++14 -O3 $(MESENFLAGS) -Wno-switch
CCOPTIONS=-fPIC -Wall -O3 $(MESENFLAGS)
ifeq ($(MESENPLATFORM),x86)