mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
assert aborts on failure - abort is not an exception. conditional noexcept is an antipattern, get rid of it. (nw)
This commit is contained in:
parent
f60ed79ed6
commit
199598977e
@ -92,7 +92,7 @@ device_execute_interface::~device_execute_interface()
|
||||
// run before we run again
|
||||
//-------------------------------------------------
|
||||
|
||||
void device_execute_interface::abort_timeslice() noexcept(MAME_NDEBUG)
|
||||
void device_execute_interface::abort_timeslice() noexcept
|
||||
{
|
||||
// ignore if not the executing device
|
||||
if (!executing())
|
||||
@ -207,7 +207,7 @@ void device_execute_interface::trigger(int trigid)
|
||||
// for a device
|
||||
//-------------------------------------------------
|
||||
|
||||
attotime device_execute_interface::local_time() const noexcept(MAME_NDEBUG)
|
||||
attotime device_execute_interface::local_time() const noexcept
|
||||
{
|
||||
// if we're active, add in the time from the current slice
|
||||
if (executing())
|
||||
@ -225,7 +225,7 @@ attotime device_execute_interface::local_time() const noexcept(MAME_NDEBUG)
|
||||
// cycles executed on this device
|
||||
//-------------------------------------------------
|
||||
|
||||
u64 device_execute_interface::total_cycles() const noexcept(MAME_NDEBUG)
|
||||
u64 device_execute_interface::total_cycles() const noexcept
|
||||
{
|
||||
if (executing())
|
||||
{
|
||||
|
@ -152,12 +152,12 @@ public:
|
||||
}
|
||||
|
||||
// execution management
|
||||
device_scheduler &scheduler() const noexcept(MAME_NDEBUG) { assert(m_scheduler != nullptr); return *m_scheduler; }
|
||||
bool executing() const noexcept(MAME_NDEBUG) { return scheduler().currently_executing() == this; }
|
||||
s32 cycles_remaining() const noexcept(MAME_NDEBUG) { return executing() ? *m_icountptr : 0; } // cycles remaining in this timeslice
|
||||
void eat_cycles(int cycles) noexcept(MAME_NDEBUG) { if (executing()) *m_icountptr = (cycles > *m_icountptr) ? 0 : (*m_icountptr - cycles); }
|
||||
void adjust_icount(int delta) noexcept(MAME_NDEBUG) { if (executing()) *m_icountptr += delta; }
|
||||
void abort_timeslice() noexcept(MAME_NDEBUG);
|
||||
device_scheduler &scheduler() const noexcept { assert(m_scheduler != nullptr); return *m_scheduler; }
|
||||
bool executing() const noexcept { return scheduler().currently_executing() == this; }
|
||||
s32 cycles_remaining() const noexcept { return executing() ? *m_icountptr : 0; } // cycles remaining in this timeslice
|
||||
void eat_cycles(int cycles) noexcept { if (executing()) *m_icountptr = (cycles > *m_icountptr) ? 0 : (*m_icountptr - cycles); }
|
||||
void adjust_icount(int delta) noexcept { if (executing()) *m_icountptr += delta; }
|
||||
void abort_timeslice() noexcept;
|
||||
|
||||
// input and interrupt management
|
||||
void set_input_line(int linenum, int state) { m_input[linenum].set_state_synced(state); }
|
||||
@ -183,8 +183,8 @@ public:
|
||||
void signal_interrupt_trigger() { trigger(m_inttrigger); }
|
||||
|
||||
// time and cycle accounting
|
||||
attotime local_time() const noexcept(MAME_NDEBUG);
|
||||
u64 total_cycles() const noexcept(MAME_NDEBUG);
|
||||
attotime local_time() const noexcept;
|
||||
u64 total_cycles() const noexcept;
|
||||
|
||||
// required operation overrides
|
||||
void run() { execute_run(); }
|
||||
|
@ -237,14 +237,6 @@ template <typename T> constexpr auto DEGREE_TO_RADIAN(T const &x) { return (M_PI
|
||||
#define ENDIAN_VALUE_NE_NNE(endian,neval,nneval) (((endian) == ENDIANNESS_NATIVE) ? (neval) : (nneval))
|
||||
|
||||
|
||||
// useful for declaring functions with asserts as conditionally noexcept
|
||||
#ifdef NDEBUG
|
||||
constexpr bool MAME_NDEBUG = true;
|
||||
#else
|
||||
constexpr bool MAME_NDEBUG = false;
|
||||
#endif
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// EXCEPTION CLASSES
|
||||
//**************************************************************************
|
||||
|
@ -206,7 +206,7 @@ public:
|
||||
|
||||
// additional helpers
|
||||
emu_options &options() const { return m_config.options(); }
|
||||
attotime time() const noexcept(MAME_NDEBUG) { return m_scheduler.time(); }
|
||||
attotime time() const noexcept { return m_scheduler.time(); }
|
||||
bool scheduled_event_pending() const { return m_exit_pending || m_hard_reset_pending; }
|
||||
bool allow_logging() const { return !m_logerror_list.empty(); }
|
||||
|
||||
|
@ -209,7 +209,7 @@ void emu_timer::adjust(attotime start_delay, s32 param, const attotime &period)
|
||||
// timer was started
|
||||
//-------------------------------------------------
|
||||
|
||||
attotime emu_timer::elapsed() const noexcept(MAME_NDEBUG)
|
||||
attotime emu_timer::elapsed() const noexcept
|
||||
{
|
||||
return machine().time() - m_start;
|
||||
}
|
||||
@ -220,7 +220,7 @@ attotime emu_timer::elapsed() const noexcept(MAME_NDEBUG)
|
||||
// remaining until the timer expires
|
||||
//-------------------------------------------------
|
||||
|
||||
attotime emu_timer::remaining() const noexcept(MAME_NDEBUG)
|
||||
attotime emu_timer::remaining() const noexcept
|
||||
{
|
||||
attotime curtime = machine().time();
|
||||
if (curtime >= m_expire)
|
||||
@ -356,7 +356,7 @@ device_scheduler::~device_scheduler()
|
||||
// time - return the current time
|
||||
//-------------------------------------------------
|
||||
|
||||
attotime device_scheduler::time() const noexcept(MAME_NDEBUG)
|
||||
attotime device_scheduler::time() const noexcept
|
||||
{
|
||||
// if we're currently in a callback, use the timer's expiration time as a base
|
||||
if (m_callback_timer != nullptr)
|
||||
|
@ -64,7 +64,7 @@ class emu_timer
|
||||
public:
|
||||
// getters
|
||||
emu_timer *next() const { return m_next; }
|
||||
running_machine &machine() const noexcept(MAME_NDEBUG) { assert(m_machine != nullptr); return *m_machine; }
|
||||
running_machine &machine() const noexcept { assert(m_machine != nullptr); return *m_machine; }
|
||||
bool enabled() const { return m_enabled; }
|
||||
int param() const { return m_param; }
|
||||
void *ptr() const { return m_ptr; }
|
||||
@ -79,8 +79,8 @@ public:
|
||||
void adjust(attotime start_delay, s32 param = 0, const attotime &periodicity = attotime::never);
|
||||
|
||||
// timing queries
|
||||
attotime elapsed() const noexcept(MAME_NDEBUG);
|
||||
attotime remaining() const noexcept(MAME_NDEBUG);
|
||||
attotime elapsed() const noexcept;
|
||||
attotime remaining() const noexcept;
|
||||
attotime start() const { return m_start; }
|
||||
attotime expire() const { return m_expire; }
|
||||
attotime period() const { return m_period; }
|
||||
@ -122,7 +122,7 @@ public:
|
||||
|
||||
// getters
|
||||
running_machine &machine() const noexcept { return m_machine; }
|
||||
attotime time() const noexcept(MAME_NDEBUG);
|
||||
attotime time() const noexcept;
|
||||
emu_timer *first_timer() const { return m_timer_list; }
|
||||
device_execute_interface *currently_executing() const noexcept { return m_executing_device; }
|
||||
bool can_save() const;
|
||||
|
Loading…
Reference in New Issue
Block a user