summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2026-03-29 05:20:40 +1100
committer Vas Crabb <vas@vastheman.com>2026-03-29 05:20:40 +1100
commitb55ba81d2a417df3e0ee9260be06425550f13541 (patch)
treed17414652c9edb2f161daf254f9b2988970f4b76 /src/devices/cpu
parent8653a44cb144c66a3f199a08763a885adb121071 (diff)
Fixed things C++20 doesn't allow:
ui/info.cpp, imagedev/cassette.cpp: Deal with UTF-8 strings as a distint type. ui/inputmap.cpp, debugger/qt/dasmwindow.cpp, debugger/qt/mainwindow.cpp, sound/coreaudio_sound.cpp, cpu/drcbec.cpp, mit/tx0_v.cpp, konami/3dom2.cpp: machine/mc68328.cpp, cpu/mips/mips1.cpp, cpu/mips/r4000.cpp, cpu/romp, machine/cammu.cpp, machine/ns32081.cpp: Avoid arithmetic between different enum types. dec/pdp1.cpp, konami/firebeat.cpp, mit/tx0.cpp, sound/lc7535.cpp, sound/spkrdev.cpp: Avoid arithmetic between enum and floating point. gaelco/gaelco3d_m.cpp: Fixed deprecated uses of volatile variables. sound/discrete.h: Avoid comparing enum to floatint point. ui/toolbar.ipp: Don't use UTF-8 qualifier on pure ASCII strings, just assume char is ASCII-like. cpu/unsp: Use default constructor for compiler_state. sgi/pm2_mmu.cpp: Avoid conflict between file static access and identically named function in unistd.h. osd/interface/audio.h: Provide an explicit constructor. util/server_http_impl.hpp: Fixed uninitialised class member warning.
Diffstat (limited to 'src/devices/cpu')
-rw-r--r--src/devices/cpu/drcbec.cpp22
-rw-r--r--src/devices/cpu/mips/mips1.cpp33
-rw-r--r--src/devices/cpu/mips/r4000.h53
-rw-r--r--src/devices/cpu/romp/romp.h23
-rw-r--r--src/devices/cpu/unsp/unsp.h5
-rw-r--r--src/devices/cpu/unsp/unspdrc.cpp2
6 files changed, 65 insertions, 73 deletions
diff --git a/src/devices/cpu/drcbec.cpp b/src/devices/cpu/drcbec.cpp
index 7450e6b8c94..da3df91c094 100644
--- a/src/devices/cpu/drcbec.cpp
+++ b/src/devices/cpu/drcbec.cpp
@@ -609,27 +609,27 @@ void drcbe_c::generate(drcuml_block &block, const instruction *instlist, uint32_
// pre-expand opcodes that encode size/scale in them
if (opcode == OP_LOAD)
- opcode = opcode_t(OP_LOAD1 + inst.param(3).size() * 4 + inst.param(3).scale());
+ opcode = opcode_t(OP_LOAD1 + unsigned(inst.param(3).size() * 4 + inst.param(3).scale()));
if (opcode == OP_LOADS)
- opcode = opcode_t(OP_LOADS1 + inst.param(3).size() * 4 + inst.param(3).scale());
+ opcode = opcode_t(OP_LOADS1 + unsigned(inst.param(3).size() * 4 + inst.param(3).scale()));
if (opcode == OP_STORE)
- opcode = opcode_t(OP_STORE1 + inst.param(3).size() * 4 + inst.param(3).scale());
+ opcode = opcode_t(OP_STORE1 + unsigned(inst.param(3).size() * 4 + inst.param(3).scale()));
if (opcode == OP_READ)
- opcode = opcode_t(OP_READ1 + inst.param(2).size());
+ opcode = opcode_t(OP_READ1 + unsigned(inst.param(2).size()));
if (opcode == OP_READM)
- opcode = opcode_t(OP_READM1 + inst.param(3).size());
+ opcode = opcode_t(OP_READM1 + unsigned(inst.param(3).size()));
if (opcode == OP_WRITE)
- opcode = opcode_t(OP_WRITE1 + inst.param(2).size());
+ opcode = opcode_t(OP_WRITE1 + unsigned(inst.param(2).size()));
if (opcode == OP_WRITEM)
- opcode = opcode_t(OP_WRITEM1 + inst.param(3).size());
+ opcode = opcode_t(OP_WRITEM1 + unsigned(inst.param(3).size()));
if (opcode == OP_SEXT)
- opcode = opcode_t(OP_SEXT1 + inst.param(2).size());
+ opcode = opcode_t(OP_SEXT1 + unsigned(inst.param(2).size()));
if (opcode == OP_FTOINT)
- opcode = opcode_t(OP_FTOI4T + 5 * (inst.param(2).size() - 2) + inst.param(3).rounding());
+ opcode = opcode_t(OP_FTOI4T + unsigned(5 * (inst.param(2).size() - 2) + inst.param(3).rounding()));
if (opcode == OP_FFRINT)
- opcode = opcode_t(OP_FFRI4 + (inst.param(2).size() - 2));
+ opcode = opcode_t(OP_FFRI4 + unsigned(inst.param(2).size() - 2));
if (opcode == OP_FFRFLT)
- opcode = opcode_t(OP_FFRFS + (inst.param(2).size() - 2));
+ opcode = opcode_t(OP_FFRFS + unsigned(inst.param(2).size() - 2));
// count how many bytes of immediates we need
int immedbytes = 0;
diff --git a/src/devices/cpu/mips/mips1.cpp b/src/devices/cpu/mips/mips1.cpp
index f61abd3cad6..542bcb53f6c 100644
--- a/src/devices/cpu/mips/mips1.cpp
+++ b/src/devices/cpu/mips/mips1.cpp
@@ -58,24 +58,21 @@ enum exception : u32
EXCEPTION_BADCOP3 = 0x3000002c,
};
-enum cop0_reg : u8
-{
- COP0_Index = 0,
- COP0_Random = 1,
- COP0_EntryLo = 2,
- COP0_BusCtrl = 2, // r3041 only
- COP0_Config = 3, // r3041/r3071/r3081 only
- COP0_Context = 4,
- COP0_BadVAddr = 8,
- COP0_Count = 9, // r3041 only
- COP0_EntryHi = 10,
- COP0_PortSize = 10, // r3041 only
- COP0_Compare = 11, // r3041 only
- COP0_Status = 12,
- COP0_Cause = 13,
- COP0_EPC = 14,
- COP0_PRId = 15,
-};
+constexpr u8 COP0_Index = 0;
+constexpr u8 COP0_Random = 1;
+constexpr u8 COP0_EntryLo = 2;
+constexpr u8 COP0_BusCtrl = 2; // r3041 only
+constexpr u8 COP0_Config = 3; // r3041/r3071/r3081 only
+constexpr u8 COP0_Context = 4;
+constexpr u8 COP0_BadVAddr = 8;
+constexpr u8 COP0_Count = 9; // r3041 only
+constexpr u8 COP0_EntryHi = 10;
+constexpr u8 COP0_PortSize = 10; // r3041 only
+constexpr u8 COP0_Compare = 11; // r3041 only
+constexpr u8 COP0_Status = 12;
+constexpr u8 COP0_Cause = 13;
+constexpr u8 COP0_EPC = 14;
+constexpr u8 COP0_PRId = 15;
enum sr_mask : u32
{
diff --git a/src/devices/cpu/mips/r4000.h b/src/devices/cpu/mips/r4000.h
index a6e0f816d9a..3f31817bb69 100644
--- a/src/devices/cpu/mips/r4000.h
+++ b/src/devices/cpu/mips/r4000.h
@@ -59,34 +59,31 @@ protected:
};
r4000_base_device(machine_config const &mconfig, device_type type, char const *tag, device_t *owner, u32 clock, u32 prid, u32 fcr, cache_size icache_size, cache_size dcache_size, unsigned m32, unsigned m64, unsigned d32, unsigned d64, bool timer_interrupt_disabled);
- enum cp0_reg : int
- {
- CP0_Index = 0,
- CP0_Random = 1,
- CP0_EntryLo0 = 2,
- CP0_EntryLo1 = 3,
- CP0_Context = 4,
- CP0_PageMask = 5,
- CP0_Wired = 6,
- CP0_BadVAddr = 8,
- CP0_Count = 9,
- CP0_EntryHi = 10,
- CP0_Compare = 11,
- CP0_Status = 12,
- CP0_Cause = 13,
- CP0_EPC = 14,
- CP0_PRId = 15,
- CP0_Config = 16,
- CP0_LLAddr = 17,
- CP0_WatchLo = 18,
- CP0_WatchHi = 19,
- CP0_XContext = 20,
- CP0_ECC = 26,
- CP0_CacheErr = 27,
- CP0_TagLo = 28,
- CP0_TagHi = 29,
- CP0_ErrorEPC = 30,
- };
+ static constexpr int CP0_Index = 0;
+ static constexpr int CP0_Random = 1;
+ static constexpr int CP0_EntryLo0 = 2;
+ static constexpr int CP0_EntryLo1 = 3;
+ static constexpr int CP0_Context = 4;
+ static constexpr int CP0_PageMask = 5;
+ static constexpr int CP0_Wired = 6;
+ static constexpr int CP0_BadVAddr = 8;
+ static constexpr int CP0_Count = 9;
+ static constexpr int CP0_EntryHi = 10;
+ static constexpr int CP0_Compare = 11;
+ static constexpr int CP0_Status = 12;
+ static constexpr int CP0_Cause = 13;
+ static constexpr int CP0_EPC = 14;
+ static constexpr int CP0_PRId = 15;
+ static constexpr int CP0_Config = 16;
+ static constexpr int CP0_LLAddr = 17;
+ static constexpr int CP0_WatchLo = 18;
+ static constexpr int CP0_WatchHi = 19;
+ static constexpr int CP0_XContext = 20;
+ static constexpr int CP0_ECC = 26;
+ static constexpr int CP0_CacheErr = 27;
+ static constexpr int CP0_TagLo = 28;
+ static constexpr int CP0_TagHi = 29;
+ static constexpr int CP0_ErrorEPC = 30;
enum cp0_sr_mask : u32
{
diff --git a/src/devices/cpu/romp/romp.h b/src/devices/cpu/romp/romp.h
index 8a69c8a0032..3555028c2e6 100644
--- a/src/devices/cpu/romp/romp.h
+++ b/src/devices/cpu/romp/romp.h
@@ -25,19 +25,16 @@ protected:
ROMP_GPR = 16,
};
- enum scr : unsigned
- {
- COUS = 6, // counter source
- COU = 7, // counter
- TS = 8, // timer status
- ECR = 9, // exception control (advanced/enhanced only)
- MQ = 10, // multiplier quotient
- MPCS = 11, // machine/program check status
- IRB = 12, // interrupt request buffer
- IAR = 13, // instruction address register
- ICS = 14, // interrupt control status
- CS = 15, // condition status
- };
+ static constexpr unsigned COUS = 6; // counter source
+ static constexpr unsigned COU = 7; // counter
+ static constexpr unsigned TS = 8; // timer status
+ static constexpr unsigned ECR = 9; // exception control (advanced/enhanced only)
+ static constexpr unsigned MQ = 10; // multiplier quotient
+ static constexpr unsigned MPCS = 11; // machine/program check status
+ static constexpr unsigned IRB = 12; // interrupt request buffer
+ static constexpr unsigned IAR = 13; // instruction address register
+ static constexpr unsigned ICS = 14; // interrupt control status
+ static constexpr unsigned CS = 15; // condition status
enum ts_mask : u32
{
diff --git a/src/devices/cpu/unsp/unsp.h b/src/devices/cpu/unsp/unsp.h
index 0372a491ffb..58a472695d4 100644
--- a/src/devices/cpu/unsp/unsp.h
+++ b/src/devices/cpu/unsp/unsp.h
@@ -131,11 +131,12 @@ protected:
/* internal compiler state */
struct compiler_state
{
+ compiler_state() = default;
compiler_state(compiler_state const&) = delete;
compiler_state& operator=(compiler_state const&) = delete;
- uint32_t m_cycles; /* accumulated cycles */
- uml::code_label m_labelnum; /* index for local labels */
+ uint32_t m_cycles = 0; /* accumulated cycles */
+ uml::code_label m_labelnum = 0; /* index for local labels */
};
struct internal_unsp_state
diff --git a/src/devices/cpu/unsp/unspdrc.cpp b/src/devices/cpu/unsp/unspdrc.cpp
index e041d1020d5..1c9e3556585 100644
--- a/src/devices/cpu/unsp/unspdrc.cpp
+++ b/src/devices/cpu/unsp/unspdrc.cpp
@@ -162,7 +162,7 @@ void unsp_device::code_flush_cache()
void unsp_device::code_compile_block(offs_t pc)
{
- compiler_state compiler = { 0 };
+ compiler_state compiler;
const opcode_desc *seqhead, *seqlast;
bool override = false;