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
25 changed files with 52 additions and 14 deletions
|
@ -27,7 +27,9 @@
|
||||||
#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);
|
DECLARE_SINGLETON(DSFilesystemFactory);
|
||||||
|
}
|
||||||
|
|
||||||
AbstractFSNode *DSFilesystemFactory::makeRootFileNode() const {
|
AbstractFSNode *DSFilesystemFactory::makeRootFileNode() const {
|
||||||
if (DS::isGBAMPAvailable()) {
|
if (DS::isGBAMPAvailable()) {
|
||||||
|
|
|
@ -27,7 +27,9 @@
|
||||||
#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);
|
DECLARE_SINGLETON(Ps2FilesystemFactory);
|
||||||
|
}
|
||||||
|
|
||||||
AbstractFSNode *Ps2FilesystemFactory::makeRootFileNode() const {
|
AbstractFSNode *Ps2FilesystemFactory::makeRootFileNode() const {
|
||||||
return new Ps2FilesystemNode();
|
return new Ps2FilesystemNode();
|
||||||
|
|
|
@ -43,7 +43,9 @@
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
namespace Common {
|
||||||
DECLARE_SINGLETON(PSPFilesystemFactory);
|
DECLARE_SINGLETON(PSPFilesystemFactory);
|
||||||
|
}
|
||||||
|
|
||||||
AbstractFSNode *PSPFilesystemFactory::makeRootFileNode() const {
|
AbstractFSNode *PSPFilesystemFactory::makeRootFileNode() const {
|
||||||
return new PSPFilesystemNode();
|
return new PSPFilesystemNode();
|
||||||
|
|
|
@ -40,7 +40,9 @@
|
||||||
#include <smb.h>
|
#include <smb.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace Common {
|
||||||
DECLARE_SINGLETON(WiiFilesystemFactory);
|
DECLARE_SINGLETON(WiiFilesystemFactory);
|
||||||
|
}
|
||||||
|
|
||||||
WiiFilesystemFactory::WiiFilesystemFactory() :
|
WiiFilesystemFactory::WiiFilesystemFactory() :
|
||||||
_dvdMounted(false),
|
_dvdMounted(false),
|
||||||
|
|
|
@ -62,7 +62,9 @@ const OSystem::GraphicsMode DisplayManager::_supportedModes[] = {
|
||||||
|
|
||||||
// Class VramAllocator -----------------------------------
|
// Class VramAllocator -----------------------------------
|
||||||
|
|
||||||
|
namespace Common {
|
||||||
DECLARE_SINGLETON(VramAllocator);
|
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,7 +30,9 @@
|
||||||
//#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);
|
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() {
|
||||||
|
|
|
@ -34,7 +34,9 @@
|
||||||
|
|
||||||
|
|
||||||
// Class PspRtc ---------------------------------------------------------------
|
// Class PspRtc ---------------------------------------------------------------
|
||||||
|
namespace Common {
|
||||||
DECLARE_SINGLETON(PspRtc);
|
DECLARE_SINGLETON(PspRtc);
|
||||||
|
}
|
||||||
|
|
||||||
void PspRtc::init() { // init our starting ticks
|
void PspRtc::init() { // init our starting ticks
|
||||||
uint32 ticks[2];
|
uint32 ticks[2];
|
||||||
|
|
|
@ -29,7 +29,9 @@
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
|
||||||
|
namespace Common {
|
||||||
DECLARE_SINGLETON(ELFMemoryManager);
|
DECLARE_SINGLETON(ELFMemoryManager);
|
||||||
|
}
|
||||||
|
|
||||||
ELFMemoryManager::ELFMemoryManager() :
|
ELFMemoryManager::ELFMemoryManager() :
|
||||||
_heap(0), _heapSize(0), _heapAlign(0),
|
_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 __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
|
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
|
||||||
|
|
|
@ -540,7 +540,9 @@ void PluginManager::addToPluginsInMemList(Plugin *plugin) {
|
||||||
|
|
||||||
#include "engines/metaengine.h"
|
#include "engines/metaengine.h"
|
||||||
|
|
||||||
|
namespace Common {
|
||||||
DECLARE_SINGLETON(EngineManager);
|
DECLARE_SINGLETON(EngineManager);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function works for both cached and uncached PluginManagers.
|
* This function works for both cached and uncached PluginManagers.
|
||||||
|
@ -631,7 +633,9 @@ const EnginePlugin::List &EngineManager::getPlugins() const {
|
||||||
|
|
||||||
#include "audio/musicplugin.h"
|
#include "audio/musicplugin.h"
|
||||||
|
|
||||||
|
namespace Common {
|
||||||
DECLARE_SINGLETON(MusicManager);
|
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);
|
||||||
|
|
|
@ -27,10 +27,10 @@
|
||||||
#include "common/savefile.h"
|
#include "common/savefile.h"
|
||||||
#include "common/textconsole.h"
|
#include "common/textconsole.h"
|
||||||
|
|
||||||
DECLARE_SINGLETON(Common::EventRecorder);
|
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
|
DECLARE_SINGLETON(EventRecorder);
|
||||||
|
|
||||||
#define RECORD_SIGNATURE 0x54455354
|
#define RECORD_SIGNATURE 0x54455354
|
||||||
#define RECORD_VERSION 1
|
#define RECORD_VERSION 1
|
||||||
|
|
||||||
|
|
|
@ -285,7 +285,7 @@ void SearchManager::clear() {
|
||||||
addDirectory(".", ".", -2);
|
addDirectory(".", ".", -2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DECLARE_SINGLETON(SearchManager);
|
||||||
|
|
||||||
} // namespace Common
|
} // namespace Common
|
||||||
|
|
||||||
DECLARE_SINGLETON(Common::SearchManager);
|
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,6 @@
|
||||||
#include "common/system.h"
|
#include "common/system.h"
|
||||||
#include "common/textconsole.h"
|
#include "common/textconsole.h"
|
||||||
|
|
||||||
DECLARE_SINGLETON(Common::ConfigManager);
|
|
||||||
|
|
||||||
static bool isValidDomainName(const Common::String &domName) {
|
static bool isValidDomainName(const Common::String &domName) {
|
||||||
const char *p = domName.c_str();
|
const char *p = domName.c_str();
|
||||||
while (*p && (isalnum(static_cast<unsigned char>(*p)) || *p == '-' || *p == '_'))
|
while (*p && (isalnum(static_cast<unsigned char>(*p)) || *p == '-' || *p == '_'))
|
||||||
|
@ -38,6 +36,8 @@ static bool isValidDomainName(const Common::String &domName) {
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
|
DECLARE_SINGLETON(ConfigManager);
|
||||||
|
|
||||||
const char *ConfigManager::kApplicationDomain = "scummvm";
|
const char *ConfigManager::kApplicationDomain = "scummvm";
|
||||||
const char *ConfigManager::kTransientDomain = "__TRANSIENT";
|
const char *ConfigManager::kTransientDomain = "__TRANSIENT";
|
||||||
|
|
||||||
|
|
|
@ -29,10 +29,10 @@
|
||||||
// TODO: Move gDebugLevel into namespace Common.
|
// TODO: Move gDebugLevel into namespace Common.
|
||||||
int gDebugLevel = -1;
|
int gDebugLevel = -1;
|
||||||
|
|
||||||
DECLARE_SINGLETON(Common::DebugManager);
|
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
|
DECLARE_SINGLETON(DebugManager);
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
struct DebugLevelComperator {
|
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
|
* This is because C++ requires initial explicit specialization
|
||||||
* to be placed in the same namespace as the template.
|
* 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) \
|
#define DECLARE_SINGLETON(T) \
|
||||||
template<> T *Common::Singleton<T>::_singleton = 0
|
template<> T *Singleton<T>::_singleton = 0
|
||||||
|
|
||||||
} // End of namespace Common
|
} // End of namespace Common
|
||||||
|
|
||||||
|
|
|
@ -37,10 +37,10 @@
|
||||||
|
|
||||||
#ifdef USE_TRANSLATION
|
#ifdef USE_TRANSLATION
|
||||||
|
|
||||||
DECLARE_SINGLETON(Common::TranslationManager);
|
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,9 @@
|
||||||
#include "common/endian.h"
|
#include "common/endian.h"
|
||||||
#include "audio/midiparser.h"
|
#include "audio/midiparser.h"
|
||||||
|
|
||||||
|
namespace Common {
|
||||||
DECLARE_SINGLETON(Lure::SoundManager);
|
DECLARE_SINGLETON(Lure::SoundManager);
|
||||||
|
}
|
||||||
|
|
||||||
namespace Lure {
|
namespace Lure {
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,9 @@
|
||||||
#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);
|
DECLARE_SINGLETON(Sword25::AnimationTemplateRegistry);
|
||||||
|
}
|
||||||
|
|
||||||
namespace Sword25 {
|
namespace Sword25 {
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,9 @@
|
||||||
#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);
|
DECLARE_SINGLETON(Sword25::RegionRegistry);
|
||||||
|
}
|
||||||
|
|
||||||
namespace Sword25 {
|
namespace Sword25 {
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,9 @@
|
||||||
|
|
||||||
#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);
|
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 {
|
||||||
|
|
|
@ -24,7 +24,9 @@
|
||||||
|
|
||||||
#include "testbed/config-params.h"
|
#include "testbed/config-params.h"
|
||||||
|
|
||||||
|
namespace Common {
|
||||||
DECLARE_SINGLETON(Testbed::ConfigParams);
|
DECLARE_SINGLETON(Testbed::ConfigParams);
|
||||||
|
}
|
||||||
|
|
||||||
namespace Testbed {
|
namespace Testbed {
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,9 @@
|
||||||
#include "common/system.h"
|
#include "common/system.h"
|
||||||
#include "common/stack.h"
|
#include "common/stack.h"
|
||||||
|
|
||||||
|
namespace Common {
|
||||||
DECLARE_SINGLETON(Graphics::CursorManager);
|
DECLARE_SINGLETON(Graphics::CursorManager);
|
||||||
|
}
|
||||||
|
|
||||||
namespace Graphics {
|
namespace Graphics {
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,9 @@
|
||||||
#include "graphics/fontman.h"
|
#include "graphics/fontman.h"
|
||||||
#include "common/translation.h"
|
#include "common/translation.h"
|
||||||
|
|
||||||
|
namespace Common {
|
||||||
DECLARE_SINGLETON(Graphics::FontManager);
|
DECLARE_SINGLETON(Graphics::FontManager);
|
||||||
|
}
|
||||||
|
|
||||||
namespace Graphics {
|
namespace Graphics {
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,9 @@ const YUVToRGBLookup *YUVToRGBManager::getLookup(Graphics::PixelFormat format) {
|
||||||
|
|
||||||
} // End of namespace Graphics
|
} // End of namespace Graphics
|
||||||
|
|
||||||
|
namespace Common {
|
||||||
DECLARE_SINGLETON(Graphics::YUVToRGBManager);
|
DECLARE_SINGLETON(Graphics::YUVToRGBManager);
|
||||||
|
}
|
||||||
|
|
||||||
#define YUVToRGBMan (Graphics::YUVToRGBManager::instance())
|
#define YUVToRGBMan (Graphics::YUVToRGBManager::instance())
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,9 @@
|
||||||
|
|
||||||
#include "graphics/cursorman.h"
|
#include "graphics/cursorman.h"
|
||||||
|
|
||||||
|
namespace Common {
|
||||||
DECLARE_SINGLETON(GUI::GuiManager);
|
DECLARE_SINGLETON(GUI::GuiManager);
|
||||||
|
}
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue