346 Commits

Author SHA1 Message Date
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
Abseil Team
7032a0ee69 No-op changes for internal experiment
PiperOrigin-RevId: 925032057
Change-Id: I8f3a4f5bb4f079211a6e1cc5dfc8c9683d11e53e
2026-06-01 18:44:39 -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
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
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
Chris Kennelly
4dcbb5982d Add VMA naming fallback for LowLevelAlloc.
PiperOrigin-RevId: 911021583
Change-Id: I3fc632b8b142cc738ced0dbb40d5eef87cc30cf4
2026-05-05 18:11:32 -07:00
Abseil Team
c7a875c193 Rollback of
Add [[clang::nomerge]] to absl::base_internal::HardeningAbort()

This lets us distinguish crashes due to different hardening checks.

PiperOrigin-RevId: 910658969
Change-Id: I820eb5291d7ce8330df0dac10ea09fafef405bbb
2026-05-05 06:58:56 -07:00
Abseil Team
d061f5f134 Add [[clang::nomerge]] to absl::base_internal::HardeningAbort()
This lets us distinguish crashes due to different hardening checks.

PiperOrigin-RevId: 910325607
Change-Id: I902df2b849af9dcc0330315cf913d9ed63163bc1
2026-05-04 17:09:23 -07:00
Abseil Team
06534e0cf0 Add VMA naming fallback for LowLevelAlloc.
PiperOrigin-RevId: 908180914
Change-Id: If5266fa8ec5b8777fe7546b2454a562d7e26e0b8
2026-04-30 08:05:27 -07:00
Chris Kennelly
5193aa7983 Add VMA naming fallback for LowLevelAlloc.
PiperOrigin-RevId: 908158129
Change-Id: I79c2677133567272be22cc0a4d73fda99efc15d9
2026-04-30 07:20:22 -07:00
Abseil Team
852fc61f31 Remove more lingering C++17 type traits polyfill usages
This will let us deprecate the declarations without triggering warnings in Abseil itself.

PiperOrigin-RevId: 906360966
Change-Id: Iee362ac0eac647909ef38003280f1179813f764d
2026-04-27 08:03:53 -07:00
Mike Kruskal
f58ee26604 Add a friendship for gloop testing
PiperOrigin-RevId: 904670147
Change-Id: Ib9741bf43ce4eb07476585610eba31e1e4c206a9
2026-04-23 15:38:58 -07:00
Abseil Team
8a6b6ae902 Automated rollback of commit 34e723033b.
PiperOrigin-RevId: 903357540
Change-Id: I0c25be897ce7cd5d0e4e82f66f912516b2943400
2026-04-21 12:10:31 -07:00
Abseil Team
34e723033b Change abseil hardening assertions in types directory 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.

This change also changes the assertion functions from inline to constexpr, to allow functions using them to be called from static assertions (like optional_ref::operator* in optional_ref's constexpr test).

PiperOrigin-RevId: 903344377
Change-Id: I50166b6cf12a8f139ed3c9fe4f6c6e0f24b51812
2026-04-21 11:43:47 -07:00
Abseil Team
ac5ea999a3 Change abseil hardening assertions in types directory 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.

This change also changes the assertion functions from inline to constexpr, to allow functions using them to be called from static assertions (like optional_ref::operator* in optional_ref's constexpr test).

PiperOrigin-RevId: 903309187
Change-Id: Icbe0fd9d0fe9e212036d17468e80833b95b8a82d
2026-04-21 10:38:58 -07:00
Chris Kennelly
fe307ced1f Replace ABSL_INTERNAL_LOG with ABSL_RAW_LOG in ReadMonotonicClockNanos.
This method is in the transitive callgraph of TCMalloc via absl::base_internal::CycleClock::Frequency().  ABSL_RAW_LOG avoids a potential reentrancy/deadlock issue when TCMalloc invokes `Frequency` while holding one of its locks.

PiperOrigin-RevId: 903293020
Change-Id: I4c8310fa32c1e12d049296377c5a9bf069ef513b
2026-04-21 10:11:28 -07:00
Mike Kruskal
9aca3c87dc Add a friendship for gloop testing
PiperOrigin-RevId: 902654675
Change-Id: I48105b39609fc7342ad931c6a2ef3e9ef3182070
2026-04-20 08:38:18 -07:00
Abseil Team
b9536c952c Add additional bounds check functions to cover most ABSL_HARDENING_ASSERTs.
Most current uses of ABSL_HARDENING_ASSERT are one of:
* numerical comparison
* checking that a container is non-empty
* checking that a pointer is non-null.

This change adds additional hardening assert functions which conduct the
comparisons necessary for these checks inside the body of the assertion
function, so that the cost of performing the check can be attributed
to the assertion.

For the smaller set of cases where more complex conditions are checked,
a general HardeningAssert which takes a bool is provided.

PiperOrigin-RevId: 899780652
Change-Id: I00602302a5d42d483053ad66d8c3e796d1708567
2026-04-14 14:42:44 -07:00
Abseil Team
9cb62a03a4 Remove unnecessary usages of absl::void_t
Most usages of absl::void_t compile fine with std::void_t, so we migrate them here. A few don't compile due to overly eager template instantiations, so we leave those.

PiperOrigin-RevId: 897231619
Change-Id: Iad34101916dac2b995257ebd5d6aacb9a0acfa32
2026-04-09 12:01:41 -07:00
Abseil Team
0b006ea16f Add SKIP_ABSL_INLINE_NAMESPACE_CHECK to absl/base/internal/exception_safety_testing.h as it doesn't use the absl namespace at all
PiperOrigin-RevId: 895410731
Change-Id: Ide13269ecfc8367d7d8ad77d0eee4f06a366c9b9
2026-04-06 11:12:40 -07:00
Abseil Team
ed2114e8ff Stop using C++17 type traits polyfills
This will let us deprecate the declarations without triggering warnings in Abseil itself.

PiperOrigin-RevId: 894202105
Change-Id: I57bb2a1647be1fedf9b724a07042fd0f564ce074
2026-04-03 12:34:35 -07:00
Derek Mauro
3eb0f0bd73 Remove the forward declaration of base::scheduling::Schedulable from
thread_identity by using a void*, and fix callers to use
base::scheduling::Schedulable::GetBoundSchedulable().

PiperOrigin-RevId: 894096577
Change-Id: I2d4c822c60501e34cadcaac7fc434ef9adb222c3
2026-04-03 08:52:00 -07:00
Derek Mauro
d2910b037f Prepare to move callers away from get_bound_schedulable()
to remove the forward declaration of base::scheduling::Schedulable.

PiperOrigin-RevId: 890987711
Change-Id: I42695f6f9b7e60627e65b00e9269cf53f497f988
2026-03-28 10:55:58 -07:00
Mike Kruskal
1bcce1bda4 Internal functionality
PiperOrigin-RevId: 882667993
Change-Id: I47f0d92b58caa9cc137ae92e8b568277dd9b1d78
2026-03-12 10:37:49 -07:00
Abseil Team
d85c5281b8 Create bounds check functions to improve observability of hardening check failures to monitoring.
The current ABSL_HARDENING_ASSERT macros are difficult to observe in stack traces in core dumps or sampling profiler output.  This change creates a pair of bounds check functions which can be used in place of some of instances of these ABSL_HARDENING_ASSERT macros while remaining clearly distinguishable in production monitoring infrastructure.

PiperOrigin-RevId: 874680671
Change-Id: Ife503e63076bb92b2a9919f18b42f305d683b99d
2026-02-24 10:30:14 -08:00
Derek Mauro
35e6a9517b Delete the internal version of throw_delegate
PiperOrigin-RevId: 868253845
Change-Id: I1cf9e2208242d0fdba8de43bfc5d698377d1c157
2026-02-10 11:57:29 -08:00
Derek Mauro
a529ebc843 As IsAtLeastInputIterator helper
PiperOrigin-RevId: 850059542
Change-Id: I35bcd2cb43d3ce33fd316e89ac93e7574a7e151c
2025-12-29 08:01:20 -08:00
Chris Kennelly
f17f9070d2 Implement SpinLockHolder in terms of std::lock_guard.
PiperOrigin-RevId: 841813256
Change-Id: Id8a446f889d999720c9d9db527a9f6dfb8b2d6a9
2025-12-08 10:10:27 -08:00
Abseil Team
5614692612 No public description
PiperOrigin-RevId: 840547347
Change-Id: I7507eaeeaf2ad5f1e3da6abc499a8b30b8901222
2025-12-04 21:56:22 -08:00
Connal de Souza
982f4254a1 (Roll forward) Change Abseil's SpinLock adaptive_spin_count to a class static variable that can be set by tcmalloc friend classes.
PiperOrigin-RevId: 826545231
Change-Id: Ic8918fdc0ebd46ea0423859ed62d667f7fe0ba57
2025-10-31 10:40:46 -07:00
Abseil Team
6c5a175774 Change Abseil's SpinLock adaptive_spin_count to a class static variable that can be set by tcmalloc friend classes.
PiperOrigin-RevId: 826261810
Change-Id: I48eedaf091aff3d9c6b97b7eb8c71958711348cf
2025-10-30 18:12:37 -07:00
Connal de Souza
ed0efc0037 Change Abseil's SpinLock adaptive_spin_count to a class static variable that can be set by tcmalloc friend classes.
PiperOrigin-RevId: 826226544
Change-Id: I8f8cb5ce199eab9ca63fcd475b536f4a1f512a19
2025-10-30 16:13:20 -07:00
Milad Fa
1a259163cc PR #1961: Fix Clang warnings on powerpc
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1961

We maintain the V8 Js Compiler on IBM platforms which uses abseil as a dependency. We have recently switched to using Clang and need to create this patch to fix two warnings:
```
warning: implicit conversion changes signedness: 'uint64_t' (aka 'unsigned long') to 'int64_t' (aka 'long') [-Wsign-conversion]
warning: implicit conversion loses integer precision: 'uintptr_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
```
Merge 2e972b5c72 into d71fcd13f6

Merging this change closes #1961

COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1961 from miladfarca:ppc-fix-clang-warn 2e972b5c72
PiperOrigin-RevId: 823581713
Change-Id: Icff10b99b3808f51866fb97576af405826742088
2025-10-24 10:30:43 -07:00
Jesse Rosenstock
820cd9ee90 type_traits: Add type_identity and type_traits_t backfills
https://en.cppreference.com/w/cpp/types/type_identity.html

PiperOrigin-RevId: 812886166
Change-Id: I159cf4e4bdbe2ac801768ff6c996c2d2a3d47a71
2025-09-29 12:03:04 -07:00
Abseil Team
f138b9d6fa Annotate ABSL_DIE_IF_NULL's return type with absl_nonnull
This helps inform Nullability inference without needing any special casing.

Since ABSL_DIE_IF_NULL is allowed for pointers, smart pointers, or classes marked with ABSL_NULLABILITY_COMPATIBLE we introduce a trait to help add the annotation only when compatible. This trait is kept internal for now out of caution for what we are supporting, though people have asked about it before (see b/394789178).

Simple cases are tested by `-Wnonnull` in absl/base/nullability_nc_test.cc. However, it's unclear how to test the complex cases like templates with universal references with the simple compiler `-Wnonnull`. There is a followup nullability inference test (cl/808830606).

Since there is Wnullability-completeness, needed to annotate the rest of die_if_null.h

PiperOrigin-RevId: 810463021
Change-Id: Id5156996bf3a29a99e689974ac2af7b94b21c460
2025-09-23 09:09:36 -07:00
Andy Getzendanner
266b1a0bf8 Cast ABSL_MIN_LOG_LEVEL to absl::LogSeverityAtLeast instead of absl::LogSeverity.
PiperOrigin-RevId: 804953870
Change-Id: I1cf4abd1e13c9644eb6e46a22d9d8c642c420d1d
2025-09-09 09:55:01 -07:00
Abseil Team
f8c283dabf Remove support for Native Client
Native Client has been fully removed from Chromium.

PiperOrigin-RevId: 803093147
Change-Id: I7fea87a8a66b35b2f0cc3d815c23f90e5e4d2043
2025-09-04 10:54:42 -07:00
Abseil Team
9dc9586eff Rollback f040e96b93
PiperOrigin-RevId: 802588083
Change-Id: Ibea44bd227dda2f4ebc7e24890426faa7a83b36b
2025-09-03 09:34:41 -07:00
Chris Kennelly
f040e96b93 Use possible CPUs to identify NumCPUs() on Linux.
This correctly handles offlined CPUs.

PiperOrigin-RevId: 802241608
Change-Id: Idad363516ed3b6027aa2656f3dbc3ee48fc50308
2025-09-02 12:12:13 -07:00
sandeepgupta12
8e7767542c PR #1918: base: add musl + ppc64le fallback for UnscaledCycleClock::Frequency
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1918

Fixes build failures on ppc64le with musl libc, where UnscaledCycleClock::Frequency() had no implementation.

This patch adds a fallback for __linux__ + __powerpc64__ when glibc is not present, using a constant 512 MHz timebase frequency. This matches the existing AIX implementation and unblocks projects like Node.js/V8 from building on Alpine Linux (musl).

Tested by building Node.js 24.x on ppc64le + musl.

Issue- https://github.com/abseil/abseil-cpp/issues/1917

Merge aa7e63a4ff into 274c81389f

Merging this change closes #1918

COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1918 from sandeepgupta12:master aa7e63a4ff
PiperOrigin-RevId: 794579241
Change-Id: I16b9bcb48dc9ff7c1f1fcf9b31ceb5f20dadf3ec
2025-08-13 07:58:41 -07:00
Abseil Team
481ab927ae Automated Code Change
PiperOrigin-RevId: 792014045
Change-Id: I21718f98414754ff9df242565d210f557913a143
2025-08-06 23:41:54 -07:00
Chris Kennelly
6a91068203 Add lifetime annotations to MutexLock, SpinLockHolder, etc.
PiperOrigin-RevId: 791269651
Change-Id: Ie3ad265f6ab6535a3240fb159ba498f5a6bb15ce
2025-08-05 10:19:40 -07:00
Chris Kennelly
8224c30b95 Mark SpinLock camel-cased methods as ready for inlining.
PiperOrigin-RevId: 790765458
Change-Id: Iff8cedf78a5b9d28eba63515d22e5ac35c34542c
2025-08-04 08:47:01 -07:00
Chris Kennelly
0f1abc9b73 Inline internal usages of pointerful SpinLockHolder/MutexLock.
PiperOrigin-RevId: 789441157
Change-Id: I2ed5d12f4b9725edbe3fd6cf629a0563a2f2d739
2025-07-31 12:59:26 -07:00
Rickard Hallerbäck
a9268d5f4b PR #1914: absl/base/internal/poison.cc: Minor build fix
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1914

```
: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
   50 |   return getpagesize();
      |   ~~~~~~ ^~~~~~~~~~~~~
../_deps/absl-src/absl/base/internal/poison.cc:79:29: error: use of undeclared identifier 'data'
   79 |   return static_cast<char*>(data) + block_size / 2;
      |                             ^
1 warning and 1 error generated.
gmake[2]: *** [_deps/absl-build/absl/base/CMakeFiles/poison.dir/build.make:76: _deps/absl-build/absl/base/CMakeFiles/poison.dir/internal/poison.cc.obj] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1843: _deps/absl-build/absl/base/CMakeFiles/poison.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
```

Merge 6b172a21d1 into 785b11b33f

Merging this change closes #1914

COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1914 from Ricardicus:master 6b172a21d1
PiperOrigin-RevId: 788985640
Change-Id: Ife849052c340985d08a4dda131dad086e670d901
2025-07-30 11:51:35 -07:00
Chris Kennelly
785b11b33f Accept references on SpinLockHolder/MutexLock
This aligns these classes more closely with std::scoped_lock.

PiperOrigin-RevId: 788920634
Change-Id: If29e8092b782bfbb11a1da31834dc738f1cbcfbc
2025-07-30 09:00:30 -07:00
Chris Kennelly
3e0d9ff64a Inline SpinLock Lock->lock, Unlock->unlock internal to Abseil.
PiperOrigin-RevId: 788531193
Change-Id: Icca9ff096c2ec2fc0662f1f94ecfb232a8492974
2025-07-29 11:12:36 -07:00
Chris Kennelly
840da4a0f0 Rename SpinLock methods to use the typical C++ lower case names.
PiperOrigin-RevId: 788447014
Change-Id: I7b285de1156553835bdc062f6d2bad967eaf2970
2025-07-29 07:33:35 -07:00
Abseil Team
6ad95e1535 Move SigSafeArena() out to absl/base/internal/low_level_alloc.h
This allows dynamic memory allocation for computing stack traces to avoid a stack overflow.

PiperOrigin-RevId: 786512779
Change-Id: Ib5ef8fef436672b99d9678137e3b2bb65ca47eba
2025-07-23 19:13:04 -07:00
Chris Kennelly
ea50280aeb Include deallocated caller-provided size in delete hooks.
As allocations may come from unsized free or delete as well, we indicate these
via std::nullopt.

PiperOrigin-RevId: 780282346
Change-Id: I123b5a0541bdf26e44686de79821dbb1326c4cf6
2025-07-07 15:28:28 -07:00