aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorOri Avtalion2011-06-28 02:06:23 +0300
committerOri Avtalion2011-06-30 22:41:41 +0300
commitaa0f307e06e5aae3b12f9f15b350dc81b30d61de (patch)
treebb7bccb7f56b30e70bd9c267238b4123dfa9d819 /common
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.
Diffstat (limited to 'common')
-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
6 files changed, 12 insertions, 14 deletions
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;
}