mirror of
https://github.com/libretro/scummvm.git
synced 2024-11-27 11:20:40 +00:00
ALL: Require DECLARE_SINGLETON to be used in the Common namepsace
Silences the clang warning: static data member specialization of '_singleton' must originally be declared in namespace 'Common'; accepted as a C++0x extension [-Wc++0x-extensions] Wrapping "namespace Common {}" around the macro assignment causes clang to complain about a spurious semicolon, and removing the semicolon at the end of the macro causes some editors to misbehave. Changing the requirement of using the macro in one namespace (the global) to another (Common) seems a small price to pay to silence a warning.
This commit is contained in:
parent
13edea3e83
commit
aa0f307e06
@ -27,7 +27,9 @@
|
||||
#include "backends/fs/ds/ds-fs.h"
|
||||
#include "dsmain.h" //for the isGBAMPAvailable() function
|
||||
|
||||
namespace Common {
|
||||
DECLARE_SINGLETON(DSFilesystemFactory);
|
||||
}
|
||||
|
||||
AbstractFSNode *DSFilesystemFactory::makeRootFileNode() const {
|
||||
if (DS::isGBAMPAvailable()) {
|
||||
|
@ -27,7 +27,9 @@
|
||||
#include "backends/fs/ps2/ps2-fs-factory.h"
|
||||
#include "backends/fs/ps2/ps2-fs.h"
|
||||
|
||||
namespace Common {
|
||||
DECLARE_SINGLETON(Ps2FilesystemFactory);
|
||||
}
|
||||
|
||||
AbstractFSNode *Ps2FilesystemFactory::makeRootFileNode() const {
|
||||
return new Ps2FilesystemNode();
|
||||
|
@ -43,7 +43,9 @@
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
namespace Common {
|
||||
DECLARE_SINGLETON(PSPFilesystemFactory);
|
||||
}
|
||||
|
||||
AbstractFSNode *PSPFilesystemFactory::makeRootFileNode() const {
|
||||
return new PSPFilesystemNode();
|
||||
|
@ -40,7 +40,9 @@
|
||||
#include <smb.h>
|
||||
#endif
|
||||
|
||||
namespace Common {
|
||||
DECLARE_SINGLETON(WiiFilesystemFactory);
|
||||
}
|
||||
|
||||
WiiFilesystemFactory::WiiFilesystemFactory() :
|
||||
_dvdMounted(false),
|
||||
|
@ -62,7 +62,9 @@ const OSystem::GraphicsMode DisplayManager::_supportedModes[] = {
|
||||
|
||||
// Class VramAllocator -----------------------------------
|
||||
|
||||
namespace Common {
|
||||
DECLARE_SINGLETON(VramAllocator);
|
||||
}
|
||||
|
||||
//#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */
|
||||
//#define __PSP_DEBUG_PRINT__
|
||||
|
@ -30,7 +30,9 @@
|
||||
//#define __PSP_DEBUG_PRINT__
|
||||
#include "backends/platform/psp/trace.h"
|
||||
|
||||
namespace Common {
|
||||
DECLARE_SINGLETON(PowerManager);
|
||||
}
|
||||
|
||||
// Function to debug the Power Manager (we have no output to screen)
|
||||
inline void PowerManager::debugPM() {
|
||||
|
@ -34,7 +34,9 @@
|
||||
|
||||
|
||||
// Class PspRtc ---------------------------------------------------------------
|
||||
namespace Common {
|
||||
DECLARE_SINGLETON(PspRtc);
|
||||
}
|
||||
|
||||
void PspRtc::init() { // init our starting ticks
|
||||
uint32 ticks[2];
|
||||
|
@ -29,7 +29,9 @@
|
||||
#include "common/util.h"
|
||||
#include <malloc.h>
|
||||
|
||||
namespace Common {
|
||||
DECLARE_SINGLETON(ELFMemoryManager);
|
||||
}
|
||||
|
||||
ELFMemoryManager::ELFMemoryManager() :
|
||||
_heap(0), _heapSize(0), _heapAlign(0),
|
||||
|
@ -33,7 +33,9 @@ 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 _gp[]; // Value of gp register
|
||||
|
||||
namespace Common {
|
||||
DECLARE_SINGLETON(ShortSegmentManager); // For singleton
|
||||
}
|
||||
|
||||
ShortSegmentManager::ShortSegmentManager() {
|
||||
_shortsStart = &__plugin_hole_start ; //shorts segment begins at the plugin hole we made when linking
|
||||
|
@ -540,7 +540,9 @@ void PluginManager::addToPluginsInMemList(Plugin *plugin) {
|
||||
|
||||
#include "engines/metaengine.h"
|
||||
|
||||
namespace Common {
|
||||
DECLARE_SINGLETON(EngineManager);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function works for both cached and uncached PluginManagers.
|
||||
@ -631,7 +633,9 @@ const EnginePlugin::List &EngineManager::getPlugins() const {
|
||||
|
||||
#include "audio/musicplugin.h"
|
||||
|
||||
namespace Common {
|
||||
DECLARE_SINGLETON(MusicManager);
|
||||
}
|
||||
|
||||
const MusicPlugin::List &MusicManager::getPlugins() const {
|
||||
return (const MusicPlugin::List &)PluginManager::instance().getPlugins(PLUGIN_TYPE_MUSIC);
|
||||
|
@ -27,10 +27,10 @@
|
||||
#include "common/savefile.h"
|
||||
#include "common/textconsole.h"
|
||||
|
||||
DECLARE_SINGLETON(Common::EventRecorder);
|
||||
|
||||
namespace Common {
|
||||
|
||||
DECLARE_SINGLETON(EventRecorder);
|
||||
|
||||
#define RECORD_SIGNATURE 0x54455354
|
||||
#define RECORD_VERSION 1
|
||||
|
||||
|
@ -285,7 +285,7 @@ void SearchManager::clear() {
|
||||
addDirectory(".", ".", -2);
|
||||
}
|
||||
|
||||
DECLARE_SINGLETON(SearchManager);
|
||||
|
||||
} // namespace Common
|
||||
|
||||
DECLARE_SINGLETON(Common::SearchManager);
|
||||
|
||||
|
@ -27,8 +27,6 @@
|
||||
#include "common/system.h"
|
||||
#include "common/textconsole.h"
|
||||
|
||||
DECLARE_SINGLETON(Common::ConfigManager);
|
||||
|
||||
static bool isValidDomainName(const Common::String &domName) {
|
||||
const char *p = domName.c_str();
|
||||
while (*p && (isalnum(static_cast<unsigned char>(*p)) || *p == '-' || *p == '_'))
|
||||
@ -38,6 +36,8 @@ static bool isValidDomainName(const Common::String &domName) {
|
||||
|
||||
namespace Common {
|
||||
|
||||
DECLARE_SINGLETON(ConfigManager);
|
||||
|
||||
const char *ConfigManager::kApplicationDomain = "scummvm";
|
||||
const char *ConfigManager::kTransientDomain = "__TRANSIENT";
|
||||
|
||||
|
@ -29,10 +29,10 @@
|
||||
// TODO: Move gDebugLevel into namespace Common.
|
||||
int gDebugLevel = -1;
|
||||
|
||||
DECLARE_SINGLETON(Common::DebugManager);
|
||||
|
||||
namespace Common {
|
||||
|
||||
DECLARE_SINGLETON(DebugManager);
|
||||
|
||||
namespace {
|
||||
|
||||
struct DebugLevelComperator {
|
||||
|
@ -89,15 +89,13 @@ protected:
|
||||
};
|
||||
|
||||
/**
|
||||
* Note that you need to use this macro from the global namespace.
|
||||
* 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.
|
||||
* It has to be put in the global namespace to assure the correct
|
||||
* namespace Common is referenced.
|
||||
*/
|
||||
#define DECLARE_SINGLETON(T) \
|
||||
template<> T *Common::Singleton<T>::_singleton = 0
|
||||
template<> T *Singleton<T>::_singleton = 0
|
||||
|
||||
} // End of namespace Common
|
||||
|
||||
|
@ -37,10 +37,10 @@
|
||||
|
||||
#ifdef USE_TRANSLATION
|
||||
|
||||
DECLARE_SINGLETON(Common::TranslationManager);
|
||||
|
||||
namespace Common {
|
||||
|
||||
DECLARE_SINGLETON(TranslationManager);
|
||||
|
||||
bool operator<(const TLanguage &l, const TLanguage &r) {
|
||||
return strcmp(l.name, r.name) < 0;
|
||||
}
|
||||
|
@ -31,7 +31,9 @@
|
||||
#include "common/endian.h"
|
||||
#include "audio/midiparser.h"
|
||||
|
||||
namespace Common {
|
||||
DECLARE_SINGLETON(Lure::SoundManager);
|
||||
}
|
||||
|
||||
namespace Lure {
|
||||
|
||||
|
@ -34,7 +34,9 @@
|
||||
#include "sword25/gfx/animationtemplateregistry.h"
|
||||
#include "sword25/gfx/animationtemplate.h"
|
||||
|
||||
namespace Common {
|
||||
DECLARE_SINGLETON(Sword25::AnimationTemplateRegistry);
|
||||
}
|
||||
|
||||
namespace Sword25 {
|
||||
|
||||
|
@ -34,7 +34,9 @@
|
||||
#include "sword25/math/regionregistry.h"
|
||||
#include "sword25/math/region.h"
|
||||
|
||||
namespace Common {
|
||||
DECLARE_SINGLETON(Sword25::RegionRegistry);
|
||||
}
|
||||
|
||||
namespace Sword25 {
|
||||
|
||||
|
@ -50,7 +50,9 @@
|
||||
|
||||
#include "sword25/gfx/animationtemplateregistry.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
|
||||
|
||||
namespace Sword25 {
|
||||
|
@ -24,7 +24,9 @@
|
||||
|
||||
#include "testbed/config-params.h"
|
||||
|
||||
namespace Common {
|
||||
DECLARE_SINGLETON(Testbed::ConfigParams);
|
||||
}
|
||||
|
||||
namespace Testbed {
|
||||
|
||||
|
@ -24,7 +24,9 @@
|
||||
#include "common/system.h"
|
||||
#include "common/stack.h"
|
||||
|
||||
namespace Common {
|
||||
DECLARE_SINGLETON(Graphics::CursorManager);
|
||||
}
|
||||
|
||||
namespace Graphics {
|
||||
|
||||
|
@ -23,7 +23,9 @@
|
||||
#include "graphics/fontman.h"
|
||||
#include "common/translation.h"
|
||||
|
||||
namespace Common {
|
||||
DECLARE_SINGLETON(Graphics::FontManager);
|
||||
}
|
||||
|
||||
namespace Graphics {
|
||||
|
||||
|
@ -189,7 +189,9 @@ const YUVToRGBLookup *YUVToRGBManager::getLookup(Graphics::PixelFormat format) {
|
||||
|
||||
} // End of namespace Graphics
|
||||
|
||||
namespace Common {
|
||||
DECLARE_SINGLETON(Graphics::YUVToRGBManager);
|
||||
}
|
||||
|
||||
#define YUVToRGBMan (Graphics::YUVToRGBManager::instance())
|
||||
|
||||
|
@ -39,7 +39,9 @@
|
||||
|
||||
#include "graphics/cursorman.h"
|
||||
|
||||
namespace Common {
|
||||
DECLARE_SINGLETON(GUI::GuiManager);
|
||||
}
|
||||
|
||||
namespace GUI {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user