aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Avtalion2011-06-28 02:06:23 +0300
committerOri Avtalion2011-06-30 22:41:41 +0300
commitaa0f307e06e5aae3b12f9f15b350dc81b30d61de (patch)
treebb7bccb7f56b30e70bd9c267238b4123dfa9d819
parent13edea3e8305f6937ee1c9b494e168275c64ad1d (diff)
downloadscummvm-rg350-aa0f307e06e5aae3b12f9f15b350dc81b30d61de.tar.gz
scummvm-rg350-aa0f307e06e5aae3b12f9f15b350dc81b30d61de.tar.bz2
scummvm-rg350-aa0f307e06e5aae3b12f9f15b350dc81b30d61de.zip
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.
-rw-r--r--backends/fs/ds/ds-fs-factory.cpp2
-rw-r--r--backends/fs/ps2/ps2-fs-factory.cpp2
-rw-r--r--backends/fs/psp/psp-fs-factory.cpp2
-rw-r--r--backends/fs/wii/wii-fs-factory.cpp2
-rw-r--r--backends/platform/psp/display_manager.cpp2
-rw-r--r--backends/platform/psp/powerman.cpp2
-rw-r--r--backends/platform/psp/rtc.cpp2
-rw-r--r--backends/plugins/elf/memory-manager.cpp2
-rw-r--r--backends/plugins/elf/shorts-segment-manager.cpp2
-rw-r--r--base/plugins.cpp4
-rw-r--r--common/EventRecorder.cpp4
-rw-r--r--common/archive.cpp4
-rw-r--r--common/config-manager.cpp4
-rw-r--r--common/debug.cpp4
-rw-r--r--common/singleton.h6
-rw-r--r--common/translation.cpp4
-rw-r--r--engines/lure/sound.cpp2
-rw-r--r--engines/sword25/gfx/animationtemplateregistry.cpp2
-rw-r--r--engines/sword25/math/regionregistry.cpp2
-rw-r--r--engines/sword25/sword25.cpp2
-rw-r--r--engines/testbed/config-params.cpp2
-rw-r--r--graphics/cursorman.cpp2
-rw-r--r--graphics/fontman.cpp2
-rw-r--r--graphics/yuv_to_rgb.cpp2
-rw-r--r--gui/gui-manager.cpp2
25 files changed, 52 insertions, 14 deletions
diff --git a/backends/fs/ds/ds-fs-factory.cpp b/backends/fs/ds/ds-fs-factory.cpp
index 3fd97d07eb..4e09c3446b 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 cad92b5dec..ef7b2013a3 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 ef1df246ba..bb3aca8ee6 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 34cde8ef46..fbc9ef1da8 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 e945dca4a8..422805714f 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 fe9dcfa673..b72d05809d 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 3d6d4295a6..6c8e919986 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 02669b3647..058d818dc4 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 b3a9531c2d..caa328a4f2 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 4c2fd2cffc..4413995b88 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 eb22e1ea88..4441070050 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 0ef3893a8c..102d7aaa3f 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 a9d8c89035..fbdb611f3c 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 0dae344bb2..50f99753db 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 2f5fa41877..43f1c0c4d0 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 e456f733fd..5c8a04352d 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 cf28e0bb74..85b86a8400 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 43c099c89d..8184b49eba 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 dff8560205..68c360a5ee 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 b111746c32..2201188052 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 9a5062185b..d7ead48f63 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 a5498903e2..1d4e482bf4 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 f40cf97602..d1da550747 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 037ea9a007..bdc481016e 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 af1852d56d..212d68430c 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 {