diff options
-rw-r--r-- | absl/base/internal/sysinfo.cc | 9 | ||||
-rw-r--r-- | absl/debugging/internal/stacktrace_aarch64-inl.inc | 13 | ||||
-rw-r--r-- | absl/strings/CMakeLists.txt | 1 | ||||
-rw-r--r-- | absl/strings/internal/str_format/arg.cc | 23 | ||||
-rw-r--r-- | absl/strings/internal/str_format/bind.h | 7 | ||||
-rw-r--r-- | absl/strings/str_cat.cc | 8 | ||||
-rw-r--r-- | absl/time/internal/cctz/src/time_zone_format.cc | 6 | ||||
-rw-r--r-- | absl/time/internal/cctz/src/time_zone_libc.cc | 15 |
8 files changed, 47 insertions, 35 deletions
diff --git a/absl/base/internal/sysinfo.cc b/absl/base/internal/sysinfo.cc index 7de8ead2..605a11eb 100644 --- a/absl/base/internal/sysinfo.cc +++ b/absl/base/internal/sysinfo.cc @@ -426,6 +426,15 @@ pid_t GetTID() { return static_cast<pid_t>(tid); } +#elif defined(__native_client__) + +pid_t GetTID() { + auto* thread = pthread_self(); + static_assert(sizeof(pid_t) == sizeof(thread), + "In NaCL int expected to be the same size as a pointer"); + return reinterpret_cast<pid_t>(thread); +} + #else // Fallback implementation of `GetTID` using `pthread_self`. diff --git a/absl/debugging/internal/stacktrace_aarch64-inl.inc b/absl/debugging/internal/stacktrace_aarch64-inl.inc index b66beba2..520e9a84 100644 --- a/absl/debugging/internal/stacktrace_aarch64-inl.inc +++ b/absl/debugging/internal/stacktrace_aarch64-inl.inc @@ -94,16 +94,21 @@ static void **NextStackFrame(void **old_frame_pointer, const void *uc) { void **const pre_signal_frame_pointer = reinterpret_cast<void **>(ucv->uc_mcontext.regs[29]); + // The most recent signal always needs special handling to find the frame + // pointer, but a nested signal does not. If pre_signal_frame_pointer is + // earlier in the stack than the old_frame_pointer, then use it. If it is + // later, then we have already unwound through it and it needs no special + // handling. + if (pre_signal_frame_pointer >= old_frame_pointer) { + new_frame_pointer = pre_signal_frame_pointer; + } // Check that alleged frame pointer is actually readable. This is to // prevent "double fault" in case we hit the first fault due to e.g. // stack corruption. if (!absl::debugging_internal::AddressIsReadable( - pre_signal_frame_pointer)) + new_frame_pointer)) return nullptr; - // Alleged frame pointer is readable, use it for further unwinding. - new_frame_pointer = pre_signal_frame_pointer; - // Skip frame size check if we return from a signal. We may be using a // an alternate stack for signals. check_frame_size = false; diff --git a/absl/strings/CMakeLists.txt b/absl/strings/CMakeLists.txt index 2ad052a3..878ff4f1 100644 --- a/absl/strings/CMakeLists.txt +++ b/absl/strings/CMakeLists.txt @@ -432,6 +432,7 @@ absl_cc_library( absl::strings absl::config absl::core_headers + absl::inlined_vector absl::numeric_representation absl::type_traits absl::utility diff --git a/absl/strings/internal/str_format/arg.cc b/absl/strings/internal/str_format/arg.cc index 018dd052..6033a75a 100644 --- a/absl/strings/internal/str_format/arg.cc +++ b/absl/strings/internal/str_format/arg.cc @@ -278,24 +278,6 @@ bool ConvertIntImplInnerSlow(const IntDigits &as_digits, return true; } -template <typename T, - typename std::enable_if<(std::is_integral<T>::value && - std::is_signed<T>::value) || - std::is_same<T, int128>::value, - int>::type = 0> -constexpr auto ConvertV(T) { - return FormatConversionCharInternal::d; -} - -template <typename T, - typename std::enable_if<(std::is_integral<T>::value && - std::is_unsigned<T>::value) || - std::is_same<T, uint128>::value, - int>::type = 0> -constexpr auto ConvertV(T) { - return FormatConversionCharInternal::u; -} - template <typename T> bool ConvertFloatArg(T v, FormatConversionSpecImpl conv, FormatSinkImpl *sink) { if (conv.conversion_char() == FormatConversionCharInternal::v) { @@ -332,10 +314,6 @@ bool ConvertIntArg(T v, FormatConversionSpecImpl conv, FormatSinkImpl *sink) { using U = typename MakeUnsigned<T>::type; IntDigits as_digits; - if (conv.conversion_char() == FormatConversionCharInternal::v) { - conv.set_conversion_char(ConvertV(T{})); - } - // This odd casting is due to a bug in -Wswitch behavior in gcc49 which causes // it to complain about a switch/case type mismatch, even though both are // FormatConverionChar. Likely this is because at this point @@ -361,6 +339,7 @@ bool ConvertIntArg(T v, FormatConversionSpecImpl conv, FormatSinkImpl *sink) { case static_cast<uint8_t>(FormatConversionCharInternal::d): case static_cast<uint8_t>(FormatConversionCharInternal::i): + case static_cast<uint8_t>(FormatConversionCharInternal::v): as_digits.PrintAsDec(v); break; diff --git a/absl/strings/internal/str_format/bind.h b/absl/strings/internal/str_format/bind.h index 4424c4b0..5e2a43d5 100644 --- a/absl/strings/internal/str_format/bind.h +++ b/absl/strings/internal/str_format/bind.h @@ -178,7 +178,7 @@ class Streamable { public: Streamable(const UntypedFormatSpecImpl& format, absl::Span<const FormatArgImpl> args) - : format_(format), args_(args.begin(), args.end()) { } + : format_(format), args_(args.begin(), args.end()) {} std::ostream& Print(std::ostream& os) const; @@ -197,8 +197,7 @@ std::string Summarize(UntypedFormatSpecImpl format, bool BindWithPack(const UnboundConversion* props, absl::Span<const FormatArgImpl> pack, BoundConversion* bound); -bool FormatUntyped(FormatRawSinkImpl raw_sink, - UntypedFormatSpecImpl format, +bool FormatUntyped(FormatRawSinkImpl raw_sink, UntypedFormatSpecImpl format, absl::Span<const FormatArgImpl> args); std::string& AppendPack(std::string* out, UntypedFormatSpecImpl format, @@ -217,7 +216,7 @@ int SnprintF(char* output, size_t size, UntypedFormatSpecImpl format, template <typename T> class StreamedWrapper { public: - explicit StreamedWrapper(const T& v) : v_(v) { } + explicit StreamedWrapper(const T& v) : v_(v) {} private: template <typename S> diff --git a/absl/strings/str_cat.cc b/absl/strings/str_cat.cc index 6c198f85..2e49c31b 100644 --- a/absl/strings/str_cat.cc +++ b/absl/strings/str_cat.cc @@ -146,7 +146,13 @@ void AppendPieces(std::string* dest, void StrAppend(std::string* dest, const AlphaNum& a) { ASSERT_NO_OVERLAP(*dest, a); - dest->append(a.data(), a.size()); + std::string::size_type old_size = dest->size(); + strings_internal::STLStringResizeUninitializedAmortized(dest, + old_size + a.size()); + char* const begin = &(*dest)[0]; + char* out = begin + old_size; + out = Append(out, a); + assert(out == begin + dest->size()); } void StrAppend(std::string* dest, const AlphaNum& a, const AlphaNum& b) { diff --git a/absl/time/internal/cctz/src/time_zone_format.cc b/absl/time/internal/cctz/src/time_zone_format.cc index 2e5f5329..0bea75a4 100644 --- a/absl/time/internal/cctz/src/time_zone_format.cc +++ b/absl/time/internal/cctz/src/time_zone_format.cc @@ -13,8 +13,10 @@ // limitations under the License. #if !defined(HAS_STRPTIME) -#if !defined(_MSC_VER) && !defined(__MINGW32__) -#define HAS_STRPTIME 1 // assume everyone has strptime() except windows +#if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__VXWORKS__) +#define HAS_STRPTIME \ + 1 // assume everyone has strptime() except windows + // and VxWorks #endif #endif diff --git a/absl/time/internal/cctz/src/time_zone_libc.cc b/absl/time/internal/cctz/src/time_zone_libc.cc index af9f063e..e503a858 100644 --- a/absl/time/internal/cctz/src/time_zone_libc.cc +++ b/absl/time/internal/cctz/src/time_zone_libc.cc @@ -71,6 +71,16 @@ auto tm_zone(const std::tm& tm) -> decltype(tzname[0]) { const bool is_dst = tm.tm_isdst > 0; return tzname[is_dst]; } +#elif defined(__VXWORKS__) +// Uses the globals: 'timezone' and 'tzname'. +auto tm_gmtoff(const std::tm& tm) -> decltype(timezone + 0) { + const bool is_dst = tm.tm_isdst > 0; + return timezone + (is_dst ? 60 * 60 : 0); +} +auto tm_zone(const std::tm& tm) -> decltype(tzname[0]) { + const bool is_dst = tm.tm_isdst > 0; + return tzname[is_dst]; +} #else // Adapt to different spellings of the struct std::tm extension fields. #if defined(tm_gmtoff) @@ -108,6 +118,7 @@ auto tm_zone(const T& tm) -> decltype(tm.__tm_zone) { } #endif // tm_zone #endif +using tm_gmtoff_t = decltype(tm_gmtoff(std::tm{})); inline std::tm* gm_time(const std::time_t* timep, std::tm* result) { #if defined(_WIN32) || defined(_WIN64) @@ -154,7 +165,7 @@ bool make_time(const civil_second& cs, int is_dst, std::time_t* t, // Find the least time_t in [lo:hi] where local time matches offset, given: // (1) lo doesn't match, (2) hi does, and (3) there is only one transition. -std::time_t find_trans(std::time_t lo, std::time_t hi, int offset) { +std::time_t find_trans(std::time_t lo, std::time_t hi, tm_gmtoff_t offset) { std::tm tm; while (lo + 1 != hi) { const std::time_t mid = lo + (hi - lo) / 2; @@ -265,7 +276,7 @@ time_zone::civil_lookup TimeZoneLibC::MakeTime(const civil_second& cs) const { return {time_zone::civil_lookup::UNIQUE, tp, tp, tp}; } - int offset = tm_gmtoff(tm0); + tm_gmtoff_t offset = tm_gmtoff(tm0); if (t0 < t1) { // negative DST std::swap(t0, t1); offset = tm_gmtoff(tm1); |