Change None in C/C++ source to NoneType.

Prevent name conflict with X11 None definition.
This commit is contained in:
Cybel Gibson 2017-11-28 15:35:48 +00:00
parent 752804372c
commit 6f6c4cdef6
7 changed files with 396 additions and 396 deletions

View File

@ -19,7 +19,7 @@
namespace YAML { namespace YAML {
namespace detail { namespace detail {
struct iterator_type { struct iterator_type {
enum value { None, Sequence, Map }; enum value { NoneType, Sequence, Map };
}; };
template <typename V> template <typename V>
@ -73,7 +73,7 @@ class node_iterator_base
typedef node_iterator_value<V> value_type; typedef node_iterator_value<V> value_type;
node_iterator_base() node_iterator_base()
: m_type(iterator_type::None), m_seqIt(), m_mapIt(), m_mapEnd() {} : m_type(iterator_type::NoneType), m_seqIt(), m_mapIt(), m_mapEnd() {}
explicit node_iterator_base(SeqIter seqIt) explicit node_iterator_base(SeqIter seqIt)
: m_type(iterator_type::Sequence), : m_type(iterator_type::Sequence),
m_seqIt(seqIt), m_seqIt(seqIt),
@ -105,7 +105,7 @@ class node_iterator_base
return false; return false;
switch (m_type) { switch (m_type) {
case iterator_type::None: case iterator_type::NoneType:
return true; return true;
case iterator_type::Sequence: case iterator_type::Sequence:
return m_seqIt == rhs.m_seqIt; return m_seqIt == rhs.m_seqIt;
@ -122,7 +122,7 @@ class node_iterator_base
node_iterator_base<V>& operator++() { node_iterator_base<V>& operator++() {
switch (m_type) { switch (m_type) {
case iterator_type::None: case iterator_type::NoneType:
break; break;
case iterator_type::Sequence: case iterator_type::Sequence:
++m_seqIt; ++m_seqIt;
@ -143,7 +143,7 @@ class node_iterator_base
value_type operator*() const { value_type operator*() const {
switch (m_type) { switch (m_type) {
case iterator_type::None: case iterator_type::NoneType:
return value_type(); return value_type();
case iterator_type::Sequence: case iterator_type::Sequence:
return value_type(**m_seqIt); return value_type(**m_seqIt);

View File

@ -103,7 +103,7 @@ GTEST_DECLARE_string_(color);
// the tests to run. If the filter is not given all tests are executed. // the tests to run. If the filter is not given all tests are executed.
GTEST_DECLARE_string_(filter); GTEST_DECLARE_string_(filter);
// This flag causes the Google Test to list tests. None of the tests listed // This flag causes the Google Test to list tests. NoneType of the tests listed
// are actually run if the flag is provided. // are actually run if the flag is provided.
GTEST_DECLARE_bool_(list_tests); GTEST_DECLARE_bool_(list_tests);

View File

@ -539,7 +539,7 @@ GTEST_API_ TestInfo* MakeAndRegisterTestInfo(
// If *pstr starts with the given prefix, modifies *pstr to be right // If *pstr starts with the given prefix, modifies *pstr to be right
// past the prefix and returns true; otherwise leaves *pstr unchanged // past the prefix and returns true; otherwise leaves *pstr unchanged
// and returns false. None of pstr, *pstr, and prefix can be NULL. // and returns false. NoneType of pstr, *pstr, and prefix can be NULL.
GTEST_API_ bool SkipPrefix(const char* prefix, const char** pstr); GTEST_API_ bool SkipPrefix(const char* prefix, const char** pstr);
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P

View File

@ -103,7 +103,7 @@ struct AssertTypeEq<T, T> {
// template Types. This allows us to simulate variadic templates // template Types. This allows us to simulate variadic templates
// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't // (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't
// support directly. // support directly.
struct None {}; struct NoneType {};
// The following family of struct and struct templates are used to // The following family of struct and struct templates are used to
// represent type lists. In particular, TypesN<T1, T2, ..., TN> // represent type lists. In particular, TypesN<T1, T2, ..., TN>
@ -144,7 +144,7 @@ struct Types$i {
// easier to write, but generates horrible messages when there is a // easier to write, but generates horrible messages when there is a
// compiler error, as gcc insists on printing out each template // compiler error, as gcc insists on printing out each template
// argument, even if it has the default value (this means Types<int> // argument, even if it has the default value (this means Types<int>
// will appear as Types<int, None, None, ..., None> in the compiler // will appear as Types<int, NoneType, None, ..., NoneType> in the compiler
// errors). // errors).
// //
// Our solution is to combine the best part of the two approaches: a // Our solution is to combine the best part of the two approaches: a
@ -154,13 +154,13 @@ struct Types$i {
// Types template. // Types template.
$range i 1..n $range i 1..n
template <$for i, [[typename T$i = internal::None]]> template <$for i, [[typename T$i = internal::NoneType]]>
struct Types { struct Types {
typedef internal::Types$n<$for i, [[T$i]]> type; typedef internal::Types$n<$for i, [[T$i]]> type;
}; };
template <> template <>
struct Types<$for i, [[internal::None]]> { struct Types<$for i, [[internal::NoneType]]> {
typedef internal::Types0 type; typedef internal::Types0 type;
}; };
@ -169,7 +169,7 @@ $for i [[
$range j 1..i $range j 1..i
$range k i+1..n $range k i+1..n
template <$for j, [[typename T$j]]> template <$for j, [[typename T$j]]>
struct Types<$for j, [[T$j]]$for k[[, internal::None]]> { struct Types<$for j, [[T$j]]$for k[[, internal::NoneType]]> {
typedef internal::Types$i<$for j, [[T$j]]> type; typedef internal::Types$i<$for j, [[T$j]]> type;
}; };

View File

@ -4997,7 +4997,7 @@ bool AlwaysTrue() {
// If *pstr starts with the given prefix, modifies *pstr to be right // If *pstr starts with the given prefix, modifies *pstr to be right
// past the prefix and returns true; otherwise leaves *pstr unchanged // past the prefix and returns true; otherwise leaves *pstr unchanged
// and returns false. None of pstr, *pstr, and prefix can be NULL. // and returns false. NoneType of pstr, *pstr, and prefix can be NULL.
bool SkipPrefix(const char* prefix, const char** pstr) { bool SkipPrefix(const char* prefix, const char** pstr) {
const size_t prefix_len = strlen(prefix); const size_t prefix_len = strlen(prefix);
if (strncmp(*pstr, prefix, prefix_len) == 0) { if (strncmp(*pstr, prefix, prefix_len) == 0) {

View File

@ -181,7 +181,7 @@ void TestRepeat(int repeat) {
// set of tests. // set of tests.
void TestRepeatWithEmptyFilter(int repeat) { void TestRepeatWithEmptyFilter(int repeat) {
GTEST_FLAG(repeat) = repeat; GTEST_FLAG(repeat) = repeat;
GTEST_FLAG(filter) = "None"; GTEST_FLAG(filter) = "NoneType";
ResetCounts(); ResetCounts();
GTEST_CHECK_INT_EQ_(0, RUN_ALL_TESTS()); GTEST_CHECK_INT_EQ_(0, RUN_ALL_TESTS());