From 4298ce18fb33d5935231a83bcf1f60289eb6b09c Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sun, 15 Nov 2020 03:58:54 +1100 Subject: Enable GCC implicit fallthrough warning. I've guessed whether break or [[fallthrough]] is appropriate. In cases where it looked particularly suspicious, I added a FIXME comment. All of these changes should be reviewed by someone familiar with the code. --- scripts/genie.lua | 6 + scripts/src/3rdparty.lua | 5 + src/devices/bus/ata/atapicdr.cpp | 1 + src/devices/bus/bbc/fdc/opus.cpp | 3 + src/devices/bus/electron/plus2.cpp | 1 + src/devices/bus/electron/romboxp.cpp | 2 + src/devices/bus/gameboy/rom.cpp | 1 + src/devices/bus/gba/rom.cpp | 1 + src/devices/bus/isa/3c503.cpp | 1 + src/devices/bus/isa/gus.cpp | 10 ++ src/devices/bus/isa/mcd.cpp | 1 + src/devices/bus/isa/myb3k_fdc.cpp | 2 + src/devices/bus/isa/sblaster.cpp | 1 + src/devices/bus/nes/cony.cpp | 2 + src/devices/bus/nes/mmc3_clones.cpp | 1 + src/devices/bus/nes/multigame.cpp | 1 + src/devices/bus/nes/namcot.cpp | 6 +- src/devices/bus/nes/nes_ines.hxx | 2 + src/devices/bus/nes/pirate.cpp | 2 +- src/devices/bus/pce/pce_rom.cpp | 1 + src/devices/bus/sunmouse/hlemouse.cpp | 1 + src/devices/bus/vcs/dpc.cpp | 1 + src/devices/bus/wswan/rom.cpp | 1 + src/devices/cpu/bcp/dp8344.cpp | 2 +- src/devices/cpu/ccpu/ccpu.cpp | 1 + src/devices/cpu/cosmac/cosmac.cpp | 4 +- src/devices/cpu/dspp/dspp.cpp | 3 +- src/devices/cpu/dspp/dsppfe.cpp | 4 +- src/devices/cpu/i8089/i8089_dasm.cpp | 3 +- src/devices/cpu/i86/i286.cpp | 3 +- src/devices/cpu/m68000/m68kfpu.cpp | 4 +- src/devices/cpu/m68000/m68kmmu.h | 1 + src/devices/cpu/mips/mips3.cpp | 2 + src/devices/cpu/mips/mips3fe.cpp | 1 + src/devices/cpu/mips/r4000.cpp | 7 +- src/devices/cpu/pdp1/pdp1.cpp | 1 + src/devices/cpu/powerpc/ppcfe.cpp | 3 + src/devices/cpu/tlcs90/tlcs90.cpp | 2 + src/devices/cpu/tlcs90/tlcs90d.cpp | 2 +- src/devices/cpu/tms7000/tms7000.cpp | 1 + src/devices/cpu/z8/z8.cpp | 2 +- src/devices/machine/cdp1879.cpp | 1 + src/devices/machine/ds1994.cpp | 1 + src/devices/machine/fga002.cpp | 2 +- src/devices/machine/i8271.cpp | 3 + src/devices/machine/i8279.cpp | 3 +- src/devices/machine/mb89374.cpp | 1 + src/devices/machine/s3520cf.cpp | 4 +- src/devices/machine/strata.cpp | 1 + src/devices/machine/vrc5074.cpp | 1 + src/devices/sound/namco.cpp | 2 + src/devices/sound/tms5220.cpp | 1 + src/devices/video/mos6566.cpp | 4 + src/devices/video/pc_vga.cpp | 3 + src/devices/video/voodoo.cpp | 3 +- src/devices/video/zeus2.cpp | 4 +- src/frontend/mame/luaengine.cpp | 244 +++++++++++++++------------------ src/lib/formats/cqm_dsk.cpp | 1 + src/mame/audio/vboy.cpp | 1 + src/mame/drivers/altos8600.cpp | 1 + src/mame/drivers/barata.cpp | 3 + src/mame/drivers/besta.cpp | 1 + src/mame/drivers/bfm_swp.cpp | 6 +- src/mame/drivers/cops.cpp | 25 +--- src/mame/drivers/cosmic.cpp | 1 + src/mame/drivers/cxhumax.cpp | 1 + src/mame/drivers/fcrash.cpp | 47 +++---- src/mame/drivers/model3.cpp | 1 + src/mame/drivers/mpu4vid.cpp | 11 +- src/mame/drivers/mpu5.cpp | 3 +- src/mame/drivers/psion5.cpp | 1 + src/mame/drivers/rainbow.cpp | 2 +- src/mame/drivers/ti89.cpp | 1 + src/mame/drivers/tx0.cpp | 8 +- src/mame/machine/3do.cpp | 1 + src/mame/machine/amiga.cpp | 4 +- src/mame/machine/arkanoid.cpp | 2 + src/mame/machine/isbc_215g.cpp | 1 + src/mame/machine/lynx.cpp | 4 + src/mame/machine/mpu4.cpp | 3 + src/mame/machine/n64.cpp | 1 + src/mame/machine/twincobr.cpp | 2 + src/mame/video/dynax.cpp | 1 + src/mame/video/k007342.cpp | 1 + src/mame/video/konamigx.cpp | 1 + src/mame/video/psychic5.cpp | 1 + src/mame/video/vc4000.cpp | 6 +- src/osd/modules/render/d3d/d3dhlsl.cpp | 1 + src/tools/imgtool/modules/psion.cpp | 1 + 89 files changed, 305 insertions(+), 216 deletions(-) diff --git a/scripts/genie.lua b/scripts/genie.lua index 7aaebdf35ff..19e3d090d99 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -1078,6 +1078,12 @@ end print("GCC version 7.0 or later needed") os.exit(-1) end + buildoptions_cpp { + "-Wimplicit-fallthrough", + } + buildoptions_objcpp { + "-Wimplicit-fallthrough", + } buildoptions { "-Wno-unused-result", -- needed for fgets,fread on linux -- array bounds checking seems to be buggy in 4.8.1 (try it on video/stvvdp1.c and video/model1.c without -Wno-array-bounds) diff --git a/scripts/src/3rdparty.lua b/scripts/src/3rdparty.lua index 352d27b31bd..39697d93051 100644 --- a/scripts/src/3rdparty.lua +++ b/scripts/src/3rdparty.lua @@ -225,6 +225,11 @@ configuration { "gmake or ninja" } buildoptions_cpp { "-x c++", } +if _OPTIONS["gcc"]~=nil and not string.find(_OPTIONS["gcc"], "clang") then + buildoptions_cpp { + "-Wno-error=implicit-fallthrough", + } +end configuration { "vs*" } buildoptions { diff --git a/src/devices/bus/ata/atapicdr.cpp b/src/devices/bus/ata/atapicdr.cpp index 33cb0cb154e..2099763468c 100644 --- a/src/devices/bus/ata/atapicdr.cpp +++ b/src/devices/bus/ata/atapicdr.cpp @@ -130,6 +130,7 @@ void atapi_cdrom_device::ExecCommand() m_transfer_length = 0; return; } + [[fallthrough]]; default: if(m_media_change) { diff --git a/src/devices/bus/bbc/fdc/opus.cpp b/src/devices/bus/bbc/fdc/opus.cpp index 43425182fba..5f1727f8251 100644 --- a/src/devices/bus/bbc/fdc/opus.cpp +++ b/src/devices/bus/bbc/fdc/opus.cpp @@ -230,6 +230,7 @@ uint8_t bbc_opus8272_device::read(offs_t offset) case 0x06: if (m_floppy0->get_device()) m_floppy0->get_device()->mon_w(1); if (m_floppy1->get_device()) m_floppy1->get_device()->mon_w(1); + [[fallthrough]]; case 0x04: data = m_fdc->msr_r(); break; @@ -237,6 +238,7 @@ uint8_t bbc_opus8272_device::read(offs_t offset) case 0x05: if (m_floppy0->get_device()) m_floppy0->get_device()->mon_w(0); if (m_floppy1->get_device()) m_floppy1->get_device()->mon_w(0); + [[fallthrough]]; case 0x07: data = m_fdc->fifo_r(); break; @@ -262,6 +264,7 @@ void bbc_opus8272_device::write(offs_t offset, uint8_t data) case 0x05: if (m_floppy0->get_device()) m_floppy0->get_device()->mon_w(0); if (m_floppy1->get_device()) m_floppy1->get_device()->mon_w(0); + [[fallthrough]]; case 0x07: m_fdc->fifo_w(data); break; diff --git a/src/devices/bus/electron/plus2.cpp b/src/devices/bus/electron/plus2.cpp index 1e9d9d6591b..7eeb4b2cd95 100644 --- a/src/devices/bus/electron/plus2.cpp +++ b/src/devices/bus/electron/plus2.cpp @@ -126,6 +126,7 @@ uint8_t electron_plus2_device::expbus_r(offs_t offset) case 13: data &= m_cart[0]->read(offset & 0x3fff, 0, 0, m_romsel & 0x01, 0, 1); data &= m_cart[1]->read(offset & 0x3fff, 0, 0, m_romsel & 0x01, 0, 1); + [[fallthrough]]; case 14: case 15: data &= m_rom[m_romsel - 13]->read_rom(offset & 0x3fff); diff --git a/src/devices/bus/electron/romboxp.cpp b/src/devices/bus/electron/romboxp.cpp index 9408ce1cc74..e6cfd472989 100644 --- a/src/devices/bus/electron/romboxp.cpp +++ b/src/devices/bus/electron/romboxp.cpp @@ -201,6 +201,7 @@ uint8_t electron_romboxp_device::expbus_r(offs_t offset) case 13: data &= m_cart[0]->read(offset & 0x3fff, 0, 0, m_romsel & 0x01, 0, 1); data &= m_cart[1]->read(offset & 0x3fff, 0, 0, m_romsel & 0x01, 0, 1); + [[fallthrough]]; case 14: case 15: if (m_rom_base == 12) @@ -274,6 +275,7 @@ void electron_romboxp_device::expbus_w(offs_t offset, uint8_t data) case 13: m_cart[0]->write(offset & 0x3fff, data, 0, 0, m_romsel & 0x01, 0, 1); m_cart[1]->write(offset & 0x3fff, data, 0, 0, m_romsel & 0x01, 0, 1); + [[fallthrough]]; case 14: case 15: if (m_rom_base == 12) diff --git a/src/devices/bus/gameboy/rom.cpp b/src/devices/bus/gameboy/rom.cpp index d3e90d73f51..b635a828b8c 100644 --- a/src/devices/bus/gameboy/rom.cpp +++ b/src/devices/bus/gameboy/rom.cpp @@ -220,6 +220,7 @@ void gb_rom_tama5_device::write_ram(offs_t offset, uint8_t data) case 0x40: /* Unknown, some kind of read */ if ((m_tama5_addr & 0x1f) == 0x12) m_tama5_data = 0xff; + [[fallthrough]]; case 0x80: /* Unknown, some kind of read (when 07=01)/write (when 07=00/02) */ default: logerror( "%s Unknown addressing mode\n", machine().describe_context() ); diff --git a/src/devices/bus/gba/rom.cpp b/src/devices/bus/gba/rom.cpp index 378ed1d03cf..643432b8433 100644 --- a/src/devices/bus/gba/rom.cpp +++ b/src/devices/bus/gba/rom.cpp @@ -301,6 +301,7 @@ uint32_t gba_rom_device::read_gpio(offs_t offset, uint32_t mem_mask) } if (ACCESSING_BITS_16_31) return m_gpio_regs[1] << 16; + [[fallthrough]]; case 1: if (ACCESSING_BITS_0_15) return m_gpio_regs[2]; diff --git a/src/devices/bus/isa/3c503.cpp b/src/devices/bus/isa/3c503.cpp index 92da79a906e..0bf96c34f53 100644 --- a/src/devices/bus/isa/3c503.cpp +++ b/src/devices/bus/isa/3c503.cpp @@ -245,6 +245,7 @@ void el2_3c503_device::el2_3c503_hiport_w(offs_t offset, uint8_t data) { default: logerror("3c503: trying to set multiple drqs %X\n", data); } + break; case 9: if(m_regs.ctrl & 0x80) logerror("3c503: changing dma address during dma is undefined\n"); m_regs.da = (data << 8) | (m_regs.da & 0xff); diff --git a/src/devices/bus/isa/gus.cpp b/src/devices/bus/isa/gus.cpp index 237211047a2..6f839321e0c 100644 --- a/src/devices/bus/isa/gus.cpp +++ b/src/devices/bus/isa/gus.cpp @@ -502,6 +502,7 @@ uint8_t gf1_device::global_reg_data_r(offs_t offset) m_dma_irq_handler(0); return ret; } + break; case 0x45: // Timer control if(offset == 1) return m_timer_ctrl & 0x0c; @@ -509,15 +510,18 @@ uint8_t gf1_device::global_reg_data_r(offs_t offset) case 0x49: // Sampling control if(offset == 1) return m_sampling_ctrl & 0xe7; + break; case 0x4c: // Reset if(offset == 1) return m_reset; + break; case 0x80: // Voice control /* bit 0 - 1 if voice is stopped * bit 6 - 1 if addresses are decreasing, can change when looping is enabled * bit 7 - 1 if Wavetable IRQ is pending */ if(offset == 1) return m_voice[m_current_voice].voice_ctrl & 0xff; + break; case 0x81: // Frequency Control ret = m_voice[m_current_voice].freq_ctrl; if(offset == 0) @@ -551,12 +555,15 @@ uint8_t gf1_device::global_reg_data_r(offs_t offset) case 0x86: // Volume Ramp rate if(offset == 1) return m_voice[m_current_voice].vol_ramp_rate; + break; case 0x87: // Volume Ramp start (high 4 bits = exponent, low 4 bits = mantissa) if(offset == 1) return m_voice[m_current_voice].vol_ramp_start; + break; case 0x88: // Volume Ramp end (high 4 bits = exponent, low 4 bits = mantissa) if(offset == 1) return m_voice[m_current_voice].vol_ramp_end; + break; case 0x89: // Current Volume (high 4 bits = exponent, middle 8 bits = mantissa, low 4 bits = 0 [reserved]) ret = m_voice[m_current_voice].current_vol; if(offset == 0) @@ -578,15 +585,18 @@ uint8_t gf1_device::global_reg_data_r(offs_t offset) case 0x8c: // Pan position (4 bits, 0=full left, 15=full right) if(offset == 1) return m_voice[m_current_voice].pan_position; + break; case 0x8d: // Volume Ramp control /* bit 0 - Ramp has stopped * bit 6 - Ramp direction * bit 7 - Ramp IRQ pending */ if(offset == 1) return m_voice[m_current_voice].vol_ramp_ctrl; + break; case 0x8e: // Active voices (6 bits, high 2 bits are always 1) if(offset == 1) return (m_active_voices - 1) | 0xc0; + break; case 0x8f: // IRQ source register if(offset == 1) { diff --git a/src/devices/bus/isa/mcd.cpp b/src/devices/bus/isa/mcd.cpp index 0e184f56da4..a06e269302c 100644 --- a/src/devices/bus/isa/mcd.cpp +++ b/src/devices/bus/isa/mcd.cpp @@ -224,6 +224,7 @@ void mcd_isa_device::cmd_w(uint8_t data) { case 5: m_readmsf = 0; + [[fallthrough]]; case 4: case 3: m_readmsf |= bcd_2_dec(data) << ((m_cmdrd_count - 3) * 8); diff --git a/src/devices/bus/isa/myb3k_fdc.cpp b/src/devices/bus/isa/myb3k_fdc.cpp index dcef550db51..6aab8787c6b 100644 --- a/src/devices/bus/isa/myb3k_fdc.cpp +++ b/src/devices/bus/isa/myb3k_fdc.cpp @@ -194,8 +194,10 @@ WRITE_LINE_MEMBER( isa8_myb3k_fdc471x_device_base::drq_w ) { case 1: m_isa->drq1_w(state); + [[fallthrough]]; // FIXME: really? case 2: m_isa->drq2_w(state); + [[fallthrough]]; // FIXME: really? default: break; } diff --git a/src/devices/bus/isa/sblaster.cpp b/src/devices/bus/isa/sblaster.cpp index 35811671add..af7bb302511 100644 --- a/src/devices/bus/isa/sblaster.cpp +++ b/src/devices/bus/isa/sblaster.cpp @@ -556,6 +556,7 @@ void sb_device::process_fifo(uint8_t cmd) { case 0x0f: // read asp reg queue_r(0); + [[fallthrough]]; case 0x0e: // write asp reg case 0x02: // get asp version case 0x04: // set asp mode register diff --git a/src/devices/bus/nes/cony.cpp b/src/devices/bus/nes/cony.cpp index e42ae833f82..922942ffa56 100644 --- a/src/devices/bus/nes/cony.cpp +++ b/src/devices/bus/nes/cony.cpp @@ -237,6 +237,7 @@ void nes_cony_device::write_h(offs_t offset, uint8_t data) { case 0x0000: m_latch1 = 1; + [[fallthrough]]; case 0x3000: case 0x30ff: case 0x31ff: @@ -283,6 +284,7 @@ void nes_cony_device::write_h(offs_t offset, uint8_t data) case 0x0314: case 0x0315: m_latch2 = 1; + [[fallthrough]]; case 0x0310: case 0x0311: case 0x0316: diff --git a/src/devices/bus/nes/mmc3_clones.cpp b/src/devices/bus/nes/mmc3_clones.cpp index e58ca754186..4db056dc6f4 100644 --- a/src/devices/bus/nes/mmc3_clones.cpp +++ b/src/devices/bus/nes/mmc3_clones.cpp @@ -775,6 +775,7 @@ void nes_pikay2k_device::write_h(offs_t offset, uint8_t data) case 0x2000: m_reg[0] = 0; + [[fallthrough]]; default: txrom_write(offset, data); break; diff --git a/src/devices/bus/nes/multigame.cpp b/src/devices/bus/nes/multigame.cpp index c117520afe5..3a78dee027a 100644 --- a/src/devices/bus/nes/multigame.cpp +++ b/src/devices/bus/nes/multigame.cpp @@ -1770,6 +1770,7 @@ void nes_bmc_ball11_device::write_h(offs_t offset, uint8_t data) { case 0x4000: // here we also update reg[0] upper bit m_reg[0] = (m_reg[0] & 0x01) | ((data >> 3) & 0x02); + [[fallthrough]]; case 0x0000: case 0x2000: case 0x6000: diff --git a/src/devices/bus/nes/namcot.cpp b/src/devices/bus/nes/namcot.cpp index 4e0951bf92a..21f49636727 100644 --- a/src/devices/bus/nes/namcot.cpp +++ b/src/devices/bus/nes/namcot.cpp @@ -454,10 +454,12 @@ uint8_t nes_namcot340_device::n340_loread(offs_t offset) { case 0x1000: return m_irq_count & 0xff; - set_irq_line(CLEAR_LINE); + set_irq_line(CLEAR_LINE); // FIXME: unreachable + [[fallthrough]]; case 0x1800: return (m_irq_count >> 8) & 0xff; - set_irq_line(CLEAR_LINE); + set_irq_line(CLEAR_LINE); // FIXME: unreachable + [[fallthrough]]; default: return 0x00; } diff --git a/src/devices/bus/nes/nes_ines.hxx b/src/devices/bus/nes/nes_ines.hxx index 6887256fc59..7cbf7cf27dc 100644 --- a/src/devices/bus/nes/nes_ines.hxx +++ b/src/devices/bus/nes/nes_ines.hxx @@ -372,6 +372,7 @@ void nes_cart_slot_device::call_load_ines() case 0x8: // it's iNES 2.0 format ines20 = true; + [[fallthrough]]; case 0x0: default: mapper |= header[7] & 0xf0; @@ -840,6 +841,7 @@ const char * nes_cart_slot_device::get_default_card_ines(get_default_card_softwa case 0x8: // it's iNES 2.0 format ines20 = true; + [[fallthrough]]; case 0x0: default: mapper |= ROM[7] & 0xf0; diff --git a/src/devices/bus/nes/pirate.cpp b/src/devices/bus/nes/pirate.cpp index acda901ecca..13a5d61c0be 100644 --- a/src/devices/bus/nes/pirate.cpp +++ b/src/devices/bus/nes/pirate.cpp @@ -1204,7 +1204,7 @@ void nes_cityfight_device::write_h(offs_t offset, uint8_t data) case 0x4008: case 0x400c: m_prg_mode = data & 1; - + [[fallthrough]]; case 0x7000: m_irq_count = (m_irq_count & 0x1e0) | ((data & 0x0f) << 1); break; diff --git a/src/devices/bus/pce/pce_rom.cpp b/src/devices/bus/pce/pce_rom.cpp index 4522e850426..897878ad13a 100644 --- a/src/devices/bus/pce/pce_rom.cpp +++ b/src/devices/bus/pce/pce_rom.cpp @@ -214,6 +214,7 @@ void pce_tennokoe_device::write_cart(offs_t offset, uint8_t data) // TODO: lock/unlock mechanism is a complete guess, needs real HW study // (writes to ports $c0000, $d0000, $f0000) m_bram_locked = (data == 0); + [[fallthrough]]; default: logerror("tennokoe: ROM writing at %06x %02x\n",offset,data); break; diff --git a/src/devices/bus/sunmouse/hlemouse.cpp b/src/devices/bus/sunmouse/hlemouse.cpp index 014176538db..e3d11558f75 100644 --- a/src/devices/bus/sunmouse/hlemouse.cpp +++ b/src/devices/bus/sunmouse/hlemouse.cpp @@ -229,6 +229,7 @@ void hle_device_base::tra_complete() m_y_delta); //break; uncommenting this causes problems with early versions of Solaris } + [[fallthrough]]; case 1U: LOG("Sent %s (B=%X->%x X=%d Y=%d) - sending X delta\n", (1U == m_phase) ? "button state" : "Y delta", diff --git a/src/devices/bus/vcs/dpc.cpp b/src/devices/bus/vcs/dpc.cpp index 16fadd4dcfb..7709fe44e5a 100644 --- a/src/devices/bus/vcs/dpc.cpp +++ b/src/devices/bus/vcs/dpc.cpp @@ -128,6 +128,7 @@ uint8_t dpc_device::read(offs_t offset) return m_shift_reg; case 0x04: // Sound value, MOVAMT value AND'd with Draw Line Carry; with Draw Line Add m_latch_62 = m_latch_64; + [[fallthrough]]; case 0x06: // Sound value, MOVAMT value AND'd with Draw Line Carry; without Draw Line Add m_latch_64 = m_latch_62 + m_df[4].top; m_dlc = (m_latch_62 + m_df[4].top > 0xff) ? 1 : 0; diff --git a/src/devices/bus/wswan/rom.cpp b/src/devices/bus/wswan/rom.cpp index c4c991212b6..68d4c1d0500 100644 --- a/src/devices/bus/wswan/rom.cpp +++ b/src/devices/bus/wswan/rom.cpp @@ -360,6 +360,7 @@ void ws_rom_sram_device::write_io(offs_t offset, uint8_t data) { case 0x01: // SRAM bank to select m_nvram_base = (data * 0x10000) & (m_nvram.size() - 1); + [[fallthrough]]; default: ws_rom_device::write_io(offset, data); break; diff --git a/src/devices/cpu/bcp/dp8344.cpp b/src/devices/cpu/bcp/dp8344.cpp index b58599e3183..628334ea569 100644 --- a/src/devices/cpu/bcp/dp8344.cpp +++ b/src/devices/cpu/bcp/dp8344.cpp @@ -1831,7 +1831,7 @@ void dp8344_device::store_result() write_register(m_latched_instr & 0x001f, m_source_data); break; } - + [[fallthrough]]; // FIXME: really? case 0xe000: if (BIT(m_latched_instr, 11)) m_source_data = sub_nzcv(m_source_data, read_accumulator(), BIT(m_latched_instr, 10) && BIT(m_ccr, 1)); diff --git a/src/devices/cpu/ccpu/ccpu.cpp b/src/devices/cpu/ccpu/ccpu.cpp index 55bba0dd96e..d1f8756f827 100644 --- a/src/devices/cpu/ccpu/ccpu.cpp +++ b/src/devices/cpu/ccpu/ccpu.cpp @@ -599,6 +599,7 @@ void ccpu_cpu_device::execute_run() /* CST */ case 0xf7: m_watchdog = 0; + [[fallthrough]]; /* ADDP */ case 0xe7: tempval = RDMEM(m_I); diff --git a/src/devices/cpu/cosmac/cosmac.cpp b/src/devices/cpu/cosmac/cosmac.cpp index 6f824b90d64..a40b6e66262 100644 --- a/src/devices/cpu/cosmac/cosmac.cpp +++ b/src/devices/cpu/cosmac/cosmac.cpp @@ -860,7 +860,7 @@ inline void cosmac_device::run_state() { case cosmac_state::STATE_0_FETCH: m_op = 0; - + [[fallthrough]]; case cosmac_state::STATE_0_FETCH_2ND: fetch_instruction(); break; @@ -872,7 +872,7 @@ inline void cosmac_device::run_state() case cosmac_state::STATE_1_EXECUTE: sample_ef_lines(); - + [[fallthrough]]; case cosmac_state::STATE_1_EXECUTE_2ND: execute_instruction(); debug(); diff --git a/src/devices/cpu/dspp/dspp.cpp b/src/devices/cpu/dspp/dspp.cpp index dded3f028f9..ac7ece3cfb5 100644 --- a/src/devices/cpu/dspp/dspp.cpp +++ b/src/devices/cpu/dspp/dspp.cpp @@ -613,10 +613,11 @@ inline void dspp_device::set_rbase(uint32_t base, uint32_t addr) case 0: m_core->m_rbase[0] = addr; m_core->m_rbase[1] = addr + 4 - base; + [[fallthrough]]; // Intentional fall-through case 8: m_core->m_rbase[2] = addr + 8 - base; - + [[fallthrough]]; case 12: m_core->m_rbase[3] = addr + 12 - base; break; diff --git a/src/devices/cpu/dspp/dsppfe.cpp b/src/devices/cpu/dspp/dsppfe.cpp index 4f29ad08c0e..f0c49fc789b 100644 --- a/src/devices/cpu/dspp/dsppfe.cpp +++ b/src/devices/cpu/dspp/dsppfe.cpp @@ -86,11 +86,11 @@ bool dspp_frontend::describe(opcode_desc &desc, const opcode_desc *prev) { case 0: describe_special(op, desc); - + [[fallthrough]]; // FIXME: really? case 1: case 2: describe_branch(op, desc); - + [[fallthrough]]; // FIXME: really? case 3: describe_complex_branch(op, desc); } diff --git a/src/devices/cpu/i8089/i8089_dasm.cpp b/src/devices/cpu/i8089/i8089_dasm.cpp index 35e873dd461..6c31ed0e6b3 100644 --- a/src/devices/cpu/i8089/i8089_dasm.cpp +++ b/src/devices/cpu/i8089/i8089_dasm.cpp @@ -362,8 +362,7 @@ std::string i8089_disassembler::do_disassemble() else if (m_wb == 2) return util::string_format("lcall %s, %05x", off, m_pc + (int16_t) i); } - else - return invalid(); + return invalid(); case 0x28: return inst_rm("addb", "add"); case 0x29: return inst_rm("orb", "or"); diff --git a/src/devices/cpu/i86/i286.cpp b/src/devices/cpu/i86/i286.cpp index c307e23901b..dfa37f022f8 100644 --- a/src/devices/cpu/i86/i286.cpp +++ b/src/devices/cpu/i86/i286.cpp @@ -850,6 +850,7 @@ void i80286_cpu_device::code_descriptor(uint16_t selector, uint16_t offset, int if (SEGDESC(r) || (GATE(r) != TSSDESCIDLE)) throw TRAP(FAULT_GP,IDXTBL(selector)); + [[fallthrough]]; case TSSDESCIDLE: switch_task(selector, gate); load_flags(CompressFlags(), CPL); @@ -1888,7 +1889,7 @@ reg.base = BASE(desc); (void)(r); reg.limit = LIMIT(desc); } break; } } - + [[fallthrough]]; default: if(!common_op(op)) { diff --git a/src/devices/cpu/m68000/m68kfpu.cpp b/src/devices/cpu/m68000/m68kfpu.cpp index 3a2ec85e0ee..655ebfbe776 100644 --- a/src/devices/cpu/m68000/m68kfpu.cpp +++ b/src/devices/cpu/m68000/m68kfpu.cpp @@ -1748,7 +1748,7 @@ void m68000_base_device::fmovem(u16 w2) case 1: // Dynamic register list, postincrement or control addressing mode. // FIXME: not really tested, but seems to work reglist = REG_D()[(reglist >> 4) & 7]; - + [[fallthrough]]; case 0: // Static register list, predecrement or control addressing mode { for (i=0; i < 8; i++) @@ -1807,7 +1807,7 @@ void m68000_base_device::fmovem(u16 w2) case 3: // Dynamic register list, predecrement addressing mode. // FIXME: not really tested, but seems to work reglist = REG_D()[(reglist >> 4) & 7]; - + [[fallthrough]]; case 2: // Static register list, postincrement or control addressing mode { for (i=0; i < 8; i++) diff --git a/src/devices/cpu/m68000/m68kmmu.h b/src/devices/cpu/m68000/m68kmmu.h index b65e1e332ba..39f53d6524c 100644 --- a/src/devices/cpu/m68000/m68kmmu.h +++ b/src/devices/cpu/m68000/m68kmmu.h @@ -1050,6 +1050,7 @@ void m68851_pmove_put(u32 ea, u16 modes) pmmu_atc_flush(); } } + [[fallthrough]]; case 1: logerror("680x0: unknown PMOVE case 1, PC %x\n", m_pc); break; diff --git a/src/devices/cpu/mips/mips3.cpp b/src/devices/cpu/mips/mips3.cpp index 97155147ff5..1d0efb3f756 100644 --- a/src/devices/cpu/mips/mips3.cpp +++ b/src/devices/cpu/mips/mips3.cpp @@ -5211,6 +5211,7 @@ void mips3_device::execute_run() machine().debug_break(); break; } + [[fallthrough]]; case 0x31: /* LWC1 */ if (!(SR & SR_COP1)) { @@ -5233,6 +5234,7 @@ void mips3_device::execute_run() machine().debug_break(); break; } + [[fallthrough]]; case 0x35: /* LDC1 */ if (!(SR & SR_COP1)) { diff --git a/src/devices/cpu/mips/mips3fe.cpp b/src/devices/cpu/mips/mips3fe.cpp index 8d6e0982bc0..2ab10712e3d 100644 --- a/src/devices/cpu/mips/mips3fe.cpp +++ b/src/devices/cpu/mips/mips3fe.cpp @@ -155,6 +155,7 @@ bool mips3_frontend::describe(opcode_desc &desc, const opcode_desc *prev) case 0x22: // LWL case 0x26: // LWR desc.regin[0] |= REGFLAG_R(RTREG); + [[fallthrough]]; case 0x20: // LB case 0x21: // LH case 0x23: // LW diff --git a/src/devices/cpu/mips/r4000.cpp b/src/devices/cpu/mips/r4000.cpp index 9d126121b1c..3a1699df7a5 100644 --- a/src/devices/cpu/mips/r4000.cpp +++ b/src/devices/cpu/mips/r4000.cpp @@ -978,7 +978,7 @@ void r4000_base_device::cpu_execute(u32 const op) m_icache_tag[(ADDR(m_r[RSREG], s16(op)) & m_icache_mask_hi) >> m_icache_shift] &= ~ICACHE_V; break; } - + [[fallthrough]]; case 0x04: // index load tag (I) if (ICACHE) { @@ -989,7 +989,7 @@ void r4000_base_device::cpu_execute(u32 const op) break; } - + [[fallthrough]]; case 0x08: // index store tag (I) if (ICACHE) { @@ -999,7 +999,7 @@ void r4000_base_device::cpu_execute(u32 const op) break; } - + [[fallthrough]]; case 0x01: // index writeback invalidate (D) case 0x02: // index invalidate (SI) case 0x03: // index writeback invalidate (SD) @@ -1891,6 +1891,7 @@ void r5000_device::cp1_execute(u32 const op) return; } } + [[fallthrough]]; case 0x11: // D switch (op & 0x3f) { diff --git a/src/devices/cpu/pdp1/pdp1.cpp b/src/devices/cpu/pdp1/pdp1.cpp index f16985610f0..be313bbbe24 100644 --- a/src/devices/cpu/pdp1/pdp1.cpp +++ b/src/devices/cpu/pdp1/pdp1.cpp @@ -551,6 +551,7 @@ void pdp1_device::device_start() { default: m_extend_support = 0; + [[fallthrough]]; case 0: /* no extension */ m_extended_address_mask = 07777; m_address_extension_mask = 00000; diff --git a/src/devices/cpu/powerpc/ppcfe.cpp b/src/devices/cpu/powerpc/ppcfe.cpp index fbb6ae3a313..fba56639631 100644 --- a/src/devices/cpu/powerpc/ppcfe.cpp +++ b/src/devices/cpu/powerpc/ppcfe.cpp @@ -711,6 +711,7 @@ bool ppc_device::frontend::describe_1f(uint32_t op, opcode_desc &desc, const opc case 0x136: // ECIWX if (!(m_ppc.m_cap & PPCCAP_VEA)) return false; + [[fallthrough]]; case 0x014: // LWARX case 0x017: // LWZX case 0x057: // LBZX @@ -920,6 +921,7 @@ bool ppc_device::frontend::describe_1f(uint32_t op, opcode_desc &desc, const opc case 0x1b6: // ECOWX if (!(m_ppc.m_cap & PPCCAP_VEA)) return false; + [[fallthrough]]; case 0x096: // STWCX. case 0x097: // STWX case 0x0d7: // STBX @@ -1339,6 +1341,7 @@ bool ppc_device::frontend::describe_3f(uint32_t op, opcode_desc &desc, const opc case 0x00e: // FCTIWx case 0x00f: // FCTIWZx FPSCR_MODIFIED(desc, 4); + [[fallthrough]]; case 0x028: // FNEGx case 0x048: // FMRx case 0x088: // FNABSx diff --git a/src/devices/cpu/tlcs90/tlcs90.cpp b/src/devices/cpu/tlcs90/tlcs90.cpp index 19684a0d080..eb07f5a8839 100644 --- a/src/devices/cpu/tlcs90/tlcs90.cpp +++ b/src/devices/cpu/tlcs90/tlcs90.cpp @@ -1022,6 +1022,7 @@ void tlcs90_device::decode() if (b0 == 0xfe) { OPCC( LDI+b1-0x58,14,18 ) NONE( 1 ) NONE( 2 ) return; } + [[fallthrough]]; // FIXME: really? case 0x60: // ADD A,g case 0x61: // ADC A,g @@ -2776,6 +2777,7 @@ TIMER_CALLBACK_MEMBER( tlcs90_device::t90_timer_callback ) case 0x03: // 8bit PWM logerror("CPU Timer %d expired with unhandled mode %d\n", i, mode); // TODO: hmm... + [[fallthrough]]; // FIXME: really? case 0x00: // 8bit m_timer_value[i]++; if ( m_timer_value[i] == m_treg_8bit[i] ) diff --git a/src/devices/cpu/tlcs90/tlcs90d.cpp b/src/devices/cpu/tlcs90/tlcs90d.cpp index bb0a1b9931c..d39ddc13325 100644 --- a/src/devices/cpu/tlcs90/tlcs90d.cpp +++ b/src/devices/cpu/tlcs90/tlcs90d.cpp @@ -877,7 +877,7 @@ void tlcs90_disassembler::decode() if (b0 == 0xfe) { OPCC( LDI+b1-0x58,14,18 ) NONE( 1 ) NONE( 2 ) return; } - + [[fallthrough]]; // FIXME: really? case 0x60: // ADD A,g case 0x61: // ADC A,g case 0x62: // SUB A,g diff --git a/src/devices/cpu/tms7000/tms7000.cpp b/src/devices/cpu/tms7000/tms7000.cpp index cc3c0a1ff88..ea7893f8cea 100644 --- a/src/devices/cpu/tms7000/tms7000.cpp +++ b/src/devices/cpu/tms7000/tms7000.cpp @@ -585,6 +585,7 @@ void tms7000_device::tms7000_pf_w(offs_t offset, uint8_t data) logerror("%s: CMOS low-power halt mode enabled\n", tag()); } data &= ~0x20; + [[fallthrough]]; case 0x13: // d0-d4: prescaler reload value // d5: t2: cascade from t1 diff --git a/src/devices/cpu/z8/z8.cpp b/src/devices/cpu/z8/z8.cpp index c1a17dc1741..b2f4a20e4fe 100644 --- a/src/devices/cpu/z8/z8.cpp +++ b/src/devices/cpu/z8/z8.cpp @@ -702,7 +702,7 @@ void z8_device::t1_trigger() case Z8_TMR_TIN_TRIGGER: if (m_internal_timer[1]->enabled()) break; - + [[fallthrough]]; case Z8_TMR_TIN_RETRIGGER: if ((m_tmr & Z8_TMR_ENABLE_T1) != 0) { diff --git a/src/devices/machine/cdp1879.cpp b/src/devices/machine/cdp1879.cpp index eee9df590b5..1ecf168b3d5 100644 --- a/src/devices/machine/cdp1879.cpp +++ b/src/devices/machine/cdp1879.cpp @@ -140,6 +140,7 @@ void cdp1879_device::write(offs_t offset, uint8_t data) m_regs[offset + 6] = data; break; } + [[fallthrough]]; case R_CNT_DAYOFMONTH: case R_CNT_MONTH: m_regs[offset] = data; diff --git a/src/devices/machine/ds1994.cpp b/src/devices/machine/ds1994.cpp index c8da607c35c..c63fdd0da15 100644 --- a/src/devices/machine/ds1994.cpp +++ b/src/devices/machine/ds1994.cpp @@ -235,6 +235,7 @@ void ds1994_device::ds1994_rom_cmd(void) case ROMCMD_SEARCHINT: verboselog(0, "timer_main rom_command not implemented %02x\n", m_shift); m_state[m_state_ptr] = STATE_COMMAND; + break; default: verboselog(0, "timer_main rom_command not found %02x\n", m_shift); m_state[m_state_ptr] = STATE_IDLE; diff --git a/src/devices/machine/fga002.cpp b/src/devices/machine/fga002.cpp index d2ac00f8f62..59a40777aa9 100644 --- a/src/devices/machine/fga002.cpp +++ b/src/devices/machine/fga002.cpp @@ -682,7 +682,7 @@ void fga002_device::write(offs_t offset, uint8_t data){ case FGA_DMA_GENERAL : LOG("FGA_DMA_GENERAL - not implemented\n"); m_fga002[FGA_DMA_GENERAL] = data; break; case FGA_CTL12 : LOG("FGA_CTL12 - not implemented\n"); m_fga002[FGA_CTL12] = data; break; case FGA_LIOTIMING : LOG("FGA_LIOTIMING - not implemented\n"); m_fga002[FGA_LIOTIMING] = data; break; - case FGA_LOCALIACK : do_fga002reg_localiack_w(data); + case FGA_LOCALIACK : do_fga002reg_localiack_w(data); break; case FGA_FMBCTL : LOG("FGA_FMBCTL - not implemented\n"); m_fga002[FGA_FMBCTL] = data; break; case FGA_FMBAREA : LOG("FGA_FMBAREA - not implemented\n"); m_fga002[FGA_FMBAREA] = data; break; case FGA_AUXSRCSTART : LOG("FGA_AUXSRCSTART - not implemented\n"); m_fga002[FGA_AUXSRCSTART] = data; break; diff --git a/src/devices/machine/i8271.cpp b/src/devices/machine/i8271.cpp index f70f1395f66..529a21b9b5d 100644 --- a/src/devices/machine/i8271.cpp +++ b/src/devices/machine/i8271.cpp @@ -754,12 +754,14 @@ void i8271_device::start_command(int cmd) switch(cmd) { case C_READ_DATA_SINGLE: command[3] = 1; + [[fallthrough]]; case C_READ_DATA_MULTI: read_data_start(flopi[BIT(command[0], 7)]); break; case C_VERIFY_DATA_SINGLE: command[3] = 1; + [[fallthrough]]; case C_VERIFY_DATA_MULTI: verify_data_start(flopi[BIT(command[0], 7)]); break; @@ -817,6 +819,7 @@ void i8271_device::start_command(int cmd) case C_WRITE_DATA_SINGLE: command[3] = 1; + [[fallthrough]]; case C_WRITE_DATA_MULTI: write_data_start(flopi[BIT(command[0], 7)]); break; diff --git a/src/devices/machine/i8279.cpp b/src/devices/machine/i8279.cpp index ae457af8fdb..5c186997cd0 100644 --- a/src/devices/machine/i8279.cpp +++ b/src/devices/machine/i8279.cpp @@ -487,8 +487,9 @@ u8 i8279_device::data_r() case 0x10: // underrun if (!fifo_size) break; + [[fallthrough]]; default: - printf("Invalid status: %X\n", m_status); + logerror("Invalid status: %X\n", m_status); } } m_status = (m_status & 0xd0) | fifo_size; // turn off overrun & full diff --git a/src/devices/machine/mb89374.cpp b/src/devices/machine/mb89374.cpp index 3e888d820ec..7cad4c899d6 100644 --- a/src/devices/machine/mb89374.cpp +++ b/src/devices/machine/mb89374.cpp @@ -326,6 +326,7 @@ void mb89374_device::write(offs_t offset, uint8_t data) case REGISTER_RXIER: m_rxier = data; + break; case REGISTER_TXSR: m_txsr = data | TXSR_MASK; diff --git a/src/devices/machine/s3520cf.cpp b/src/devices/machine/s3520cf.cpp index bdd29a0d33f..abdd1d83638 100644 --- a/src/devices/machine/s3520cf.cpp +++ b/src/devices/machine/s3520cf.cpp @@ -268,8 +268,8 @@ inline void s3520cf_device::rtc_write(u8 offset,u8 data) case 0xa: m_rtc.month = (m_cntrl1 & 2) ? 1 : m_rtc.month + 0x10; check_overflow(); break; case 0xb: m_rtc.year = (m_cntrl1 & 2) ? m_rtc.year & 0xf0 : m_rtc.year + 1; check_overflow(); break; case 0xc: m_rtc.year = (m_cntrl1 & 2) ? m_rtc.year & 0x0f : m_rtc.year + 0x10; check_overflow(); break; - case 0xd: m_cntrl1 = data & 0xf; - case 0xe: m_cntrl2 = data & 0xf; + case 0xd: m_cntrl1 = data & 0xf; break; + case 0xe: m_cntrl2 = data & 0xf; break; } } } diff --git a/src/devices/machine/strata.cpp b/src/devices/machine/strata.cpp index df434adbd24..7976a16def9 100644 --- a/src/devices/machine/strata.cpp +++ b/src/devices/machine/strata.cpp @@ -500,6 +500,7 @@ void strataflash_device::write8_16(offs_t offset, uint16_t data, bus_width_t bus else m_wrbuf_base = offset; memset(m_wrbuf, 0xff, m_wrbuf_len); /* right??? */ + [[fallthrough]]; case FM_WRBUFPART3: if ((offset < m_wrbuf_base) || (offset >= (m_wrbuf_base + m_wrbuf_len))) m_status |= 0x30; diff --git a/src/devices/machine/vrc5074.cpp b/src/devices/machine/vrc5074.cpp index dd8894abe39..a2e1c0ea061 100644 --- a/src/devices/machine/vrc5074.cpp +++ b/src/devices/machine/vrc5074.cpp @@ -883,6 +883,7 @@ void vrc5074_device::cpu_reg_w(offs_t offset, uint32_t data, uint32_t mem_mask) case NREG_CPUSTAT + 0: /* CPU status */ if (data & 0x1) logerror("cpu_reg_w: System Cold Reset\n"); if (data & 0x2) logerror("cpu_reg_w: CPU Warm Reset\n"); + [[fallthrough]]; case NREG_CPUSTAT + 1: /* CPU status */ if (LOG_NILE) logerror("%s NILE WRITE: CPU status(%03X) = %08X & %08X\n", machine().describe_context(), offset * 4, data, mem_mask); logit = 0; diff --git a/src/devices/sound/namco.cpp b/src/devices/sound/namco.cpp index 694dad0cd29..5eaa04c7fae 100644 --- a/src/devices/sound/namco.cpp +++ b/src/devices/sound/namco.cpp @@ -522,6 +522,7 @@ void namco_15xx_device::namco_15xx_w(offs_t offset, uint8_t data) case 0x06: voice->waveform_select = (data >> 4) & 7; + [[fallthrough]]; case 0x04: case 0x05: /* the frequency has 20 bits */ @@ -598,6 +599,7 @@ void namco_cus30_device::namcos1_sound_w(offs_t offset, uint8_t data) case 0x01: voice->waveform_select = (data >> 4) & 15; + [[fallthrough]]; case 0x02: case 0x03: /* the frequency has 20 bits */ diff --git a/src/devices/sound/tms5220.cpp b/src/devices/sound/tms5220.cpp index d0afb710f46..05c5c3464df 100644 --- a/src/devices/sound/tms5220.cpp +++ b/src/devices/sound/tms5220.cpp @@ -1770,6 +1770,7 @@ void tms5220_device::device_timer(emu_timer &timer, device_timer_id id, int para case 0x03: /* High Impedance */ m_io_ready = param; + break; case 0x00: /* illegal */ m_io_ready = param; diff --git a/src/devices/video/mos6566.cpp b/src/devices/video/mos6566.cpp index a6e3c246a76..80d8a7c01b6 100644 --- a/src/devices/video/mos6566.cpp +++ b/src/devices/video/mos6566.cpp @@ -1152,6 +1152,8 @@ void mos6566_device::execute_run() // Third sample of border state m_border_on_sample[2] = m_border_on; + [[fallthrough]]; // FIXME: really? + // Graphics case 19: @@ -1739,6 +1741,8 @@ void mos6569_device::execute_run() // Third sample of border state m_border_on_sample[2] = m_border_on; + [[fallthrough]]; // FIXME: really? + // Graphics case 19: diff --git a/src/devices/video/pc_vga.cpp b/src/devices/video/pc_vga.cpp index 9f0bf5c48a7..d72899d2de2 100644 --- a/src/devices/video/pc_vga.cpp +++ b/src/devices/video/pc_vga.cpp @@ -2444,6 +2444,7 @@ uint8_t tseng_vga_device::port_03c0_r(offs_t offset) break; case 0x08: et4k.dac_state = 0; + [[fallthrough]]; default: res = vga_device::port_03c0_r(offset); break; @@ -2481,6 +2482,7 @@ void tseng_vga_device::port_03c0_w(offs_t offset, uint8_t data) et4k.dac_ctrl = data; break; } + [[fallthrough]]; default: vga_device::port_03c0_w(offset,data); break; @@ -4434,6 +4436,7 @@ bit 0-2 (911-928) READ-REG-SEL. Read Register Select. Selects the register case 0xf000: ibm8514.multifunc_sel = data & 0x000f; if(LOG_8514) logerror("S3: Multifunction select write %04x\n",data); + break; default: if(LOG_8514) logerror("S3: Unimplemented multifunction register %i write %03x\n",data >> 12,data & 0x0fff); } diff --git a/src/devices/video/voodoo.cpp b/src/devices/video/voodoo.cpp index bedd957c81d..edbc92de7d0 100644 --- a/src/devices/video/voodoo.cpp +++ b/src/devices/video/voodoo.cpp @@ -1630,7 +1630,7 @@ void voodoo_device::recompute_video_memory() { case 3: /* reserved */ logerror("VOODOO.ERROR:Unexpected memory configuration in recompute_video_memory!\n"); - + [[fallthrough]]; case 0: /* 2 color buffers, 1 aux buffer */ fbi.rgboffs[2] = ~0; fbi.auxoffs = 2 * buffer_pages * 0x1000; @@ -4591,6 +4591,7 @@ uint32_t voodoo_device::register_r(voodoo_device *vd, offs_t offset) case fbiAfuncFail: case fbiPixelsOut: vd->update_statistics(true); + [[fallthrough]]; case fbiTrianglesOut: result = vd->reg[regnum].u & 0xffffff; break; diff --git a/src/devices/video/zeus2.cpp b/src/devices/video/zeus2.cpp index f57b3f53dda..b6626ce933a 100644 --- a/src/devices/video/zeus2.cpp +++ b/src/devices/video/zeus2.cpp @@ -1222,7 +1222,7 @@ bool zeus2_device::zeus2_fifo_process(const uint32_t *data, int numwords) return false; zeus_trans[3] = convert_float(data[1]); dataoffs = 1; - + [[fallthrough]]; /* 0x07: set matrix and point (crusnexo) */ case 0x07: if (numwords < 13) @@ -1294,6 +1294,7 @@ bool zeus2_device::zeus2_fifo_process(const uint32_t *data, int numwords) } break; } + [[fallthrough]]; // 0x1b: thegrid // 0x1c: crusnexo (4 words) case 0x1b: @@ -1471,6 +1472,7 @@ void zeus2_device::zeus2_draw_model(uint32_t baseaddr, uint16_t count, int logit case 0x00: // crusnexo if (logit && curoffs == count) logerror(" end cmd 00\n"); + [[fallthrough]]; case 0x21: /* thegrid */ case 0x22: /* crusnexo */ // Sets 0x68 (uv float offset) and texture line and mode diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp index e0660cb8e5b..9fbaa272d79 100644 --- a/src/frontend/mame/luaengine.cpp +++ b/src/frontend/mame/luaengine.cpp @@ -88,125 +88,104 @@ namespace sol }; template<> struct is_container : std::false_type {}; // don't convert core_optons to a table directly - namespace stack + sol::buffer *sol_lua_get(sol::types, lua_State *L, int index, sol::stack::record &tracking) { - template <> - struct pusher - { - static int push(lua_State *L, osd_file::error error) - { - const char *strerror; - switch(error) - { - case osd_file::error::NONE: - return stack::push(L, sol::nil); - case osd_file::error::FAILURE: - strerror = "failure"; - break; - case osd_file::error::OUT_OF_MEMORY: - strerror = "out_of_memory"; - break; - case osd_file::error::NOT_FOUND: - strerror = "not_found"; - break; - case osd_file::error::ACCESS_DENIED: - strerror = "access_denied"; - break; - case osd_file::error::ALREADY_OPEN: - strerror = "already_open"; - break; - case osd_file::error::TOO_MANY_FILES: - strerror = "too_many_files"; - break; - case osd_file::error::INVALID_DATA: - strerror = "invalid_data"; - break; - case osd_file::error::INVALID_ACCESS: - strerror = "invalid_access"; - break; - default: - strerror = "unknown_error"; - break; - } - return stack::push(L, strerror); - } - }; - template <> - struct checker - { - template - static bool check (lua_State* L, int index, Handler&& handler, record& tracking) - { - return stack::check(L, index, handler); - } - }; - template <> - struct getter - { - static sol::buffer *get(lua_State* L, int index, record& tracking) - { - return new sol::buffer(stack::get(L, index), L); - } - }; - template <> - struct pusher - { - static int push(lua_State* L, sol::buffer *buff) - { - delete buff; - return 1; - } - }; - template <> - struct pusher - { - static int push(lua_State *L, map_handler_type type) - { - const char *typestr; - switch(type) - { - case AMH_NONE: - typestr = "none"; - break; - case AMH_RAM: - typestr = "ram"; - break; - case AMH_ROM: - typestr = "rom"; - break; - case AMH_NOP: - typestr = "nop"; - break; - case AMH_UNMAP: - typestr = "unmap"; - break; - case AMH_DEVICE_DELEGATE: - case AMH_DEVICE_DELEGATE_M: - case AMH_DEVICE_DELEGATE_S: - case AMH_DEVICE_DELEGATE_SM: - case AMH_DEVICE_DELEGATE_MO: - case AMH_DEVICE_DELEGATE_SMO: - typestr = "delegate"; - break; - case AMH_PORT: - typestr = "port"; - break; - case AMH_BANK: - typestr = "bank"; - break; - case AMH_DEVICE_SUBMAP: - typestr = "submap"; - break; - default: - typestr = "unknown"; - break; - } - return stack::push(L, typestr); - } - }; + return new sol::buffer(stack::get(L, index), L); + } + int sol_lua_push(sol::types, lua_State *L, buffer *value) + { + delete value; + return 1; } } +int sol_lua_push(sol::types, lua_State *L, osd_file::error &&value) +{ + const char *strerror; + switch(value) + { + case osd_file::error::NONE: + return sol::stack::push(L, sol::nil); + case osd_file::error::FAILURE: + strerror = "failure"; + break; + case osd_file::error::OUT_OF_MEMORY: + strerror = "out_of_memory"; + break; + case osd_file::error::NOT_FOUND: + strerror = "not_found"; + break; + case osd_file::error::ACCESS_DENIED: + strerror = "access_denied"; + break; + case osd_file::error::ALREADY_OPEN: + strerror = "already_open"; + break; + case osd_file::error::TOO_MANY_FILES: + strerror = "too_many_files"; + break; + case osd_file::error::INVALID_DATA: + strerror = "invalid_data"; + break; + case osd_file::error::INVALID_ACCESS: + strerror = "invalid_access"; + break; + default: + strerror = "unknown_error"; + break; + } + return sol::stack::push(L, strerror); +} + +template +bool sol_lua_check(sol::types, lua_State *L, int index, Handler &&handler, sol::stack::record &tracking) +{ + return sol::stack::check(L, index, std::forward(handler)); +} + +int sol_lua_push(sol::types, lua_State *L, map_handler_type &&value) +{ + const char *typestr; + switch(value) + { + case AMH_NONE: + typestr = "none"; + break; + case AMH_RAM: + typestr = "ram"; + break; + case AMH_ROM: + typestr = "rom"; + break; + case AMH_NOP: + typestr = "nop"; + break; + case AMH_UNMAP: + typestr = "unmap"; + break; + case AMH_DEVICE_DELEGATE: + case AMH_DEVICE_DELEGATE_M: + case AMH_DEVICE_DELEGATE_S: + case AMH_DEVICE_DELEGATE_SM: + case AMH_DEVICE_DELEGATE_MO: + case AMH_DEVICE_DELEGATE_SMO: + typestr = "delegate"; + break; + case AMH_PORT: + typestr = "port"; + break; + case AMH_BANK: + typestr = "bank"; + break; + case AMH_DEVICE_SUBMAP: + typestr = "submap"; + break; + default: + typestr = "unknown"; + break; + } + return sol::stack::push(L, typestr); +} namespace { @@ -1966,7 +1945,7 @@ void lua_engine::initialize() return port_table; })); ioport_manager_type.set("type_seq", [](ioport_manager &m, ioport_type type, int player, input_seq_type seqtype) { - return sol::make_user(m.type_seq(type, player, seqtype)); + return sol::make_user(input_seq(m.type_seq(type, player, seqtype))); }); sol().registry().set("ioport", ioport_manager_type); @@ -2080,7 +2059,7 @@ void lua_engine::initialize() auto ioport_field_type = sol().registry().new_usertype("new", sol::no_constructor); ioport_field_type.set("set_value", &ioport_field::set_value); - ioport_field_type.set("set_input_seq", [](ioport_field &f, const std::string &seq_type_string, sol::user seq) { + ioport_field_type.set("set_input_seq", [](ioport_field &f, const std::string &seq_type_string, const input_seq &seq) { input_seq_type seq_type = s_seq_type_parser(seq_type_string); ioport_field::user_settings settings; f.get_user_settings(settings); @@ -2089,15 +2068,15 @@ void lua_engine::initialize() }); ioport_field_type.set("input_seq", [](ioport_field &f, const std::string &seq_type_string) { input_seq_type seq_type = s_seq_type_parser(seq_type_string); - return sol::make_user(f.seq(seq_type)); + return sol::make_user(input_seq(f.seq(seq_type))); }); - ioport_field_type.set("set_default_input_seq", [](ioport_field &f, const std::string &seq_type_string, sol::user seq) { + ioport_field_type.set("set_default_input_seq", [](ioport_field &f, const std::string &seq_type_string, const input_seq &seq) { input_seq_type seq_type = s_seq_type_parser(seq_type_string); f.set_defseq(seq_type, seq); }); ioport_field_type.set("default_input_seq", [](ioport_field &f, const std::string &seq_type_string) { input_seq_type seq_type = s_seq_type_parser(seq_type_string); - return sol::make_user(f.defseq(seq_type)); + return sol::make_user(input_seq(f.defseq(seq_type))); }); ioport_field_type.set("keyboard_codes", [this](ioport_field &f, int which) { sol::table result = sol().create_table(); @@ -2316,14 +2295,14 @@ void lua_engine::initialize() auto input_type = sol().registry().new_usertype("new", sol::no_constructor); input_type.set("code_from_token", [](input_manager &input, const char *token) { return sol::make_user(input.code_from_token(token)); }); - input_type.set("code_pressed", [](input_manager &input, sol::user code) { return input.code_pressed(code); }); - input_type.set("code_to_token", [](input_manager &input, sol::user code) { return input.code_to_token(code); }); - input_type.set("code_name", [](input_manager &input, sol::user code) { return input.code_name(code); }); - input_type.set("seq_from_tokens", [](input_manager &input, const char *tokens) { input_seq seq; input.seq_from_tokens(seq, tokens); return sol::make_user(seq); }); - input_type.set("seq_pressed", [](input_manager &input, sol::user seq) { return input.seq_pressed(seq); }); - input_type.set("seq_to_tokens", [](input_manager &input, sol::user seq) { return input.seq_to_tokens(seq); }); - input_type.set("seq_name", [](input_manager &input, sol::user seq) { return input.seq_name(seq); }); - input_type.set("seq_clean", [](input_manager &input, sol::user seq) { input_seq cleaned_seq = input.seq_clean(seq); return sol::make_user(cleaned_seq); }); + input_type.set("code_pressed", [](input_manager &input, const input_code &code) { return input.code_pressed(code); }); + input_type.set("code_to_token", [](input_manager &input, const input_code &code) { return input.code_to_token(code); }); + input_type.set("code_name", [](input_manager &input, const input_code &code) { return input.code_name(code); }); + input_type.set("seq_from_tokens", [](input_manager &input, const char *tokens) { input_seq seq; input.seq_from_tokens(seq, tokens); return sol::make_user(std::move(seq)); }); + input_type.set("seq_pressed", [](input_manager &input, const input_seq &seq) { return input.seq_pressed(seq); }); + input_type.set("seq_to_tokens", [](input_manager &input, const input_seq &seq) { return input.seq_to_tokens(seq); }); + input_type.set("seq_name", [](input_manager &input, const input_seq &seq) { return input.seq_name(seq); }); + input_type.set("seq_clean", [](input_manager &input, const input_seq &seq) { return sol::make_user(input.seq_clean(seq)); }); input_type.set("seq_poll_start", [this](input_manager &input, const char *cls_string, sol::object seq) { if (!m_seq_poll) m_seq_poll.reset(new input_sequence_poller(input)); @@ -2353,7 +2332,7 @@ void lua_engine::initialize() input_type.set("seq_poll_final", [this](input_manager &input) -> sol::object { if (!m_seq_poll) return sol::make_object(sol(), sol::nil); - return sol::make_object(sol(), sol::make_user(m_seq_poll->valid() ? m_seq_poll->sequence() : input_seq())); + return sol::make_object(sol(), sol::make_user(m_seq_poll->valid() ? input_seq(m_seq_poll->sequence()) : input_seq())); }); input_type.set("seq_poll_modified", [this](input_manager &input) -> sol::object { if (!m_seq_poll) @@ -2368,7 +2347,7 @@ void lua_engine::initialize() input_type.set("seq_poll_sequence", [this](input_manager &input) -> sol::object { if (!m_seq_poll) return sol::make_object(sol(), sol::nil); - return sol::make_object(sol(), sol::make_user(m_seq_poll->sequence())); + return sol::make_object(sol(), sol::make_user(input_seq(m_seq_poll->sequence()))); }); input_type.set("device_classes", sol::property([this](input_manager &input) { sol::table result = sol().create_table(); @@ -2449,7 +2428,7 @@ void lua_engine::initialize() input_device_item_type.set("token", sol::property(&input_device_item::token)); input_device_item_type.set("code", [](input_device_item &item) { input_code code(item.device().devclass(), item.device().devindex(), item.itemclass(), ITEM_MODIFIER_NONE, item.itemid()); - return sol::make_user(code); + return sol::make_user(std::move(code)); }); sol().registry().set("input_device_item", input_device_item_type); @@ -2974,7 +2953,8 @@ void lua_engine::initialize() image_type.set("create", [](device_image_interface &di, const std::string &filename) { return di.create(filename); }); image_type.set("crc", &device_image_interface::crc); image_type.set("display", [](device_image_interface &di) { return di.call_display(); }); - image_type.set("device", sol::property(static_cast(&device_image_interface::device))); + // FIXME: the next line is causing sol3 to try instantiating device_t for some reason + //image_type.set("device", sol::property(static_cast(&device_image_interface::device)); image_type.set("instance_name", sol::property(&device_image_interface::instance_name)); image_type.set("brief_instance_name", sol::property(&device_image_interface::brief_instance_name)); image_type.set("is_readable", sol::property(&device_image_interface::is_readable)); diff --git a/src/lib/formats/cqm_dsk.cpp b/src/lib/formats/cqm_dsk.cpp index c38f06bde1c..3afba37090d 100644 --- a/src/lib/formats/cqm_dsk.cpp +++ b/src/lib/formats/cqm_dsk.cpp @@ -308,6 +308,7 @@ bool cqm_format::load(io_generic *io, uint32_t form_factor, floppy_image *image) if (heads == 1) return false; // single side ED ? image->set_variant(floppy_image::DSED); + [[fallthrough]]; // FIXME: really? default: return false; } diff --git a/src/mame/audio/vboy.cpp b/src/mame/audio/vboy.cpp index 56aa88e9054..3d6abbe6b89 100644 --- a/src/mame/audio/vboy.cpp +++ b/src/mame/audio/vboy.cpp @@ -442,6 +442,7 @@ void vboysnd_device::write(offs_t offset, uint8_t data) break; } } + [[fallthrough]]; // FIXME: really? case SxINT: if (channel < 5) { diff --git a/src/mame/drivers/altos8600.cpp b/src/mame/drivers/altos8600.cpp index 8a0490a7161..24f75577628 100644 --- a/src/mame/drivers/altos8600.cpp +++ b/src/mame/drivers/altos8600.cpp @@ -323,6 +323,7 @@ void altos8600_state::hd_w(offs_t offset, u8 data) m_stat |= 0xa; break; } + [[fallthrough]]; case 0x4: m_secoff = 0; m_stat |= 1; diff --git a/src/mame/drivers/barata.cpp b/src/mame/drivers/barata.cpp index 2f32dd90b95..ff3e1fd3a76 100644 --- a/src/mame/drivers/barata.cpp +++ b/src/mame/drivers/barata.cpp @@ -213,6 +213,7 @@ void barata_state::fpga_send(unsigned char cmd) { m_lamps[lamp_index] = state ? 0 : 1; } + [[fallthrough]]; // FIXME: really? default: mode = FPGA_WAITING_FOR_NEW_CMD; break; @@ -248,6 +249,7 @@ void barata_state::fpga_send(unsigned char cmd) m_digits[2*counter_bank] = dec_7seg(counter_data/10); m_digits[2*counter_bank+1] = dec_7seg(counter_data%10); } + [[fallthrough]]; // FIXME: really? default: mode = FPGA_WAITING_FOR_NEW_CMD; break; @@ -265,6 +267,7 @@ void barata_state::fpga_send(unsigned char cmd) case 2: sample_index = (sample_index << 3) | cmd; logerror("PLAY_SAMPLE #%d.\n", sample_index); + [[fallthrough]]; // FIXME: really? default: mode = FPGA_WAITING_FOR_NEW_CMD; break; diff --git a/src/mame/drivers/besta.cpp b/src/mame/drivers/besta.cpp index bb0cbb5639f..d974ff5f3d3 100644 --- a/src/mame/drivers/besta.cpp +++ b/src/mame/drivers/besta.cpp @@ -70,6 +70,7 @@ void besta_state::mpcc_reg_w(offs_t offset, uint8_t data) break; case 10: m_terminal->write(data); + [[fallthrough]]; // FIXME: really? default: m_mpcc_regs[offset] = data; break; diff --git a/src/mame/drivers/bfm_swp.cpp b/src/mame/drivers/bfm_swp.cpp index d07adf71b52..d40ef0a7e56 100644 --- a/src/mame/drivers/bfm_swp.cpp +++ b/src/mame/drivers/bfm_swp.cpp @@ -145,15 +145,15 @@ uint32_t bfm_swp_state::bfm_swp_mem_r(offs_t offset, uint32_t mem_mask) switch ( cs ) { case 1: - if (offset<0x100000/4) return m_cpuregion[offset]; - + if (offset<0x100000/4) + return m_cpuregion[offset]; + [[fallthrough]]; // FIXME: really? case 2: offset&=0x3fff; return m_mainram[offset]; default: logerror("%08x maincpu read access offset %08x mem_mask %08x cs %d\n", pc, offset*4, mem_mask, cs); - } return 0x0000; diff --git a/src/mame/drivers/cops.cpp b/src/mame/drivers/cops.cpp index 71d28878295..049a19e3328 100644 --- a/src/mame/drivers/cops.cpp +++ b/src/mame/drivers/cops.cpp @@ -430,7 +430,6 @@ void cops_state::dacia_w(offs_t offset, uint8_t data) switch(offset & 0x07) { case 0: /* IRQ enable Register 1 */ - { m_dacia_irq1_reg &= ~0x80; if (data & 0x80) //enable bits @@ -444,10 +443,8 @@ void cops_state::dacia_w(offs_t offset, uint8_t data) if (LOG_DACIA) logerror("DACIA IRQ 1 Register: %02x\n", m_dacia_irq1_reg); update_dacia_irq(); break; - } case 1: /* Control / Format Register 1 */ - { if (data & 0x80) //Format Register { m_dacia_rts1 = (data & 0x01); @@ -478,13 +475,12 @@ void cops_state::dacia_w(offs_t offset, uint8_t data) } break; - } + case 2: /* Compare / Aux Ctrl Register 1 */ - { if (m_dacia_reg1 == CMP_REGISTER) { - m_dacia_cmp1 =1; - m_dacia_cmpval1=data; + m_dacia_cmp1 = 1; + m_dacia_cmpval1 = data; if (LOG_DACIA) logerror("DACIA Compare mode: %02x \n", data); // update_dacia_irq(); } @@ -492,15 +488,13 @@ void cops_state::dacia_w(offs_t offset, uint8_t data) { if (LOG_DACIA) logerror("DACIA Aux ctrl: %02x \n", data); } - } + [[fallthrough]]; // FIXME: really? case 3: /* Transmit Data Register 1 */ - { if (LOG_DACIA) logerror("DACIA Transmit: %02x %c\n", data, (char)data); m_ld->command_w(data); break; - } + case 4: /* IRQ enable Register 2 */ - { m_dacia_irq2_reg &= ~0x80; if (data & 0x80) //enable bits @@ -514,10 +508,8 @@ void cops_state::dacia_w(offs_t offset, uint8_t data) if (LOG_DACIA) logerror("DACIA IRQ 2 Register: %02x\n", m_dacia_irq2_reg); update_dacia_irq(); break; - } case 5: /* Control / Format Register 2 */ - { if (data & 0x80) //Format Register { m_dacia_rts2 = (data & 0x01); @@ -548,9 +540,8 @@ void cops_state::dacia_w(offs_t offset, uint8_t data) } break; - } + case 6: /* Compare / Aux Ctrl Register 2 */ - { if (m_dacia_reg2 == CMP_REGISTER) { m_dacia_cmp2 =1; @@ -562,9 +553,8 @@ void cops_state::dacia_w(offs_t offset, uint8_t data) { if (LOG_DACIA) logerror("DACIA Aux ctrl 2: %02x \n", data); } - } + [[fallthrough]]; // FIXME: really? case 7: /* Transmit Data Register 2 */ - { if (LOG_DACIA) logerror("DACIA Transmit 2: %02x %c\n", data, (char)data); // for (int i=0; i <8; i++) @@ -573,7 +563,6 @@ void cops_state::dacia_w(offs_t offset, uint8_t data) } // m_ld->command_w(data); break; - } } } /************************************* diff --git a/src/mame/drivers/cosmic.cpp b/src/mame/drivers/cosmic.cpp index 07a805194d1..a846e06043d 100644 --- a/src/mame/drivers/cosmic.cpp +++ b/src/mame/drivers/cosmic.cpp @@ -280,6 +280,7 @@ void cosmic_state::cosmica_sound_output_w(offs_t offset, uint8_t data) break; } } + [[fallthrough]]; // FIXME: really? case 3: /*Dive Bombing Type B (G.S.B)*/ if (data) diff --git a/src/mame/drivers/cxhumax.cpp b/src/mame/drivers/cxhumax.cpp index dfdc0d779a7..a7d9f7c9054 100644 --- a/src/mame/drivers/cxhumax.cpp +++ b/src/mame/drivers/cxhumax.cpp @@ -427,6 +427,7 @@ void cxhumax_state::cx_uart2_w(offs_t offset, uint32_t data, uint32_t mem_mask) } } } + [[fallthrough]]; default: COMBINE_DATA(&m_uart2_regs[offset]); break; } diff --git a/src/mame/drivers/fcrash.cpp b/src/mame/drivers/fcrash.cpp index 69e628227df..25a52b5e66a 100644 --- a/src/mame/drivers/fcrash.cpp +++ b/src/mame/drivers/fcrash.cpp @@ -234,30 +234,31 @@ void fcrash_state::sf2m1_layer_w(offs_t offset, uint16_t data) m_cps_a_regs[0x14 / 2] = data; break; case 0x06: - switch (data) - { - case 0: - data = 0x078e; - break; - case 1: - data = 0x12c0; - break; - case 2: - data = 0x06ce; - break; - case 3: - data = 0x09ce; - break; - case 4: - data = 0x12ce; - break; - case 5: - data = 0x0b4e; - break; - } - case 0xb3: - m_cps_b_regs[m_layer_enable_reg / 2] = data; + switch (data) + { + case 0: + data = 0x078e; + break; + case 1: + data = 0x12c0; + break; + case 2: + data = 0x06ce; + break; + case 3: + data = 0x09ce; break; + case 4: + data = 0x12ce; + break; + case 5: + data = 0x0b4e; + break; + } + [[fallthrough]]; + case 0xb3: + m_cps_b_regs[m_layer_enable_reg / 2] = data; + break; case 0x0b: case 0x1b: m_cps_a_regs[0x06 / 2] = data; diff --git a/src/mame/drivers/model3.cpp b/src/mame/drivers/model3.cpp index e479365d8ae..5f71bcac1c1 100644 --- a/src/mame/drivers/model3.cpp +++ b/src/mame/drivers/model3.cpp @@ -790,6 +790,7 @@ uint32_t model3_state::pci_device_get_reg() logerror("pci_device_get_reg: Device 11, unknown reg %02X", reg); break; } + [[fallthrough]]; // FIXME: really? case 13: /* Real3D Controller chip */ switch(reg) diff --git a/src/mame/drivers/mpu4vid.cpp b/src/mame/drivers/mpu4vid.cpp index ad753bdc98d..c8205d16387 100644 --- a/src/mame/drivers/mpu4vid.cpp +++ b/src/mame/drivers/mpu4vid.cpp @@ -1997,9 +1997,14 @@ void mpu4vid_state::mpu4_vid_bt_a00002_w(offs_t offset, uint8_t data) { switch (m_bt_which) { - case 0: m_btpal_r[m_bt_palbase] = data; - case 1: m_btpal_g[m_bt_palbase] = data; - case 2: m_btpal_b[m_bt_palbase] = data; + case 0: + m_btpal_r[m_bt_palbase] = data; + [[fallthrough]]; // FIXME: really? + case 1: + m_btpal_g[m_bt_palbase] = data; + [[fallthrough]]; // FIXME: really? + case 2: + m_btpal_b[m_bt_palbase] = data; } m_bt_which++; diff --git a/src/mame/drivers/mpu5.cpp b/src/mame/drivers/mpu5.cpp index a61b076d025..c2bfacd671d 100644 --- a/src/mame/drivers/mpu5.cpp +++ b/src/mame/drivers/mpu5.cpp @@ -275,12 +275,11 @@ void mpu5_state::asic_w8(offs_t offset, uint8_t data) break; case 0x09: - { //Assume SEC fitted for now m_sec->data_w(~data&0x01); m_sec->clk_w(~data&0x02); m_sec->cs_w(~data&0x04); - } + [[fallthrough]]; case 0x0b: output().set_value("statuslamp1", BIT(data, 4)); output().set_value("statuslamp2", BIT(data, 5)); diff --git a/src/mame/drivers/psion5.cpp b/src/mame/drivers/psion5.cpp index 677aa1d387e..9cd4b7413a8 100644 --- a/src/mame/drivers/psion5.cpp +++ b/src/mame/drivers/psion5.cpp @@ -652,6 +652,7 @@ void psion5mx_state::periphs_w(offs_t offset, uint32_t data, uint32_t mem_mask) case REG_PADR: LOGMASKED(LOG_GPIO_WRITES, "%s: peripheral write, PADR = %08x & %08x\n", machine().describe_context(), data, mem_mask); m_ports[PORTA] = data; + break; case REG_PBDR: { LOGMASKED(LOG_GPIO_WRITES, "%s: peripheral write, PBDR = %08x & %08x\n", machine().describe_context(), data, mem_mask); diff --git a/src/mame/drivers/rainbow.cpp b/src/mame/drivers/rainbow.cpp index 8db3fc465ac..35a1495af5b 100644 --- a/src/mame/drivers/rainbow.cpp +++ b/src/mame/drivers/rainbow.cpp @@ -1601,7 +1601,7 @@ uint8_t rainbow_modelb_state::rtc_r(offs_t offset) case 0x2004: // 0xFE004 (MIRROR) if (m_rtc->chip_enable()) return (m_rtc->read_data() & 0x01); - + [[fallthrough]]; // FIXME: really? // (RTC ACTIVATION) read magic pattern 0 case 0x0100: // 0xFC100 case 0x2100: // 0xFE100 (MIRROR) diff --git a/src/mame/drivers/ti89.cpp b/src/mame/drivers/ti89.cpp index b7815de0f74..d47451ef609 100644 --- a/src/mame/drivers/ti89.cpp +++ b/src/mame/drivers/ti89.cpp @@ -79,6 +79,7 @@ void ti68k_state::ti68k_io_w(offs_t offset, uint16_t data) break; case 0x0b: m_timer_val = data & 0xff; + [[fallthrough]]; // FIXME: really? case 0x0c: m_kb_mask = data & 0x03ff; break; diff --git a/src/mame/drivers/tx0.cpp b/src/mame/drivers/tx0.cpp index 87e9f7d8e7f..51b11d3b0ee 100644 --- a/src/mame/drivers/tx0.cpp +++ b/src/mame/drivers/tx0.cpp @@ -899,7 +899,7 @@ void tx0_state::magtape_callback() { case MTS_UNSELECTING: m_magtape.state = MTS_UNSELECTED; - + [[fallthrough]]; case MTS_UNSELECTED: if (m_magtape.sel_pending) { @@ -960,7 +960,7 @@ void tx0_state::magtape_callback() } break; } - + [[fallthrough]]; case MTS_SELECTED: switch (m_magtape.command) { @@ -1254,7 +1254,7 @@ void tx0_state::magtape_callback() { m_magtape.u.write.state = MTWTS_STATE1; } - + [[fallthrough]]; case MTWTS_STATE1: if (m_magtape.u.write.counter) { @@ -1282,7 +1282,7 @@ void tx0_state::magtape_callback() m_magtape.u.write.counter = 3; } } - + [[fallthrough]]; case MTWTS_STATE2: if (m_magtape.u.write.counter != 0) { diff --git a/src/mame/machine/3do.cpp b/src/mame/machine/3do.cpp index cf5af65cfe8..28eb8937c22 100644 --- a/src/mame/machine/3do.cpp +++ b/src/mame/machine/3do.cpp @@ -637,6 +637,7 @@ void _3do_state::madam_w(offs_t offset, uint32_t data, uint32_t mem_mask){ case 0x0680/4: case 0x0684/4: case 0x0688/4: case 0x068c/4: case 0x0690/4: case 0x0694/4: case 0x0698/4: case 0x069c/4: m_madam.mult[offset & 0x3f] = data; + [[fallthrough]]; case 0x07f0/4: m_madam.mult_control |= data; break; diff --git a/src/mame/machine/amiga.cpp b/src/mame/machine/amiga.cpp index 2db6151d286..95842dc8c94 100644 --- a/src/mame/machine/amiga.cpp +++ b/src/mame/machine/amiga.cpp @@ -1176,11 +1176,11 @@ uint16_t amiga_state::custom_chip_r(offs_t offset) case REG_JOY0DAT: if (m_joy0dat_port.found()) return joy0dat_r(); - + [[fallthrough]]; // FIXME: Really? Fall through to potentially reading the other joystick? case REG_JOY1DAT: if (m_joy1dat_port.found()) return joy1dat_r(); - + [[fallthrough]]; // TODO: check that this is correct case REG_POTGOR: return m_potgo_port.read_safe(0x5500); diff --git a/src/mame/machine/arkanoid.cpp b/src/mame/machine/arkanoid.cpp index 19a3776fd23..294acd3dd73 100644 --- a/src/mame/machine/arkanoid.cpp +++ b/src/mame/machine/arkanoid.cpp @@ -383,6 +383,7 @@ void arkanoid_state::arkanoid_bootleg_d018_w(uint8_t data) m_bootleg_cmd = 0x00; if (m_maincpu->pc() == 0x7c47) m_bootleg_cmd = 0x00; + [[fallthrough]]; // FIXME: really? case 0x89: /* unneeded value : no read back */ if (m_maincpu->pc() == 0x67e5) m_bootleg_cmd = 0x00; @@ -433,6 +434,7 @@ void arkanoid_state::arkanoid_bootleg_d018_w(uint8_t data) m_bootleg_cmd = 0x00; if (m_maincpu->pc() == 0x7c47) m_bootleg_cmd = 0x00; + [[fallthrough]]; // FIXME: really? case 0x89: /* unneeded value : no read back */ if (m_maincpu->pc() == 0x67e5) m_bootleg_cmd = 0x00; diff --git a/src/mame/machine/isbc_215g.cpp b/src/mame/machine/isbc_215g.cpp index 6b00e9eabfc..a0092feb154 100644 --- a/src/mame/machine/isbc_215g.cpp +++ b/src/mame/machine/isbc_215g.cpp @@ -192,6 +192,7 @@ void isbc_215g_device::io_w(offs_t offset, uint16_t data) find_sector(); else if(m_amsrch) logerror("isbc_215g: address search without read gate\n"); + [[fallthrough]]; case 0x01: m_stepdir = (data & 0x80) ? 1 : 0; break; diff --git a/src/mame/machine/lynx.cpp b/src/mame/machine/lynx.cpp index d8da6e304f8..3f8fa1200a3 100644 --- a/src/mame/machine/lynx.cpp +++ b/src/mame/machine/lynx.cpp @@ -1111,14 +1111,18 @@ void lynx_state::suzy_write(offs_t offset, uint8_t data) break; case HPOSSTRTL: m_blitter.x_pos = data; + [[fallthrough]]; // FIXME: really? case HPOSSTRTH: m_blitter.x_pos &= 0xff; m_blitter.x_pos |= data<<8; + [[fallthrough]]; // FIXME: really? case VPOSSTRTL: m_blitter.y_pos = data; + [[fallthrough]]; // FIXME: really? case VPOSSTRTH: m_blitter.y_pos &= 0xff; m_blitter.y_pos |= data<<8; + [[fallthrough]]; // FIXME: really? case SPRHSIZL: m_blitter.width = data; break; diff --git a/src/mame/machine/mpu4.cpp b/src/mame/machine/mpu4.cpp index 4dccb4606b2..6db64fbbe6e 100644 --- a/src/mame/machine/mpu4.cpp +++ b/src/mame/machine/mpu4.cpp @@ -963,6 +963,7 @@ void mpu4_state::pia_ic5_porta_w(uint8_t data) m_aux1_input|= 0xd0; break; } + break; case 0x01: //Middle row - note switches don't match pattern switch (machine().rand() & 0x3) @@ -987,6 +988,7 @@ void mpu4_state::pia_ic5_porta_w(uint8_t data) m_aux1_input|= 0x90; break; } + break; case 0x02: //Bottom row switch (machine().rand() & 0x3) @@ -1011,6 +1013,7 @@ void mpu4_state::pia_ic5_porta_w(uint8_t data) m_aux1_input|= 0x30; break; } + break; } } } diff --git a/src/mame/machine/n64.cpp b/src/mame/machine/n64.cpp index d5395995f2d..532aa9db70b 100644 --- a/src/mame/machine/n64.cpp +++ b/src/mame/machine/n64.cpp @@ -1754,6 +1754,7 @@ int n64_periphs::pif_channel_handle_command(int channel, int slength, uint8_t *s rdata[2] = 0x01; return 0; } + [[fallthrough]]; // FIXME: really? } case 4: { diff --git a/src/mame/machine/twincobr.cpp b/src/mame/machine/twincobr.cpp index 2bfdbbf9f79..9408330ecda 100644 --- a/src/mame/machine/twincobr.cpp +++ b/src/mame/machine/twincobr.cpp @@ -75,6 +75,7 @@ void twincobr_state::twincobr_dsp_w(u16 data) switch (m_main_ram_seg) { case 0x30000: if ((m_dsp_addr_w < 3) && (data == 0)) m_dsp_execute = 1; + [[fallthrough]]; case 0x40000: case 0x50000: {address_space &mainspace = m_maincpu->space(AS_PROGRAM); mainspace.write_word(m_main_ram_seg + m_dsp_addr_w, data); @@ -125,6 +126,7 @@ void twincobr_state::wardner_dsp_w(u16 data) switch (m_main_ram_seg) { case 0x7000: if ((m_dsp_addr_w < 3) && (data == 0)) m_dsp_execute = 1; + [[fallthrough]]; case 0x8000: case 0xa000: {address_space &mainspace = m_maincpu->space(AS_PROGRAM); mainspace.write_byte(m_main_ram_seg + (m_dsp_addr_w + 0), (data & 0xff)); diff --git a/src/mame/video/dynax.cpp b/src/mame/video/dynax.cpp index 6cdbf33beca..14577b0e1be 100644 --- a/src/mame/video/dynax.cpp +++ b/src/mame/video/dynax.cpp @@ -946,6 +946,7 @@ uint32_t dynax_state::screen_update_hanamai(screen_device &screen, bitmap_ind16 switch (m_hanamai_priority) { default: popmessage("unknown priority %02x", m_hanamai_priority); + [[fallthrough]]; // FIXME: really? case 0x10: lay[0] = 0; lay[1] = 1; lay[2] = 2; lay[3] = 3; break; case 0x11: lay[0] = 0; lay[1] = 3; lay[2] = 2; lay[3] = 1; break; case 0x12: lay[0] = 0; lay[1] = 1; lay[2] = 3; lay[3] = 2; break; diff --git a/src/mame/video/k007342.cpp b/src/mame/video/k007342.cpp index 2f870fcc85b..24910b52bfa 100644 --- a/src/mame/video/k007342.cpp +++ b/src/mame/video/k007342.cpp @@ -153,6 +153,7 @@ void k007342_device::vreg_w(offs_t offset, uint8_t data) case 0x01: /* used for banking in Rock'n'Rage */ if (data != m_regs[1]) machine().tilemap().mark_all_dirty(); + [[fallthrough]]; case 0x02: m_scrollx[0] = (m_scrollx[0] & 0xff) | ((data & 0x01) << 8); m_scrollx[1] = (m_scrollx[1] & 0xff) | ((data & 0x02) << 7); diff --git a/src/mame/video/konamigx.cpp b/src/mame/video/konamigx.cpp index a024bc3f372..31cc3ea82fb 100644 --- a/src/mame/video/konamigx.cpp +++ b/src/mame/video/konamigx.cpp @@ -587,6 +587,7 @@ void konamigx_state::konamigx_mixer(screen_device &screen, bitmap_rgb32 &bitmap, // Daisukiss bad shadow filter case 4: if (k & 0x3000 || k == 0x0800) continue; + [[fallthrough]]; // Tokkae shadow masking (INACCURATE) case 5: diff --git a/src/mame/video/psychic5.cpp b/src/mame/video/psychic5.cpp index 68a0e336dd9..59b78f8afe3 100644 --- a/src/mame/video/psychic5.cpp +++ b/src/mame/video/psychic5.cpp @@ -310,6 +310,7 @@ void psychic5_state::draw_background(screen_device &screen, bitmap_rgb32 &bitmap case 3: case 7: if (m_sy2 == 0xf0) m_bg_clip_mode++; break; case 9: case 11: if (m_sx1 == 0xf0) m_bg_clip_mode++; break; case 13: case 15: if (sx1_old == 0xf0) m_bg_clip_mode++; + [[fallthrough]]; case 16: if (m_sy1 != 0x00) m_bg_clip_mode = 0; break; } diff --git a/src/mame/video/vc4000.cpp b/src/mame/video/vc4000.cpp index fa52c41fd20..29248a12523 100644 --- a/src/mame/video/vc4000.cpp +++ b/src/mame/video/vc4000.cpp @@ -426,7 +426,7 @@ void vc4000_state::vc4000_sprite_update(bitmap_ind16 &bitmap, uint8_t *collision case 0: if (m_video.line != This->y + 2) break; This->state++; - + [[fallthrough]]; case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8:case 9:case 10: vc4000_collision_plot(collision+This->data->x1, This->data->bitmap[This->state-1],This->mask,This->size); @@ -471,7 +471,7 @@ void vc4000_state::vc4000_sprite_update(bitmap_ind16 &bitmap, uint8_t *collision This->delay=0; This->state++; - + [[fallthrough]]; case 12: if (This->y!=0) { @@ -479,7 +479,7 @@ void vc4000_state::vc4000_sprite_update(bitmap_ind16 &bitmap, uint8_t *collision break; } This->state++; - + [[fallthrough]]; case 13: case 14: case 15: case 16: case 17: case 18: case 19:case 20:case 21:case 22: vc4000_collision_plot(collision+This->data->x2,This->data->bitmap[This->state-13],This->mask,This->size); diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp index 57ab4943adb..d7dac959e62 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.cpp +++ b/src/osd/modules/render/d3d/d3dhlsl.cpp @@ -2599,6 +2599,7 @@ void uniform::update() break; case CU_CHROMA_CONVERSION_GAIN: m_shader->set_vector("ConversionGain", 3, &options->chroma_conversion_gain[0]); + break; case CU_CHROMA_Y_GAIN: m_shader->set_vector("YGain", 3, &options->chroma_y_gain[0]); break; diff --git a/src/tools/imgtool/modules/psion.cpp b/src/tools/imgtool/modules/psion.cpp index 5759673349e..82a78388e11 100644 --- a/src/tools/imgtool/modules/psion.cpp +++ b/src/tools/imgtool/modules/psion.cpp @@ -245,6 +245,7 @@ char *stream_getline(imgtool::stream &source, uint16_t max_len) source.read(&data, 1); if (data != '\n') source.seek(-1, SEEK_CUR); + [[fallthrough]]; case '\n': return line; default: -- cgit v1.2.3