mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-19 18:03:47 +00:00
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:
parent
7a849482ea
commit
a327c86a52
@ -44,9 +44,7 @@
|
|||||||
'prune_crash_reports.h',
|
'prune_crash_reports.h',
|
||||||
'settings.cc',
|
'settings.cc',
|
||||||
'settings.h',
|
'settings.h',
|
||||||
'simple_string_dictionary.cc',
|
|
||||||
'simple_string_dictionary.h',
|
'simple_string_dictionary.h',
|
||||||
'simple_address_range_bag.cc',
|
|
||||||
'simple_address_range_bag.h',
|
'simple_address_range_bag.h',
|
||||||
'simulate_crash.h',
|
'simulate_crash.h',
|
||||||
'simulate_crash_mac.cc',
|
'simulate_crash_mac.cc',
|
||||||
|
@ -14,18 +14,15 @@
|
|||||||
|
|
||||||
#include "client/crashpad_info.h"
|
#include "client/crashpad_info.h"
|
||||||
|
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
#include "util/misc/address_sanitizer.h"
|
#include "util/misc/address_sanitizer.h"
|
||||||
#include "util/misc/from_pointer_cast.h"
|
#include "util/misc/from_pointer_cast.h"
|
||||||
#include "util/stdlib/cxx.h"
|
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
#include <mach-o/loader.h>
|
#include <mach-o/loader.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CXX_LIBRARY_VERSION >= 2011
|
|
||||||
#include <type_traits>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
constexpr uint32_t kCrashpadInfoVersion = 1;
|
constexpr uint32_t kCrashpadInfoVersion = 1;
|
||||||
@ -34,20 +31,8 @@ constexpr uint32_t kCrashpadInfoVersion = 1;
|
|||||||
|
|
||||||
namespace crashpad {
|
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,
|
static_assert(std::is_standard_layout<CrashpadInfo>::value,
|
||||||
"CrashpadInfo must be standard layout");
|
"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 doesn’t 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
|
// This structure needs to be stored somewhere that is easy to find without
|
||||||
// external information.
|
// external information.
|
||||||
|
@ -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 doesn’t 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
|
|
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/numerics/safe_conversions.h"
|
#include "base/numerics/safe_conversions.h"
|
||||||
@ -188,6 +190,9 @@ class TSimpleAddressRangeBag {
|
|||||||
//! \brief A TSimpleAddressRangeBag with default template parameters.
|
//! \brief A TSimpleAddressRangeBag with default template parameters.
|
||||||
using SimpleAddressRangeBag = TSimpleAddressRangeBag<64>;
|
using SimpleAddressRangeBag = TSimpleAddressRangeBag<64>;
|
||||||
|
|
||||||
|
static_assert(std::is_standard_layout<SimpleAddressRangeBag>::value,
|
||||||
|
"SimpleAddressRangeBag must be standard layout");
|
||||||
|
|
||||||
} // namespace crashpad
|
} // namespace crashpad
|
||||||
|
|
||||||
#endif // CRASHPAD_CLIENT_SIMPLE_ADDRESS_RANGE_BAG_H_
|
#endif // CRASHPAD_CLIENT_SIMPLE_ADDRESS_RANGE_BAG_H_
|
||||||
|
@ -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 doesn’t 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
|
|
@ -19,6 +19,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
@ -279,6 +280,9 @@ class TSimpleStringDictionary {
|
|||||||
//! size factors as a previous implementation.
|
//! size factors as a previous implementation.
|
||||||
using SimpleStringDictionary = TSimpleStringDictionary<256, 256, 64>;
|
using SimpleStringDictionary = TSimpleStringDictionary<256, 256, 64>;
|
||||||
|
|
||||||
|
static_assert(std::is_standard_layout<SimpleStringDictionary>::value,
|
||||||
|
"SimpleStringDictionary must be standard layout");
|
||||||
|
|
||||||
} // namespace crashpad
|
} // namespace crashpad
|
||||||
|
|
||||||
#endif // CRASHPAD_CLIENT_SIMPLE_STRING_DICTIONARY_H_
|
#endif // CRASHPAD_CLIENT_SIMPLE_STRING_DICTIONARY_H_
|
||||||
|
@ -40,8 +40,6 @@
|
|||||||
'mac/mach-o/getsect.h',
|
'mac/mach-o/getsect.h',
|
||||||
'mac/mach-o/loader.h',
|
'mac/mach-o/loader.h',
|
||||||
'mac/sys/resource.h',
|
'mac/sys/resource.h',
|
||||||
'non_cxx11_lib/type_traits',
|
|
||||||
'non_cxx11_lib/utility',
|
|
||||||
'non_mac/mach/mach.h',
|
'non_mac/mach/mach.h',
|
||||||
'non_win/dbghelp.h',
|
'non_win/dbghelp.h',
|
||||||
'non_win/minwinbase.h',
|
'non_win/minwinbase.h',
|
||||||
@ -66,12 +64,10 @@
|
|||||||
],
|
],
|
||||||
'include_dirs': [
|
'include_dirs': [
|
||||||
'mac',
|
'mac',
|
||||||
'non_cxx11_lib',
|
|
||||||
],
|
],
|
||||||
'direct_dependent_settings': {
|
'direct_dependent_settings': {
|
||||||
'include_dirs': [
|
'include_dirs': [
|
||||||
'mac',
|
'mac',
|
||||||
'non_cxx11_lib',
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}],
|
}],
|
||||||
|
@ -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_
|
|
@ -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_
|
|
@ -16,11 +16,7 @@
|
|||||||
#define CRASHPAD_COMPAT_WIN_SYS_TYPES_H_
|
#define CRASHPAD_COMPAT_WIN_SYS_TYPES_H_
|
||||||
|
|
||||||
// This is intended to be roughly equivalent to #include_next.
|
// 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>
|
#include <../ucrt/sys/types.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
@ -16,11 +16,7 @@
|
|||||||
#define CRASHPAD_COMPAT_WIN_TIME_H_
|
#define CRASHPAD_COMPAT_WIN_TIME_H_
|
||||||
|
|
||||||
// This is intended to be roughly equivalent to #include_next.
|
// This is intended to be roughly equivalent to #include_next.
|
||||||
#if _MSC_VER < 1900
|
|
||||||
#include <../include/time.h>
|
|
||||||
#else
|
|
||||||
#include <../ucrt/time.h>
|
#include <../ucrt/time.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -53,12 +53,10 @@ class MachOImageSymbolTableReader {
|
|||||||
uint8_t section;
|
uint8_t section;
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO(mark): Use unordered_map or a similar hash-based map? For now,
|
// 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,
|
// std::map is fine because this map only stores external defined symbols, and
|
||||||
// and there aren’t expected to be very many of those that performance would
|
// there aren’t expected to be very many of those that performance would
|
||||||
// become a problem. std::map is also guaranteed to be part of the standard
|
// become a problem. In reality, std::unordered_map does not appear to provide
|
||||||
// library, which isn’t the case for std::unordered_map, which requires the
|
|
||||||
// C++11 library. In reality, std::unordered_map does not appear to provide
|
|
||||||
// a performance advantage. It appears that the memory copies currently done
|
// a performance advantage. It appears that the memory copies currently done
|
||||||
// by TaskMemory::Read() have substantially more impact on symbol table
|
// by TaskMemory::Read() have substantially more impact on symbol table
|
||||||
// operations.
|
// operations.
|
||||||
|
@ -223,12 +223,10 @@ inline void Assign<UInt64Array4, UInt32Array4>(UInt64Array4* destination,
|
|||||||
size_t count, \
|
size_t count, \
|
||||||
struct_name* generic) { \
|
struct_name* generic) { \
|
||||||
if (!process_reader->Is64Bit()) { \
|
if (!process_reader->Is64Bit()) { \
|
||||||
return ReadArrayIntoInternal< \
|
return ReadArrayIntoInternal<internal::struct_name<internal::Traits32>>( \
|
||||||
internal::struct_name<internal::Traits32> >( \
|
|
||||||
process_reader, address, count, generic); \
|
process_reader, address, count, generic); \
|
||||||
} else { \
|
} else { \
|
||||||
return ReadArrayIntoInternal< \
|
return ReadArrayIntoInternal<internal::struct_name<internal::Traits64>>( \
|
||||||
internal::struct_name<internal::Traits64> >( \
|
|
||||||
process_reader, address, count, generic); \
|
process_reader, address, count, generic); \
|
||||||
} \
|
} \
|
||||||
return true; \
|
return true; \
|
||||||
|
@ -123,10 +123,8 @@ TEST_F(SystemSnapshotWinTest, TimeZone) {
|
|||||||
|
|
||||||
// |standard_offset_seconds| gives seconds east of UTC, and |timezone| gives
|
// |standard_offset_seconds| gives seconds east of UTC, and |timezone| gives
|
||||||
// seconds west of UTC.
|
// seconds west of UTC.
|
||||||
#if _MSC_VER >= 1900
|
|
||||||
long timezone = 0;
|
long timezone = 0;
|
||||||
_get_timezone(&timezone);
|
_get_timezone(&timezone);
|
||||||
#endif
|
|
||||||
EXPECT_EQ(standard_offset_seconds, -timezone);
|
EXPECT_EQ(standard_offset_seconds, -timezone);
|
||||||
|
|
||||||
// In contemporary usage, most time zones have an integer hour offset from
|
// In contemporary usage, most time zones have an integer hour offset from
|
||||||
|
@ -23,28 +23,22 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/rand_util.h"
|
#include "base/rand_util.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "base/sys_byteorder.h"
|
#include "base/sys_byteorder.h"
|
||||||
#include "util/stdlib/cxx.h"
|
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
#include <uuid/uuid.h>
|
#include <uuid/uuid.h>
|
||||||
#endif // OS_MACOSX
|
#endif // OS_MACOSX
|
||||||
|
|
||||||
#if CXX_LIBRARY_VERSION >= 2011
|
|
||||||
#include <type_traits>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
|
|
||||||
static_assert(sizeof(UUID) == 16, "UUID must be 16 bytes");
|
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");
|
static_assert(std::is_pod<UUID>::value, "UUID must be POD");
|
||||||
#endif
|
|
||||||
|
|
||||||
bool UUID::operator==(const UUID& that) const {
|
bool UUID::operator==(const UUID& that) const {
|
||||||
return memcmp(this, &that, sizeof(*this)) == 0;
|
return memcmp(this, &that, sizeof(*this)) == 0;
|
||||||
|
@ -23,15 +23,6 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#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 crashpad {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
@ -70,19 +61,16 @@ struct AlignedAllocator {
|
|||||||
using other = AlignedAllocator<U, Alignment>;
|
using other = AlignedAllocator<U, Alignment>;
|
||||||
};
|
};
|
||||||
|
|
||||||
AlignedAllocator() CRASHPAD_NOEXCEPT {}
|
AlignedAllocator() noexcept {}
|
||||||
AlignedAllocator(const AlignedAllocator& other) CRASHPAD_NOEXCEPT {}
|
AlignedAllocator(const AlignedAllocator& other) noexcept {}
|
||||||
|
|
||||||
template <typename U>
|
template <typename U>
|
||||||
AlignedAllocator(const AlignedAllocator<U, Alignment>& other)
|
AlignedAllocator(const AlignedAllocator<U, Alignment>& other) noexcept {}
|
||||||
CRASHPAD_NOEXCEPT {}
|
|
||||||
|
|
||||||
~AlignedAllocator() {}
|
~AlignedAllocator() {}
|
||||||
|
|
||||||
pointer address(reference x) const CRASHPAD_NOEXCEPT { return &x; }
|
pointer address(reference x) const noexcept { return &x; }
|
||||||
const_pointer address(const_reference x) const CRASHPAD_NOEXCEPT {
|
const_pointer address(const_reference x) const noexcept { return &x; }
|
||||||
return &x;
|
|
||||||
}
|
|
||||||
|
|
||||||
pointer allocate(size_type n, std::allocator<void>::const_pointer hint = 0) {
|
pointer allocate(size_type n, std::allocator<void>::const_pointer hint = 0) {
|
||||||
return reinterpret_cast<pointer>(
|
return reinterpret_cast<pointer>(
|
||||||
@ -91,7 +79,7 @@ struct AlignedAllocator {
|
|||||||
|
|
||||||
void deallocate(pointer p, size_type n) { internal::AlignedFree(p); }
|
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);
|
return std::numeric_limits<size_type>::max() / sizeof(value_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,13 +102,13 @@ struct AlignedAllocator {
|
|||||||
|
|
||||||
template <class T1, class T2, size_t Alignment>
|
template <class T1, class T2, size_t Alignment>
|
||||||
bool operator==(const AlignedAllocator<T1, Alignment>& lhs,
|
bool operator==(const AlignedAllocator<T1, Alignment>& lhs,
|
||||||
const AlignedAllocator<T2, Alignment>& rhs) CRASHPAD_NOEXCEPT {
|
const AlignedAllocator<T2, Alignment>& rhs) noexcept {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T1, class T2, size_t Alignment>
|
template <class T1, class T2, size_t Alignment>
|
||||||
bool operator!=(const AlignedAllocator<T1, Alignment>& lhs,
|
bool operator!=(const AlignedAllocator<T1, Alignment>& lhs,
|
||||||
const AlignedAllocator<T2, Alignment>& rhs) CRASHPAD_NOEXCEPT {
|
const AlignedAllocator<T2, Alignment>& rhs) noexcept {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,6 +122,4 @@ using AlignedVector = std::vector<T, AlignedAllocator<T, Alignment>>;
|
|||||||
|
|
||||||
} // namespace crashpad
|
} // namespace crashpad
|
||||||
|
|
||||||
#undef CRASHPAD_NOEXCEPT
|
|
||||||
|
|
||||||
#endif // CRASHPAD_UTIL_STDLIB_ALIGNED_ALLOCATOR_H_
|
#endif // CRASHPAD_UTIL_STDLIB_ALIGNED_ALLOCATOR_H_
|
||||||
|
@ -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> doesn’t do very much, and under libc++, it will cause the
|
|
||||||
// _LIBCPP_VERSION macro to be defined properly. Under libstdc++, it doesn’t
|
|
||||||
// cause __GLIBCXX__ to be defined, but if _LIBCPP_VERSION isn’t 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_
|
|
@ -23,19 +23,6 @@
|
|||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#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 won’t 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 {
|
namespace {
|
||||||
|
|
||||||
@ -50,12 +37,12 @@ struct StringToIntegerTraits {
|
|||||||
static_assert(std::numeric_limits<TIntType>::is_signed ==
|
static_assert(std::numeric_limits<TIntType>::is_signed ==
|
||||||
std::numeric_limits<TLongType>::is_signed,
|
std::numeric_limits<TLongType>::is_signed,
|
||||||
"IntType and LongType signedness must agree");
|
"IntType and LongType signedness must agree");
|
||||||
CONSTEXPR_STATIC_ASSERT(std::numeric_limits<TIntType>::min() >=
|
static_assert(std::numeric_limits<TIntType>::min() >=
|
||||||
std::numeric_limits<TLongType>::min() &&
|
std::numeric_limits<TLongType>::min() &&
|
||||||
std::numeric_limits<TIntType>::min() <
|
std::numeric_limits<TIntType>::min() <
|
||||||
std::numeric_limits<TLongType>::max(),
|
std::numeric_limits<TLongType>::max(),
|
||||||
"IntType min must be in LongType range");
|
"IntType min must be in LongType range");
|
||||||
CONSTEXPR_STATIC_ASSERT(std::numeric_limits<TIntType>::max() >
|
static_assert(std::numeric_limits<TIntType>::max() >
|
||||||
std::numeric_limits<TLongType>::min() &&
|
std::numeric_limits<TLongType>::min() &&
|
||||||
std::numeric_limits<TIntType>::max() <=
|
std::numeric_limits<TIntType>::max() <=
|
||||||
std::numeric_limits<TLongType>::max(),
|
std::numeric_limits<TLongType>::max(),
|
||||||
|
@ -183,7 +183,6 @@
|
|||||||
'process/process_memory_range.h',
|
'process/process_memory_range.h',
|
||||||
'stdlib/aligned_allocator.cc',
|
'stdlib/aligned_allocator.cc',
|
||||||
'stdlib/aligned_allocator.h',
|
'stdlib/aligned_allocator.h',
|
||||||
'stdlib/cxx.h',
|
|
||||||
'stdlib/map_insert.h',
|
'stdlib/map_insert.h',
|
||||||
'stdlib/objc.h',
|
'stdlib/objc.h',
|
||||||
'stdlib/pointer_container.h',
|
'stdlib/pointer_container.h',
|
||||||
|
@ -108,13 +108,7 @@ class InitialClientData {
|
|||||||
HANDLE client_process_;
|
HANDLE client_process_;
|
||||||
bool is_valid_;
|
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);
|
DISALLOW_COPY_AND_ASSIGN(InitialClientData);
|
||||||
#endif // _MSC_VER < 1900
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace crashpad
|
} // namespace crashpad
|
||||||
|
Loading…
x
Reference in New Issue
Block a user