This change introduces the concept of "blocked elements" for tables with capacities < Group::kWidth - 1, where we are allowed to have no empty control blocks in the main part.
These elements do not have allocated slots, reducing memory usage for small tables. The control bytes for these blocked elements are initialized to kSentinel. The allocation and deallocation logic, as well as resize operations, have been updated to account for the blocked element count.
PiperOrigin-RevId: 924878555
Change-Id: I4ed2b9c30b3ccbe3a74f560e247ed296db819c78
In the follow up changes these functions would have even more difference in the implementation.
PiperOrigin-RevId: 924857072
Change-Id: I637e532b1e6ed1e7fe5d700686d9775cc0e8ec11
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/2069
Fix documentation inconsistencies in absl/strings/escaping.h:
- Add missing `true` return value documentation to
WebSafeBase64Unescape(), aligning it with the parallel
Base64Unescape() which already documents this.
- Fix missing closing backtick in WebSafeBase64Escape() comment
(`dest` was unterminated).
- Fix inconsistent single quotes to backticks on `src`/`dest`
references, matching the style used elsewhere in the file.
Merge 0616be3080 into fe126c727b
Merging this change closes#2069
COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/2069 from DrishtiTripathi2230:docs/websafe-base64-unescape-return-value 0616be3080
PiperOrigin-RevId: 924786942
Change-Id: Idcd6d27e1da696614cd8c9417bb6facb277d1d47
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/2064Fixes#1478
absl::StrFormat compile-time format string checking relies on
__attribute__((format(...))), a GCC/Clang-specific compiler extension
that MSVC does not support. This adds a note to the file-level
documentation so MSVC users are aware that format string errors will
only be caught at runtime, not at compile time.
Merge 81977d7954 into e7a10c8ec2
Merging this change closes#2064
COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/2064 from DrishtiTripathi2230:docs/strformat-msvc-compile-time-check 81977d7954
PiperOrigin-RevId: 922922072
Change-Id: I91f545b6a1e64f3d8aba3350ac6332cb9548a40a
- Move cpu_detect to absl::base_internal, adding the kNvidiaGrace and kIntelGraniterapids enums.
- On aarch64 Linux, implement custom ISAR0.RNDR checking logic to distinguish kArmNeoverseV2 from kNvidiaGrace.
- Add IsSMTEnabled and NumContextsPerCPU
PiperOrigin-RevId: 922862384
Change-Id: I038b7732714400d6c63ff309bf20af3f436afcf5
Prior to this change logging absl::SourceLocation sometimes worked
when //absl/strings/internal/stringify_sink.h was in the transitive
includes, usually through str_cat.h.
This change adds native support to logging, to avoid dependency issues.
PiperOrigin-RevId: 922782911
Change-Id: I599390a062c6f8828985d6475a6dbd324d3e52c9
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