From abe1959d36816b6c0703c1c3802764818585d0b6 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 16 Nov 2010 08:23:13 +0000 Subject: COMMON: Simplify DECLARE_SINGLETON macro This makes it possible to write DECLARE_SINGLETON(foo); instead of DECLARE_SINGLETON(foo) without causing a warning about an extra semicolon. The extra semicolon helps some editors at parsing the C++ code. svn-id: r54258 --- backends/fs/ds/ds-fs-factory.cpp | 2 +- backends/fs/ps2/ps2-fs-factory.cpp | 2 +- backends/fs/psp/psp-fs-factory.cpp | 2 +- backends/fs/wii/wii-fs-factory.cpp | 2 +- backends/platform/psp/display_manager.cpp | 2 +- backends/platform/psp/powerman.cpp | 2 +- backends/platform/psp/rtc.cpp | 2 +- base/plugins.cpp | 6 +++--- common/EventRecorder.cpp | 2 +- common/archive.cpp | 2 +- common/config-manager.cpp | 2 +- common/debug.cpp | 2 +- common/singleton.h | 4 +--- common/translation.cpp | 2 +- engines/lure/sound.cpp | 2 +- engines/sword25/gfx/animationtemplateregistry.cpp | 2 +- engines/sword25/gfx/renderobjectregistry.cpp | 2 +- engines/sword25/math/regionregistry.cpp | 2 +- engines/testbed/config-params.cpp | 2 +- graphics/cursorman.cpp | 2 +- graphics/font.h | 4 ++-- graphics/fontman.cpp | 15 +++++++-------- gui/GuiManager.cpp | 2 +- 23 files changed, 32 insertions(+), 35 deletions(-) diff --git a/backends/fs/ds/ds-fs-factory.cpp b/backends/fs/ds/ds-fs-factory.cpp index 4919c04174..0dfa70b716 100644 --- a/backends/fs/ds/ds-fs-factory.cpp +++ b/backends/fs/ds/ds-fs-factory.cpp @@ -27,7 +27,7 @@ #include "backends/fs/ds/ds-fs.h" #include "dsmain.h" //for the isGBAMPAvailable() function -DECLARE_SINGLETON(DSFilesystemFactory) +DECLARE_SINGLETON(DSFilesystemFactory); AbstractFSNode *DSFilesystemFactory::makeRootFileNode() const { if (DS::isGBAMPAvailable()) { diff --git a/backends/fs/ps2/ps2-fs-factory.cpp b/backends/fs/ps2/ps2-fs-factory.cpp index 05c18c8a7f..8b5202bff4 100644 --- a/backends/fs/ps2/ps2-fs-factory.cpp +++ b/backends/fs/ps2/ps2-fs-factory.cpp @@ -30,7 +30,7 @@ #include "backends/fs/ps2/ps2-fs-factory.h" #include "backends/fs/ps2/ps2-fs.cpp" -DECLARE_SINGLETON(Ps2FilesystemFactory) +DECLARE_SINGLETON(Ps2FilesystemFactory); AbstractFSNode *Ps2FilesystemFactory::makeRootFileNode() const { return new Ps2FilesystemNode(); diff --git a/backends/fs/psp/psp-fs-factory.cpp b/backends/fs/psp/psp-fs-factory.cpp index 7a22954919..7ed84de034 100644 --- a/backends/fs/psp/psp-fs-factory.cpp +++ b/backends/fs/psp/psp-fs-factory.cpp @@ -26,7 +26,7 @@ #include "backends/fs/psp/psp-fs-factory.h" #include "backends/fs/psp/psp-fs.cpp" -DECLARE_SINGLETON(PSPFilesystemFactory) +DECLARE_SINGLETON(PSPFilesystemFactory); AbstractFSNode *PSPFilesystemFactory::makeRootFileNode() const { return new PSPFilesystemNode(); diff --git a/backends/fs/wii/wii-fs-factory.cpp b/backends/fs/wii/wii-fs-factory.cpp index 2e8051029d..6a11d7d12e 100644 --- a/backends/fs/wii/wii-fs-factory.cpp +++ b/backends/fs/wii/wii-fs-factory.cpp @@ -37,7 +37,7 @@ #include #endif -DECLARE_SINGLETON(WiiFilesystemFactory) +DECLARE_SINGLETON(WiiFilesystemFactory); WiiFilesystemFactory::WiiFilesystemFactory() : _dvdMounted(false), diff --git a/backends/platform/psp/display_manager.cpp b/backends/platform/psp/display_manager.cpp index 2c94882a63..6d2c92c474 100644 --- a/backends/platform/psp/display_manager.cpp +++ b/backends/platform/psp/display_manager.cpp @@ -63,7 +63,7 @@ const OSystem::GraphicsMode DisplayManager::_supportedModes[] = { // Class VramAllocator ----------------------------------- -DECLARE_SINGLETON(VramAllocator) +DECLARE_SINGLETON(VramAllocator); //#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */ //#define __PSP_DEBUG_PRINT__ diff --git a/backends/platform/psp/powerman.cpp b/backends/platform/psp/powerman.cpp index 869d9b3023..f00a2c0fde 100644 --- a/backends/platform/psp/powerman.cpp +++ b/backends/platform/psp/powerman.cpp @@ -33,7 +33,7 @@ //#define __PSP_DEBUG_PRINT__ #include "backends/platform/psp/trace.h" -DECLARE_SINGLETON(PowerManager) +DECLARE_SINGLETON(PowerManager); // Function to debug the Power Manager (we have no output to screen) inline void PowerManager::debugPM() { diff --git a/backends/platform/psp/rtc.cpp b/backends/platform/psp/rtc.cpp index f26e5770a6..976a5aa3ec 100644 --- a/backends/platform/psp/rtc.cpp +++ b/backends/platform/psp/rtc.cpp @@ -37,7 +37,7 @@ // Class PspRtc --------------------------------------------------------------- -DECLARE_SINGLETON(PspRtc) +DECLARE_SINGLETON(PspRtc); void PspRtc::init() { // init our starting ticks uint32 ticks[2]; diff --git a/base/plugins.cpp b/base/plugins.cpp index 41e213a53a..e881944a1b 100644 --- a/base/plugins.cpp +++ b/base/plugins.cpp @@ -300,7 +300,7 @@ void FilePluginProvider::addCustomDirectories(Common::FSList &dirs) const { #pragma mark - -DECLARE_SINGLETON(PluginManager) +DECLARE_SINGLETON(PluginManager); PluginManager::PluginManager() { // Always add the static plugin provider. @@ -450,7 +450,7 @@ void PluginManager::addToPluginsInMemList(Plugin *plugin) { #include "engines/metaengine.h" -DECLARE_SINGLETON(EngineManager) +DECLARE_SINGLETON(EngineManager); GameDescriptor EngineManager::findGameOnePluginAtATime(const Common::String &gameName, const EnginePlugin **plugin) const { GameDescriptor result; @@ -514,7 +514,7 @@ const EnginePlugin::List &EngineManager::getPlugins() const { #include "sound/musicplugin.h" -DECLARE_SINGLETON(MusicManager) +DECLARE_SINGLETON(MusicManager); const MusicPlugin::List &MusicManager::getPlugins() const { return (const MusicPlugin::List &)PluginManager::instance().getPlugins(PLUGIN_TYPE_MUSIC); diff --git a/common/EventRecorder.cpp b/common/EventRecorder.cpp index 8d9856e45a..2ce57b8502 100644 --- a/common/EventRecorder.cpp +++ b/common/EventRecorder.cpp @@ -28,7 +28,7 @@ #include "common/config-manager.h" #include "common/random.h" -DECLARE_SINGLETON(Common::EventRecorder) +DECLARE_SINGLETON(Common::EventRecorder); namespace Common { diff --git a/common/archive.cpp b/common/archive.cpp index fe62355b8a..c65408b56e 100644 --- a/common/archive.cpp +++ b/common/archive.cpp @@ -290,5 +290,5 @@ void SearchManager::clear() { } // namespace Common -DECLARE_SINGLETON(Common::SearchManager) +DECLARE_SINGLETON(Common::SearchManager); diff --git a/common/config-manager.cpp b/common/config-manager.cpp index 67cb74d9eb..0141b22483 100644 --- a/common/config-manager.cpp +++ b/common/config-manager.cpp @@ -29,7 +29,7 @@ #include "common/util.h" #include "common/system.h" -DECLARE_SINGLETON(Common::ConfigManager) +DECLARE_SINGLETON(Common::ConfigManager); static bool isValidDomainName(const Common::String &domName) { const char *p = domName.c_str(); diff --git a/common/debug.cpp b/common/debug.cpp index 46f8e8b829..890648d4ec 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -51,7 +51,7 @@ // TODO: Move gDebugLevel into namespace Common. int gDebugLevel = -1; -DECLARE_SINGLETON(Common::DebugManager) +DECLARE_SINGLETON(Common::DebugManager); namespace Common { diff --git a/common/singleton.h b/common/singleton.h index 4ef871b173..33e943f162 100644 --- a/common/singleton.h +++ b/common/singleton.h @@ -101,9 +101,7 @@ protected: * namespace Common is referenced. */ #define DECLARE_SINGLETON(T) \ - namespace Common { \ - template<> T *Singleton::_singleton = 0; \ - } // End of namespace Common + template<> T *Common::Singleton::_singleton = 0 } // End of namespace Common diff --git a/common/translation.cpp b/common/translation.cpp index 70dac7a318..08b0431865 100644 --- a/common/translation.cpp +++ b/common/translation.cpp @@ -35,7 +35,7 @@ #include "common/archive.h" #include "common/config-manager.h" -DECLARE_SINGLETON(Common::TranslationManager) +DECLARE_SINGLETON(Common::TranslationManager); #ifdef USE_DETECTLANG #ifndef WIN32 diff --git a/engines/lure/sound.cpp b/engines/lure/sound.cpp index ca15ad8287..85beba8447 100644 --- a/engines/lure/sound.cpp +++ b/engines/lure/sound.cpp @@ -34,7 +34,7 @@ #include "common/endian.h" #include "sound/midiparser.h" -DECLARE_SINGLETON(Lure::SoundManager) +DECLARE_SINGLETON(Lure::SoundManager); namespace Lure { diff --git a/engines/sword25/gfx/animationtemplateregistry.cpp b/engines/sword25/gfx/animationtemplateregistry.cpp index ac1d6096f4..2245090f8f 100644 --- a/engines/sword25/gfx/animationtemplateregistry.cpp +++ b/engines/sword25/gfx/animationtemplateregistry.cpp @@ -39,7 +39,7 @@ #include "sword25/gfx/animationtemplateregistry.h" #include "sword25/gfx/animationtemplate.h" -DECLARE_SINGLETON(Sword25::AnimationTemplateRegistry) +DECLARE_SINGLETON(Sword25::AnimationTemplateRegistry); namespace Sword25 { diff --git a/engines/sword25/gfx/renderobjectregistry.cpp b/engines/sword25/gfx/renderobjectregistry.cpp index c52e2f1a45..8f55cf65a9 100644 --- a/engines/sword25/gfx/renderobjectregistry.cpp +++ b/engines/sword25/gfx/renderobjectregistry.cpp @@ -34,7 +34,7 @@ #include "sword25/gfx/renderobjectregistry.h" -DECLARE_SINGLETON(Sword25::RenderObjectRegistry) +DECLARE_SINGLETON(Sword25::RenderObjectRegistry); namespace Sword25 { diff --git a/engines/sword25/math/regionregistry.cpp b/engines/sword25/math/regionregistry.cpp index 40909aebad..c1fd6e98a8 100644 --- a/engines/sword25/math/regionregistry.cpp +++ b/engines/sword25/math/regionregistry.cpp @@ -39,7 +39,7 @@ #include "sword25/math/regionregistry.h" #include "sword25/math/region.h" -DECLARE_SINGLETON(Sword25::RegionRegistry) +DECLARE_SINGLETON(Sword25::RegionRegistry); namespace Sword25 { diff --git a/engines/testbed/config-params.cpp b/engines/testbed/config-params.cpp index e5a581ec29..c9f3932539 100644 --- a/engines/testbed/config-params.cpp +++ b/engines/testbed/config-params.cpp @@ -27,7 +27,7 @@ #include "testbed/config-params.h" -DECLARE_SINGLETON(Testbed::ConfigParams) +DECLARE_SINGLETON(Testbed::ConfigParams); namespace Testbed { diff --git a/graphics/cursorman.cpp b/graphics/cursorman.cpp index 35e771b2f4..fe90545280 100644 --- a/graphics/cursorman.cpp +++ b/graphics/cursorman.cpp @@ -27,7 +27,7 @@ #include "common/system.h" #include "common/stack.h" -DECLARE_SINGLETON(Graphics::CursorManager) +DECLARE_SINGLETON(Graphics::CursorManager); namespace Graphics { diff --git a/graphics/font.h b/graphics/font.h index 0e65e9418c..101fd6eac6 100644 --- a/graphics/font.h +++ b/graphics/font.h @@ -149,10 +149,10 @@ public: #define FORWARD_DECLARE_FONT(n) \ extern const NewFont *n; \ - extern void create_##n(); + extern void create_##n() #define INIT_FONT(n) \ - create_##n(); + create_##n() } // End of namespace Graphics diff --git a/graphics/fontman.cpp b/graphics/fontman.cpp index c6972cfaab..35ea14b199 100644 --- a/graphics/fontman.cpp +++ b/graphics/fontman.cpp @@ -23,16 +23,15 @@ */ #include "graphics/fontman.h" -//#include "gui/consolefont.h" -DECLARE_SINGLETON(Graphics::FontManager) +DECLARE_SINGLETON(Graphics::FontManager); namespace Graphics { const ScummFont *g_scummfont = 0; -FORWARD_DECLARE_FONT(g_sysfont) -FORWARD_DECLARE_FONT(g_sysfont_big) -FORWARD_DECLARE_FONT(g_consolefont) +FORWARD_DECLARE_FONT(g_sysfont); +FORWARD_DECLARE_FONT(g_sysfont_big); +FORWARD_DECLARE_FONT(g_consolefont); FontManager::FontManager() { // This assert should *never* trigger, because @@ -41,9 +40,9 @@ FontManager::FontManager() { // reset to 0 in the desctructor of this class). assert(g_scummfont == 0); g_scummfont = new ScummFont; - INIT_FONT(g_sysfont) - INIT_FONT(g_sysfont_big) - INIT_FONT(g_consolefont) + INIT_FONT(g_sysfont); + INIT_FONT(g_sysfont_big); + INIT_FONT(g_consolefont); } FontManager::~FontManager() { diff --git a/gui/GuiManager.cpp b/gui/GuiManager.cpp index a2a8654bf6..22a69f1ee5 100644 --- a/gui/GuiManager.cpp +++ b/gui/GuiManager.cpp @@ -39,7 +39,7 @@ #include "graphics/cursorman.h" -DECLARE_SINGLETON(GUI::GuiManager) +DECLARE_SINGLETON(GUI::GuiManager); namespace GUI { -- cgit v1.2.3