diff options
Diffstat (limited to 'absl')
-rw-r--r-- | absl/base/macros.h | 15 | ||||
-rw-r--r-- | absl/debugging/symbolize_test.cc | 8 | ||||
-rw-r--r-- | absl/strings/internal/str_join_internal.h | 24 | ||||
-rw-r--r-- | absl/time/internal/cctz/src/time_zone_lookup_test.cc | 1 | ||||
-rw-r--r-- | absl/types/span.h | 3 |
5 files changed, 26 insertions, 25 deletions
diff --git a/absl/base/macros.h b/absl/base/macros.h index 114a7be131f7..afa30300bc3e 100644 --- a/absl/base/macros.h +++ b/absl/base/macros.h @@ -36,21 +36,20 @@ // ABSL_ARRAYSIZE() // -// Returns the # of elements in an array as a compile-time constant, which can -// be used in defining new arrays. If you use this macro on a pointer by +// Returns the number of elements in an array as a compile-time constant, which +// can be used in defining new arrays. If you use this macro on a pointer by // mistake, you will get a compile-time error. -// -// Note: this template function declaration is used in defining arraysize. -// Note that the function doesn't need an implementation, as we only -// use its type. +#define ABSL_ARRAYSIZE(array) \ + (sizeof(::absl::macros_internal::ArraySizeHelper(array))) + namespace absl { 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> auto ArraySizeHelper(const T (&array)[N]) -> char (&)[N]; } // namespace macros_internal } // namespace absl -#define ABSL_ARRAYSIZE(array) \ - (sizeof(::absl::macros_internal::ArraySizeHelper(array))) // kLinkerInitialized // diff --git a/absl/debugging/symbolize_test.cc b/absl/debugging/symbolize_test.cc index c1090b8dc437..5f2af47ee45d 100644 --- a/absl/debugging/symbolize_test.cc +++ b/absl/debugging/symbolize_test.cc @@ -68,7 +68,7 @@ int ABSL_ATTRIBUTE_SECTION_VARIABLE(.text.exit) exit_func() { return 0; } -int ABSL_ATTRIBUTE_SECTION_VARIABLE(.text) regular_func() { +int /*ABSL_ATTRIBUTE_SECTION_VARIABLE(.text)*/ regular_func() { 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. static constexpr size_t kHpageSize = 1 << 21; const char kHpageTextPadding[kHpageSize * 4] ABSL_ATTRIBUTE_SECTION_VARIABLE( - ".text") = ""; + .text) = ""; static char try_symbolize_buffer[4096]; @@ -236,9 +236,9 @@ TEST(Symbolize, SymbolizeWithDemanglingStackConsumption) { const size_t kPageSize = 64 << 10; // We place a read-only symbols into the .text section and verify that we can // 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) { diff --git a/absl/strings/internal/str_join_internal.h b/absl/strings/internal/str_join_internal.h index c5fdc287cbab..a734758c21ee 100644 --- a/absl/strings/internal/str_join_internal.h +++ b/absl/strings/internal/str_join_internal.h @@ -234,17 +234,19 @@ std::string JoinAlgorithm(Iterator start, Iterator end, absl::string_view s, result_size += it->size(); } - STLStringResizeUninitialized(&result, result_size); - - // Joins strings - char* result_buf = &*result.begin(); - memcpy(result_buf, start->data(), start->size()); - result_buf += start->size(); - for (Iterator it = start; ++it != end;) { - memcpy(result_buf, s.data(), s.size()); - result_buf += s.size(); - memcpy(result_buf, it->data(), it->size()); - result_buf += it->size(); + if (result_size > 0) { + STLStringResizeUninitialized(&result, result_size); + + // Joins strings + char* result_buf = &*result.begin(); + memcpy(result_buf, start->data(), start->size()); + result_buf += start->size(); + for (Iterator it = start; ++it != end;) { + memcpy(result_buf, s.data(), s.size()); + result_buf += s.size(); + memcpy(result_buf, it->data(), it->size()); + result_buf += it->size(); + } } } diff --git a/absl/time/internal/cctz/src/time_zone_lookup_test.cc b/absl/time/internal/cctz/src/time_zone_lookup_test.cc index 2dfe53b26764..f97eab0227eb 100644 --- a/absl/time/internal/cctz/src/time_zone_lookup_test.cc +++ b/absl/time/internal/cctz/src/time_zone_lookup_test.cc @@ -415,7 +415,6 @@ const char* const kTimeZoneNames[] = { "CST6CDT", "Canada/Atlantic", "Canada/Central", - "Canada/East-Saskatchewan", "Canada/Eastern", "Canada/Mountain", "Canada/Newfoundland", diff --git a/absl/types/span.h b/absl/types/span.h index 0ca30d1d0f08..f781353c2347 100644 --- a/absl/types/span.h +++ b/absl/types/span.h @@ -290,7 +290,8 @@ class Span { constexpr Span(T (&a)[N]) noexcept // NOLINT(runtime/explicit) : 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>, typename = EnableIfMutableView<V>> explicit Span(V& v) noexcept // NOLINT(runtime/references) |