C++14 is required, don’t pretend to support pre-C++11 or pre-MSVS 2015

Change-Id: Ide835421599480acc63e8e88ce2217433c0d376e
Reviewed-on: https://chromium-review.googlesource.com/719036
Reviewed-by: Leonard Mosescu <mosescu@chromium.org>
This commit is contained in:
Mark Mentovai 2017-10-13 10:35:45 -04:00
parent 7a849482ea
commit a327c86a52
20 changed files with 128 additions and 442 deletions

View File

@ -44,9 +44,7 @@
'prune_crash_reports.h',
'settings.cc',
'settings.h',
'simple_string_dictionary.cc',
'simple_string_dictionary.h',
'simple_address_range_bag.cc',
'simple_address_range_bag.h',
'simulate_crash.h',
'simulate_crash_mac.cc',

View File

@ -14,18 +14,15 @@
#include "client/crashpad_info.h"
#include <type_traits>
#include "util/misc/address_sanitizer.h"
#include "util/misc/from_pointer_cast.h"
#include "util/stdlib/cxx.h"
#if defined(OS_MACOSX)
#include <mach-o/loader.h>
#endif
#if CXX_LIBRARY_VERSION >= 2011
#include <type_traits>
#endif
namespace {
constexpr uint32_t kCrashpadInfoVersion = 1;
@ -34,20 +31,8 @@ constexpr uint32_t kCrashpadInfoVersion = 1;
namespace crashpad {
#if CXX_LIBRARY_VERSION >= 2011 || DOXYGEN
// In C++11, check that CrashpadInfo has standard layout, which is what is
// actually important.
static_assert(std::is_standard_layout<CrashpadInfo>::value,
"CrashpadInfo must be standard layout");
#else
// In C++98 (ISO 14882), section 9.5.1 says that a union cannot have a member
// with a non-trivial ctor, copy ctor, dtor, or assignment operator. Use this
// property to ensure that CrashpadInfo remains POD. This doesnt work for C++11
// because the requirements for unions have been relaxed.
union Compile_Assert {
CrashpadInfo Compile_Assert__CrashpadInfo_must_be_pod;
};
#endif
// This structure needs to be stored somewhere that is easy to find without
// external information.

View File

@ -1,45 +0,0 @@
// Copyright 2016 The Crashpad Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "client/simple_address_range_bag.h"
#include "util/stdlib/cxx.h"
#if CXX_LIBRARY_VERSION >= 2011
#include <type_traits>
#endif
namespace crashpad {
namespace {
using SimpleAddressRangeBagForAssertion = TSimpleAddressRangeBag<1>;
#if CXX_LIBRARY_VERSION >= 2011
// In C++11, check that TSimpleAddressRangeBag has standard layout, which is
// what is actually important.
static_assert(
std::is_standard_layout<SimpleAddressRangeBagForAssertion>::value,
"SimpleAddressRangeBag must be standard layout");
#else
// In C++98 (ISO 14882), section 9.5.1 says that a union cannot have a member
// with a non-trivial ctor, copy ctor, dtor, or assignment operator. Use this
// property to ensure that Entry remains POD. This doesnt work for C++11
// because the requirements for unions have been relaxed.
union Compile_Assert {
SimpleAddressRangeBagForAssertion::Entry Compile_Assert__entry_must_be_pod;
};
#endif
} // namespace
} // namespace crashpad

View File

@ -17,6 +17,8 @@
#include <stdint.h>
#include <type_traits>
#include "base/logging.h"
#include "base/macros.h"
#include "base/numerics/safe_conversions.h"
@ -188,6 +190,9 @@ class TSimpleAddressRangeBag {
//! \brief A TSimpleAddressRangeBag with default template parameters.
using SimpleAddressRangeBag = TSimpleAddressRangeBag<64>;
static_assert(std::is_standard_layout<SimpleAddressRangeBag>::value,
"SimpleAddressRangeBag must be standard layout");
} // namespace crashpad
#endif // CRASHPAD_CLIENT_SIMPLE_ADDRESS_RANGE_BAG_H_

View File

@ -1,45 +0,0 @@
// Copyright 2014 The Crashpad Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "client/simple_string_dictionary.h"
#include "util/stdlib/cxx.h"
#if CXX_LIBRARY_VERSION >= 2011
#include <type_traits>
#endif
namespace crashpad {
namespace {
using SimpleStringDictionaryForAssertion = TSimpleStringDictionary<1, 1, 1>;
#if CXX_LIBRARY_VERSION >= 2011
// In C++11, check that TSimpleStringDictionary has standard layout, which is
// what is actually important.
static_assert(
std::is_standard_layout<SimpleStringDictionaryForAssertion>::value,
"SimpleStringDictionary must be standard layout");
#else
// In C++98 (ISO 14882), section 9.5.1 says that a union cannot have a member
// with a non-trivial ctor, copy ctor, dtor, or assignment operator. Use this
// property to ensure that Entry remains POD. This doesnt work for C++11
// because the requirements for unions have been relaxed.
union Compile_Assert {
SimpleStringDictionaryForAssertion::Entry Compile_Assert__entry_must_be_pod;
};
#endif
} // namespace
} // namespace crashpad

View File

@ -19,6 +19,7 @@
#include <sys/types.h>
#include <algorithm>
#include <type_traits>
#include "base/logging.h"
#include "base/macros.h"
@ -279,6 +280,9 @@ class TSimpleStringDictionary {
//! size factors as a previous implementation.
using SimpleStringDictionary = TSimpleStringDictionary<256, 256, 64>;
static_assert(std::is_standard_layout<SimpleStringDictionary>::value,
"SimpleStringDictionary must be standard layout");
} // namespace crashpad
#endif // CRASHPAD_CLIENT_SIMPLE_STRING_DICTIONARY_H_

View File

@ -40,8 +40,6 @@
'mac/mach-o/getsect.h',
'mac/mach-o/loader.h',
'mac/sys/resource.h',
'non_cxx11_lib/type_traits',
'non_cxx11_lib/utility',
'non_mac/mach/mach.h',
'non_win/dbghelp.h',
'non_win/minwinbase.h',
@ -66,12 +64,10 @@
],
'include_dirs': [
'mac',
'non_cxx11_lib',
],
'direct_dependent_settings': {
'include_dirs': [
'mac',
'non_cxx11_lib',
],
},
}],

View File

@ -1,42 +0,0 @@
// Copyright 2015 The Crashpad Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef CRASHPAD_COMPAT_NON_CXX11_LIB_TYPE_TRAITS_
#define CRASHPAD_COMPAT_NON_CXX11_LIB_TYPE_TRAITS_
#include "util/stdlib/cxx.h"
#if CXX_LIBRARY_VERSION >= 2011
#include_next <type_traits>
#else
namespace std {
template <class T>
struct remove_reference { using type = T; };
template <class T>
struct remove_reference<T&> { using type = T; };
template <typename T, typename S>
struct is_same { enum { value = false }; };
template <typename T>
struct is_same<T, T> { enum { value = true }; };
} // namespace std
#endif // CXX_LIBRARY_VERSION
#endif // CRASHPAD_COMPAT_NON_CXX11_LIB_TYPE_TRAITS_

View File

@ -1,46 +0,0 @@
// Copyright 2015 The Crashpad Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef CRASHPAD_COMPAT_NON_CXX11_LIB_UTILITY_
#define CRASHPAD_COMPAT_NON_CXX11_LIB_UTILITY_
#include_next <utility>
#include "util/stdlib/cxx.h"
#if CXX_LIBRARY_VERSION < 2011
#include <type_traits>
namespace std {
template <class T>
T&& forward(typename remove_reference<T>::type& t) noexcept {
return static_cast<T&&>(t);
}
template <class T>
T&& forward(typename remove_reference<T>::type&& t) noexcept {
return static_cast<T&&>(t);
}
template <class T>
typename remove_reference<T>::type&& move(T&& t) noexcept {
return static_cast<typename remove_reference<T>::type&&>(t);
}
} // namespace std
#endif // CXX_LIBRARY_VERSION
#endif // CRASHPAD_COMPAT_NON_CXX11_LIB_UTILITY_

View File

@ -16,11 +16,7 @@
#define CRASHPAD_COMPAT_WIN_SYS_TYPES_H_
// This is intended to be roughly equivalent to #include_next.
#if _MSC_VER < 1900
#include <../include/sys/types.h>
#else
#include <../ucrt/sys/types.h>
#endif
#include <stdint.h>

View File

@ -16,11 +16,7 @@
#define CRASHPAD_COMPAT_WIN_TIME_H_
// This is intended to be roughly equivalent to #include_next.
#if _MSC_VER < 1900
#include <../include/time.h>
#else
#include <../ucrt/time.h>
#endif
#ifdef __cplusplus
extern "C" {

View File

@ -53,12 +53,10 @@ class MachOImageSymbolTableReader {
uint8_t section;
};
// TODO(mark): Use unordered_map or a similar hash-based map? For now,
// std::map is fine because this map only stores external defined symbols,
// and there arent expected to be very many of those that performance would
// become a problem. std::map is also guaranteed to be part of the standard
// library, which isnt the case for std::unordered_map, which requires the
// C++11 library. In reality, std::unordered_map does not appear to provide
// TODO(mark): Use std::unordered_map or a similar hash-based map? For now,
// std::map is fine because this map only stores external defined symbols, and
// there arent expected to be very many of those that performance would
// become a problem. In reality, std::unordered_map does not appear to provide
// a performance advantage. It appears that the memory copies currently done
// by TaskMemory::Read() have substantially more impact on symbol table
// operations.

View File

@ -88,51 +88,51 @@ inline void Assign<UInt64Array4, UInt32Array4>(UInt64Array4* destination,
// operates on each member in the struct.
#define PROCESS_TYPE_STRUCT_IMPLEMENT 1
#define PROCESS_TYPE_STRUCT_BEGIN(struct_name) \
namespace crashpad { \
namespace process_types { \
\
/* static */ \
size_t struct_name::ExpectedSize(ProcessReader* process_reader) { \
if (!process_reader->Is64Bit()) { \
return internal::struct_name<internal::Traits32>::Size(); \
} else { \
return internal::struct_name<internal::Traits64>::Size(); \
} \
} \
\
/* static */ \
bool struct_name::ReadInto(ProcessReader* process_reader, \
mach_vm_address_t address, \
struct_name* generic) { \
if (!process_reader->Is64Bit()) { \
return ReadIntoInternal<internal::struct_name<internal::Traits32> >( \
process_reader, address, generic); \
} else { \
return ReadIntoInternal<internal::struct_name<internal::Traits64> >( \
process_reader, address, generic); \
} \
} \
\
/* static */ \
template <typename T> \
bool struct_name::ReadIntoInternal(ProcessReader* process_reader, \
mach_vm_address_t address, \
struct_name* generic) { \
T specific; \
if (!specific.Read(process_reader, address)) { \
return false; \
} \
specific.GenericizeInto(generic, &generic->size_); \
return true; \
} \
\
namespace internal { \
\
template <typename Traits> \
void struct_name<Traits>::GenericizeInto( \
process_types::struct_name* generic, \
size_t* specific_size) { \
#define PROCESS_TYPE_STRUCT_BEGIN(struct_name) \
namespace crashpad { \
namespace process_types { \
\
/* static */ \
size_t struct_name::ExpectedSize(ProcessReader* process_reader) { \
if (!process_reader->Is64Bit()) { \
return internal::struct_name<internal::Traits32>::Size(); \
} else { \
return internal::struct_name<internal::Traits64>::Size(); \
} \
} \
\
/* static */ \
bool struct_name::ReadInto(ProcessReader* process_reader, \
mach_vm_address_t address, \
struct_name* generic) { \
if (!process_reader->Is64Bit()) { \
return ReadIntoInternal<internal::struct_name<internal::Traits32>>( \
process_reader, address, generic); \
} else { \
return ReadIntoInternal<internal::struct_name<internal::Traits64>>( \
process_reader, address, generic); \
} \
} \
\
/* static */ \
template <typename T> \
bool struct_name::ReadIntoInternal(ProcessReader* process_reader, \
mach_vm_address_t address, \
struct_name* generic) { \
T specific; \
if (!specific.Read(process_reader, address)) { \
return false; \
} \
specific.GenericizeInto(generic, &generic->size_); \
return true; \
} \
\
namespace internal { \
\
template <typename Traits> \
void struct_name<Traits>::GenericizeInto( \
process_types::struct_name* generic, \
size_t* specific_size) { \
*specific_size = Size();
#define PROCESS_TYPE_STRUCT_MEMBER(member_type, member_name, ...) \
@ -200,56 +200,54 @@ inline void Assign<UInt64Array4, UInt32Array4>(UInt64Array4* destination,
// can do so by guarding their proctype definitions against this macro.
#define PROCESS_TYPE_STRUCT_IMPLEMENT_ARRAY 1
#define PROCESS_TYPE_STRUCT_BEGIN(struct_name) \
namespace crashpad { \
namespace process_types { \
namespace internal { \
\
/* static */ \
template <typename Traits> \
bool struct_name<Traits>::ReadArrayInto(ProcessReader* process_reader, \
mach_vm_address_t address, \
size_t count, \
struct_name<Traits>* specific) { \
return process_reader->Memory()->Read( \
address, sizeof(struct_name<Traits>[count]), specific); \
} \
\
} /* namespace internal */ \
\
/* static */ \
bool struct_name::ReadArrayInto(ProcessReader* process_reader, \
mach_vm_address_t address, \
size_t count, \
struct_name* generic) { \
if (!process_reader->Is64Bit()) { \
return ReadArrayIntoInternal< \
internal::struct_name<internal::Traits32> >( \
process_reader, address, count, generic); \
} else { \
return ReadArrayIntoInternal< \
internal::struct_name<internal::Traits64> >( \
process_reader, address, count, generic); \
} \
return true; \
} \
\
/* static */ \
template <typename T> \
bool struct_name::ReadArrayIntoInternal(ProcessReader* process_reader, \
mach_vm_address_t address, \
size_t count, \
struct_name* generic) { \
std::unique_ptr<T[]> specific(new T[count]); \
if (!T::ReadArrayInto(process_reader, address, count, &specific[0])) { \
return false; \
} \
for (size_t index = 0; index < count; ++index) { \
specific[index].GenericizeInto(&generic[index], &generic[index].size_); \
} \
return true; \
} \
} /* namespace process_types */ \
#define PROCESS_TYPE_STRUCT_BEGIN(struct_name) \
namespace crashpad { \
namespace process_types { \
namespace internal { \
\
/* static */ \
template <typename Traits> \
bool struct_name<Traits>::ReadArrayInto(ProcessReader* process_reader, \
mach_vm_address_t address, \
size_t count, \
struct_name<Traits>* specific) { \
return process_reader->Memory()->Read( \
address, sizeof(struct_name<Traits>[count]), specific); \
} \
\
} /* namespace internal */ \
\
/* static */ \
bool struct_name::ReadArrayInto(ProcessReader* process_reader, \
mach_vm_address_t address, \
size_t count, \
struct_name* generic) { \
if (!process_reader->Is64Bit()) { \
return ReadArrayIntoInternal<internal::struct_name<internal::Traits32>>( \
process_reader, address, count, generic); \
} else { \
return ReadArrayIntoInternal<internal::struct_name<internal::Traits64>>( \
process_reader, address, count, generic); \
} \
return true; \
} \
\
/* static */ \
template <typename T> \
bool struct_name::ReadArrayIntoInternal(ProcessReader* process_reader, \
mach_vm_address_t address, \
size_t count, \
struct_name* generic) { \
std::unique_ptr<T[]> specific(new T[count]); \
if (!T::ReadArrayInto(process_reader, address, count, &specific[0])) { \
return false; \
} \
for (size_t index = 0; index < count; ++index) { \
specific[index].GenericizeInto(&generic[index], &generic[index].size_); \
} \
return true; \
} \
} /* namespace process_types */ \
} /* namespace crashpad */
#define PROCESS_TYPE_STRUCT_MEMBER(member_type, member_name, ...)

View File

@ -123,10 +123,8 @@ TEST_F(SystemSnapshotWinTest, TimeZone) {
// |standard_offset_seconds| gives seconds east of UTC, and |timezone| gives
// seconds west of UTC.
#if _MSC_VER >= 1900
long timezone = 0;
_get_timezone(&timezone);
#endif
EXPECT_EQ(standard_offset_seconds, -timezone);
// In contemporary usage, most time zones have an integer hour offset from

View File

@ -23,28 +23,22 @@
#include <stdio.h>
#include <string.h>
#include <type_traits>
#include "base/logging.h"
#include "base/rand_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/sys_byteorder.h"
#include "util/stdlib/cxx.h"
#if defined(OS_MACOSX)
#include <uuid/uuid.h>
#endif // OS_MACOSX
#if CXX_LIBRARY_VERSION >= 2011
#include <type_traits>
#endif
namespace crashpad {
static_assert(sizeof(UUID) == 16, "UUID must be 16 bytes");
#if CXX_LIBRARY_VERSION >= 2011
static_assert(std::is_pod<UUID>::value, "UUID must be POD");
#endif
bool UUID::operator==(const UUID& that) const {
return memcmp(this, &that, sizeof(*this)) == 0;

View File

@ -23,15 +23,6 @@
#include <utility>
#include <vector>
#include "build/build_config.h"
#include "util/stdlib/cxx.h"
#if defined(COMPILER_MSVC) && _MSC_VER < 1900
#define CRASHPAD_NOEXCEPT _NOEXCEPT
#else
#define CRASHPAD_NOEXCEPT noexcept
#endif
namespace crashpad {
namespace internal {
@ -70,19 +61,16 @@ struct AlignedAllocator {
using other = AlignedAllocator<U, Alignment>;
};
AlignedAllocator() CRASHPAD_NOEXCEPT {}
AlignedAllocator(const AlignedAllocator& other) CRASHPAD_NOEXCEPT {}
AlignedAllocator() noexcept {}
AlignedAllocator(const AlignedAllocator& other) noexcept {}
template <typename U>
AlignedAllocator(const AlignedAllocator<U, Alignment>& other)
CRASHPAD_NOEXCEPT {}
AlignedAllocator(const AlignedAllocator<U, Alignment>& other) noexcept {}
~AlignedAllocator() {}
pointer address(reference x) const CRASHPAD_NOEXCEPT { return &x; }
const_pointer address(const_reference x) const CRASHPAD_NOEXCEPT {
return &x;
}
pointer address(reference x) const noexcept { return &x; }
const_pointer address(const_reference x) const noexcept { return &x; }
pointer allocate(size_type n, std::allocator<void>::const_pointer hint = 0) {
return reinterpret_cast<pointer>(
@ -91,7 +79,7 @@ struct AlignedAllocator {
void deallocate(pointer p, size_type n) { internal::AlignedFree(p); }
size_type max_size() const CRASHPAD_NOEXCEPT {
size_type max_size() const noexcept {
return std::numeric_limits<size_type>::max() / sizeof(value_type);
}
@ -114,13 +102,13 @@ struct AlignedAllocator {
template <class T1, class T2, size_t Alignment>
bool operator==(const AlignedAllocator<T1, Alignment>& lhs,
const AlignedAllocator<T2, Alignment>& rhs) CRASHPAD_NOEXCEPT {
const AlignedAllocator<T2, Alignment>& rhs) noexcept {
return true;
}
template <class T1, class T2, size_t Alignment>
bool operator!=(const AlignedAllocator<T1, Alignment>& lhs,
const AlignedAllocator<T2, Alignment>& rhs) CRASHPAD_NOEXCEPT {
const AlignedAllocator<T2, Alignment>& rhs) noexcept {
return false;
}
@ -134,6 +122,4 @@ using AlignedVector = std::vector<T, AlignedAllocator<T, Alignment>>;
} // namespace crashpad
#undef CRASHPAD_NOEXCEPT
#endif // CRASHPAD_UTIL_STDLIB_ALIGNED_ALLOCATOR_H_

View File

@ -1,70 +0,0 @@
// Copyright 2014 The Crashpad Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef CRASHPAD_UTIL_STDLIB_CXX_H_
#define CRASHPAD_UTIL_STDLIB_CXX_H_
#include "build/build_config.h"
#if defined(COMPILER_MSVC)
#define CXX_LIBRARY_VERSION 2011
#define CXX_LIBRARY_HAS_CONSTEXPR 0
#else // !COMPILER_MSVC
// <ciso646> doesnt do very much, and under libc++, it will cause the
// _LIBCPP_VERSION macro to be defined properly. Under libstdc++, it doesnt
// cause __GLIBCXX__ to be defined, but if _LIBCPP_VERSION isnt defined after
// #including <ciso646>, assume libstdc++ and #include libstdc++s internal
// header that defines __GLIBCXX__.
#include <ciso646>
#if !defined(_LIBCPP_VERSION)
#if defined(__has_include)
#if __has_include(<bits/c++config.h>)
#include <bits/c++config.h>
#endif
#else
#include <bits/c++config.h>
#endif
#endif
// libstdc++ does not identify its version directly, but identifies the GCC
// package it is a part of via the __GLIBCXX__ macro, which is based on the date
// of the GCC release. libstdc++ had sufficient C++11 support as of GCC 4.6.0,
// __GLIBCXX__ 20110325, but maintenance releases in the 4.4 an 4.5 series
// followed this date, so check for those versions by their date stamps.
// http://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html#abi.versioning
//
// libc++, identified by _LIBCPP_VERSION, always supports C++11.
#if __cplusplus >= 201103l && \
((defined(__GLIBCXX__) && \
__GLIBCXX__ >= 20110325ul && /* GCC >= 4.6.0 */ \
__GLIBCXX__ != 20110416ul && /* GCC 4.4.6 */ \
__GLIBCXX__ != 20120313ul && /* GCC 4.4.7 */ \
__GLIBCXX__ != 20110428ul && /* GCC 4.5.3 */ \
__GLIBCXX__ != 20120702ul) || /* GCC 4.5.4 */ \
(defined(_LIBCPP_VERSION)))
#define CXX_LIBRARY_VERSION 2011
#define CXX_LIBRARY_HAS_CONSTEXPR 1
#else
#define CXX_LIBRARY_VERSION 2003
#define CXX_LIBRARY_HAS_CONSTEXPR 0
#endif
#endif // COMPILER_MSVC
#endif // CRASHPAD_UTIL_STDLIB_CXX_H_

View File

@ -23,19 +23,6 @@
#include <limits>
#include "base/logging.h"
#include "util/stdlib/cxx.h"
// CONSTEXPR_STATIC_ASSERT will be a normal static_assert if the C++ library is
// the C++11 library. If using an older C++ library, the
// std::numeric_limits<>::min() and max() functions will not be marked as
// constexpr, and thus wont be usable with static_assert(). In that case, a
// run-time CHECK() will have to do.
#if CXX_LIBRARY_HAS_CONSTEXPR
#define CONSTEXPR_STATIC_ASSERT(condition, message) \
static_assert(condition, message)
#else
#define CONSTEXPR_STATIC_ASSERT(condition, message) CHECK(condition) << message
#endif
namespace {
@ -50,16 +37,16 @@ struct StringToIntegerTraits {
static_assert(std::numeric_limits<TIntType>::is_signed ==
std::numeric_limits<TLongType>::is_signed,
"IntType and LongType signedness must agree");
CONSTEXPR_STATIC_ASSERT(std::numeric_limits<TIntType>::min() >=
std::numeric_limits<TLongType>::min() &&
std::numeric_limits<TIntType>::min() <
std::numeric_limits<TLongType>::max(),
"IntType min must be in LongType range");
CONSTEXPR_STATIC_ASSERT(std::numeric_limits<TIntType>::max() >
std::numeric_limits<TLongType>::min() &&
std::numeric_limits<TIntType>::max() <=
std::numeric_limits<TLongType>::max(),
"IntType max must be in LongType range");
static_assert(std::numeric_limits<TIntType>::min() >=
std::numeric_limits<TLongType>::min() &&
std::numeric_limits<TIntType>::min() <
std::numeric_limits<TLongType>::max(),
"IntType min must be in LongType range");
static_assert(std::numeric_limits<TIntType>::max() >
std::numeric_limits<TLongType>::min() &&
std::numeric_limits<TIntType>::max() <=
std::numeric_limits<TLongType>::max(),
"IntType max must be in LongType range");
}
};

View File

@ -183,7 +183,6 @@
'process/process_memory_range.h',
'stdlib/aligned_allocator.cc',
'stdlib/aligned_allocator.h',
'stdlib/cxx.h',
'stdlib/map_insert.h',
'stdlib/objc.h',
'stdlib/pointer_container.h',

View File

@ -108,13 +108,7 @@ class InitialClientData {
HANDLE client_process_;
bool is_valid_;
#if _MSC_VER < 1900
// The default copy and assignment constructors are fine, as we don't take
// ownership of the handles. They also shouldn't be required for how we use
// this class, however, VS2013 seems to think they are.
#else
DISALLOW_COPY_AND_ASSIGN(InitialClientData);
#endif // _MSC_VER < 1900
};
} // namespace crashpad