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:
Abseil Team 2019-12-12 10:36:03 -08:00 committed by Matt Calabrese
parent 1e39f8626a
commit 12bc53e031
339 changed files with 948 additions and 82 deletions

View file

@ -526,6 +526,8 @@ absl_cc_library(
${ABSL_DEFAULT_COPTS}
LINKOPTS
${ABSL_DEFAULT_LINKOPTS}
DEPS
absl::config
)
# Internal-only target, do not depend on directly.
@ -559,6 +561,8 @@ absl_cc_library(
${ABSL_DEFAULT_COPTS}
LINKOPTS
${ABSL_DEFAULT_LINKOPTS}
DEPS
absl::config
)
# Internal-only target, do not depend on directly.
@ -618,6 +622,8 @@ absl_cc_library(
${ABSL_DEFAULT_COPTS}
LINKOPTS
${ABSL_DEFAULT_LINKOPTS}
DEPS
absl::config
TESTONLY
)
@ -631,6 +637,8 @@ absl_cc_library(
${ABSL_DEFAULT_COPTS}
LINKOPTS
${ABSL_DEFAULT_LINKOPTS}
DEPS
absl::config
TESTONLY
)
@ -782,6 +790,8 @@ absl_cc_library(
${ABSL_DEFAULT_COPTS}
LINKOPTS
${ABSL_DEFAULT_LINKOPTS}
DEPS
absl::config
)
# Internal-only target, do not depend on directly.
@ -816,6 +826,7 @@ absl_cc_library(
${ABSL_DEFAULT_LINKOPTS}
DEPS
absl::random_internal_platform
absl::config
)
# Internal-only target, do not depend on directly.
@ -835,6 +846,7 @@ absl_cc_library(
DEPS
absl::random_internal_platform
absl::random_internal_randen_hwaes_impl
absl::config
)
# Internal-only target, do not depend on directly.
@ -851,6 +863,7 @@ absl_cc_library(
${ABSL_DEFAULT_LINKOPTS}
DEPS
absl::random_internal_platform
absl::config
)
# Internal-only target, do not depend on directly.
@ -868,6 +881,7 @@ absl_cc_library(
LINKOPTS
${ABSL_DEFAULT_LINKOPTS}
DEPS
absl::config
absl::core_headers
absl::raw_logging_internal
absl::strings

View file

@ -24,6 +24,7 @@
#include "absl/random/internal/iostream_state_saver.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
// absl::bernoulli_distribution is a drop in replacement for
// std::bernoulli_distribution. It guarantees that (given a perfect
@ -193,6 +194,7 @@ bool bernoulli_distribution::Generate(double p,
}
}
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_BERNOULLI_DISTRIBUTION_H_

View file

@ -29,6 +29,7 @@
#include "absl/random/internal/iostream_state_saver.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
// absl::beta_distribution:
// Generate a floating-point variate conforming to a Beta distribution:
@ -420,6 +421,7 @@ std::basic_istream<CharT, Traits>& operator>>(
return is;
}
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_BETA_DISTRIBUTION_H_

View file

@ -31,6 +31,7 @@
#include "absl/random/internal/mocking_bit_gen_base.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
template <typename URBG, typename = void, typename = void, typename = void>
@ -146,6 +147,7 @@ struct DistributionCaller<absl::BitGenRef> {
};
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_BIT_GEN_REF_H_

View file

@ -21,6 +21,7 @@
#include "absl/random/random.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
class ConstBitGen : public absl::random_internal::MockingBitGenBase {
bool CallImpl(const std::type_info&, void*, void* result) override {
@ -96,4 +97,5 @@ TEST(BitGenRefTest, MockingBitGenBaseOverrides) {
EXPECT_EQ(FnTest(gen_ref), 42); // Copy
}
} // namespace
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -15,6 +15,7 @@
#include "absl/random/discrete_distribution.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// Initializes the distribution table for Walker's Aliasing algorithm, described
@ -93,4 +94,5 @@ std::vector<std::pair<double, size_t>> InitDiscreteDistribution(
}
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -29,6 +29,7 @@
#include "absl/random/uniform_int_distribution.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
// absl::discrete_distribution
//
@ -240,6 +241,7 @@ std::basic_istream<CharT, Traits>& operator>>(
return is;
}
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_DISCRETE_DISTRIBUTION_H_

View file

@ -36,6 +36,7 @@
#include "absl/types/span.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
struct IntervalClosedClosedTag;
struct IntervalClosedOpenTag;
@ -271,6 +272,7 @@ struct DistributionFormatTraits<UniformDistributionWrapper<NumType>> {
};
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_DISTRIBUTION_FORMAT_TRAITS_H_

View file

@ -67,6 +67,7 @@
#include "absl/random/zipf_distribution.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
ABSL_INTERNAL_INLINE_CONSTEXPR(IntervalClosedClosedTag, IntervalClosedClosed,
{});
@ -458,6 +459,7 @@ IntType Zipf(URBG&& urbg, // NOLINT(runtime/references)
distribution_t, format_t>(&urbg, hi, q, v);
}
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_DISTRIBUTIONS_H_

View file

@ -27,6 +27,7 @@
#include "absl/random/internal/iostream_state_saver.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
// absl::exponential_distribution:
// Generates a number conforming to an exponential distribution and is
@ -158,6 +159,7 @@ std::basic_istream<CharT, Traits>& operator>>(
return is;
}
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_EXPONENTIAL_DISTRIBUTION_H_

View file

@ -4,6 +4,7 @@
#include "absl/random/gaussian_distribution.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
const gaussian_distribution_base::Tables
@ -96,6 +97,7 @@ const gaussian_distribution_base::Tables
0.9362826816850632339, 0.9635996931270905952, 1}};
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
// clang-format on

View file

@ -33,6 +33,7 @@
#include "absl/random/internal/iostream_state_saver.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// absl::gaussian_distribution_base implements the underlying ziggurat algorithm
@ -267,6 +268,7 @@ inline double gaussian_distribution_base::zignor(
}
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_GAUSSIAN_DISTRIBUTION_H_

View file

@ -51,6 +51,7 @@ cc_library(
visibility = [
"//absl/random:__pkg__",
],
deps = ["//absl/base:config"],
)
cc_library(
@ -78,6 +79,7 @@ cc_library(
visibility = [
"//absl/random:__pkg__",
],
deps = ["//absl/base:config"],
)
cc_library(
@ -138,6 +140,7 @@ cc_library(
],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = ["//absl/base:config"],
)
cc_library(
@ -148,6 +151,7 @@ cc_library(
],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = ["//absl/base:config"],
)
cc_library(
@ -269,6 +273,7 @@ cc_library(
"randen-keys.inc",
"platform.h",
],
deps = ["//absl/base:config"],
)
cc_library(
@ -297,6 +302,7 @@ cc_library(
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":platform",
"//absl/base:config",
"//absl/base:core_headers",
],
)
@ -317,6 +323,7 @@ cc_library(
deps = [
":platform",
":randen_hwaes_impl",
"//absl/base:config",
],
)
@ -338,6 +345,7 @@ cc_library(
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":platform",
"//absl/base:config",
"//absl/base:core_headers",
],
)
@ -368,6 +376,7 @@ cc_library(
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
"//absl/base:config",
"//absl/base:core_headers",
"//absl/base:raw_logging_internal",
"//absl/strings",

View file

@ -19,6 +19,7 @@
#include "absl/random/internal/distribution_test_util.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
namespace {
@ -227,4 +228,5 @@ double ChiSquarePValue(double chi_square, int dof) {
}
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -26,7 +26,10 @@
#include <cassert>
#include "absl/base/config.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
constexpr const char kChiSquared[] = "chi-squared";
@ -80,6 +83,7 @@ double ChiSquareValue(int dof, double p);
double ChiSquarePValue(double chi_square, int dof);
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_CHI_SQUARE_H_

View file

@ -19,7 +19,10 @@
#include <utility>
#include "absl/base/config.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// DistributionCaller provides an opportunity to overload the general
@ -51,6 +54,7 @@ struct DistributionCaller {
};
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_DISTRIBUTION_CALLER_H_

View file

@ -25,6 +25,7 @@
#include "absl/strings/str_format.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
namespace {
@ -413,4 +414,5 @@ double MaxErrorTolerance(double acceptance_probability) {
}
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -26,6 +26,7 @@
// non-test code.
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// http://webspace.ship.edu/pgmarr/Geo441/Lectures/Lec%205%20-%20Normality%20Testing.pdf
@ -106,6 +107,7 @@ double BetaIncomplete(double x, double p, double q);
double BetaIncompleteInv(double p, double q, double alpha);
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_DISTRIBUTION_TEST_UTIL_H_

View file

@ -23,6 +23,7 @@
#include "absl/random/internal/uniform_helper.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// In the absence of an explicitly provided return-type, the template
@ -45,6 +46,7 @@ using uniform_inferred_return_t =
is_widening_convertible<A, B>::value, B, A>::type>;
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_DISTRIBUTIONS_H_

View file

@ -22,7 +22,10 @@
#include <iterator>
#include <vector>
#include "absl/base/config.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// This class conforms to the C++ Standard "Seed Sequence" concept
@ -82,6 +85,7 @@ class ExplicitSeedSeq {
};
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_EXPLICIT_SEED_SEQ_H_

View file

@ -20,7 +20,10 @@
#include <limits>
#include <type_traits>
#include "absl/base/config.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// Returns true if the input value is zero or a power of two. Useful for
// determining if the range of output values in a URBG
@ -255,6 +258,7 @@ FastUniformBits<UIntType>::Generate(URBG& g, // NOLINT(runtime/references)
}
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_FAST_UNIFORM_BITS_H_

View file

@ -19,6 +19,7 @@
#include "gtest/gtest.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
namespace {
@ -269,4 +270,5 @@ TEST(FastUniformBitsTest, URBG32bitRegression) {
} // namespace
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -25,6 +25,7 @@
#include "absl/base/internal/bits.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// Returns the position of the first bit set.
@ -67,6 +68,7 @@ inline constexpr uint64_t rotr(uint64_t value, uint8_t bits) {
}
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_FASTMATH_H_

View file

@ -27,6 +27,7 @@
#include "absl/base/macros.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
namespace {
@ -135,6 +136,7 @@ void TableGenerator::Print(std::ostream* os) {
}
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
int main(int, char**) {

View file

@ -29,6 +29,7 @@
#include "absl/random/internal/traits.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// Tristate tag types controlling the output of GenerateRealFromBits.
@ -139,6 +140,7 @@ inline RealType GenerateRealFromBits(uint64_t bits, int exp_bias = 0) {
}
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_GENERATE_REAL_H_

View file

@ -24,6 +24,7 @@
#include "absl/numeric/int128.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// The null_state_saver does nothing.
@ -238,6 +239,7 @@ inline FloatType read_floating_point(IStream& is) {
}
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_IOSTREAM_STATE_SAVER_H_

View file

@ -23,6 +23,7 @@
#include "absl/random/mocking_bit_gen.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
template <typename DistrT, typename Fn>
@ -85,5 +86,6 @@ struct MockOverloadSet<DistrT, FirstSig, Rest...>
};
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_MOCK_OVERLOAD_SET_H_

View file

@ -25,6 +25,7 @@
#include "absl/strings/str_cat.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// MockingBitGenExpectationFormatter is invoked to format unsatisfied mocks
@ -113,6 +114,7 @@ class MockingBitGenBase {
}; // namespace random_internal
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_MOCKING_BIT_GEN_BASE_H_

View file

@ -70,6 +70,7 @@
#endif
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal_nanobenchmark {
namespace {
@ -799,4 +800,5 @@ size_t Measure(const Func func, const void* arg, const FuncInput* inputs,
}
} // namespace random_internal_nanobenchmark
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -50,7 +50,10 @@
#include <stddef.h>
#include <stdint.h>
#include "absl/base/config.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal_nanobenchmark {
// Input influencing the function being measured (e.g. number of bytes to copy).
@ -163,6 +166,7 @@ static inline size_t MeasureClosure(const Closure& closure,
}
} // namespace random_internal_nanobenchmark
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_NANOBENCHMARK_H_

View file

@ -18,6 +18,7 @@
#include "absl/strings/numbers.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal_nanobenchmark {
namespace {
@ -67,6 +68,7 @@ void RunAll(const int argc, char* argv[]) {
} // namespace
} // namespace random_internal_nanobenchmark
ABSL_NAMESPACE_END
} // namespace absl
int main(int argc, char* argv[]) {

View file

@ -33,6 +33,7 @@
#include "absl/types/span.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// Each instance of NonsecureURBGBase<URBG> will be seeded by variates produced
@ -143,6 +144,7 @@ class NonsecureURBGBase {
};
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_NONSECURE_BASE_H_

View file

@ -24,6 +24,7 @@
#include "absl/random/internal/iostream_state_saver.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// pcg_engine is a simplified implementation of Melissa O'Neil's PCG engine in
@ -300,6 +301,7 @@ using pcg32_2018_engine = pcg_engine<
random_internal::pcg_xsh_rr_64_32>;
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_PCG_ENGINE_H_

View file

@ -37,6 +37,7 @@ using absl::base_internal::SpinLock;
using absl::base_internal::SpinLockHolder;
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
namespace {
@ -249,4 +250,5 @@ template class RandenPool<uint32_t>;
template class RandenPool<uint64_t>;
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -22,6 +22,7 @@
#include "absl/types/span.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// RandenPool is a thread-safe random number generator [random.req.urbg] that
@ -124,6 +125,7 @@ class PoolURBG {
};
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_POOL_URBG_H_

View file

@ -41,6 +41,7 @@
// structured/low-entropy counters to digits of Pi.
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
namespace {
@ -86,4 +87,5 @@ Randen::Randen() {
}
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -23,6 +23,7 @@
#include "absl/random/internal/randen_traits.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// RANDen = RANDom generator or beetroots in Swiss German.
@ -95,6 +96,7 @@ class Randen {
};
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_RANDEN_H_

View file

@ -95,6 +95,7 @@ static uint32_t GetAuxval(uint32_t hwcap_type) {
#endif
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// The default return at the end of the function might be unreachable depending
@ -216,4 +217,5 @@ bool CPUSupportsRandenHwAes() {
#endif
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -15,7 +15,10 @@
#ifndef ABSL_RANDOM_INTERNAL_RANDEN_DETECT_H_
#define ABSL_RANDOM_INTERNAL_RANDEN_DETECT_H_
#include "absl/base/config.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// Returns whether the current CPU supports RandenHwAes implementation.
@ -24,6 +27,7 @@ namespace random_internal {
bool CPUSupportsRandenHwAes();
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_RANDEN_DETECT_H_

View file

@ -28,6 +28,7 @@
#include "absl/random/internal/randen.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// Deterministic pseudorandom byte generator with backtracking resistance
@ -223,6 +224,7 @@ class alignas(16) randen_engine {
};
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_RANDEN_ENGINE_H_

View file

@ -75,6 +75,7 @@
#include <cstdlib>
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// No accelerated implementation.
@ -106,6 +107,7 @@ void RandenHwAes::Generate(const void*, void*) {
}
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#else // defined(ABSL_RANDEN_HWAES_IMPL)
@ -518,6 +520,7 @@ inline ABSL_TARGET_CRYPTO void Permute(
} // namespace
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
bool HasRandenHwAesImplementation() { return true; }
@ -629,6 +632,7 @@ void ABSL_TARGET_CRYPTO RandenHwAes::Generate(const void* keys,
#endif
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // (ABSL_RANDEN_HWAES_IMPL)

View file

@ -15,12 +15,15 @@
#ifndef ABSL_RANDOM_INTERNAL_RANDEN_HWAES_H_
#define ABSL_RANDOM_INTERNAL_RANDEN_HWAES_H_
#include "absl/base/config.h"
// HERMETIC NOTE: The randen_hwaes target must not introduce duplicate
// symbols from arbitrary system and other headers, since it may be built
// with different flags from other targets, using different levels of
// optimization, potentially introducing ODR violations.
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// RANDen = RANDom generator or beetroots in Swiss German.
@ -41,6 +44,7 @@ class RandenHwAes {
bool HasRandenHwAesImplementation();
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_RANDEN_HWAES_H_

View file

@ -462,6 +462,7 @@ inline ABSL_RANDOM_INTERNAL_ATTRIBUTE_ALWAYS_INLINE void Permute(
} // namespace
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
const void* RandenSlow::GetKeys() {
@ -501,4 +502,5 @@ void RandenSlow::Generate(const void* keys, void* state_void) {
}
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -17,7 +17,10 @@
#include <cstddef>
#include "absl/base/config.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// RANDen = RANDom generator or beetroots in Swiss German.
@ -38,6 +41,7 @@ class RandenSlow {
};
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_RANDEN_SLOW_H_

View file

@ -22,7 +22,10 @@
#include <cstddef>
#include "absl/base/config.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// RANDen = RANDom generator or beetroots in Swiss German.
@ -54,6 +57,7 @@ struct RandenTraits {
};
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_RANDEN_TRAITS_H_

View file

@ -30,6 +30,7 @@
#include "absl/types/span.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// This class conforms to the C++ Standard "Seed Sequence" concept
@ -160,6 +161,7 @@ SaltedSeedSeq<typename std::decay<SSeq>::type> MakeSaltedSeedSeq(SSeq&& seq) {
}
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_SALTED_SEED_SEQ_H_

View file

@ -61,6 +61,7 @@
#endif
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
namespace {
@ -214,4 +215,5 @@ absl::optional<uint32_t> GetSaltMaterial() {
}
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -27,6 +27,7 @@
#include "absl/types/span.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// Returns the number of 32-bit blocks needed to contain the given number of
@ -97,6 +98,7 @@ void MixIntoSeedMaterial(absl::Span<const uint32_t> sequence,
absl::optional<uint32_t> GetSaltMaterial();
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_SEED_MATERIAL_H_

View file

@ -21,7 +21,10 @@
#include <type_traits>
#include <vector>
#include "absl/base/config.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// `sequence_urbg` is a simple random number generator which meets the
@ -51,6 +54,7 @@ class sequence_urbg {
};
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_SEQUENCE_URBG_H_

View file

@ -22,6 +22,7 @@
#include "absl/base/config.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// random_internal::is_widening_convertible<A, B>
@ -94,6 +95,7 @@ struct make_unsigned_bits {
};
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_TRAITS_H_

View file

@ -22,6 +22,7 @@
#include "absl/meta/type_traits.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
template <typename IntType>
class uniform_int_distribution;
@ -173,6 +174,7 @@ struct UniformDistributionWrapper : public UniformDistribution<NumType> {
};
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_UNIFORM_HELPER_H_

View file

@ -31,6 +31,7 @@
#include "absl/random/internal/traits.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
// Helper object to multiply two 64-bit values to a 128-bit value.
@ -104,6 +105,7 @@ struct wide_multiply<uint64_t> {
#endif
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_WIDE_MULTIPLY_H_

View file

@ -30,6 +30,7 @@
#include "absl/random/uniform_int_distribution.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
// log_uniform_int_distribution:
//
@ -247,6 +248,7 @@ std::basic_istream<CharT, Traits>& operator>>(
return is;
}
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_LOG_UNIFORM_INT_DISTRIBUTION_H_

View file

@ -53,6 +53,7 @@
#include "absl/random/mocking_bit_gen.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
// -----------------------------------------------------------------------------
// absl::MockUniform
@ -254,6 +255,7 @@ using MockZipf =
IntType(MockingBitGen&, IntType, double,
double)>;
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_MOCK_DISTRIBUTIONS_H_

View file

@ -18,6 +18,7 @@
#include <string>
namespace absl {
ABSL_NAMESPACE_BEGIN
MockingBitGen::~MockingBitGen() {
for (const auto& del : deleters_) {
@ -25,4 +26,5 @@ MockingBitGen::~MockingBitGen() {
}
}
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -51,6 +51,7 @@
#include "absl/utility/utility.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
@ -189,6 +190,7 @@ struct DistributionCaller<absl::MockingBitGen> {
};
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_MOCKING_BIT_GEN_H_

View file

@ -28,6 +28,7 @@
#include "absl/random/internal/iostream_state_saver.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
// absl::poisson_distribution:
// Generates discrete variates conforming to a Poisson distribution.
@ -251,6 +252,7 @@ std::basic_istream<CharT, Traits>& operator>>(
return is;
}
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_POISSON_DISTRIBUTION_H_

View file

@ -41,6 +41,7 @@
#include "absl/random/seed_sequences.h" // IWYU pragma: export
namespace absl {
ABSL_NAMESPACE_BEGIN
// -----------------------------------------------------------------------------
// absl::BitGen
@ -182,6 +183,7 @@ using InsecureBitGen =
// discards the intermediate results.
// ---------------------------------------------------------------------------
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_RANDOM_H_

View file

@ -19,6 +19,7 @@
#include "absl/base/config.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
static constexpr const char kExceptionMessage[] =
"Failed generating seed-material for URBG.";
@ -41,4 +42,5 @@ void ThrowSeedGenException() {
}
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -28,7 +28,10 @@
#include <exception>
#include "absl/base/config.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
//------------------------------------------------------------------------------
// SeedGenException
@ -46,6 +49,7 @@ namespace random_internal {
[[noreturn]] void ThrowSeedGenException();
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_SEED_GEN_EXCEPTION_H_

View file

@ -17,6 +17,7 @@
#include "absl/random/internal/pool_urbg.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
SeedSeq MakeSeedSeq() {
SeedSeq::result_type seed_material[8];
@ -24,4 +25,5 @@ SeedSeq MakeSeedSeq() {
return SeedSeq(std::begin(seed_material), std::end(seed_material));
}
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -34,6 +34,7 @@
#include "absl/types/span.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
// -----------------------------------------------------------------------------
// absl::SeedSeq
@ -103,6 +104,7 @@ SeedSeq CreateSeedSeqFrom(URBG* urbg) {
//
SeedSeq MakeSeedSeq();
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_SEED_SEQUENCES_H_

View file

@ -40,6 +40,7 @@
#include "absl/random/internal/wide_multiply.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
// absl::uniform_int_distribution<T>
//
@ -268,6 +269,7 @@ uniform_int_distribution<IntType>::Generate(
return helper::hi(product);
}
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_UNIFORM_INT_DISTRIBUTION_H_

View file

@ -45,6 +45,7 @@
#include "absl/random/internal/iostream_state_saver.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
// absl::uniform_real_distribution<T>
//
@ -195,6 +196,7 @@ std::basic_istream<CharT, Traits>& operator>>(
}
return is;
}
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_UNIFORM_REAL_DISTRIBUTION_H_

View file

@ -26,6 +26,7 @@
#include "absl/random/uniform_real_distribution.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
// absl::zipf_distribution produces random integer-values in the range [0, k],
// distributed according to the discrete probability function:
@ -264,6 +265,7 @@ std::basic_istream<CharT, Traits>& operator>>(
return is;
}
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_ZIPF_DISTRIBUTION_H_