COMMON: Remove USE_CXX11 checks, it is now always present
This commit is contained in:
parent
e5a60d34cc
commit
c544e5119b
8 changed files with 3 additions and 33 deletions
|
@ -27,10 +27,7 @@
|
||||||
#include "common/algorithm.h"
|
#include "common/algorithm.h"
|
||||||
#include "common/textconsole.h" // For error()
|
#include "common/textconsole.h" // For error()
|
||||||
#include "common/memory.h"
|
#include "common/memory.h"
|
||||||
|
|
||||||
#ifdef USE_CXX11
|
|
||||||
#include "common/initializer_list.h"
|
#include "common/initializer_list.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
|
@ -99,7 +96,6 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_CXX11
|
|
||||||
/**
|
/**
|
||||||
* Construct an array as a copy of the given array using the C++11 move semantic.
|
* Construct an array as a copy of the given array using the C++11 move semantic.
|
||||||
*/
|
*/
|
||||||
|
@ -124,7 +120,6 @@ public:
|
||||||
if (_storage)
|
if (_storage)
|
||||||
Common::uninitialized_copy(list.begin(), list.end(), _storage);
|
Common::uninitialized_copy(list.begin(), list.end(), _storage);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct an array by copying data from a regular array.
|
* Construct an array by copying data from a regular array.
|
||||||
|
@ -258,7 +253,6 @@ public:
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_CXX11
|
|
||||||
/** Assign the given array to this array using the C++11 move semantic. */
|
/** Assign the given array to this array using the C++11 move semantic. */
|
||||||
Array &operator=(Array<T> &&old) {
|
Array &operator=(Array<T> &&old) {
|
||||||
if (this == &old)
|
if (this == &old)
|
||||||
|
@ -275,7 +269,6 @@ public:
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Return the size of the array. */
|
/** Return the size of the array. */
|
||||||
size_type size() const {
|
size_type size() const {
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
#define COMMON_INITIALIZER_LIST_H
|
#define COMMON_INITIALIZER_LIST_H
|
||||||
|
|
||||||
// Some compiler only have partial support for C++11 and we provide replacements for reatures not available.
|
// Some compiler only have partial support for C++11 and we provide replacements for reatures not available.
|
||||||
#ifdef USE_CXX11
|
|
||||||
|
|
||||||
#ifdef NO_CXX11_INITIALIZER_LIST
|
#ifdef NO_CXX11_INITIALIZER_LIST
|
||||||
namespace std {
|
namespace std {
|
||||||
template<class T> class initializer_list {
|
template<class T> class initializer_list {
|
||||||
|
@ -44,6 +42,4 @@ namespace std {
|
||||||
|
|
||||||
#endif // NO_CXX11_INITIALIZER_LIST
|
#endif // NO_CXX11_INITIALIZER_LIST
|
||||||
|
|
||||||
#endif // USE_CXX11
|
|
||||||
|
|
||||||
#endif // COMMON_INITIALIZER_LIST_H
|
#endif // COMMON_INITIALIZER_LIST_H
|
||||||
|
|
|
@ -27,10 +27,9 @@
|
||||||
#include "common/noncopyable.h"
|
#include "common/noncopyable.h"
|
||||||
#include "common/safe-bool.h"
|
#include "common/safe-bool.h"
|
||||||
#include "common/types.h"
|
#include "common/types.h"
|
||||||
#ifdef USE_CXX11
|
|
||||||
/* For nullptr_t */
|
/* For nullptr_t */
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
|
@ -89,10 +88,8 @@ public:
|
||||||
BasePtr() : _refCount(nullptr), _deletion(nullptr), _pointer(nullptr) {
|
BasePtr() : _refCount(nullptr), _deletion(nullptr), _pointer(nullptr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_CXX11
|
|
||||||
explicit BasePtr(std::nullptr_t) : _refCount(nullptr), _deletion(nullptr), _pointer(nullptr) {
|
explicit BasePtr(std::nullptr_t) : _refCount(nullptr), _deletion(nullptr), _pointer(nullptr) {
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
template<class T2>
|
template<class T2>
|
||||||
explicit BasePtr(T2 *p) : _refCount(new RefValue(1)), _deletion(new BasePtrDeletionImpl<T2>(p)), _pointer(p) {
|
explicit BasePtr(T2 *p) : _refCount(new RefValue(1)), _deletion(new BasePtrDeletionImpl<T2>(p)), _pointer(p) {
|
||||||
|
@ -286,10 +283,8 @@ public:
|
||||||
SharedPtr() : BasePtr<T>() {
|
SharedPtr() : BasePtr<T>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_CXX11
|
|
||||||
SharedPtr(std::nullptr_t) : BasePtr<T>() {
|
SharedPtr(std::nullptr_t) : BasePtr<T>() {
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
template<class T2>
|
template<class T2>
|
||||||
explicit SharedPtr(T2 *p) : BasePtr<T>(p) {
|
explicit SharedPtr(T2 *p) : BasePtr<T>(p) {
|
||||||
|
@ -352,10 +347,8 @@ public:
|
||||||
WeakPtr() : BasePtr<T>() {
|
WeakPtr() : BasePtr<T>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_CXX11
|
|
||||||
WeakPtr(std::nullptr_t) : BasePtr<T>() {
|
WeakPtr(std::nullptr_t) : BasePtr<T>() {
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
template<class T2>
|
template<class T2>
|
||||||
explicit WeakPtr(T2 *p) : BasePtr<T>(p) {
|
explicit WeakPtr(T2 *p) : BasePtr<T>(p) {
|
||||||
|
|
|
@ -482,9 +482,9 @@ typedef uint32 uintptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// std::nullptr_t when c++11 is enabled but this type is not available
|
// std::nullptr_t when this type is not available
|
||||||
//
|
//
|
||||||
#if defined(USE_CXX11) && defined(NO_CXX11_NULLPTR_T)
|
#if defined(NO_CXX11_NULLPTR_T)
|
||||||
namespace std {
|
namespace std {
|
||||||
typedef decltype(nullptr) nullptr_t;
|
typedef decltype(nullptr) nullptr_t;
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,11 +172,9 @@ bool String::contains(uint32 x) const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_CXX11
|
|
||||||
bool String::contains(char32_t x) const {
|
bool String::contains(char32_t x) const {
|
||||||
return contains((uint32)x);
|
return contains((uint32)x);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SCUMMVM_UTIL
|
#ifndef SCUMMVM_UTIL
|
||||||
|
|
||||||
|
|
|
@ -116,9 +116,7 @@ public:
|
||||||
bool contains(const char *x) const;
|
bool contains(const char *x) const;
|
||||||
bool contains(char x) const;
|
bool contains(char x) const;
|
||||||
bool contains(uint32 x) const;
|
bool contains(uint32 x) const;
|
||||||
#ifdef USE_CXX11
|
|
||||||
bool contains(char32_t x) const;
|
bool contains(char32_t x) const;
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple DOS-style pattern matching function (understands * and ? like used in DOS).
|
* Simple DOS-style pattern matching function (understands * and ? like used in DOS).
|
||||||
|
|
|
@ -52,11 +52,7 @@ class String;
|
||||||
* The presence of \0 characters in the string will cause undefined
|
* The presence of \0 characters in the string will cause undefined
|
||||||
* behavior in some operations.
|
* behavior in some operations.
|
||||||
*/
|
*/
|
||||||
#ifdef USE_CXX11
|
|
||||||
typedef char32_t u32char_type_t;
|
typedef char32_t u32char_type_t;
|
||||||
#else
|
|
||||||
typedef uint32 u32char_type_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class U32String : public BaseString<u32char_type_t> {
|
class U32String : public BaseString<u32char_type_t> {
|
||||||
public:
|
public:
|
||||||
|
@ -71,11 +67,9 @@ public:
|
||||||
/** Construct a new string containing exactly @p len characters read from address @p str. */
|
/** Construct a new string containing exactly @p len characters read from address @p str. */
|
||||||
U32String(const value_type *str, uint32 len) : BaseString<u32char_type_t>(str, len) {}
|
U32String(const value_type *str, uint32 len) : BaseString<u32char_type_t>(str, len) {}
|
||||||
|
|
||||||
#ifdef USE_CXX11
|
|
||||||
explicit U32String(const uint32 *str) : BaseString<u32char_type_t>((const value_type *) str) {}
|
explicit U32String(const uint32 *str) : BaseString<u32char_type_t>((const value_type *) str) {}
|
||||||
U32String(const uint32 *str, uint32 len) : BaseString<u32char_type_t>((const value_type *) str, len) {}
|
U32String(const uint32 *str, uint32 len) : BaseString<u32char_type_t>((const value_type *) str, len) {}
|
||||||
U32String(const uint32 *beginP, const uint32 *endP) : BaseString<u32char_type_t>((const value_type *) beginP, (const value_type *) endP) {}
|
U32String(const uint32 *beginP, const uint32 *endP) : BaseString<u32char_type_t>((const value_type *) beginP, (const value_type *) endP) {}
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Construct a new string containing the characters between @p beginP (including) and @p endP (excluding). */
|
/** Construct a new string containing the characters between @p beginP (including) and @p endP (excluding). */
|
||||||
U32String(const value_type *beginP, const value_type *endP) : BaseString<u32char_type_t>(beginP, endP) {}
|
U32String(const value_type *beginP, const value_type *endP) : BaseString<u32char_type_t>(beginP, endP) {}
|
||||||
|
|
|
@ -323,13 +323,11 @@ class ArrayTestSuite : public CxxTest::TestSuite
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_array_constructor_list() {
|
void test_array_constructor_list() {
|
||||||
#ifdef USE_CXX11
|
|
||||||
Common::Array<int> array = {1, 42, 255};
|
Common::Array<int> array = {1, 42, 255};
|
||||||
TS_ASSERT_EQUALS(array.size(), 3U);
|
TS_ASSERT_EQUALS(array.size(), 3U);
|
||||||
TS_ASSERT_EQUALS(array[0], 1);
|
TS_ASSERT_EQUALS(array[0], 1);
|
||||||
TS_ASSERT_EQUALS(array[1], 42);
|
TS_ASSERT_EQUALS(array[1], 42);
|
||||||
TS_ASSERT_EQUALS(array[2], 255);
|
TS_ASSERT_EQUALS(array[2], 255);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_array_constructor_count_copy_value() {
|
void test_array_constructor_count_copy_value() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue