This will let us deprecate the declarations without triggering warnings in Abseil itself.
PiperOrigin-RevId: 906360966
Change-Id: Iee362ac0eac647909ef38003280f1179813f764d
Updates `absl::Mutex` and related RAII lockers (`absl::MutexLock`,
etc) to deprecate legacy APIs in favor of standard-compliant
alternatives.
* `absl::Mutex`: Adds `[[deprecated]]` to legacy CamelCase methods
(e.g., `Lock`, `ReaderLock`) in favor of standard C++ lower-case
methods (`lock`, `lock_shared`) which support `std::scoped_lock`.
* `absl::MutexLock` (and friends): Adds `[[deprecated]]` to
constructors accepting raw pointers, favoring new
reference-accepting constructors.
To support this change, warnings coming from external repositories
are now suppressed in Bazel CI builds.
PiperOrigin-RevId: 852978576
Change-Id: I54ae951f28a1b7d90fcb46ceeaf09f192af257df
When Abseil is built as a shared library (`ABSL_BUILD_DLL`) with `NDEBUG` defined, `Mutex::Dtor()` is currently fully inlined and no symbol is emitted.
Downstream clients building against this shared library without `NDEBUG` defined (e.g., a debug build of an application linking against a system-provided release Abseil DLL) will expect a `Mutex::Dtor()` symbol to exist, ensuring ABI compatibility. Currently, this leads to undefined reference linker errors.
This patch aligns `Mutex::Dtor()` with the existing logic for `Mutex::~Mutex()`: it disables inlining in the header when `ABSL_BUILD_DLL` is active and ensures an empty definition is provided in the source file for these builds.
PiperOrigin-RevId: 828160210
Change-Id: I5ed1fd6757d631e80d6f084d20bfe8e25f6ef253
ReleasableMutexLock::Release() resets this pointers, so destructor can compare
it to nullptr, to avoid double release.
PiperOrigin-RevId: 803163168
Change-Id: Ib97f86a4e5fca789552b1a8c385868d4227b9874
Manual annotation of these APIs specifically helps us avoid inferring them with tooling as having conflicted nullability due to a small number of incorrect uses out of many, many uses.
These annotations have no runtime impact.
PiperOrigin-RevId: 739258146
Change-Id: Id18bd1f0313c5b196e1d9e8ed4d1ce057dfcd582
* Fix many benchmarks to be cc_binary instead of cc_test
* Add a few benchmarks for StrFormat
* Add benchmarks for Substitute
* Add benchmarks for Damerau-Levenshtein distance used in flags
PiperOrigin-RevId: 738448552
Change-Id: I521f4b2ef9116c9895b44c32d27e94507380bee8
Applying a non-zero offset to a null pointer is undefined behavior.
Our UBSAN tests were missing `-fno-sanitize-recover`, which
means UBSAN logs a warning, but the program continues,
causing the test not to fail.
`-fno-sanitize-recover` will be added once all errors are fixed.
PiperOrigin-RevId: 733395060
Change-Id: Ibf71d0d2a27fac14f0c33dbdf83f4089645b8b37
In this change, //absl/status is intentionally excluded because of
complication with SWIG compatibility. This may be handled separately.
PiperOrigin-RevId: 731387819
Change-Id: I71bf2e02f3a477d65575d467f5e5ab163846d31e
instead of our custom ones from before the Bazel rules existed.
Also add the missing rules_cc to WORKSPACE, since we already had
it in MODULE.bazel
PiperOrigin-RevId: 715006932
Change-Id: Ibb38a78c115a7dc2983426455bb271162795846f
Linux "latest" containers updated to
GCC 14.2
CMake 3.31.2
Bazel 8.0.0
Included are various fixes to get these versions to work.
Bazel now references repositories by their canonical names from the
Bazel Central Registry. For example, Abseil is now @abseil-cpp instead
of @com_google_absl, and GoogleTest is now @googletest instead of
@com_google_googletest. Users still using the old WORKSPACE system may
need to use `repo_mapping` on repositories using the old names. See
`WORKSPACE.bazel` in this commit for an example.
PiperOrigin-RevId: 709102146
Change-Id: I02327ed4f8fb947766480bdeef2b1930a7f831eb
Saving one "&" operation in the Mutex::Unlock fast path. This has likely no performance impact (the two AND instructions ran in parallel anyway), but is as complex as the current solution, and enables two possible improvements in the future.
1. If bits Ev, Wr, Wa, De are made into the highest bits in the kMuLow,
then the second "&" operation can be omitted because if kMuWriter is set,
the there are no readers, so the kMuHigh bits are zero.
2. If the meanings of kMuWriter and kMuDesig are flipped, then the "^"
operation is not needed either.
PiperOrigin-RevId: 679272590
Change-Id: Iea7a04df0118d2410b7bfdab70b30e33d4b90e43
The existing implementation uses wall-clock time. However, wall clock can drastically differ from the internal system clock, because the system can be suspended and then resumed.
We want to account for at least some kinds of suspensions that might occur during automated testing, such as VM suspension or hypervisor preemption ("steal time"). These are tricky cases, because the physical (host) CPU is still running -- just the logical (guest) virtual CPU isn't. Therefore, we need to ensure that our time measurements exclude elapsed host-only time.
Unfortunately the correctness of a method depends on the nature & configuration of each VM and the guest. For example, it can depend whether RDTSC is virtualized, or on whether the host and guest support accounting for steal time. Windows, for example, appears to only support steal time measurements if the hypervisor is Hyper-V.
Since this is all for the sake of testing, we use a simpler trick that we hope will work around the problem on our systems: we subtract the so-called "interrupt time bias" from the system uptime in Windows. The interrupt time bias includes sleep/hibernation time, and seems to advance during for VM suspensions as well, so it may take care of the problem.
PiperOrigin-RevId: 675654840
Change-Id: I66150b18912175fa72609d3f137e3ea4fee8fc43