- e63f59e34d34d483f89e4e6a7fe80805d1332329 This CL replicates github.com/abseil/abseil-cpp/pull/117 ... by Abseil Team <absl-team@google.com>

- 8444789eefc1f20c0102041ee52ad841131dcf93 Import of CCTZ from Github. by Abseil Team <absl-team@google.com>
  - 847bf3389edff542cdfcc4fcfb5b1d7466a5d297 Suggest using MakeSpan rather than the explicit mutable r... by Abseil Team <absl-team@google.com>
  - b6f130c12a3b2e8ea14e848df523f3ca8d360d25 ABSL_ARRAYSIZE is now declared and documented more clearl... by Matt Armstrong <marmstrong@google.com>
  - 8243bbcd7398e0cc1fed405b3c7cecc54fe77145 Don't dereference the begin() iterator of an empty string. by Derek Mauro <dmauro@google.com>
  - be817477eb17964a0f4c2a943c8281763ee269b0 Revert rename THREAD_ANNOTATION_ATTRIBUTE__ by Abseil Team <absl-team@google.com>
  - 940d4657f63acd7ff61d986558b0a38fa545a1fe Don't create '".text"' section when '.text' was intended. by Abseil Team <absl-team@google.com>
  - f6680d634b66537acec18121fbdca7c9083877b1 Rename THREAD_ANNOTATION_ATTRIBUTE__ by Abseil Team <absl-team@google.com>

GitOrigin-RevId: e63f59e34d34d483f89e4e6a7fe80805d1332329
Change-Id: If6f2286d6cbfd7b822e83c6cc28fa3e752bb41a4
This commit is contained in:
Abseil Team 2018-05-09 13:57:56 -07:00 committed by John Olson
parent a193b3d3b7
commit cd95e71df6
6 changed files with 31 additions and 30 deletions

View file

@ -36,21 +36,20 @@
// ABSL_ARRAYSIZE() // ABSL_ARRAYSIZE()
// //
// Returns the # of elements in an array as a compile-time constant, which can // Returns the number of elements in an array as a compile-time constant, which
// be used in defining new arrays. If you use this macro on a pointer by // can be used in defining new arrays. If you use this macro on a pointer by
// mistake, you will get a compile-time error. // mistake, you will get a compile-time error.
// #define ABSL_ARRAYSIZE(array) \
// Note: this template function declaration is used in defining arraysize. (sizeof(::absl::macros_internal::ArraySizeHelper(array)))
// Note that the function doesn't need an implementation, as we only
// use its type.
namespace absl { namespace absl {
namespace macros_internal { namespace macros_internal {
// Note: this internal template function declaration is used by ABSL_ARRAYSIZE.
// The function doesn't need a definition, as we only use its type.
template <typename T, size_t N> template <typename T, size_t N>
auto ArraySizeHelper(const T (&array)[N]) -> char (&)[N]; auto ArraySizeHelper(const T (&array)[N]) -> char (&)[N];
} // namespace macros_internal } // namespace macros_internal
} // namespace absl } // namespace absl
#define ABSL_ARRAYSIZE(array) \
(sizeof(::absl::macros_internal::ArraySizeHelper(array)))
// kLinkerInitialized // kLinkerInitialized
// //

View file

@ -68,7 +68,7 @@ int ABSL_ATTRIBUTE_SECTION_VARIABLE(.text.exit) exit_func() {
return 0; return 0;
} }
int ABSL_ATTRIBUTE_SECTION_VARIABLE(.text) regular_func() { int /*ABSL_ATTRIBUTE_SECTION_VARIABLE(.text)*/ regular_func() {
return 0; return 0;
} }
@ -88,7 +88,7 @@ static volatile bool volatile_bool = false;
// Force the binary to be large enough that a THP .text remap will succeed. // Force the binary to be large enough that a THP .text remap will succeed.
static constexpr size_t kHpageSize = 1 << 21; static constexpr size_t kHpageSize = 1 << 21;
const char kHpageTextPadding[kHpageSize * 4] ABSL_ATTRIBUTE_SECTION_VARIABLE( const char kHpageTextPadding[kHpageSize * 4] ABSL_ATTRIBUTE_SECTION_VARIABLE(
".text") = ""; .text) = "";
static char try_symbolize_buffer[4096]; static char try_symbolize_buffer[4096];
@ -236,9 +236,9 @@ TEST(Symbolize, SymbolizeWithDemanglingStackConsumption) {
const size_t kPageSize = 64 << 10; const size_t kPageSize = 64 << 10;
// We place a read-only symbols into the .text section and verify that we can // We place a read-only symbols into the .text section and verify that we can
// symbolize them and other symbols after remapping them. // symbolize them and other symbols after remapping them.
const char kPadding0[kPageSize * 4] ABSL_ATTRIBUTE_SECTION_VARIABLE(".text") = const char kPadding0[kPageSize * 4] ABSL_ATTRIBUTE_SECTION_VARIABLE(.text) =
""; "";
const char kPadding1[kPageSize * 4] ABSL_ATTRIBUTE_SECTION_VARIABLE(".text") = const char kPadding1[kPageSize * 4] ABSL_ATTRIBUTE_SECTION_VARIABLE(.text) =
""; "";
static int FilterElfHeader(struct dl_phdr_info *info, size_t size, void *data) { static int FilterElfHeader(struct dl_phdr_info *info, size_t size, void *data) {

View file

@ -234,6 +234,7 @@ std::string JoinAlgorithm(Iterator start, Iterator end, absl::string_view s,
result_size += it->size(); result_size += it->size();
} }
if (result_size > 0) {
STLStringResizeUninitialized(&result, result_size); STLStringResizeUninitialized(&result, result_size);
// Joins strings // Joins strings
@ -247,6 +248,7 @@ std::string JoinAlgorithm(Iterator start, Iterator end, absl::string_view s,
result_buf += it->size(); result_buf += it->size();
} }
} }
}
return result; return result;
} }

View file

@ -415,7 +415,6 @@ const char* const kTimeZoneNames[] = {
"CST6CDT", "CST6CDT",
"Canada/Atlantic", "Canada/Atlantic",
"Canada/Central", "Canada/Central",
"Canada/East-Saskatchewan",
"Canada/Eastern", "Canada/Eastern",
"Canada/Mountain", "Canada/Mountain",
"Canada/Newfoundland", "Canada/Newfoundland",

View file

@ -290,7 +290,8 @@ class Span {
constexpr Span(T (&a)[N]) noexcept // NOLINT(runtime/explicit) constexpr Span(T (&a)[N]) noexcept // NOLINT(runtime/explicit)
: Span(a, N) {} : Span(a, N) {}
// Explicit reference constructor for a mutable `Span<T>` type // Explicit reference constructor for a mutable `Span<T>` type. Can be
// replaced with MakeSpan() to infer the type parameter.
template <typename V, typename = EnableIfConvertibleFrom<V>, template <typename V, typename = EnableIfConvertibleFrom<V>,
typename = EnableIfMutableView<V>> typename = EnableIfMutableView<V>>
explicit Span(V& v) noexcept // NOLINT(runtime/references) explicit Span(V& v) noexcept // NOLINT(runtime/references)