Export of internal Abseil changes
-- c99f979ad34f155fbeeea69b88bdc7458d89a21c by Derek Mauro <dmauro@google.com>: Remove a floating point division by zero test. This isn't testing behavior related to the library, and MSVC warns about it in opt mode. PiperOrigin-RevId: 285220804 -- 68b015491f0dbf1ab547994673281abd1f34cd4b by Gennadiy Rozental <rogeeff@google.com>: This CL introduces following changes to the class FlagImpl: * We eliminate the CommandLineFlagLocks struct. Instead callback guard and callback function are combined into a single CallbackData struct, while primary data lock is stored separately. * CallbackData member of class FlagImpl is initially set to be nullptr and is only allocated and initialized when a flag's callback is being set. For most flags we do not pay for the extra space and extra absl::Mutex now. * Primary data guard is stored in data_guard_ data member. This is a properly aligned character buffer of necessary size. During initialization of the flag we construct absl::Mutex in this space using placement new call. * We now avoid extra value copy after successful attempt to parse value out of string. Instead we swap flag's current value with tentative value we just produced. PiperOrigin-RevId: 285132636 -- ed45d118fb818969eb13094cf7827c885dfc562c by Tom Manshreck <shreck@google.com>: Change null-term* (and nul-term*) to NUL-term* in comments PiperOrigin-RevId: 285036610 -- 729619017944db895ce8d6d29c1995aa2e5628a5 by Derek Mauro <dmauro@google.com>: Use the Posix implementation of thread identity on MinGW. Some versions of MinGW suffer from thread_local bugs. PiperOrigin-RevId: 285022920 -- 39a25493503c76885bc3254c28f66a251c5b5bb0 by Greg Falcon <gfalcon@google.com>: Implementation detail change. Add further ABSL_NAMESPACE_BEGIN and _END annotation macros to files in Abseil. PiperOrigin-RevId: 285012012 GitOrigin-RevId: c99f979ad34f155fbeeea69b88bdc7458d89a21c Change-Id: I4c85d3704e45d11a9ac50d562f39640a6adbedc1
This commit is contained in:
parent
1e39f8626a
commit
12bc53e031
339 changed files with 948 additions and 82 deletions
|
|
@ -21,6 +21,7 @@
|
|||
#include "absl/time/time.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
@ -170,4 +171,5 @@ std::ostream& operator<<(std::ostream& os, CivilSecond s) {
|
|||
|
||||
} // namespace time_internal
|
||||
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@
|
|||
#include "absl/time/internal/cctz/include/cctz/civil_time.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
|
||||
namespace time_internal {
|
||||
struct second_tag : cctz::detail::second_tag {};
|
||||
|
|
@ -531,6 +532,7 @@ std::ostream& operator<<(std::ostream& os, CivilSecond s);
|
|||
|
||||
} // namespace time_internal
|
||||
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_TIME_CIVIL_TIME_H_
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include "absl/base/thread_annotations.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
Time Now() {
|
||||
// TODO(bww): Get a timespec instead so we don't have to divide.
|
||||
int64_t n = absl::GetCurrentTimeNanos();
|
||||
|
|
@ -43,6 +44,7 @@ Time Now() {
|
|||
}
|
||||
return time_internal::FromUnixDuration(absl::Nanoseconds(n));
|
||||
}
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
// Decide if we should use the fast GetCurrentTimeNanos() algorithm
|
||||
|
|
@ -71,9 +73,11 @@ Time Now() {
|
|||
|
||||
#if !ABSL_USE_CYCLECLOCK_FOR_GET_CURRENT_TIME_NANOS
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
int64_t GetCurrentTimeNanos() {
|
||||
return GET_CURRENT_TIME_NANOS_FROM_SYSTEM();
|
||||
}
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
#else // Use the cyclecounter-based implementation below.
|
||||
|
||||
|
|
@ -91,6 +95,7 @@ static int64_t stats_slow_paths;
|
|||
static int64_t stats_fast_slow_paths;
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace time_internal {
|
||||
// This is a friend wrapper around UnscaledCycleClock::Now()
|
||||
// (needed to access UnscaledCycleClock).
|
||||
|
|
@ -515,10 +520,12 @@ static uint64_t UpdateLastSample(uint64_t now_cycles, uint64_t now_ns,
|
|||
|
||||
return estimated_base_ns;
|
||||
}
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
#endif // ABSL_USE_CYCLECLOCK_FOR_GET_CURRENT_TIME_NANOS
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace {
|
||||
|
||||
// Returns the maximum duration that SleepOnce() can sleep for.
|
||||
|
|
@ -546,6 +553,7 @@ void SleepOnce(absl::Duration to_sleep) {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "absl/time/time.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
|
||||
// Now()
|
||||
//
|
||||
|
|
@ -49,6 +50,7 @@ int64_t GetCurrentTimeNanos();
|
|||
// * Returns immediately when passed a nonpositive duration.
|
||||
void SleepFor(absl::Duration duration);
|
||||
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@
|
|||
#include "absl/time/time.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
@ -917,4 +918,5 @@ bool ParseFlag(const std::string& text, Duration* dst, std::string* ) {
|
|||
|
||||
std::string UnparseFlag(Duration d) { return FormatDuration(d); }
|
||||
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
|||
|
|
@ -762,11 +762,6 @@ TEST(Duration, DivisionByZero) {
|
|||
const double dbl_inf = std::numeric_limits<double>::infinity();
|
||||
const double dbl_denorm = std::numeric_limits<double>::denorm_min();
|
||||
|
||||
// IEEE 754 behavior
|
||||
double z = 0.0, two = 2.0;
|
||||
EXPECT_TRUE(std::isinf(two / z));
|
||||
EXPECT_TRUE(std::isnan(z / z)); // We'll return inf
|
||||
|
||||
// Operator/(Duration, double)
|
||||
EXPECT_EQ(inf, zero / 0.0);
|
||||
EXPECT_EQ(-inf, zero / -0.0);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
namespace cctz = absl::time_internal::cctz;
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
|
||||
extern const char RFC3339_full[] = "%Y-%m-%dT%H:%M:%E*S%Ez";
|
||||
extern const char RFC3339_sec[] = "%Y-%m-%dT%H:%M:%S%Ez";
|
||||
|
|
@ -145,4 +146,5 @@ std::string UnparseFlag(absl::Time t) {
|
|||
return absl::FormatTime(RFC3339_full, t, absl::UTCTimeZone());
|
||||
}
|
||||
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
#include <cstdint>
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace time_internal {
|
||||
|
||||
static int64_t GetCurrentTimeNanosFromSystem() {
|
||||
|
|
@ -26,4 +27,5 @@ static int64_t GetCurrentTimeNanosFromSystem() {
|
|||
}
|
||||
|
||||
} // namespace time_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include "absl/base/internal/raw_logging.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace time_internal {
|
||||
|
||||
static int64_t GetCurrentTimeNanosFromSystem() {
|
||||
|
|
@ -19,4 +20,5 @@ static int64_t GetCurrentTimeNanosFromSystem() {
|
|||
}
|
||||
|
||||
} // namespace time_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
namespace cctz = absl::time_internal::cctz;
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace time_internal {
|
||||
|
||||
TimeZone LoadTimeZone(const std::string& name) {
|
||||
|
|
@ -33,9 +34,11 @@ TimeZone LoadTimeZone(const std::string& name) {
|
|||
}
|
||||
|
||||
} // namespace time_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace time_internal {
|
||||
namespace cctz_extension {
|
||||
namespace {
|
||||
|
|
@ -123,4 +126,5 @@ ZoneInfoSourceFactory zone_info_source_factory = TestFactory;
|
|||
|
||||
} // namespace cctz_extension
|
||||
} // namespace time_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
|||
|
|
@ -20,12 +20,14 @@
|
|||
#include "absl/time/time.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace time_internal {
|
||||
|
||||
// Loads the named timezone, but dies on any failure.
|
||||
absl::TimeZone LoadTimeZone(const std::string& name);
|
||||
|
||||
} // namespace time_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_TIME_INTERNAL_TEST_UTIL_H_
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@
|
|||
namespace cctz = absl::time_internal::cctz;
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
@ -494,4 +495,5 @@ struct tm ToTM(absl::Time t, absl::TimeZone tz) {
|
|||
return tm;
|
||||
}
|
||||
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ struct timeval;
|
|||
#include "absl/time/internal/cctz/include/cctz/time_zone.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
|
||||
class Duration; // Defined below
|
||||
class Time; // Defined below
|
||||
|
|
@ -1574,6 +1575,7 @@ constexpr Time FromTimeT(time_t t) {
|
|||
return time_internal::FromUnixDuration(Seconds(t));
|
||||
}
|
||||
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_TIME_TIME_H_
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue