[Scummvm-cvs-logs] scummvm master -> aa0f307e06e5aae3b12f9f15b350dc81b30d61de

salty-horse ori at avtalion.name
Thu Jun 30 21:44:24 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
aa0f307e06 ALL: Require DECLARE_SINGLETON to be used in the Common namepsace


Commit: aa0f307e06e5aae3b12f9f15b350dc81b30d61de
    https://github.com/scummvm/scummvm/commit/aa0f307e06e5aae3b12f9f15b350dc81b30d61de
Author: Ori Avtalion (ori at avtalion.name)
Date: 2011-06-30T12:41:41-07:00

Commit Message:
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.

Changed paths:
    backends/fs/ds/ds-fs-factory.cpp
    backends/fs/ps2/ps2-fs-factory.cpp
    backends/fs/psp/psp-fs-factory.cpp
    backends/fs/wii/wii-fs-factory.cpp
    backends/platform/psp/display_manager.cpp
    backends/platform/psp/powerman.cpp
    backends/platform/psp/rtc.cpp
    backends/plugins/elf/memory-manager.cpp
    backends/plugins/elf/shorts-segment-manager.cpp
    base/plugins.cpp
    common/EventRecorder.cpp
    common/archive.cpp
    common/config-manager.cpp
    common/debug.cpp
    common/singleton.h
    common/translation.cpp
    engines/lure/sound.cpp
    engines/sword25/gfx/animationtemplateregistry.cpp
    engines/sword25/math/regionregistry.cpp
    engines/sword25/sword25.cpp
    engines/testbed/config-params.cpp
    graphics/cursorman.cpp
    graphics/fontman.cpp
    graphics/yuv_to_rgb.cpp
    gui/gui-manager.cpp



diff --git a/backends/fs/ds/ds-fs-factory.cpp b/backends/fs/ds/ds-fs-factory.cpp
index 3fd97d0..4e09c34 100644
--- a/backends/fs/ds/ds-fs-factory.cpp
+++ b/backends/fs/ds/ds-fs-factory.cpp
@@ -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()) {
diff --git a/backends/fs/ps2/ps2-fs-factory.cpp b/backends/fs/ps2/ps2-fs-factory.cpp
index cad92b5..ef7b201 100644
--- a/backends/fs/ps2/ps2-fs-factory.cpp
+++ b/backends/fs/ps2/ps2-fs-factory.cpp
@@ -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();
diff --git a/backends/fs/psp/psp-fs-factory.cpp b/backends/fs/psp/psp-fs-factory.cpp
index ef1df24..bb3aca8 100644
--- a/backends/fs/psp/psp-fs-factory.cpp
+++ b/backends/fs/psp/psp-fs-factory.cpp
@@ -43,7 +43,9 @@
 
 #include <unistd.h>
 
+namespace Common {
 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 34cde8e..fbc9ef1 100644
--- a/backends/fs/wii/wii-fs-factory.cpp
+++ b/backends/fs/wii/wii-fs-factory.cpp
@@ -40,7 +40,9 @@
 #include <smb.h>
 #endif
 
+namespace Common {
 DECLARE_SINGLETON(WiiFilesystemFactory);
+}
 
 WiiFilesystemFactory::WiiFilesystemFactory() :
 	_dvdMounted(false),
diff --git a/backends/platform/psp/display_manager.cpp b/backends/platform/psp/display_manager.cpp
index e945dca..4228057 100644
--- a/backends/platform/psp/display_manager.cpp
+++ b/backends/platform/psp/display_manager.cpp
@@ -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__
diff --git a/backends/platform/psp/powerman.cpp b/backends/platform/psp/powerman.cpp
index fe9dcfa..b72d058 100644
--- a/backends/platform/psp/powerman.cpp
+++ b/backends/platform/psp/powerman.cpp
@@ -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() {
diff --git a/backends/platform/psp/rtc.cpp b/backends/platform/psp/rtc.cpp
index 3d6d429..6c8e919 100644
--- a/backends/platform/psp/rtc.cpp
+++ b/backends/platform/psp/rtc.cpp
@@ -34,7 +34,9 @@
 
 
 // Class PspRtc ---------------------------------------------------------------
+namespace Common {
 DECLARE_SINGLETON(PspRtc);
+}
 
 void PspRtc::init() {						// init our starting ticks
 	uint32 ticks[2];
diff --git a/backends/plugins/elf/memory-manager.cpp b/backends/plugins/elf/memory-manager.cpp
index 02669b3..058d818 100644
--- a/backends/plugins/elf/memory-manager.cpp
+++ b/backends/plugins/elf/memory-manager.cpp
@@ -29,7 +29,9 @@
 #include "common/util.h"
 #include <malloc.h>
 
+namespace Common {
 DECLARE_SINGLETON(ELFMemoryManager);
+}
 
 ELFMemoryManager::ELFMemoryManager() :
 	_heap(0), _heapSize(0), _heapAlign(0),
diff --git a/backends/plugins/elf/shorts-segment-manager.cpp b/backends/plugins/elf/shorts-segment-manager.cpp
index b3a9531..caa328a 100644
--- a/backends/plugins/elf/shorts-segment-manager.cpp
+++ b/backends/plugins/elf/shorts-segment-manager.cpp
@@ -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
diff --git a/base/plugins.cpp b/base/plugins.cpp
index 4c2fd2c..4413995 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -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);
diff --git a/common/EventRecorder.cpp b/common/EventRecorder.cpp
index eb22e1e..4441070 100644
--- a/common/EventRecorder.cpp
+++ b/common/EventRecorder.cpp
@@ -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
 
diff --git a/common/archive.cpp b/common/archive.cpp
index 0ef3893..102d7aa 100644
--- a/common/archive.cpp
+++ b/common/archive.cpp
@@ -285,7 +285,7 @@ void SearchManager::clear() {
 	addDirectory(".", ".", -2);
 }
 
-} // namespace Common
+DECLARE_SINGLETON(SearchManager);
 
-DECLARE_SINGLETON(Common::SearchManager);
+} // namespace Common
 
diff --git a/common/config-manager.cpp b/common/config-manager.cpp
index a9d8c89..fbdb611 100644
--- a/common/config-manager.cpp
+++ b/common/config-manager.cpp
@@ -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";
 
diff --git a/common/debug.cpp b/common/debug.cpp
index 0dae344..50f9975 100644
--- a/common/debug.cpp
+++ b/common/debug.cpp
@@ -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 {
diff --git a/common/singleton.h b/common/singleton.h
index 2f5fa41..43f1c0c 100644
--- a/common/singleton.h
+++ b/common/singleton.h
@@ -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
 
diff --git a/common/translation.cpp b/common/translation.cpp
index e456f73..5c8a043 100644
--- a/common/translation.cpp
+++ b/common/translation.cpp
@@ -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;
 }
diff --git a/engines/lure/sound.cpp b/engines/lure/sound.cpp
index cf28e0b..85b86a8 100644
--- a/engines/lure/sound.cpp
+++ b/engines/lure/sound.cpp
@@ -31,7 +31,9 @@
 #include "common/endian.h"
 #include "audio/midiparser.h"
 
+namespace Common {
 DECLARE_SINGLETON(Lure::SoundManager);
+}
 
 namespace Lure {
 
diff --git a/engines/sword25/gfx/animationtemplateregistry.cpp b/engines/sword25/gfx/animationtemplateregistry.cpp
index 43c099c..8184b49 100644
--- a/engines/sword25/gfx/animationtemplateregistry.cpp
+++ b/engines/sword25/gfx/animationtemplateregistry.cpp
@@ -34,7 +34,9 @@
 #include "sword25/gfx/animationtemplateregistry.h"
 #include "sword25/gfx/animationtemplate.h"
 
+namespace Common {
 DECLARE_SINGLETON(Sword25::AnimationTemplateRegistry);
+}
 
 namespace Sword25 {
 
diff --git a/engines/sword25/math/regionregistry.cpp b/engines/sword25/math/regionregistry.cpp
index dff8560..68c360a 100644
--- a/engines/sword25/math/regionregistry.cpp
+++ b/engines/sword25/math/regionregistry.cpp
@@ -34,7 +34,9 @@
 #include "sword25/math/regionregistry.h"
 #include "sword25/math/region.h"
 
+namespace Common {
 DECLARE_SINGLETON(Sword25::RegionRegistry);
+}
 
 namespace Sword25 {
 
diff --git a/engines/sword25/sword25.cpp b/engines/sword25/sword25.cpp
index b111746..2201188 100644
--- a/engines/sword25/sword25.cpp
+++ b/engines/sword25/sword25.cpp
@@ -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 {
diff --git a/engines/testbed/config-params.cpp b/engines/testbed/config-params.cpp
index 9a50621..d7ead48 100644
--- a/engines/testbed/config-params.cpp
+++ b/engines/testbed/config-params.cpp
@@ -24,7 +24,9 @@
 
 #include "testbed/config-params.h"
 
+namespace Common {
 DECLARE_SINGLETON(Testbed::ConfigParams);
+}
 
 namespace Testbed {
 
diff --git a/graphics/cursorman.cpp b/graphics/cursorman.cpp
index a549890..1d4e482 100644
--- a/graphics/cursorman.cpp
+++ b/graphics/cursorman.cpp
@@ -24,7 +24,9 @@
 #include "common/system.h"
 #include "common/stack.h"
 
+namespace Common {
 DECLARE_SINGLETON(Graphics::CursorManager);
+}
 
 namespace Graphics {
 
diff --git a/graphics/fontman.cpp b/graphics/fontman.cpp
index f40cf97..d1da550 100644
--- a/graphics/fontman.cpp
+++ b/graphics/fontman.cpp
@@ -23,7 +23,9 @@
 #include "graphics/fontman.h"
 #include "common/translation.h"
 
+namespace Common {
 DECLARE_SINGLETON(Graphics::FontManager);
+}
 
 namespace Graphics {
 
diff --git a/graphics/yuv_to_rgb.cpp b/graphics/yuv_to_rgb.cpp
index 037ea9a..bdc4810 100644
--- a/graphics/yuv_to_rgb.cpp
+++ b/graphics/yuv_to_rgb.cpp
@@ -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())
 
diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index af1852d..212d684 100644
--- a/gui/gui-manager.cpp
+++ b/gui/gui-manager.cpp
@@ -39,7 +39,9 @@
 
 #include "graphics/cursorman.h"
 
+namespace Common {
 DECLARE_SINGLETON(GUI::GuiManager);
+}
 
 namespace GUI {
 






More information about the Scummvm-git-logs mailing list