diff options
author | Vas Crabb <vas@vastheman.com> | 2022-08-03 02:27:49 +1000 |
---|---|---|
committer | Vas Crabb <vas@vastheman.com> | 2022-08-03 02:27:49 +1000 |
commit | 7cc3481d8ff8893fa8a5ccef4cffd97d73403bc0 (patch) | |
tree | 4c0c2f68a4c0298fee81a5430c318bfc2e2158f5 /src/osd/modules | |
parent | 9bbf203c39fbd306772620f84de8f6cb2c20f926 (diff) |
ui/icorender.cpp: Revert initialisations that can hide real bugs.
MSVC isn't smart enough to detect that these can only be used after
being assigned while clang and GCC can work it out fine. Initialising
them to zero at declaration has the potential to mask real bugs if some
code path tries to use them without assigning them. Code flow analysis
(e.g. Coverity) or memory analysers (e.g. valgrind or Purify) won't pick
up on the buggy path because the variable will technically be
initialised.
MSVC is problematic when it comes to warnings about uninitialised
variables in general. Unfortunately MSVC has no option to selectively
treat warnings as errors, unlike clang/GCC which have -Wno-error= which
we use extensively. Until Microsoft addresses these issues, you'll have
to use NOWERROR=1 when building with MSVC.
Also, some cleanup.
Diffstat (limited to 'src/osd/modules')
-rw-r--r-- | src/osd/modules/debugger/debuggdbstub.cpp | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/osd/modules/debugger/debuggdbstub.cpp b/src/osd/modules/debugger/debuggdbstub.cpp index cd21a4c5b1b..eaeb1df4cca 100644 --- a/src/osd/modules/debugger/debuggdbstub.cpp +++ b/src/osd/modules/debugger/debuggdbstub.cpp @@ -643,16 +643,8 @@ void debug_gdbstub::wait_for_debugger(device_t &device, bool firststop) if ( firststop && !m_initialized ) { - // find the "main" CPU, which is the first CPU (gdbstub doesn't seem to have any notion of switching CPUs) - for (device_t &device : device_enumerator(m_machine->root_device())) - { - auto *cpu = dynamic_cast<cpu_device *>(&device); - if (cpu) - { - m_maincpu = cpu; - break; - } - } + // find the "main" CPU, which is the first CPU (gdbstub doesn't have any notion of switching CPUs) + m_maincpu = device_type_enumerator<cpu_device>(m_machine->root_device()).first(); if (!m_maincpu) fatalerror("gdbstub: cannot find any CPUs\n"); |