This will let us deprecate the declarations without triggering warnings in Abseil itself.
PiperOrigin-RevId: 906360966
Change-Id: Iee362ac0eac647909ef38003280f1179813f764d
This will let us deprecate the declarations without triggering warnings in Abseil itself.
PiperOrigin-RevId: 894202105
Change-Id: I57bb2a1647be1fedf9b724a07042fd0f564ce074
Consolidate the mocking requirements so that mock detection is mediated
via the MockingAccess class
* HasInvokeMock has been deduplicated; MockingAccess now owns it
* InvokeMock is done via MockingAccess::InvokeMock
* In absl::BitGenRef, if a class has a conversion operator that is used.
* `friend class MockingAccess` is now the only mocking friend, except for backwards compat.
- friend DistributionCaller is now unnecessary.
- friend BitGenRef is now unnecessary.
- friend MockHelpers now unnecessary.
PiperOrigin-RevId: 889366369
Change-Id: I288cd60f6ac13b257c10ec3268d96828f1e61db6
absl::variant, and related types
The corresponding headers are removed from cc files, but kept in
headers to prevent breakages from transitive dependencies.
PiperOrigin-RevId: 872421685
Change-Id: I867d4c3f7c9e422289c63816d44719b0530fb0a6
for the Randen entropy pool.
https://github.com/abseil/abseil-cpp/pull/1872 reports that since
we leak the pointer but no variable holds its address, Valgrind
reports a leak. The PR contains a proposed fix, but I believe this
is simpler.
PiperOrigin-RevId: 749868815
Change-Id: I222fc3202b7a38b8ff960c2398dbf2636e60e490
absl::FastTypeId<Type>() evaluates at compile-time to a unique id for the
passed-in type. These are meant to be good match for keys into maps or
straight up comparisons.
Previously this was an internal implemention detail used by a few libraries.
This is now a supported utility function.
PiperOrigin-RevId: 743194478
Change-Id: Ie01ed8a2850696ee661acb91726252adb4c20538
In this change, //absl/status is intentionally excluded because of
complication with SWIG compatibility. This may be handled separately.
PiperOrigin-RevId: 731387819
Change-Id: I71bf2e02f3a477d65575d467f5e5ab163846d31e
If the user overrides -march e.g. via BAZEL_CXXOPTS it may conflict with
the -march override for Randen. So instead use a target attribute which
works on clang and gcc.
PiperOrigin-RevId: 728408888
Change-Id: Ie870600a80fb25f95b53f5e87bb9cc7ade53d69d
If the user overrides -march e.g. via BAZEL_CXXOPTS it may conflict with
the -march override for Randen. So instead use a target attribute which
works on clang and gcc.
PiperOrigin-RevId: 728313249
Change-Id: Ifdbf5430fbec9febdab844b8c325f9d1c7518c82
ABSL_HAVE_ACCELERATED_AES is unrelated to whether AES is supported at
runtime, so replace the ABSL_HAVE_ACCELERATED_AES check with a call to
CPUSupportsRandenHwAes() to do runtime detection.
Moreover, nothing else refers to ABSL_INTERNAL_DISABLE_AES besides this
benchmark program, so stop checking for it.
PiperOrigin-RevId: 725351190
Change-Id: Ieddb0724095db060cc5defc7c09e030b3bbafd6f
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1819
Fix the following error:
absl/random/internal/randen_detect.cc:123:12: error: no member named 'nullopt' in namespace 'std'; did you mean 'absl::nullopt'?
123 | return std::nullopt;
| ^~~~~~~~~~~~
| absl::nullopt
absl/types/optional.h:86:43: note: 'absl::nullopt' declared here
86 | ABSL_INTERNAL_INLINE_CONSTEXPR(nullopt_t, nullopt,
| ^
Merge b9a2d3920a into 7253ff8f95
Merging this change closes#1819
COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1819 from clementperon:master b9a2d3920a
PiperOrigin-RevId: 722599523
Change-Id: Ie66cbf9daf3b115668194da8b74acd6a43e12a03
The __builtin_cpu_supports path seems to cause problems on certain builds, let's remove it.
PiperOrigin-RevId: 717993600
Change-Id: I69568c17dc768a5edd097709884ba07f2c78db91
This lets us dynamically determine if we should attempt to use HW
instructions for AES.
PiperOrigin-RevId: 716350656
Change-Id: I1ead17b7b44373850b3591307b7f6d3f9147d5f9
instead of our custom ones from before the Bazel rules existed.
Also add the missing rules_cc to WORKSPACE, since we already had
it in MODULE.bazel
PiperOrigin-RevId: 715006932
Change-Id: Ibb38a78c115a7dc2983426455bb271162795846f
Linux "latest" containers updated to
GCC 14.2
CMake 3.31.2
Bazel 8.0.0
Included are various fixes to get these versions to work.
Bazel now references repositories by their canonical names from the
Bazel Central Registry. For example, Abseil is now @abseil-cpp instead
of @com_google_absl, and GoogleTest is now @googletest instead of
@com_google_googletest. Users still using the old WORKSPACE system may
need to use `repo_mapping` on repositories using the old names. See
`WORKSPACE.bazel` in this commit for an example.
PiperOrigin-RevId: 709102146
Change-Id: I02327ed4f8fb947766480bdeef2b1930a7f831eb
In order to avoid unrelated diffs in future changes that touch this code.
PiperOrigin-RevId: 694625990
Change-Id: I51ac54438a977f38c54c7638701d9ff3a259a58b
See some relevant context on this project in 254b3a5326. This type existed to support the incremental migration of added validation to MockingBitGen, validating that the returned value from absl::Uniform() is in bounds. All known cases where an out-of-bounds value was returned have been fixed and migrated to use MockingBitGen.
PiperOrigin-RevId: 693836317
Change-Id: I04f54b7b4856f4280580b294194ce2c25a18e9b1
`absl::int128` and `absl::uint128` are not `std::is_integral`. There is an internal `IsIntegral` type trait we could use, but it actually makes more sense to remove the `static_assert` altogether. Any compile-time validation should be done in `absl::Uniform` itself, and duplicating that logic here just increases the chance of divergence.
PiperOrigin-RevId: 635971431
Change-Id: I9177ae64c86ee1abe6571e0b29aba1844553c972
`absl::Uniform(tag, rng, a, b)` has some restrictions on the values it can produce in that it will always be in the range specified by `a` and `b`, but these restrictions can be violated by `absl::MockingBitGen`. This makes it easier than necessary to introduce a bug in tests using a mock RNG.
We can fix this by making `MockingBitGen` emit a runtime error if the value produced is out of bounds.
Immediately fixing all the internal buggy uses of `MockingBitGen` is currently infeasible, so the plan is this:
1. Add turned-off validation to `MockingBitGen` to avoid the costs of maintaining unsubmitted code.
2. Temporarily migrate the internal buggy use cases to keep the current behavior, to be fixed later.
3. Turn on validation for `MockingBitGen`.
4. Fix the internal buggy use cases over time.
---
A few of the different categories of errors I found:
- `Call(tag, rng, a, b) -> a or b`, for open/half-open intervals (i.e. incorrect boundary condition). This case happens quite a lot, e.g. by specifying `absl::Uniform<double>(rng, 0, 1)` to return `1.0`.
- `Call(tag, rng, 0, 1) -> 42` (i.e. return an arbitrary value). These may be straightforward to fix by just returning an in-range value, or sometimes they are difficult to fix because other data structures depend on those values.
PiperOrigin-RevId: 635503223
Change-Id: I9293ab78e79450e2b7b682dcb05149f238ecc550
The layering_check feature ensures that rules that include a header
explicitly depend on a rule that exports that header. Compiler support
is required, and currently only Clang 16+ supports diagnoses
layering_check failures.
The parse_headers feature ensures headers are self-contained by
compiling them with -fsyntax-only on supported compilers.
PiperOrigin-RevId: 572350144
Change-Id: I37297f761566d686d9dd58d318979d688b7e36d1
The non-RAW_ versions provide better output but weren't available when most of these tests were written.
There are just a couple spots where RAW_ is actually needed, e.g. signal handlers and malloc hooks.
Also fix a couple warnings in layout_test.cc newly surfaced because the optimizer understands CHECK_XX differently than INTERNAL_CHECK.
PiperOrigin-RevId: 534584435
Change-Id: I8d36fa809ffdaae5a3813064bd602cb8611c1613
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1452
__cpuid is declared in intrin.h, but is excluded on non-Windows platforms.
We add this declaration to compensate.
Fixes#1358
PiperOrigin-RevId: 534449804
Change-Id: I91027f79d8d52c4da428d5c3a53e2cec00825c13
This change fixes -Wimplicit-const-int-float-conversion warnings
by making the conversions explicit.
PiperOrigin-RevId: 520707623
Change-Id: Ib6917469120cd7458257195cbf39beb3fd397543
Since the return value of `NumBits()` will always fit into `size_t`,
use an explicit cast to silence the implicit conversion warning.
Fixes#1384
PiperOrigin-RevId: 518041598
Change-Id: If2f2456db4b27b78e9ea9e026dce610953bd5bfb