Commit Graph

3345 Commits

Author SHA1 Message Date
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
Abseil Team
33bbc26609 Break on nullptr return address in UnwindImpl on RISC-V
PiperOrigin-RevId: 914222352
Change-Id: Iff9028a38e878465961f71e90484c2a62ed89132
2026-05-12 05:13:17 -07:00
Derek Mauro
5704b72fe0 Fix absl::make_unique_for_overwrite test under GCC 16
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
2026-05-11 16:06:28 -07:00
Vitaly Goldshteyn
ae7be71bd8 Optimize is_small() checks in raw_hash_set for log-based capacity.
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
2026-05-11 08:37:20 -07:00
Vitaly Goldshteyn
e309302b7a Added handle to make HashtableInlineData store log-based capacity based on compile time flag.
That is important to facilitate experimentation with log-based capacity mode.

PiperOrigin-RevId: 913613088
Change-Id: I6d328d5b8866623a24b9b639271b239794bc384c
2026-05-11 03:44:13 -07:00
Abseil Team
30bba84041 Roll back changing abseil hardening assertion in any_invocable from macro to function
This change broke rust wrappers for any_invocable due to templating issues.

PiperOrigin-RevId: 912760874
Change-Id: Ia0303e011e384e2cca284e393e59c0301974394e
2026-05-08 17:00:13 -07:00
Abseil Team
723c2e7c8a Change abseil hardening assertion in any_invocable from macro to function
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
2026-05-08 11:35:33 -07:00
Derek Mauro
659ba44acf absl::Substitute: Set variables in the correct order to avoid an
uninitialized variable warning in GCC 10

PiperOrigin-RevId: 912616225
Change-Id: Ieb72a17cdfdbff66df6d04b9b87b8eb03bbfb30d
2026-05-08 11:34:47 -07:00
Derek Mauro
638e17aedd Add absl::CopyCordToSpan()
PiperOrigin-RevId: 912247630
Change-Id: Ie5d2837c9b878e6094dce4d2ec7e60441a7c6bb7
2026-05-07 17:55:11 -07:00
Abseil Team
d0d4c59910 Deprecate and inline some historical inline variables in Abseil
PiperOrigin-RevId: 911711219
Change-Id: Icf6fa5f06d4c9f251d1f4139f942182c078db743
2026-05-06 20:55:45 -07:00
Abseil Team
9517566568 Change abseil hardening assertions in cleanup from macros to functions
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
2026-05-06 16:50:58 -07:00
Evan Brown
e68f11887b Update AssertIsValidForComparison to have better comments for cases in which there are sanitizer crashes that we can't give a good assertion failure message for.
Also add a test for comparing an iterator from a moved from table.

PiperOrigin-RevId: 911594422
Change-Id: I72ed53b5db81fb7f9656979d406ac7729eb20dc5
2026-05-06 15:52:58 -07:00