COMMON: Change way the Singleton instances are instantiated
This fixes tons of warnings with clang from a recent xcode version on macOS (and possibly other systems) complaining that an instantiation of _singleton is required but no definition is available.
This commit is contained in:
parent
1141bfc1a6
commit
eefa72afa1
36 changed files with 1 additions and 138 deletions
|
@ -32,11 +32,6 @@
|
||||||
#include "backends/networking/sdl_net/localwebserver.h"
|
#include "backends/networking/sdl_net/localwebserver.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
|
|
||||||
DECLARE_SINGLETON(Cloud::CloudManager);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Cloud {
|
namespace Cloud {
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,6 @@
|
||||||
#include "backends/fs/ds/ds-fs.h"
|
#include "backends/fs/ds/ds-fs.h"
|
||||||
#include "dsmain.h" //for the isGBAMPAvailable() function
|
#include "dsmain.h" //for the isGBAMPAvailable() function
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(DSFilesystemFactory);
|
|
||||||
}
|
|
||||||
|
|
||||||
AbstractFSNode *DSFilesystemFactory::makeRootFileNode() const {
|
AbstractFSNode *DSFilesystemFactory::makeRootFileNode() const {
|
||||||
if (DS::isGBAMPAvailable()) {
|
if (DS::isGBAMPAvailable()) {
|
||||||
|
|
|
@ -28,10 +28,6 @@
|
||||||
#include "backends/fs/ps2/ps2-fs-factory.h"
|
#include "backends/fs/ps2/ps2-fs-factory.h"
|
||||||
#include "backends/fs/ps2/ps2-fs.h"
|
#include "backends/fs/ps2/ps2-fs.h"
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(Ps2FilesystemFactory);
|
|
||||||
}
|
|
||||||
|
|
||||||
AbstractFSNode *Ps2FilesystemFactory::makeRootFileNode() const {
|
AbstractFSNode *Ps2FilesystemFactory::makeRootFileNode() const {
|
||||||
return new Ps2FilesystemNode();
|
return new Ps2FilesystemNode();
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,10 +44,6 @@
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(PSPFilesystemFactory);
|
|
||||||
}
|
|
||||||
|
|
||||||
AbstractFSNode *PSPFilesystemFactory::makeRootFileNode() const {
|
AbstractFSNode *PSPFilesystemFactory::makeRootFileNode() const {
|
||||||
return new PSPFilesystemNode();
|
return new PSPFilesystemNode();
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,10 +43,6 @@
|
||||||
#include <smb.h>
|
#include <smb.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(WiiFilesystemFactory);
|
|
||||||
}
|
|
||||||
|
|
||||||
WiiFilesystemFactory::WiiFilesystemFactory() :
|
WiiFilesystemFactory::WiiFilesystemFactory() :
|
||||||
_dvdMounted(false),
|
_dvdMounted(false),
|
||||||
_smbMounted(false),
|
_smbMounted(false),
|
||||||
|
|
|
@ -27,10 +27,6 @@
|
||||||
#include "common/textconsole.h"
|
#include "common/textconsole.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(OpenGL::ShaderManager);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace OpenGL {
|
namespace OpenGL {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
|
@ -29,12 +29,6 @@
|
||||||
#include "common/timer.h"
|
#include "common/timer.h"
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
|
|
||||||
DECLARE_SINGLETON(Networking::ConnectionManager);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Networking {
|
namespace Networking {
|
||||||
|
|
||||||
ConnectionManager::ConnectionManager(): _multi(0), _timerStarted(false), _frame(0) {
|
ConnectionManager::ConnectionManager(): _multi(0), _timerStarted(false), _frame(0) {
|
||||||
|
|
|
@ -51,9 +51,6 @@
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
class MemoryReadWriteStream;
|
class MemoryReadWriteStream;
|
||||||
|
|
||||||
DECLARE_SINGLETON(Networking::LocalWebserver);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Networking {
|
namespace Networking {
|
||||||
|
|
|
@ -62,10 +62,6 @@ const OSystem::GraphicsMode DisplayManager::_supportedModes[] = {
|
||||||
|
|
||||||
// Class VramAllocator -----------------------------------
|
// Class VramAllocator -----------------------------------
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(VramAllocator);
|
|
||||||
}
|
|
||||||
|
|
||||||
//#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */
|
//#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */
|
||||||
//#define __PSP_DEBUG_PRINT__
|
//#define __PSP_DEBUG_PRINT__
|
||||||
|
|
||||||
|
|
|
@ -30,10 +30,6 @@
|
||||||
//#define __PSP_DEBUG_PRINT__
|
//#define __PSP_DEBUG_PRINT__
|
||||||
#include "backends/platform/psp/trace.h"
|
#include "backends/platform/psp/trace.h"
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(PowerManager);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Function to debug the Power Manager (we have no output to screen)
|
// Function to debug the Power Manager (we have no output to screen)
|
||||||
inline void PowerManager::debugPM() {
|
inline void PowerManager::debugPM() {
|
||||||
PSP_DEBUG_PRINT("PM status[%d]. Listcount[%d]. CriticalCount[%d]. ThreadId[%x]. Error[%d]\n",
|
PSP_DEBUG_PRINT("PM status[%d]. Listcount[%d]. CriticalCount[%d]. ThreadId[%x]. Error[%d]\n",
|
||||||
|
|
|
@ -34,9 +34,6 @@
|
||||||
|
|
||||||
|
|
||||||
// Class PspRtc ---------------------------------------------------------------
|
// Class PspRtc ---------------------------------------------------------------
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(PspRtc);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PspRtc::init() { // init our starting ticks
|
void PspRtc::init() { // init our starting ticks
|
||||||
uint32 ticks[2];
|
uint32 ticks[2];
|
||||||
|
|
|
@ -29,10 +29,6 @@
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(ELFMemoryManager);
|
|
||||||
}
|
|
||||||
|
|
||||||
ELFMemoryManager::ELFMemoryManager() :
|
ELFMemoryManager::ELFMemoryManager() :
|
||||||
_heap(0), _heapSize(0), _heapAlign(0),
|
_heap(0), _heapSize(0), _heapAlign(0),
|
||||||
_trackAllocs(false), _measuredSize(0), _measuredAlign(0),
|
_trackAllocs(false), _measuredSize(0), _measuredAlign(0),
|
||||||
|
|
|
@ -33,10 +33,6 @@ extern char __plugin_hole_start; // Indicates start of hole in program file for
|
||||||
extern char __plugin_hole_end; // Indicates end of hole in program file
|
extern char __plugin_hole_end; // Indicates end of hole in program file
|
||||||
extern char _gp[]; // Value of gp register
|
extern char _gp[]; // Value of gp register
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(ShortSegmentManager); // For singleton
|
|
||||||
}
|
|
||||||
|
|
||||||
ShortSegmentManager::ShortSegmentManager() {
|
ShortSegmentManager::ShortSegmentManager() {
|
||||||
_shortsStart = &__plugin_hole_start ; //shorts segment begins at the plugin hole we made when linking
|
_shortsStart = &__plugin_hole_start ; //shorts segment begins at the plugin hole we made when linking
|
||||||
_shortsEnd = &__plugin_hole_end; //and ends at the end of that hole.
|
_shortsEnd = &__plugin_hole_end; //and ends at the end of that hole.
|
||||||
|
|
|
@ -446,10 +446,6 @@ void PluginManager::addToPluginsInMemList(Plugin *plugin) {
|
||||||
|
|
||||||
#include "engines/metaengine.h"
|
#include "engines/metaengine.h"
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(EngineManager);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function works for both cached and uncached PluginManagers.
|
* This function works for both cached and uncached PluginManagers.
|
||||||
* For the cached version, most of the logic here will short circuit.
|
* For the cached version, most of the logic here will short circuit.
|
||||||
|
@ -539,10 +535,6 @@ const EnginePlugin::List &EngineManager::getPlugins() const {
|
||||||
|
|
||||||
#include "audio/musicplugin.h"
|
#include "audio/musicplugin.h"
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(MusicManager);
|
|
||||||
}
|
|
||||||
|
|
||||||
const MusicPlugin::List &MusicManager::getPlugins() const {
|
const MusicPlugin::List &MusicManager::getPlugins() const {
|
||||||
return (const MusicPlugin::List &)PluginManager::instance().getPlugins(PLUGIN_TYPE_MUSIC);
|
return (const MusicPlugin::List &)PluginManager::instance().getPlugins(PLUGIN_TYPE_MUSIC);
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,6 +284,4 @@ void SearchManager::clear() {
|
||||||
addDirectory(".", ".", -2);
|
addDirectory(".", ".", -2);
|
||||||
}
|
}
|
||||||
|
|
||||||
DECLARE_SINGLETON(SearchManager);
|
|
||||||
|
|
||||||
} // namespace Common
|
} // namespace Common
|
||||||
|
|
|
@ -36,8 +36,6 @@ static bool isValidDomainName(const Common::String &domName) {
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
DECLARE_SINGLETON(ConfigManager);
|
|
||||||
|
|
||||||
char const *const ConfigManager::kApplicationDomain = "scummvm";
|
char const *const ConfigManager::kApplicationDomain = "scummvm";
|
||||||
char const *const ConfigManager::kTransientDomain = "__TRANSIENT";
|
char const *const ConfigManager::kTransientDomain = "__TRANSIENT";
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,6 @@ namespace Common {
|
||||||
/** Helper null context instance */
|
/** Helper null context instance */
|
||||||
CoroContext nullContext = NULL;
|
CoroContext nullContext = NULL;
|
||||||
|
|
||||||
DECLARE_SINGLETON(CoroutineScheduler);
|
|
||||||
|
|
||||||
#ifdef COROUTINE_DEBUG
|
#ifdef COROUTINE_DEBUG
|
||||||
namespace {
|
namespace {
|
||||||
/** Count of active coroutines */
|
/** Count of active coroutines */
|
||||||
|
|
|
@ -34,8 +34,6 @@ bool gDebugChannelsOnly = false;
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
DECLARE_SINGLETON(DebugManager);
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
struct DebugLevelComperator {
|
struct DebugLevelComperator {
|
||||||
|
|
|
@ -24,8 +24,6 @@
|
||||||
#include "common/system.h"
|
#include "common/system.h"
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
DECLARE_SINGLETON(OSDMessageQueue);
|
|
||||||
|
|
||||||
OSDMessageQueue::OSDMessageQueue() : _lastUpdate(0) {
|
OSDMessageQueue::OSDMessageQueue() : _lastUpdate(0) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,14 +88,7 @@ protected:
|
||||||
static T *_singleton;
|
static T *_singleton;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
template<class T> T *Singleton<T>::_singleton = 0;
|
||||||
* Note that you need to use this macro from the Common namespace.
|
|
||||||
*
|
|
||||||
* This is because C++ requires initial explicit specialization
|
|
||||||
* to be placed in the same namespace as the template.
|
|
||||||
*/
|
|
||||||
#define DECLARE_SINGLETON(T) \
|
|
||||||
template<> T *Singleton<T>::_singleton = 0
|
|
||||||
|
|
||||||
} // End of namespace Common
|
} // End of namespace Common
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,6 @@
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
DECLARE_SINGLETON(TranslationManager);
|
|
||||||
|
|
||||||
bool operator<(const TLanguage &l, const TLanguage &r) {
|
bool operator<(const TLanguage &l, const TLanguage &r) {
|
||||||
return strcmp(l.name, r.name) < 0;
|
return strcmp(l.name, r.name) < 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,10 +133,6 @@ bool ChainedGamesManager::pop(Common::String &target, int &slot) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(ChainedGamesManager);
|
|
||||||
}
|
|
||||||
|
|
||||||
Engine::Engine(OSystem *syst)
|
Engine::Engine(OSystem *syst)
|
||||||
: _system(syst),
|
: _system(syst),
|
||||||
_mixer(_system->getMixer()),
|
_mixer(_system->getMixer()),
|
||||||
|
|
|
@ -31,10 +31,6 @@
|
||||||
#include "common/endian.h"
|
#include "common/endian.h"
|
||||||
#include "audio/midiparser.h"
|
#include "audio/midiparser.h"
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(Lure::SoundManager);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Lure {
|
namespace Lure {
|
||||||
|
|
||||||
//#define SOUND_CROP_CHANNELS
|
//#define SOUND_CROP_CHANNELS
|
||||||
|
|
|
@ -30,10 +30,6 @@
|
||||||
#include "pegasus/gamestate.h"
|
#include "pegasus/gamestate.h"
|
||||||
#include "pegasus/scoring.h"
|
#include "pegasus/scoring.h"
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(Pegasus::GameStateManager);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Pegasus {
|
namespace Pegasus {
|
||||||
|
|
||||||
Common::Error GameStateManager::writeGameState(Common::WriteStream *stream) {
|
Common::Error GameStateManager::writeGameState(Common::WriteStream *stream) {
|
||||||
|
|
|
@ -30,10 +30,6 @@
|
||||||
#include "pegasus/input.h"
|
#include "pegasus/input.h"
|
||||||
#include "pegasus/pegasus.h"
|
#include "pegasus/pegasus.h"
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(Pegasus::InputDeviceManager);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Pegasus {
|
namespace Pegasus {
|
||||||
|
|
||||||
InputDeviceManager::InputDeviceManager() {
|
InputDeviceManager::InputDeviceManager() {
|
||||||
|
|
|
@ -34,10 +34,6 @@
|
||||||
#include "sword25/gfx/animationtemplateregistry.h"
|
#include "sword25/gfx/animationtemplateregistry.h"
|
||||||
#include "sword25/gfx/animationtemplate.h"
|
#include "sword25/gfx/animationtemplate.h"
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(Sword25::AnimationTemplateRegistry);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Sword25 {
|
namespace Sword25 {
|
||||||
|
|
||||||
bool AnimationTemplateRegistry::persist(OutputPersistenceBlock &writer) {
|
bool AnimationTemplateRegistry::persist(OutputPersistenceBlock &writer) {
|
||||||
|
|
|
@ -34,10 +34,6 @@
|
||||||
#include "sword25/math/regionregistry.h"
|
#include "sword25/math/regionregistry.h"
|
||||||
#include "sword25/math/region.h"
|
#include "sword25/math/region.h"
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(Sword25::RegionRegistry);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Sword25 {
|
namespace Sword25 {
|
||||||
|
|
||||||
bool RegionRegistry::persist(OutputPersistenceBlock &writer) {
|
bool RegionRegistry::persist(OutputPersistenceBlock &writer) {
|
||||||
|
|
|
@ -50,9 +50,6 @@
|
||||||
|
|
||||||
#include "sword25/gfx/animationtemplateregistry.h" // Needed so we can destroy the singleton
|
#include "sword25/gfx/animationtemplateregistry.h" // Needed so we can destroy the singleton
|
||||||
#include "sword25/gfx/renderobjectregistry.h" // Needed so we can destroy the singleton
|
#include "sword25/gfx/renderobjectregistry.h" // Needed so we can destroy the singleton
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(Sword25::RenderObjectRegistry);
|
|
||||||
}
|
|
||||||
#include "sword25/math/regionregistry.h" // Needed so we can destroy the singleton
|
#include "sword25/math/regionregistry.h" // Needed so we can destroy the singleton
|
||||||
|
|
||||||
namespace Sword25 {
|
namespace Sword25 {
|
||||||
|
|
|
@ -25,10 +25,6 @@
|
||||||
|
|
||||||
#include "testbed/config-params.h"
|
#include "testbed/config-params.h"
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(Testbed::ConfigParams);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Testbed {
|
namespace Testbed {
|
||||||
|
|
||||||
ConfigParams::ConfigParams() {
|
ConfigParams::ConfigParams() {
|
||||||
|
|
|
@ -32,9 +32,6 @@
|
||||||
#include "engines/wintermute/wintermute.h"
|
#include "engines/wintermute/wintermute.h"
|
||||||
#include "engines/wintermute/system/sys_class_registry.h"
|
#include "engines/wintermute/system/sys_class_registry.h"
|
||||||
#include "common/system.h"
|
#include "common/system.h"
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(Wintermute::BaseEngine);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Wintermute {
|
namespace Wintermute {
|
||||||
|
|
||||||
|
|
|
@ -25,10 +25,6 @@
|
||||||
#include "common/system.h"
|
#include "common/system.h"
|
||||||
#include "common/stack.h"
|
#include "common/stack.h"
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(Graphics::CursorManager);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Graphics {
|
namespace Graphics {
|
||||||
|
|
||||||
CursorManager::~CursorManager() {
|
CursorManager::~CursorManager() {
|
||||||
|
|
|
@ -26,10 +26,6 @@
|
||||||
|
|
||||||
#include "common/translation.h"
|
#include "common/translation.h"
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(Graphics::FontManager);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Graphics {
|
namespace Graphics {
|
||||||
|
|
||||||
FORWARD_DECLARE_FONT(g_sysfont);
|
FORWARD_DECLARE_FONT(g_sysfont);
|
||||||
|
|
|
@ -668,9 +668,5 @@ Font *loadTTFFont(Common::SeekableReadStream &stream, int size, TTFSizeMode size
|
||||||
|
|
||||||
} // End of namespace Graphics
|
} // End of namespace Graphics
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(Graphics::TTFLibrary);
|
|
||||||
} // End of namespace Common
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -86,10 +86,6 @@
|
||||||
#include "graphics/surface.h"
|
#include "graphics/surface.h"
|
||||||
#include "graphics/yuv_to_rgb.h"
|
#include "graphics/yuv_to_rgb.h"
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(Graphics::YUVToRGBManager);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Graphics {
|
namespace Graphics {
|
||||||
|
|
||||||
class YUVToRGBLookup {
|
class YUVToRGBLookup {
|
||||||
|
|
|
@ -25,10 +25,6 @@
|
||||||
|
|
||||||
#ifdef ENABLE_EVENTRECORDER
|
#ifdef ENABLE_EVENTRECORDER
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(GUI::EventRecorder);
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "common/debug-channels.h"
|
#include "common/debug-channels.h"
|
||||||
#include "backends/timer/sdl/sdl-timer.h"
|
#include "backends/timer/sdl/sdl-timer.h"
|
||||||
#include "backends/mixer/sdl/sdl-mixer.h"
|
#include "backends/mixer/sdl/sdl-mixer.h"
|
||||||
|
|
|
@ -41,10 +41,6 @@
|
||||||
|
|
||||||
#include "graphics/cursorman.h"
|
#include "graphics/cursorman.h"
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
DECLARE_SINGLETON(GUI::GuiManager);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue