mirror of https://github.com/stella-emu/stella.git
Move codebase to requiring C++20, and fix resultant non-standard code.
This commit is contained in:
parent
4aba8a1955
commit
ce6cc2ef02
|
@ -34,7 +34,7 @@
|
|||
|
||||
* Added Joy2B+ controller support.
|
||||
|
||||
* Added auto detection for QuadTari attached controllers
|
||||
* Added auto detection for QuadTari attached controllers.
|
||||
|
||||
* Enhanced Kid Vid support to play tape audio.
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
|||
|
||||
* Added missing PlusROM support for E7 bankswitching.
|
||||
|
||||
* Enhanced movie cart (MVC) support
|
||||
* Enhanced movie cart (MVC) support.
|
||||
|
||||
* Accelerated emulation up to ~15% (ARM).
|
||||
|
||||
|
@ -60,6 +60,9 @@
|
|||
|
||||
* Removed 'launcherroms' option, since it was causing some issues.
|
||||
|
||||
* Codebase now uses C++20 features, which means a minimum of gcc-11
|
||||
or clang-10 for Linux/Mac, and Visual Studio 2022 for Windows.
|
||||
|
||||
-Have fun!
|
||||
|
||||
|
||||
|
|
4
Makefile
4
Makefile
|
@ -51,12 +51,12 @@ CXXFLAGS+= -Wall -Wextra -Wno-unused-parameter
|
|||
CFLAGS+= -Wall -Wextra -Wno-unused-parameter
|
||||
|
||||
ifdef HAVE_GCC
|
||||
CXXFLAGS+= -Wno-multichar -Wunused -Woverloaded-virtual -Wnon-virtual-dtor -std=c++17
|
||||
CXXFLAGS+= -Wno-multichar -Wunused -Woverloaded-virtual -Wnon-virtual-dtor -std=c++20
|
||||
CFLAGS+= -Wno-multichar -Wunused
|
||||
endif
|
||||
|
||||
ifdef HAVE_CLANG
|
||||
CXXFLAGS+= -Wno-multichar -Wunused -Woverloaded-virtual -Wnon-virtual-dtor -std=c++17
|
||||
CXXFLAGS+= -Wno-multichar -Wunused -Woverloaded-virtual -Wnon-virtual-dtor -std=c++20
|
||||
CFLAGS+= -Wno-multichar -Wunused
|
||||
endif
|
||||
|
||||
|
|
|
@ -378,7 +378,7 @@ else
|
|||
fi
|
||||
|
||||
for compiler in $compilers; do
|
||||
if test_compiler "$compiler -std=c++17"; then
|
||||
if test_compiler "$compiler -std=c++20"; then
|
||||
CXX=$compiler
|
||||
echo $CXX
|
||||
break
|
||||
|
|
|
@ -265,7 +265,7 @@
|
|||
<h2><b><a name="Features">Features</a></b></h2>
|
||||
|
||||
<ul>
|
||||
<li>High speed emulation using optimized C++17 code</li>
|
||||
<li>High speed emulation using optimized C++20 code</li>
|
||||
<li>Supports high quality TIA emulation using the cycle-exact TIA core from
|
||||
<a href="https://github.com/6502ts/6502.ts">6502.ts</a> by
|
||||
Christian Speckner</li>
|
||||
|
@ -359,7 +359,7 @@
|
|||
<li>i386 or x86_64 class machine, with 32 or 64-bit distribution</li>
|
||||
<li>Other architectures (MIPS, PPC, PPC64, etc.) have been confirmed to work,
|
||||
but aren't as well tested as i386/x86_64</li>
|
||||
<li>GNU g++ v/7 or Clang v/5 (with C++17 support) and the make utility are required for compiling the Stella source code</li>
|
||||
<li>GNU g++ v/11 or Clang v/10 (with C++20 support) and the make utility are required for compiling the Stella source code</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
|
|
|
@ -62,9 +62,10 @@ class FSNodeFactory
|
|||
return make_unique<FSNodeZIP>(path);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
// Following constructors and assignment operators not supported
|
||||
|
|
|
@ -218,6 +218,7 @@ size_t FSNodeZIP::read(ByteBuffer& buffer, size_t) const
|
|||
case zip_error::NOT_A_FILE: throw runtime_error("ZIP file contains errors/not found");
|
||||
case zip_error::NOT_READABLE: throw runtime_error("ZIP file not readable");
|
||||
case zip_error::NO_ROMS: throw runtime_error("ZIP file doesn't contain any ROMs");
|
||||
default: throw runtime_error("FSNodeZIP::read default case hit");
|
||||
}
|
||||
|
||||
myZipHandler->open(_zipFile);
|
||||
|
|
|
@ -46,32 +46,27 @@ void FpsMeter::render(uInt32 frameCount)
|
|||
}
|
||||
|
||||
const size_t queueSize = myQueue.capacity();
|
||||
entry first, last;
|
||||
entry e_first, e_last;
|
||||
|
||||
last.frames = frameCount;
|
||||
last.timestamp = high_resolution_clock::now();
|
||||
e_last.frames = frameCount;
|
||||
e_last.timestamp = high_resolution_clock::now();
|
||||
|
||||
if (myQueue.size() < queueSize) {
|
||||
myQueue.push_back(last);
|
||||
myQueue.push_back(e_last);
|
||||
myFrameCount += frameCount;
|
||||
|
||||
first = myQueue.at(myQueueOffset);
|
||||
e_first = myQueue.at(myQueueOffset);
|
||||
} else {
|
||||
myFrameCount = myFrameCount - myQueue.at(myQueueOffset).frames + frameCount;
|
||||
myQueue.at(myQueueOffset) = last;
|
||||
myQueue.at(myQueueOffset) = e_last;
|
||||
|
||||
myQueueOffset = (myQueueOffset + 1) % queueSize;
|
||||
first = myQueue.at(myQueueOffset);
|
||||
e_first = myQueue.at(myQueueOffset);
|
||||
}
|
||||
|
||||
const float myTimeInterval =
|
||||
duration_cast<duration<float>>(last.timestamp - first.timestamp).count();
|
||||
duration_cast<duration<float>>(e_last.timestamp - e_first.timestamp).count();
|
||||
|
||||
if (myTimeInterval > 0) myFps = (myFrameCount - first.frames) / myTimeInterval;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
float FpsMeter::fps() const
|
||||
{
|
||||
return myFps;
|
||||
if (myTimeInterval > 0)
|
||||
myFps = (myFrameCount - e_first.frames) / myTimeInterval;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class FpsMeter
|
|||
|
||||
void render(uInt32 frameCount);
|
||||
|
||||
float fps() const;
|
||||
float fps() const { return myFps; }
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ class LinkedObjectPool
|
|||
/*
|
||||
Create a pool of size CAPACITY; the active list starts out empty.
|
||||
*/
|
||||
LinkedObjectPool<T, CAPACITY>() { resize(CAPACITY); }
|
||||
LinkedObjectPool() { resize(CAPACITY); }
|
||||
|
||||
/**
|
||||
Return node data that the 'current' iterator points to.
|
||||
|
|
|
@ -96,6 +96,8 @@ MouseControl::MouseControl(Console& console, string_view mode)
|
|||
id = 1;
|
||||
msg << "Right MindLink";
|
||||
break;
|
||||
default:
|
||||
break; // Not supposed to get here
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#pragma clang diagnostic ignored "-Wimplicit-fallthrough"
|
||||
#pragma clang diagnostic ignored "-Wreserved-id-macro"
|
||||
#pragma clang diagnostic ignored "-Wold-style-cast"
|
||||
#pragma clang diagnostic ignored "-Wswitch-default"
|
||||
#include <SDL.h>
|
||||
#pragma clang diagnostic pop
|
||||
#elif defined(BSPF_WINDOWS)
|
||||
|
|
|
@ -283,6 +283,8 @@ string SoundSDL2::about() const
|
|||
case AudioSettings::Preset::ultraQualityMinimalLag:
|
||||
buf << "Ultra quality, minimal lag\n";
|
||||
break;
|
||||
default:
|
||||
break; // Not supposed to get here
|
||||
}
|
||||
buf << " Fragment size: " << static_cast<uInt32>(myHardwareSpec.samples)
|
||||
<< " bytes\n"
|
||||
|
@ -300,6 +302,8 @@ string SoundSDL2::about() const
|
|||
case AudioSettings::ResamplingQuality::lanczos_3:
|
||||
buf << "Quality 3, Lanczos (a = 3)\n";
|
||||
break;
|
||||
default:
|
||||
break; // Not supposed to get here
|
||||
}
|
||||
buf << " Headroom: " << std::fixed << std::setprecision(1)
|
||||
<< (0.5 * myAudioSettings.headroom()) << " frames\n"
|
||||
|
|
|
@ -37,7 +37,7 @@ class FixedStack
|
|||
public:
|
||||
using StackFunction = std::function<void(T&)>;
|
||||
|
||||
FixedStack<T, CAPACITY>() = default;
|
||||
FixedStack() = default;
|
||||
|
||||
bool empty() const { return _size == 0; }
|
||||
bool full() const { return _size >= CAPACITY; }
|
||||
|
|
|
@ -139,6 +139,8 @@ VideoModeHandler::Mode::Mode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh,
|
|||
iw = std::min(static_cast<uInt32>(iw * zoomLevel), screenS.w) * overscan;
|
||||
ih = std::min(static_cast<uInt32>(ih * zoomLevel), screenS.h) * overscan;
|
||||
break;
|
||||
default:
|
||||
break; // Not supposed to get here
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -157,6 +159,9 @@ VideoModeHandler::Mode::Mode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh,
|
|||
|
||||
case Stretch::None: // UI Mode
|
||||
break; // Do not change image or screen rects whatsoever
|
||||
|
||||
default:
|
||||
break; // Not supposed to get here
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ void AtariNTSC::render(const uInt8* atari_in, const uInt32 in_width,
|
|||
// Spawn the threads...
|
||||
for(uInt32 i = 0; i < myWorkerThreads; ++i)
|
||||
{
|
||||
myThreads[i] = std::thread([=] // NOLINT (cppcoreguidelines-misleading-capture-default-by-value
|
||||
myThreads[i] = std::thread([=, this]
|
||||
{
|
||||
rgb_in == nullptr ?
|
||||
renderThread(atari_in, in_width, in_height, myTotalThreads,
|
||||
|
|
|
@ -741,6 +741,9 @@ bool CartDebug::getLabel(ostream& buf, uInt16 addr, bool isRead,
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break; // Not supposed to get here
|
||||
}
|
||||
|
||||
switch(places)
|
||||
|
|
|
@ -383,6 +383,8 @@ bool DebuggerParser::getArgs(string_view command, string& verb)
|
|||
curArg += c;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break; // Not supposed to get here
|
||||
} // switch(state)
|
||||
}
|
||||
while(i < length);
|
||||
|
@ -505,6 +507,9 @@ bool DebuggerParser::validateArgs(int cmd)
|
|||
|
||||
case Parameters::ARG_END_ARGS:
|
||||
break;
|
||||
|
||||
default:
|
||||
break; // Not supposed to get here
|
||||
}
|
||||
++curCount;
|
||||
++p;
|
||||
|
@ -2645,6 +2650,8 @@ void DebuggerParser::executeTrapRW(uInt32 addr, bool read, bool write, bool add)
|
|||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break; // Not supposed to get here
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -505,8 +505,10 @@ bool TIADebug::collision(CollisionBit id, bool toggle) const
|
|||
if(toggle)
|
||||
myTIA.toggleCollM0M1();
|
||||
return myTIA.collCXPPMM() & 0x40;
|
||||
|
||||
default:
|
||||
return false; // Not supposed to get here
|
||||
}
|
||||
return false; // make compiler happy
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -399,6 +399,9 @@ int yylex() {
|
|||
return yylval.val;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break; // Not supposed to get here
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1516,6 +1516,9 @@ bool MovieCart::process(uInt16 address)
|
|||
case TitleState::Stream:
|
||||
runStateMachine();
|
||||
break;
|
||||
|
||||
default:
|
||||
break; // Not supposed to get here
|
||||
}
|
||||
|
||||
return a12;
|
||||
|
|
|
@ -293,6 +293,9 @@ void FBSurface::frameRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
|||
vLine(x + w - 1, i, i, color);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break; // Not supposed to get here
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ class FSNode
|
|||
|
||||
/**
|
||||
* Append the given path to the node, adding a directory separator
|
||||
* when necessary. Modelled on the C++17 fs::path API.
|
||||
* when necessary.
|
||||
*/
|
||||
FSNode& operator/=(string_view path);
|
||||
|
||||
|
|
|
@ -890,6 +890,9 @@ inline bool FrameBuffer::drawMessage()
|
|||
myMsg.x = imageRect().w() - dst.w() - 5;
|
||||
myMsg.y = imageRect().h() - dst.h() - 5;
|
||||
break;
|
||||
|
||||
default:
|
||||
break; // Not supposed to get here
|
||||
}
|
||||
|
||||
myMsg.surface->setDstPos(myMsg.x + imageRect().x(), myMsg.y + imageRect().y());
|
||||
|
|
|
@ -433,7 +433,7 @@ void PlusROM::send()
|
|||
// as the thread is running. Thus, the request can only be destructed once
|
||||
// the thread has finished, and we can safely evict it from the deque at
|
||||
// any time.
|
||||
std::thread thread([=]() // NOLINT (cppcoreguidelines-misleading-capture-default-by-value)
|
||||
std::thread thread([=, this]()
|
||||
{
|
||||
request->execute();
|
||||
switch(request->getState())
|
||||
|
|
|
@ -482,6 +482,8 @@ string TIASurface::effectsInfo() const
|
|||
case Filter::BlarggPhosphor:
|
||||
buf << myNTSCFilter.getPreset() << ", phosphor=" << myPBlend;
|
||||
break;
|
||||
default:
|
||||
break; // Not supposed to get here
|
||||
}
|
||||
if(attr.blendalpha)
|
||||
buf << ", scanlines=" << attr.blendalpha
|
||||
|
@ -585,6 +587,9 @@ void TIASurface::render(bool shade)
|
|||
myNTSCFilter.render(myTIA->frameBuffer(), width, height, out, outPitch << 2, myRGBFramebuffer.data());
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break; // Not supposed to get here
|
||||
}
|
||||
|
||||
// Draw TIA image
|
||||
|
@ -650,6 +655,7 @@ void TIASurface::renderForSnapshot()
|
|||
}
|
||||
|
||||
case Filter::BlarggPhosphor:
|
||||
{
|
||||
uInt32 bufofs = 0;
|
||||
for(uInt32 y = height; y; --y)
|
||||
for(uInt32 x = outPitch; x; --x)
|
||||
|
@ -657,6 +663,10 @@ void TIASurface::renderForSnapshot()
|
|||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break; // Not supposed to get here
|
||||
}
|
||||
|
||||
if(myPhosphorHandler.phosphorEnabled())
|
||||
{
|
||||
// Draw TIA image
|
||||
|
|
|
@ -224,6 +224,9 @@ void Playfield::applyColors()
|
|||
myColorRight = myColorP1 &= 0xfe;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break; // Not supposed to get here
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -436,6 +436,9 @@ void TIA::bindToControllers()
|
|||
case Controller::AnalogPin::Nine:
|
||||
updateAnalogReadout(0);
|
||||
break;
|
||||
|
||||
default:
|
||||
break; // Not supposed to get here
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -452,6 +455,9 @@ void TIA::bindToControllers()
|
|||
case Controller::AnalogPin::Nine:
|
||||
updateAnalogReadout(2);
|
||||
break;
|
||||
|
||||
default:
|
||||
break; // Not supposed to get here
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -1797,6 +1803,9 @@ FORCE_INLINE void TIA::renderPixel(uInt32 x, uInt32 y)
|
|||
else if (myBall.isOn()) color = myBall.getColor();
|
||||
else color = myBackground.getColor();
|
||||
break;
|
||||
|
||||
default:
|
||||
break; // Not supposed to get here
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ void FrameLayoutDetector::finalizeFrame()
|
|||
// 1.0 (>=312) and added to PAL and (inverted) NTSC sums.
|
||||
constexpr double ODD_PENALTY = 0.5; // guessed value :)
|
||||
const double palFrame = BSPF::clamp(((myCurrentFrameFinalLines % 2) ? ODD_PENALTY : 1.0)
|
||||
* (static_cast<double>(myCurrentFrameFinalLines) - frameLinesNTSC)
|
||||
* static_cast<double>(myCurrentFrameFinalLines - frameLinesNTSC)
|
||||
/ static_cast<double>(frameLinesPAL - frameLinesNTSC), 0.0, 1.0);
|
||||
myPalFrameSum += palFrame;
|
||||
myNtscFrameSum += 1.0 - palFrame;
|
||||
|
|
|
@ -265,6 +265,9 @@ void BrowserDialog::show(string_view startpath,
|
|||
_selected->setEnabled(false);
|
||||
_okWidget->setLabel("OK");
|
||||
break;
|
||||
|
||||
default:
|
||||
break; // Not supposed to get here
|
||||
}
|
||||
|
||||
// Set start path
|
||||
|
|
|
@ -320,6 +320,7 @@ void DialogContainer::handleMouseButtonEvent(MouseButton b, bool pressed,
|
|||
break;
|
||||
|
||||
case MouseButton::NONE: // should never get here
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -968,6 +968,8 @@ void CheckboxWidget::setFill(FillType type)
|
|||
_img = checked_img_circle.data();
|
||||
_drawBox = false;
|
||||
break;
|
||||
default:
|
||||
break; // Not supposed to get here
|
||||
}
|
||||
setDirty();
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ TARGET_NAME = stella
|
|||
|
||||
|
||||
ifeq (,$(findstring msvc,$(platform)))
|
||||
CXXFLAGS += -std=c++17 -fno-rtti
|
||||
CXXFLAGS += -std=c++20 -fno-rtti
|
||||
LIBS := -lm
|
||||
else
|
||||
LIBS :=
|
||||
|
@ -305,8 +305,8 @@ else ifneq (,$(filter $(platform), ngc wii wiiu))
|
|||
else ifeq ($(platform), emscripten)
|
||||
TARGET := $(TARGET_NAME)_libretro_$(platform).bc
|
||||
STATIC_LINKING = 1
|
||||
CXXFLAGS += $(PTHREAD_FLAGS) -std=c++17
|
||||
LDFLAGS += $(PTHREAD_FLAGS) -std=c++17
|
||||
CXXFLAGS += $(PTHREAD_FLAGS) -std=c++20
|
||||
LDFLAGS += $(PTHREAD_FLAGS) -std=c++20
|
||||
|
||||
# Genode
|
||||
else ifeq ($(platform), genode)
|
||||
|
@ -370,7 +370,7 @@ else ifneq (,$(findstring windows_msvc2017,$(platform)))
|
|||
endif
|
||||
|
||||
# Specific to this core
|
||||
MSVC2017CompileFlags += -D__WIN32__ /std:c++17
|
||||
MSVC2017CompileFlags += -D__WIN32__ /std:c++20
|
||||
|
||||
CXX = cl.exe
|
||||
CXXFLAGS += $(MSVC2017CompileFlags)
|
||||
|
|
|
@ -14,6 +14,6 @@ endif
|
|||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := retro
|
||||
LOCAL_SRC_FILES := $(SOURCES_CXX) $(SOURCES_C)
|
||||
LOCAL_CXXFLAGS := $(COREFLAGS) -std=c++17
|
||||
LOCAL_CXXFLAGS := $(COREFLAGS) -std=c++20
|
||||
LOCAL_LDFLAGS := -Wl,-version-script=$(CORE_DIR)/os/libretro/link.T
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
|
|
@ -3791,7 +3791,7 @@
|
|||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES;
|
||||
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++20";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_WARN_ASSIGN_ENUM = YES;
|
||||
CLANG_WARN_ATOMIC_IMPLICIT_SEQ_CST = YES;
|
||||
|
@ -3869,7 +3869,7 @@
|
|||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES;
|
||||
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++20";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_WARN_ASSIGN_ENUM = YES;
|
||||
CLANG_WARN_ATOMIC_IMPLICIT_SEQ_CST = YES;
|
||||
|
|
|
@ -593,7 +593,7 @@
|
|||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
<ObjectFileName>$(IntDir)obj\\windows\%(RelativeDir)</ObjectFileName>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<DisableSpecificWarnings>4100;4127;4146;4244;26400;26409;26410;26415;26429;26438;26440;26446;26451;26455;26459;26467;26472;26481;26482;26485;26492;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
|
|
Loading…
Reference in New Issue