Commit Graph

3356 Commits

Author SHA1 Message Date
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
Abseil Team
213609f5c8 Fix a bug in LogMessage::CopyToEncodedBufferWithStructuredProtoField where all strings are encoded as not literal strings.
PiperOrigin-RevId: 917976428
Change-Id: Idd6b77216dccdbd761748f185fb466b716fff38b
2026-05-19 12:50:06 -07:00
Abseil Team
ad00fb75a8 Disable ABSL_DEFINE_UNQUALIFIED_STATUS_MACROS in OSS
PiperOrigin-RevId: 917960707
Change-Id: I2bf388a82f324d63f45ea44929847fdc19f84d7a
2026-05-19 12:16:37 -07:00
Abseil Team
23837c607e Prefix ABSL_ to ASSIGN_OR_RETURN() and RETURN_IF_ERROR() macros and use ABSL_DEFINE_UNQUALIFIED_STATUS_MACROS to enable them
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
2026-05-19 09:13:49 -07:00
Derek Mauro
2d5f437f35 Enforce GCC 10 and MSVC 2022 minimum
https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md

PiperOrigin-RevId: 917839505
Change-Id: I9a3841f819edeb2daed547dd721bbdbcf265b17d
2026-05-19 08:04:20 -07:00
Abseil Team
1ea7b9254f Undo deprecate and inline of absl::optional and absl::nullopt
PiperOrigin-RevId: 916628855
Change-Id: Iadbb9574d526aa1b6d65992135de21529600fc01
2026-05-16 20:27:56 -07:00
Abseil Team
18e7230eee Fix visibility issue in absl/log/internal:flags
PiperOrigin-RevId: 916300899
Change-Id: I219afa7d0fd85e950a05e569cb151e414358b325
2026-05-15 20:03:24 -07:00
Abseil Team
7eaa5fbb22 Deprecate and inline absl::optional and absl::nullopt
PiperOrigin-RevId: 916205787
Change-Id: I3b9e732184f45fc33f7c9fc3976c27b45bce81f9
2026-05-15 15:16:24 -07:00
Abseil Team
b0e44a92f8 Refactor size checks in c_copy and c_copy_n to use base_internal::HardeningAssert.
PiperOrigin-RevId: 916158503
Change-Id: Ie3565d3a8a2c3a983af794078b01c18beb1d49b9
2026-05-15 13:33:19 -07:00
Abseil Team
a20313e890 Deprecate and inline historical functions in Abseil
PiperOrigin-RevId: 916125223
Change-Id: I79a4bb099685ef9119718f5ab468fdb2aff21ed0
2026-05-15 12:17:13 -07:00
Abseil Team
07389c2182 Remove unused leftover STATUS_MACROS_... macros
PiperOrigin-RevId: 916122109
Change-Id: Ic4aeb927a67d755153f4bad2ca36467730cc2a65
2026-05-15 12:10:43 -07:00
Abseil Team
98583eccc8 Deprecate and inline absl::apply
PiperOrigin-RevId: 916044225
Change-Id: I526618be54733fed7d7fd68480c96a2c41e47eb3
2026-05-15 09:34:02 -07:00
Evan Brown
d936f59065 Move dereferences that crash when the iterator is invalid into the new CrashIfIteratorIsInvalid function in order to give more helpful stack traces.
PiperOrigin-RevId: 915656842
Change-Id: I8542ce08c37d44f35a85e666eaf7eccd46132aef
2026-05-14 15:48:35 -07:00
Abseil Team
c20be0a44d Add absl::StatusBuilder and status macros (ASSIGN_OR_RETURN, RETURN_IF_ERROR, etc.)
PiperOrigin-RevId: 915476143
Change-Id: If1ce23cf40e4e44c39164f81f6d5ca66988d405c
2026-05-14 09:45:04 -07:00
Milad Fa
d885e62bc8 PR #2051: Fix absl_stacktrace_test on s390x
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
2026-05-14 04:36:26 -07:00
Abseil Team
ca1d7cb497 Add container overloads for absl::c_copy and absl::c_copy_n
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
2026-05-13 13:43:47 -07:00
Connal de Souza
0c60e214e9 Remove PCLMUL steam on AMD Rome, as it appears to be marginally faster without it.
PiperOrigin-RevId: 914995032
Change-Id: I642095189cf36e7cf1dcaa44e8bfb97246158831
2026-05-13 12:26:43 -07:00
Evan Brown
c349faaf18 Refactor HashtableCapacity code to force using bzhi when available (and when capacity-by-log is enabled, which is non-default).
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
2026-05-13 10:21:26 -07:00
Abseil Team
a7fbfa4486 Add [[clang::nomerge]] to absl::base_internal::HardeningAbort()
This lets us distinguish crashes due to different hardening checks.

PiperOrigin-RevId: 914894842
Change-Id: I5a875bceac5ae398308c5edaa45fea952fec501f
2026-05-13 09:03:01 -07:00
Derek Mauro
89203a0303 Update Abseil deps in preparation for release
PiperOrigin-RevId: 914597435
Change-Id: I8e2551dc51be13bbdb04ec56b3fe27eaea3ee8a3
2026-05-12 19:28:46 -07:00
Abseil Team
d4aba0a323 Deprecate and inline historical functions in Abseil
Migrates uses of absl:: symbols to std:: symbols

PiperOrigin-RevId: 914475818
Change-Id: I35908b9d91b4fba465b9fe3e5b2c8f497f2f192b
2026-05-12 14:21:33 -07:00
Derek Mauro
bc5e9d0ce0 Abseil CI updates:
* 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
2026-05-12 10:58:57 -07:00