3377 Commits

Author SHA1 Message Date
Abseil Team
d96371953c Use constexpr instead of ABSL_INTERNAL_CONSTEXPR_SINCE_CXX20
These are equivalent since they fall back to the standard library. There's no need to reimpose whatever constraints the standard library already imposes.

PiperOrigin-RevId: 926341943
Change-Id: I406d1203ca2d4fec68ae7a06eef0cf2dad6916dd
2026-06-03 16:36:30 -07:00
Abseil Team
bc5c03f738 Remove obsolete comments and inlining on absl_testing::status_internal::GetStatus
These functions are not in the same namespace as their arguments, so ADL is not possible.

PiperOrigin-RevId: 926284424
Change-Id: I778c6b4de0fee337f9bd09cae98a88345f12b4c4
2026-06-03 14:55:43 -07:00
Abseil Team
75b686b129 Consolidate redundant absl::c_{copy,move}(_n) signatures
PiperOrigin-RevId: 926259500
Change-Id: I89d0feb16f2525ce2574f3e1e20731ae8bccb8cb
2026-06-03 14:14:30 -07:00
Vitaly Goldshteyn
0a6b505c95 Extra tests for reserved hash table with tombstones. They are useful to test blocked element logic for tables with removed values.
PiperOrigin-RevId: 926241950
Change-Id: I6bec0306cb7c7df5e712166e250b1399b088df4f
2026-06-03 13:46:34 -07:00
h-vetinari
39519d75c2 PR #2067: Simplify the condition for ABSL_HAVE_PTHREAD_CPU_NUMBER_NP
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/2067

The conditions are always satisfied based on the macOS [lower bound](https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md) that has long moved past the versions being considered here.
Merge 49ed819784 into e3555a1274

Merging this change closes #2067

PiperOrigin-RevId: 926238049
Change-Id: Ib90a33dd1d95eb3acea25a5c09bf367f2b64cfaa
2026-06-03 13:40:05 -07:00
h-vetinari
bbca5fe5b0 PR #2067: Simplify the condition for ABSL_HAVE_PTHREAD_CPU_NUMBER_NP
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/2067

The conditions are always satisfied based on the macOS [lower bound](https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md) that has long moved past the versions being considered here.
Merge 49ed819784 into e3555a1274

Merging this change closes #2067

COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/2067 from h-vetinari:var_rm2 49ed819784
PiperOrigin-RevId: 926184137
Change-Id: I29d9f328d3bc971a22c4dec7c038d30d09c02e36
2026-06-03 12:11:56 -07:00
Abseil Team
259108c6b8 Remove empty build targets in Abseil
PiperOrigin-RevId: 926172397
Change-Id: I4bcd6c86fe30f59ab5f375db268bf78fdcf3a21e
2026-06-03 11:49:40 -07:00
Abseil Team
4c75ce5978 Use constexpr instead of ABSL_INTERNAL_CONSTEXPR_SINCE_CXX17
We only support C++17 and later now, so these are equivalent.

PiperOrigin-RevId: 926168514
Change-Id: I16f637aa1335d46dc612a0394a017e98631f3ce7
2026-06-03 11:42:48 -07:00
Abseil Team
20f6557134 Remove unnecessary uses of std::enable_if for forcing semicolons
PiperOrigin-RevId: 926097600
Change-Id: I4f1b7a213961b40585b448e6dc4d4627d4ce09f7
2026-06-03 09:54:13 -07:00
Abseil Team
c0a2d65306 Migrate invocation of deprecated absl::rotate() to std::rotate()
PiperOrigin-RevId: 926028342
Change-Id: I07e3623aac70f4b6004522df9fa78f2a321ae460
2026-06-03 07:56:06 -07:00
Vitaly Goldshteyn
e3555a1274 Extend support of blocked elements for reserved tables for capacity 15 on x86 (7 for ARM).
PiperOrigin-RevId: 925812098
Change-Id: I3027dd7908e6be3fe3a912fa3dd79472b3b42853
2026-06-02 23:35:59 -07:00
Vitaly Goldshteyn
a696886c27 Refactor raw_hash_set destructor to use type-erased destruction except empty case.
Recent changes (SOO, small tables, blocked elements) increased size of the destructor. There are planned changes that would increase it more.

Type-erasing reduces binary size and also reduces negative effects on the destructor binary size increase in the future.

PiperOrigin-RevId: 925614135
Change-Id: I863e10cb8c6c746c0d6a07b9b15df4029609f7cb
2026-06-02 15:35:06 -07:00
Abseil Team
0dc90f01cc Avoid unnecessary absl::void_t usage
PiperOrigin-RevId: 925529542
Change-Id: I19f7795cfad77f6ae0f8396b9a7a794629a8dad1
2026-06-02 12:58:43 -07:00
Abseil Team
26139554b9 Rollback of no-op changes for internal experiment
PiperOrigin-RevId: 925405274
Change-Id: Ieac8e1e8d427fefecd8ddacc62043ea27e729c88
2026-06-02 09:37:41 -07:00
Vitaly Goldshteyn
90758df74d Rollforward: "Add ABSL_ATTRIBUTE_NOINLINE to PrepareInsertLargeSlow."
PiperOrigin-RevId: 925399267
Change-Id: Id7c9f11188c2bff82330a7ab37cb1fe5bb3dd35b
2026-06-02 09:30:56 -07:00
Peter Foley
4c1be601a8 Automated Code Change
PiperOrigin-RevId: 925338543
Change-Id: Iacee19b17791d5b765117825157d532c2907c0fa
2026-06-02 07:29:47 -07:00
Mike Kruskal
1225009870 Internal cleanup
PiperOrigin-RevId: 925058738
Change-Id: I913092e6273bc43f6bb4e9ff23d908f7387b901c
2026-06-01 19:56:48 -07:00
Abseil Team
7032a0ee69 No-op changes for internal experiment
PiperOrigin-RevId: 925032057
Change-Id: I8f3a4f5bb4f079211a6e1cc5dfc8c9683d11e53e
2026-06-01 18:44:39 -07:00
Abseil Team
89ffed9131 Rollback: "Add ABSL_ATTRIBUTE_NOINLINE to PrepareInsertLargeSlow."
PiperOrigin-RevId: 925005394
Change-Id: I936be3c5c4f349c0923c86235f1bdc6b73143520
2026-06-01 17:38:08 -07:00
Mark Hansen
d873f87006 Add link to Open-addresing wiki
PiperOrigin-RevId: 924993633
Change-Id: Ib405ec707e2d2ee87cd79192b6a8a1cc23b811d0
2026-06-01 17:11:58 -07:00
Vitaly Goldshteyn
572c952b70 Add ABSL_ATTRIBUTE_NOINLINE to PrepareInsertLargeSlow.
This function is a slow path for insertions and is rarely taken. Marking it as noinline helps keep the fast path smaller.

PiperOrigin-RevId: 924928525
Change-Id: Id7fd5fb897d01094f47819420b966aa0d837baea
2026-06-01 14:57:32 -07:00
Mike Kruskal
af44d6bb45 Internal
PiperOrigin-RevId: 924927873
Change-Id: I2d87408bf0d4b0c2bab32c3d0d6973ddd28fe24f
2026-06-01 14:55:56 -07:00
Vitaly Goldshteyn
0ee7a18a4c Introduce blocked elements for reserved tables in small capacities (3 and 7 for x86 and just 3 for ARM).
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
2026-06-01 13:23:50 -07:00
h-vetinari
62816355f5 PR #2065: remove unused ABSL_INTERNAL_APPLE_CXX17_TYPES_UNAVAILABLE
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/2065

While checking on the current lower bounds of macOS support (c.f. #1513), I noticed the following block, that has been unused since aea2fc0ea1. I suggest to delete it.
Merge 87b905160b into fe126c727b

Merging this change closes #2065

COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/2065 from h-vetinari:var_rm 87b905160b
PiperOrigin-RevId: 924859200
Change-Id: I1b483bb64d79b6cb04e149552cea7eb9d8f34726
2026-06-01 12:46:54 -07:00
Vitaly Goldshteyn
19937ca3e5 Split logic for resizing empty and allocated tables.
In the follow up changes these functions would have even more difference in the implementation.

PiperOrigin-RevId: 924857072
Change-Id: I637e532b1e6ed1e7fe5d700686d9775cc0e8ec11
2026-06-01 12:42:31 -07:00
Drishti Tripathi
a30bcb2c51 PR #2069: docs: fix documentation inconsistencies in escaping.h
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
2026-06-01 10:33:34 -07:00
Derek Mauro
64730a2348 Remove an obsolete //visibility:private tag
PiperOrigin-RevId: 924755156
Change-Id: I60faad5644dbcf53e1ca4a502f1eb4bf4dfd1b87
2026-06-01 09:35:26 -07:00
Derek Mauro
c1e1979605 Use std::make_unique_for_overwrite to implement
absl::make_unique_for_overwrite when it is available

PiperOrigin-RevId: 924723063
Change-Id: Id3981612b1880c2bee505ca49ae079dc713ac746
2026-06-01 08:26:37 -07:00
Drishti Tripathi
fe126c727b PR #2064: docs: document MSVC compile-time format checking limitation in str_format.h
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/2064

Fixes #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
2026-05-28 12:46:00 -07:00
Mike Kruskal
3c5f7ea9fc Relocate and enhance CPU microarchitecture detection in Abseil
- 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
2026-05-28 10:52:28 -07:00
Abseil Team
fae2e4b515 Check if __CUDA_ARCH__ and __CUDA__ are defined in ABSL_INTERNAL_HARDENING_ABORT.
PiperOrigin-RevId: 922834347
Change-Id: I0367aa989cce098546514d4f89a7cd29f6e93d3f
2026-05-28 10:02:23 -07:00
Derek Mauro
e7a10c8ec2 Fix logging when absl::SourceLocation is an alias of std::source_location
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
2026-05-28 08:17:33 -07:00
Max Shavrick
917befffa2 Move HardeningAbort to a macro to address CUDA build issues
PiperOrigin-RevId: 922287526
Change-Id: Iff5d97f8ee48dde34cffd3b142430ee5f8b07b47
2026-05-27 12:38:41 -07:00
Derek Mauro
01c2bd4a02 Various cleanups in //absl/time/format.cc
* Remove old workaround for lack of constexpr
  * Simplify whitespace stripping
  * Remove old ParseFlag/UnparseFlag (use AbslParseFlag/AbslUnparseFlag)

PiperOrigin-RevId: 921784357
Change-Id: I87037954a4d261f76e95b45c81b2ee47f5a14ca9
2026-05-26 17:43:32 -07:00
Derek Mauro
147d631c21 Use absl::StripLeadingAsciiWhitespace instead of a lambda using std::isspace
As written the lambda doesn't correctly handle sign-extension.

Closes #2061

PiperOrigin-RevId: 921439321
Change-Id: I952e9f29c957546e91d3c91d9df0bbc45b7a2888
2026-05-26 06:51:20 -07:00
Vitaly Goldshteyn
635c53fd9d Add extra tests for working with reserved tables.
PiperOrigin-RevId: 920556603
Change-Id: Id9ed97bf11f424abf7fc5d0095bdfd78d97b9100
2026-05-24 08:33:18 -07:00
Vitaly Goldshteyn
54615fe69f Refactor ClearBackingArray and add test for clearing with different sizes.
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
2026-05-23 06:33:38 -07:00
Abseil Team
e9f87bcdb1 Disable inlining for some templated symbols in Abseil
PiperOrigin-RevId: 919789320
Change-Id: Iffcd57ecdc2dc7137caf1fe5f8c052b9bd8a1cdc
2026-05-22 11:58:22 -07:00
Abseil Team
eb0e0d4124 Add parentheses-removal support for non-__VA_OPT__-supporting compilers to status macros
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
2026-05-22 09:03:10 -07:00
Abseil Team
f883d40d20 Fix comment in variant.h to refer to absl::variant.
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
2026-05-21 17:21:03 -07:00
Abseil Team
0e9e3daf54 Add an overload of absl::c_move to move between containers.
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
2026-05-21 12:18:51 -07:00
Drishti Tripathi
b368f2cc55 PR #2057: doc: clarify moved-from state for hash containers
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
2026-05-21 10:52:18 -07:00
Derek Mauro
e7e7b016aa CRC: Fix unused variable warnings in no-op implementation
PiperOrigin-RevId: 919072538
Change-Id: Id927ef7e9d17dc9f5e83ca12a23851c2fcf60aad
2026-05-21 08:45:36 -07:00
Vitaly Goldshteyn
c7269872a5 Store capacity by log and change macro to represent original version of storing by value.
That reduces size of the hash table inline data by 25%.

PiperOrigin-RevId: 918947400
Change-Id: I56a6fa510a112aeabb3604de819454f1d72dd9af
2026-05-21 03:24:18 -07:00
Derek Mauro
9346a86073 Fix typo in the documentation of absl::CopyCordToSpan()
PiperOrigin-RevId: 918529786
Change-Id: I1cff5ae9a9571a97ea38e2b83de1d661675363a0
2026-05-20 10:40:25 -07:00
Abseil Team
caf7059741 Add friends to visibility list for Abseil hardening build target
PiperOrigin-RevId: 918493837
Change-Id: If712860dd480fef1e1d484094363f77ba2054cfa
2026-05-20 09:32:39 -07:00
Abseil Team
7890035167 Remove STATUS_MACROS_IMPL_ELSE_BLOCKER_
PiperOrigin-RevId: 918488384
Change-Id: I8cb609a307963c075a8113dc3bc94388484d4988
2026-05-20 09:19:59 -07:00
Vitaly Goldshteyn
c508bab517 Do not reserve space for GrowthInfo for single element tables in non-SOO case.
That would save 8 bytes of allocation size for such tables.

PiperOrigin-RevId: 918340255
Change-Id: Ic5f00dfb87392089ac04242418e4f55cc599619e
2026-05-20 03:23:02 -07:00
Peter Collingbourne
8fb4507d10 Fix strict aliasing violation in node_hash_map
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
2026-05-19 15:45:30 -07:00
Abseil Team
7153103088 Remove more unused leftover STATUS_MACROS_... macros
PiperOrigin-RevId: 918014423
Change-Id: I0e87d86a6cdfe329bb1bc08f8017961eb8a2a661
2026-05-19 13:59:56 -07:00