[Scummvm-cvs-logs] SF.net SVN: scummvm:[48254] scummvm/trunk

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sat Mar 13 22:55:52 CET 2010


Revision: 48254
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48254&view=rev
Author:   lordhoto
Date:     2010-03-13 21:55:49 +0000 (Sat, 13 Mar 2010)

Log Message:
-----------
Fix our DECLARE_SINGLETON macro to conform to the C++ specs.

We need to use a namespace Common { } there to make strict C++ compilers
like clang++ and comeau happy. I also added a slight comment about why
that is needed to the macro definition and a note that you need to use
it from the global namespace.

Modified Paths:
--------------
    scummvm/trunk/backends/fs/palmos/palmos-fs-factory.cpp
    scummvm/trunk/backends/fs/ps2/ps2-fs-factory.cpp
    scummvm/trunk/backends/fs/psp/psp-fs-factory.cpp
    scummvm/trunk/backends/fs/wii/wii-fs-factory.cpp
    scummvm/trunk/backends/platform/psp/powerman.cpp
    scummvm/trunk/backends/platform/psp/psploader.cpp
    scummvm/trunk/base/plugins.cpp
    scummvm/trunk/common/EventRecorder.cpp
    scummvm/trunk/common/archive.cpp
    scummvm/trunk/common/config-manager.cpp
    scummvm/trunk/common/singleton.h
    scummvm/trunk/engines/lure/sound.cpp
    scummvm/trunk/graphics/cursorman.cpp
    scummvm/trunk/graphics/fontman.cpp
    scummvm/trunk/gui/GuiManager.cpp
    scummvm/trunk/sound/audiocd.cpp

Modified: scummvm/trunk/backends/fs/palmos/palmos-fs-factory.cpp
===================================================================
--- scummvm/trunk/backends/fs/palmos/palmos-fs-factory.cpp	2010-03-13 19:45:49 UTC (rev 48253)
+++ scummvm/trunk/backends/fs/palmos/palmos-fs-factory.cpp	2010-03-13 21:55:49 UTC (rev 48254)
@@ -26,7 +26,7 @@
 #include "backends/fs/palmos/palmos-fs-factory.h"
 #include "backends/fs/palmos/palmos-fs.cpp"
 
-DECLARE_SINGLETON(PalmOSFilesystemFactory);
+DECLARE_SINGLETON(PalmOSFilesystemFactory)
 
 AbstractFSNode *PalmOSFilesystemFactory::makeRootFileNode() const {
 	return new PalmOSFilesystemNode();

Modified: scummvm/trunk/backends/fs/ps2/ps2-fs-factory.cpp
===================================================================
--- scummvm/trunk/backends/fs/ps2/ps2-fs-factory.cpp	2010-03-13 19:45:49 UTC (rev 48253)
+++ scummvm/trunk/backends/fs/ps2/ps2-fs-factory.cpp	2010-03-13 21:55:49 UTC (rev 48254)
@@ -26,7 +26,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();

Modified: scummvm/trunk/backends/fs/psp/psp-fs-factory.cpp
===================================================================
--- scummvm/trunk/backends/fs/psp/psp-fs-factory.cpp	2010-03-13 19:45:49 UTC (rev 48253)
+++ scummvm/trunk/backends/fs/psp/psp-fs-factory.cpp	2010-03-13 21:55:49 UTC (rev 48254)
@@ -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();

Modified: scummvm/trunk/backends/fs/wii/wii-fs-factory.cpp
===================================================================
--- scummvm/trunk/backends/fs/wii/wii-fs-factory.cpp	2010-03-13 19:45:49 UTC (rev 48253)
+++ scummvm/trunk/backends/fs/wii/wii-fs-factory.cpp	2010-03-13 21:55:49 UTC (rev 48254)
@@ -36,7 +36,7 @@
 #include <smb.h>
 #endif
 
-DECLARE_SINGLETON(WiiFilesystemFactory);
+DECLARE_SINGLETON(WiiFilesystemFactory)
 
 WiiFilesystemFactory::WiiFilesystemFactory() :
 	_dvdMounted(false),

Modified: scummvm/trunk/backends/platform/psp/powerman.cpp
===================================================================
--- scummvm/trunk/backends/platform/psp/powerman.cpp	2010-03-13 19:45:49 UTC (rev 48253)
+++ scummvm/trunk/backends/platform/psp/powerman.cpp	2010-03-13 21:55:49 UTC (rev 48254)
@@ -30,7 +30,7 @@
 #include "./trace.h"
 #include "engine.h"
 
-DECLARE_SINGLETON(PowerManager);
+DECLARE_SINGLETON(PowerManager)
 
 #ifdef __PSP_DEBUG_SUSPEND__
 void PowerManager::debugPM() {

Modified: scummvm/trunk/backends/platform/psp/psploader.cpp
===================================================================
--- scummvm/trunk/backends/platform/psp/psploader.cpp	2010-03-13 19:45:49 UTC (rev 48253)
+++ scummvm/trunk/backends/platform/psp/psploader.cpp	2010-03-13 21:55:49 UTC (rev 48254)
@@ -51,7 +51,7 @@
 extern char __plugin_hole_end;		// Indicates end of hole in program file
 extern char _gp[];			// Value of gp register
 
-DECLARE_SINGLETON(ShortSegmentManager);	// For singleton
+DECLARE_SINGLETON(ShortSegmentManager)	// For singleton
 
 // Get rid of symbol table in memory
 void DLObject::discard_symtab() {

Modified: scummvm/trunk/base/plugins.cpp
===================================================================
--- scummvm/trunk/base/plugins.cpp	2010-03-13 19:45:49 UTC (rev 48253)
+++ scummvm/trunk/base/plugins.cpp	2010-03-13 21:55:49 UTC (rev 48254)
@@ -283,7 +283,7 @@
 
 #pragma mark -
 
-DECLARE_SINGLETON(PluginManager);
+DECLARE_SINGLETON(PluginManager)
 
 PluginManager::PluginManager() {
 	// Always add the static plugin provider.
@@ -375,7 +375,7 @@
 
 #include "engines/metaengine.h"
 
-DECLARE_SINGLETON(EngineManager);
+DECLARE_SINGLETON(EngineManager)
 
 GameDescriptor EngineManager::findGame(const Common::String &gameName, const EnginePlugin **plugin) const {
 	// Find the GameDescriptor for this target
@@ -421,7 +421,7 @@
 
 #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);

Modified: scummvm/trunk/common/EventRecorder.cpp
===================================================================
--- scummvm/trunk/common/EventRecorder.cpp	2010-03-13 19:45:49 UTC (rev 48253)
+++ scummvm/trunk/common/EventRecorder.cpp	2010-03-13 21:55:49 UTC (rev 48254)
@@ -27,7 +27,7 @@
 
 #include "common/config-manager.h"
 
-DECLARE_SINGLETON(Common::EventRecorder);
+DECLARE_SINGLETON(Common::EventRecorder)
 
 namespace Common {
 

Modified: scummvm/trunk/common/archive.cpp
===================================================================
--- scummvm/trunk/common/archive.cpp	2010-03-13 19:45:49 UTC (rev 48253)
+++ scummvm/trunk/common/archive.cpp	2010-03-13 21:55:49 UTC (rev 48254)
@@ -270,8 +270,6 @@
 }
 
 
-DECLARE_SINGLETON(SearchManager);
-
 SearchManager::SearchManager() {
 	clear();	// Force a reset
 }
@@ -291,3 +289,6 @@
 }
 
 } // namespace Common
+
+DECLARE_SINGLETON(Common::SearchManager)
+

Modified: scummvm/trunk/common/config-manager.cpp
===================================================================
--- scummvm/trunk/common/config-manager.cpp	2010-03-13 19:45:49 UTC (rev 48253)
+++ scummvm/trunk/common/config-manager.cpp	2010-03-13 21:55:49 UTC (rev 48254)
@@ -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();

Modified: scummvm/trunk/common/singleton.h
===================================================================
--- scummvm/trunk/common/singleton.h	2010-03-13 19:45:49 UTC (rev 48253)
+++ scummvm/trunk/common/singleton.h	2010-03-13 21:55:49 UTC (rev 48254)
@@ -91,7 +91,18 @@
 	typedef T	SingletonBaseType;
 };
 
-#define DECLARE_SINGLETON(T) template<> T *Common::Singleton<T>::_singleton = 0
+/**
+ * Note that you need to use this macro from the global 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) \
+	namespace Common { \
+	template<> T *Singleton<T>::_singleton = 0; \
+	} // End of namespace Common
 
 }	// End of namespace Common
 

Modified: scummvm/trunk/engines/lure/sound.cpp
===================================================================
--- scummvm/trunk/engines/lure/sound.cpp	2010-03-13 19:45:49 UTC (rev 48253)
+++ scummvm/trunk/engines/lure/sound.cpp	2010-03-13 21:55:49 UTC (rev 48254)
@@ -34,7 +34,7 @@
 #include "common/endian.h"
 #include "sound/midiparser.h"
 
-DECLARE_SINGLETON(Lure::SoundManager);
+DECLARE_SINGLETON(Lure::SoundManager)
 
 namespace Lure {
 

Modified: scummvm/trunk/graphics/cursorman.cpp
===================================================================
--- scummvm/trunk/graphics/cursorman.cpp	2010-03-13 19:45:49 UTC (rev 48253)
+++ scummvm/trunk/graphics/cursorman.cpp	2010-03-13 21:55:49 UTC (rev 48254)
@@ -27,7 +27,7 @@
 #include "common/system.h"
 #include "common/stack.h"
 
-DECLARE_SINGLETON(Graphics::CursorManager);
+DECLARE_SINGLETON(Graphics::CursorManager)
 
 namespace Graphics {
 

Modified: scummvm/trunk/graphics/fontman.cpp
===================================================================
--- scummvm/trunk/graphics/fontman.cpp	2010-03-13 19:45:49 UTC (rev 48253)
+++ scummvm/trunk/graphics/fontman.cpp	2010-03-13 21:55:49 UTC (rev 48254)
@@ -25,7 +25,7 @@
 #include "graphics/fontman.h"
 //#include "gui/consolefont.h"
 
-DECLARE_SINGLETON(Graphics::FontManager);
+DECLARE_SINGLETON(Graphics::FontManager)
 
 namespace Graphics {
 

Modified: scummvm/trunk/gui/GuiManager.cpp
===================================================================
--- scummvm/trunk/gui/GuiManager.cpp	2010-03-13 19:45:49 UTC (rev 48253)
+++ scummvm/trunk/gui/GuiManager.cpp	2010-03-13 21:55:49 UTC (rev 48254)
@@ -37,7 +37,7 @@
 
 #include "graphics/cursorman.h"
 
-DECLARE_SINGLETON(GUI::GuiManager);
+DECLARE_SINGLETON(GUI::GuiManager)
 
 namespace GUI {
 

Modified: scummvm/trunk/sound/audiocd.cpp
===================================================================
--- scummvm/trunk/sound/audiocd.cpp	2010-03-13 19:45:49 UTC (rev 48253)
+++ scummvm/trunk/sound/audiocd.cpp	2010-03-13 21:55:49 UTC (rev 48254)
@@ -32,7 +32,7 @@
 #include "common/util.h"
 #include "common/system.h"
 
-DECLARE_SINGLETON(Audio::AudioCDManager);
+DECLARE_SINGLETON(Audio::AudioCDManager)
 
 namespace Audio {
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list