As written the lambda doesn't correctly handle sign-extension.
Closes#2061
PiperOrigin-RevId: 921439321
Change-Id: I952e9f29c957546e91d3c91d9df0bbc45b7a2888
This change refactors the "no reuse" logic from ClearBackingArray into a new helper function ClearBackingArrayNoReuse. It also clarifies that ClearBackingArray is only applicable to tables with capacity greater than MaxSmallCapacity(), adding asserts and checks to enforce this.
PiperOrigin-RevId: 920163391
Change-Id: I22b5fe24d796b00fc1231d4e42720d58a2a7aa60
This enables writing expressions such as ABSL_ASSIGN_OR_RETURN((std::tuple<int, int> t1), ...) to allow commas in the type name on MSVC's traditional preprocessor, which does not support __VA_OPT__.
PiperOrigin-RevId: 919705428
Change-Id: I6887b5607d422b8bc4586068ed42b4e9d384ee44
The comment is updated to accurately reflect that `absl::variant` was the polyfill and is now an alias for `std::variant`.
PiperOrigin-RevId: 919336725
Change-Id: If39bd3f61f229f561d547391ca97015688b1fad1
This change introduces a new overload for absl::c_move that takes two ranges, allowing elements to be moved from a source container to a destination container. The destination container must be fixed size so we can perform bounds checking.
PiperOrigin-RevId: 919189227
Change-Id: Ica35c5d8bd59ebe16564f2b2f490770899ad16f8
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/2057
Adds documentation to flat_hash_map, flat_hash_set, node_hash_map, and
node_hash_set clarifying the moved-from contract for Swiss table containers.
After a move, only destruction, assignment, and clear() are guaranteed
safe. Any other operation (e.g. size(), empty(), iteration) results in
undefined behavior.
Fixes#1928
Merge 64990acd7a into c7269872a5
Merging this change closes#2057
COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/2057 from DrishtiTripathi2230:oc/moved-from-hash-container-state 64990acd7a
PiperOrigin-RevId: 919140795
Change-Id: Ie755387c46907b0e5a78d4e21577173616c10f9f
node_hash_map uses the function TypeErasedDerefAndApplyToSlotFn to hash a
slot's key. This function accesses a slot pointer as if it were of type
Key* when in fact it is of type value_type* (aka std::pair<const Key,
Value> *). This is technically a strict aliasing violation because the
types of the pointer objects are different. Fix it by defining a new
type erased function TypeErasedDerefAndApplyToSlotFirstFn that uses the
correct type for the pointer.
PiperOrigin-RevId: 918067685
Change-Id: I5d65e0e077f84a0f869be0e24fee094b4b09fbfb
Also temporarily define ABSL_DEFINE_UNQUALIFIED_STATUS_MACROS until we turn it off in OSS. (I split these up to make them easier to submit & revert, given I wanted TGPs for both.)
PiperOrigin-RevId: 917868888
Change-Id: I3e1128f5838f8fa988b90b9c4d1b794e7f0bbdfc
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/2051
Commit 33bbc26 made changes to stacktrace_emscripten-inl.inc but did not change the stacktrace_generic-inl.inc file. This caused `absl_stacktrace_test` to fail on s390x.
```
Expected: (results[i]) != (nullptr), actual: NULL vs (nullptr)
Unexpected nullptr found at index 14
[ FAILED ] StackTrace.NoNullptrInPopulatedRange (0 ms)
```
This patch applies the same logic to stacktrace_generic-inl.inc.
Merge b2fef211b0 into 89203a0303
Merging this change closes#2051
COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/2051 from miladfarca:fix-33bbc26 b2fef211b0
PiperOrigin-RevId: 915361786
Change-Id: Iafb02166414df57845410457796758a97bcc253a
These versions accept a container as the output destination. The primary motivation for these overloads is to add bounds checking. We determine if an object is a container by checking if they support `std::begin`/`std::end`.
PiperOrigin-RevId: 915035028
Change-Id: Ibeb17b784ec313215ba8216a6085628d11eac102
Also:
- Adds type safety for probe overloads, which has been a source of bugs for me in the past so I think it should be useful regardless of whether log-based-capacity lands.
- Adds an assertion for IsValid() when getting capacity from CommonFields and not calling maybe_invalid_capacity().
Note that this is a no-op (other than the new assertion) when capacity-by-log is disabled (default behavior).
PiperOrigin-RevId: 914932479
Change-Id: I86fd20ea27048ad6dfdf39da54f3f300cc7af4f9
* GCC latest is now 16.1
* GCC floor is 10.5.0
* CMake 4.3.2"
* Clang/LLVM 22.1.0"
* Bazel 9.1.0
The new Linux docker containers now refer to their SHA256
instead of a tag in the configuration file.
PiperOrigin-RevId: 914372195
Change-Id: I39cb89b922a4b829f9e045790742de9b765b210f
Dead-store elimination and lifetime analysis are breaking and/or
causing warnings for the initialization tests. Inhibit optimization to
prevent this.
PiperOrigin-RevId: 913929059
Change-Id: I2a748f9d18607c0cde99d184e4158cd6e1d4c6ad
Comparing capacity_data_ directly leads to a better generated code.
One byte comparison is used before computing the capacity in order to detect small tables.
On x86 the diff for critical path detection of small table:
```
48 c7 c1 ff ff ff ff movq $-0x1, %rcx ~~~> a8 fe testb $-0x2, %al
c4 e2 f9 f7 c9 shlxq %rax, %rcx, %rcx ~~~>
48 83 f9 fe cmpq $-0x2, %rcx ~~~>
```
PiperOrigin-RevId: 913716016
Change-Id: I264cc3051e359632a2af5a4a196f44ed272dedc2
That is important to facilitate experimentation with log-based capacity mode.
PiperOrigin-RevId: 913613088
Change-Id: I6d328d5b8866623a24b9b639271b239794bc384c
This change broke rust wrappers for any_invocable due to templating issues.
PiperOrigin-RevId: 912760874
Change-Id: Ia0303e011e384e2cca284e393e59c0301974394e
This associates debug information with the assertion site,
allowing clearer stack-traces for assertion failures and
better accounting of the performance overhead of assertions.
PiperOrigin-RevId: 912616493
Change-Id: I3bcaa8d24fc7d9adc04e67fe228bf418bb5eb842
This associates debug information with the assertion sites,
allowing clearer stack-traces for assertion failures and
better accounting of the performance overhead of assertions.
PiperOrigin-RevId: 911622698
Change-Id: If981469b9da24c83a97534db2aa579ee21c9547c