Changes imported from Abseil "staging" branch:

- 14488f5397315b265d57b50e6796890107e0efb2 Clarify comment on absl::NormalizeLogSeverity. by Abseil Team <absl-team@google.com>
  - 401dcf3fdb121e8356e8f54c9f2838faad9ffdf7 Internal change. by Alex Strelnikov <strel@google.com>
  - 1401400b77f8cb5d11fac414c89ffc3b55713f41 Remove unnecessary extern specifier on function declarati... by Alex Strelnikov <strel@google.com>
  - 97d1079d0e8930b1d77bda7bac5e4d15e0e74278 Add missing explicit casts between signed and unsigned in... by Alex Strelnikov <strel@google.com>
  - 47c4138142900de510e4c5426b4bf606252d7dac Internal change. by Alex Strelnikov <strel@google.com>
  - 40eb2555499a000adb78a6581215c701fa818568 Documentation fixes for `absl::optional`, for the `value_... by Abseil Team <absl-team@google.com>

GitOrigin-RevId: 14488f5397315b265d57b50e6796890107e0efb2
Change-Id: I3c11216c0c6ef5633aa5cc3b7f5977fa4a3ea1f5
This commit is contained in:
Abseil Team 2018-02-02 10:36:07 -08:00 committed by jueminyang
parent 0ec11bad6f
commit 0fa86cac40
3 changed files with 31 additions and 25 deletions

View file

@ -46,7 +46,7 @@ constexpr const char* LogSeverityName(absl::LogSeverity s) {
: s == absl::LogSeverity::kFatal ? "FATAL" : "UNKNOWN";
}
// Note that out-of-range large severities normalize to kError, not kFatal.
// Note that out-of-range severities normalize to kInfo or kError, never kFatal.
constexpr absl::LogSeverity NormalizeLogSeverity(absl::LogSeverity s) {
return s < absl::LogSeverity::kInfo
? absl::LogSeverity::kInfo

View file

@ -206,7 +206,7 @@ class alignas(16) uint128 {
extern const uint128 kuint128max;
// allow uint128 to be logged
extern std::ostream& operator<<(std::ostream& os, uint128 v);
std::ostream& operator<<(std::ostream& os, uint128 v);
// TODO(strel) add operator>>(std::istream&, uint128)
@ -287,55 +287,61 @@ constexpr uint64_t Uint128High64(uint128 v) { return v.hi_; }
#if defined(ABSL_IS_LITTLE_ENDIAN)
constexpr uint128::uint128(uint64_t high, uint64_t low)
: lo_(low), hi_(high) {}
: lo_{low}, hi_{high} {}
constexpr uint128::uint128(int v)
: lo_(v), hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0) {}
: lo_{static_cast<uint64_t>(v)},
hi_{v < 0 ? std::numeric_limits<uint64_t>::max() : 0} {}
constexpr uint128::uint128(long v) // NOLINT(runtime/int)
: lo_(v), hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0) {}
: lo_{static_cast<uint64_t>(v)},
hi_{v < 0 ? std::numeric_limits<uint64_t>::max() : 0} {}
constexpr uint128::uint128(long long v) // NOLINT(runtime/int)
: lo_(v), hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0) {}
: lo_{static_cast<uint64_t>(v)},
hi_{v < 0 ? std::numeric_limits<uint64_t>::max() : 0} {}
constexpr uint128::uint128(unsigned int v) : lo_(v), hi_(0) {}
constexpr uint128::uint128(unsigned int v) : lo_{v}, hi_{0} {}
// NOLINTNEXTLINE(runtime/int)
constexpr uint128::uint128(unsigned long v) : lo_(v), hi_(0) {}
constexpr uint128::uint128(unsigned long v) : lo_{v}, hi_{0} {}
// NOLINTNEXTLINE(runtime/int)
constexpr uint128::uint128(unsigned long long v) : lo_(v), hi_(0) {}
constexpr uint128::uint128(unsigned long long v) : lo_{v}, hi_{0} {}
#ifdef ABSL_HAVE_INTRINSIC_INT128
constexpr uint128::uint128(__int128 v)
: lo_(static_cast<uint64_t>(v & ~uint64_t{0})),
hi_(static_cast<uint64_t>(static_cast<unsigned __int128>(v) >> 64)) {}
: lo_{static_cast<uint64_t>(v & ~uint64_t{0})},
hi_{static_cast<uint64_t>(static_cast<unsigned __int128>(v) >> 64)} {}
constexpr uint128::uint128(unsigned __int128 v)
: lo_(static_cast<uint64_t>(v & ~uint64_t{0})),
hi_(static_cast<uint64_t>(v >> 64)) {}
: lo_{static_cast<uint64_t>(v & ~uint64_t{0})},
hi_{static_cast<uint64_t>(v >> 64)} {}
#endif // ABSL_HAVE_INTRINSIC_INT128
#elif defined(ABSL_IS_BIG_ENDIAN)
constexpr uint128::uint128(uint64_t high, uint64_t low)
: hi_(high), lo_(low) {}
: hi_{high}, lo_{low} {}
constexpr uint128::uint128(int v)
: hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0), lo_(v) {}
: hi_{v < 0 ? std::numeric_limits<uint64_t>::max() : 0},
lo_{static_cast<uint64_t>(v)} {}
constexpr uint128::uint128(long v) // NOLINT(runtime/int)
: hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0), lo_(v) {}
: hi_{v < 0 ? std::numeric_limits<uint64_t>::max() : 0},
lo_{static_cast<uint64_t>(v)} {}
constexpr uint128::uint128(long long v) // NOLINT(runtime/int)
: hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0), lo_(v) {}
: hi_{v < 0 ? std::numeric_limits<uint64_t>::max() : 0},
lo_{static_cast<uint64_t>(v)} {}
constexpr uint128::uint128(unsigned int v) : hi_(0), lo_(v) {}
constexpr uint128::uint128(unsigned int v) : hi_{0}, lo_{v} {}
// NOLINTNEXTLINE(runtime/int)
constexpr uint128::uint128(unsigned long v) : hi_(0), lo_(v) {}
constexpr uint128::uint128(unsigned long v) : hi_{0}, lo_{v} {}
// NOLINTNEXTLINE(runtime/int)
constexpr uint128::uint128(unsigned long long v) : hi_(0), lo_(v) {}
constexpr uint128::uint128(unsigned long long v) : hi_{0}, lo_{v} {}
#ifdef ABSL_HAVE_INTRINSIC_INT128
constexpr uint128::uint128(__int128 v)
: hi_(static_cast<uint64_t>(static_cast<unsigned __int128>(v) >> 64)),
lo_(static_cast<uint64_t>(v & ~uint64_t{0})) {}
: hi_{static_cast<uint64_t>(static_cast<unsigned __int128>(v) >> 64)},
lo_{static_cast<uint64_t>(v & ~uint64_t{0})} {}
constexpr uint128::uint128(unsigned __int128 v)
: hi_(static_cast<uint64_t>(v >> 64)),
lo_(static_cast<uint64_t>(v & ~uint64_t{0})) {}
: hi_{static_cast<uint64_t>(v >> 64)},
lo_{static_cast<uint64_t>(v & ~uint64_t{0})} {}
#endif // ABSL_HAVE_INTRINSIC_INT128
#else // byte order

View file

@ -845,7 +845,7 @@ class optional : private optional_internal::optional_data<T>,
// optional::value_or()
//
// Returns either the value of `T` or a passed default `val` if the `optional`
// Returns either the value of `T` or a passed default `v` if the `optional`
// is empty.
template <typename U>
constexpr T value_or(U&& v) const& {