general: housekeeping and msvc warning elimination

* avoid potential unsafe use of bool
* avoid potentially empty controlled statements
* annotate some unused variables
* remove some undefined functions
This commit is contained in:
Patrick Mackinlay 2025-01-03 15:58:54 +07:00
parent 2692ea19b5
commit 8170718492
18 changed files with 34 additions and 28 deletions

View File

@ -2934,11 +2934,11 @@ void nes_bmc_f600_device::write_l(offs_t offset, u8 data)
m_reg = offset;
m_prg_base = (m_reg & 0x38) << 1;
m_prg_mask = 0x1f >> BIT(m_reg, 5);
m_prg_mask = 0x1f >> (BIT(m_reg, 5) ? 1 : 0);
set_prg(m_prg_base, m_prg_mask);
m_chr_base = (m_reg & 0x07) << 7;
m_chr_mask = 0xff >> !BIT(m_reg, 2);
m_chr_mask = 0xff >> (BIT(m_reg, 2) ? 0 : 1);
set_chr(m_chr_source, m_chr_base, m_chr_mask);
}
}
@ -3332,7 +3332,7 @@ void nes_bmc_810305c_device::write_h(offs_t offset, u8 data)
m_outer = BIT(offset, 13, 2);
m_prg_base = m_outer << 5;
m_prg_mask = 0x1f >> (m_outer == 2);
m_prg_mask = 0x1f >> ((m_outer == 2) ? 1 : 0);
set_prg(m_prg_base, m_prg_mask);
m_chr_base = m_outer << 7;

View File

@ -310,7 +310,9 @@ void neogs_device::dac_flush()
right += out;
if (BIT(m_gscfg0, 2) && BIT(m_gscfg0, 6)) // PAN4CH
;
{
// TODO
}
}
m_dac[0]->data_w(left);
m_dac[1]->data_w(right);

View File

@ -938,8 +938,8 @@ protected:
void tccr1a_w(uint8_t data);
void tccr1b_w(uint8_t data);
void tccr1c_w(uint8_t data);
void tcnt1l_w(uint8_t data);
void tcnt1h_w(uint8_t data);
//void tcnt1l_w(uint8_t data);
//void tcnt1h_w(uint8_t data);
void icr1l_w(uint8_t data);
void icr1h_w(uint8_t data);
void ocr1al_w(uint8_t data);
@ -1045,8 +1045,8 @@ protected:
void tccr3a_w(uint8_t data);
void tccr3b_w(uint8_t data);
void tccr3c_w(uint8_t data);
void tcnt3l_w(uint8_t data);
void tcnt3h_w(uint8_t data);
//void tcnt3l_w(uint8_t data);
//void tcnt3h_w(uint8_t data);
void icr3l_w(uint8_t data);
void icr3h_w(uint8_t data);
void ocr3al_w(uint8_t data);

View File

@ -794,7 +794,7 @@ void i386_device::i386_trap_with_error(int irq, int irq_gate, int trap_level, ui
PUSH16(error);
}
}
catch(uint64_t e)
catch([[maybe_unused]] uint64_t e)
{
trap_level++;
if(trap_level == 1)

View File

@ -469,7 +469,7 @@ template <unsigned Which> void arm_iomd_device::irqmsk_w(u32 data)
// master clock control
inline void arm7500fe_iomd_device::refresh_host_cpu_clocks()
{
m_host_cpu->set_unscaled_clock(this->clock() >> (m_cpuclk_divider == false));
m_host_cpu->set_unscaled_clock(this->clock() >> (m_cpuclk_divider ? 0 : 1));
}
u32 arm7500fe_iomd_device::clkctl_r()

View File

@ -110,7 +110,7 @@ void psion_asic5_device::device_reset()
m_int_mask = 0x00;
m_int_status = 0x02; // UART transmitter empty
m_control = 0x00;
m_bdr = 0xffff;
m_bdr = -1;
receive_register_reset();
transmit_register_reset();

View File

@ -46,9 +46,9 @@ menu_control_device_preset::~menu_control_device_preset()
void menu_control_device_preset::populate()
{
auto presets = m_image.preset_images_list();
for(int i = 0; i != int(presets.size()); i++)
for(uintptr_t i = 0; i != uintptr_t(presets.size()); i++)
item_append(presets[i], 0, reinterpret_cast<void *>(i));
set_selection(reinterpret_cast<void *>(m_image.current_preset_image_id()));
set_selection(reinterpret_cast<void *>(uintptr_t(m_image.current_preset_image_id())));
}

View File

@ -340,7 +340,7 @@ void nl_convert_spice_t::convert_block(const str_list &contents)
{
process_line(line);
}
catch (const plib::pexception &e)
catch ([[maybe_unused]] const plib::pexception &e)
{
fprintf(stderr, "Error on line: <%d>\n", linenumber);
throw;

View File

@ -536,7 +536,7 @@ u8 ibm5100_state::nxr_r()
* giving 64KiB. Even and odd bytes are selected by a flip-flop
* which is toggled with each read.
*/
data = BIT(m_nxr[rs][m_nxr_address >> basic], (m_nxr_ff & NXR_B0) ? 0 : 8, 8);
data = BIT(m_nxr[rs][m_nxr_address >> (basic ? 1 : 0)], (m_nxr_ff & NXR_B0) ? 0 : 8, 8);
}
// always increment address for BASIC, only on odd bytes for APL

View File

@ -232,7 +232,6 @@ private:
u32 slqz3_gpio_r();
u32 lhdmg_gpio_r();
u32 lhzb3106c5m_gpio_r();
void unk2_w(u32 data);
TIMER_DEVICE_CALLBACK_MEMBER(interrupt);

View File

@ -1751,7 +1751,7 @@ void namcos22_state::draw_sprites()
bool y_lowres = BIT(~m_spriteram[0], 18);
const int deltax = (m_spriteram[1] & 0xffff) + (m_spriteram[2] & 0xffff) + 0x2d;
const int deltay = (m_spriteram[3] >> 16) + (0x2a >> y_lowres);
const int deltay = (m_spriteram[3] >> 16) + (0x2a >> (y_lowres ? 1 : 0));
const int base = m_spriteram[0] & 0xffff; // alpines/alpinr2b
int num_sprites = ((m_spriteram[1] >> 16) - base) + 1;

View File

@ -4081,7 +4081,7 @@ void gorgon_state::render_run(screen_device &screen, bitmap_rgb32 &bitmap)
{
bool y_lowres = !BIT(m_c435.spritedata[0], 2);
s16 deltax = (s16)((s16)m_c435.spritedata[6] + (s16)m_c435.spritedata[10] + 0x50);
s16 deltay = (s16)((s16)m_c435.spritedata[12] + (0x2a >> y_lowres));
s16 deltay = (s16)((s16)m_c435.spritedata[12] + (0x2a >> (y_lowres ? 1 : 0)));
u16 base = m_c435.spritedata[2];
u16 sprite_count = (m_c435.spritedata[4] - base) + 1;
for (int i = 0; i < sprite_count; i++)

View File

@ -680,7 +680,7 @@ void pc88va_state::draw_text(bitmap_rgb32 &bitmap, const rectangle &cliprect)
void pc88va_state::draw_graphic_layer(bitmap_rgb32 &bitmap, const rectangle &cliprect, u8 which)
{
// disable graphic B if screen 0 only setting is enabled
if (which > m_ymmd)
if (which && !m_ymmd)
return;
// ditto for 5bpp color mode

View File

@ -183,10 +183,10 @@ void atm_state::atm_update_video_mode()
{
bool zx_scale = m_rg & 1;
bool double_width = BIT(m_rg, 1) && !zx_scale;
u8 border_x = (40 - (32 * !zx_scale)) << double_width;
u8 border_x = (40 - (32 * !zx_scale)) << (double_width ? 1 : 0);
u8 border_y = (40 - (4 * !zx_scale));
rectangle scr = get_screen_area();
m_screen->configure(448 << double_width, m_screen->height(), {scr.left() - border_x, scr.right() + border_x, scr.top() - border_y, scr.bottom() + border_y}, m_screen->frame_period().as_attoseconds());
m_screen->configure(448 << (double_width ? 1 : 0), m_screen->height(), {scr.left() - border_x, scr.right() + border_x, scr.top() - border_y, scr.bottom() + border_y}, m_screen->frame_period().as_attoseconds());
LOGVIDEO("Video mode: %d\n", m_rg);
//spectrum_palette(m_palette);

View File

@ -2609,7 +2609,8 @@ void specnext_state::map_io(address_map &map)
return /*m_nr_d8_io_trap_fdc_en ? ... :*/ 0x00;
}), NAME([this](u8 data) {
if (m_nr_d8_io_trap_fdc_en)
;
{
}
}));

View File

@ -65,7 +65,7 @@ specnext_tiles_device &specnext_tiles_device::set_palette(const char *tag, u16 b
TILE_GET_INFO_MEMBER(specnext_tiles_device::get_tile_info)
{
const bool attr_in_map = BIT(~m_control, 5);
const u8 *data = &m_tiles_info[tile_index << attr_in_map];
const u8 *data = &m_tiles_info[tile_index << (attr_in_map ? 1 : 0)];
u8 attr = attr_in_map ? *(data + attr_in_map) : m_default_flags;
u16 code = *data;

View File

@ -424,7 +424,7 @@ void sprinter_state::draw_tile(u8* mode, bitmap_ind16 &bitmap, const rectangle &
{
for (auto dx = cliprect.left(); dx <= cliprect.right(); dx++)
{
const u8 color = m_vram[(y + (((dy - m_hold.second) & 7) >> lowres)) * 1024 + x + (((dx - m_hold.first) & 15) >> (1 + lowres))];
const u8 color = m_vram[(y + (((dy - m_hold.second) & 7) >> (lowres ? 1 : 0))) * 1024 + x + (((dx - m_hold.first) & 15) >> (1 + lowres))];
*pix++ = pal + (BIT(mode[0], 5) ? color : (((dx - m_hold.first) & 1) ? (color & 0x0f) : (color >> 4)));
}
pix += SPRINT_WIDTH - cliprect.width();
@ -716,9 +716,13 @@ void sprinter_state::dcp_w(offs_t offset, u8 data)
case 0x1b:
if (data & 0x80)
; // RESET
{
// RESET
}
if (data & 0x40)
; // AEN
{
// AEN
}
m_isa_addr_ext = data & 0x3f;
break;

View File

@ -579,7 +579,7 @@ void juku_state::fdc_data_w(uint8_t data)
void juku_state::speaker_w(int state)
{
m_speaker->level_w((m_beep_state = state) << m_beep_level);
m_speaker->level_w((m_beep_state = state) << (m_beep_level ? 1 : 0));
}
@ -602,7 +602,7 @@ void juku_state::pio0_porta_w(uint8_t data)
m_contrdat = (col_data & 0b1100'0000) >> 6; // decoded by 2x К555ИД7
if (m_beep_level != BIT(data, 4))
m_speaker->level_w(m_beep_state << (m_beep_level = BIT(data, 4)));
m_speaker->level_w(m_beep_state << ((m_beep_level = BIT(data, 4)) ? 1 : 0));
m_key_encoder->update();
}