Doing this opportunistically allows us to avoid performance overhead in the vast majority of calls (rare, non-reentrant ones) while simultaneously minimizing stack space usage.
PiperOrigin-RevId: 831560881
Change-Id: Idc6ba1dd0dcf1b4aaf3ee7cf468054bcfdcf90af
deprecated directive so that we can give users a custom deprecation
message.
PiperOrigin-RevId: 830908658
Change-Id: I07fec685b025ea507ef7dd16f117d4c29e80a2c1
The existing code uses the same stack space regardless of whether fixups are performed. This commit avoids using the stack space in calls that statically bypass fixups, to reduce the potential of a stack overflow.
PiperOrigin-RevId: 830610605
Change-Id: I06168e44e7199e10a606ff634e214ac9a8f9b872
This is to distinguish it from insert operations that find an existing value.
PiperOrigin-RevId: 828654839
Change-Id: I7ef1ffef22e978d806932537962292f81526521f
Add explicit template instantiations for `AllocateBackingArray` and `DeallocateBackingArray` in `raw_hash_set.cc` for the `std::allocator<char>` and `alignof(size_t)` case. Add corresponding `extern template` declarations in `raw_hash_set.h`. This reduces compile times and linker input size by ensuring these common instantiations are only generated once.
PiperOrigin-RevId: 828501019
Change-Id: I2927e756f0cf8238d6455c6eee4473fff790435f
There was no visible improvement and potentially performance regression in the production.
PiperOrigin-RevId: 828365574
Change-Id: Id3dab84ce9a6a6c132db40f370303fee0a42ed9b
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
instead of uniquely `absl::StatusOr`, e.g. `google::cloud::StatusOr`.
This is intended to support existing types that provide compliant `.ok()` and
`.status()`. However support for types other than absl::StatusOr is not a
guaranteed feature and may be removed in the future
PiperOrigin-RevId: 828072487
Change-Id: I1ae696b41eecf6048bd7a4ae3d893648e57e81d1
Corrects `__asjms__` to `__asmjs__` and adds a `static_cast<size_t>` to the result of `getpagesize() - 1`.
Without this static cast, emscripten based builds will trigger `-Wsign-conversion` on this line.
PiperOrigin-RevId: 827655583
Change-Id: I19b8ed7d3240409127934ac6debcb523fdb73e22
Add an explicit check for an empty string after `StripAsciiWhitespace` in `SimpleAtof` to avoid issues with `absl::from_chars`, which does not accept empty input.
PiperOrigin-RevId: 827589429
Change-Id: Iaf7e486d40d2c981a070aab912c7c61b72b33553
- StringAppendAndOverwrite() should always call StringResizeAndOverwrite()
with at least capacity() in case the standard library decides to shrink
the buffer (Fixes#1965)
- Small refactor to make the minimum growth an addition for clarity and
to make it easier to test 1.5x growth in the future
- Turn an ABSL_HARDENING_ASSERT into a ThrowStdLengthError
- Add a missing std::move
PiperOrigin-RevId: 826107106
Change-Id: I73ee3e98daa10161aa9023b2a879f6178ebedbcf
StringResizeAndOverwrite() but optimized for repeated appends, using
exponential growth to ensure amortized complexity of increasing
a string size by a small amount is O(1).
Use this function to replace STLStringResizeUninitializedAmortized()
PiperOrigin-RevId: 825100704
Change-Id: Ife64b13301bc4288d68154b7c496f57aaad4b6a4
These are convenience macros for `EXPECT_THAT(..., IsOk())` and
`ASSERT_THAT(..., IsOk())`, which can sometimes be more convenient to write.
This also documents a `#define` flag that defines the unqualified (i.e.
`EXPECT_OK` and `ASSERT_OK` versions of these macros, though they're
not preferred.
PiperOrigin-RevId: 825052892
Change-Id: Ib699709fbda3bc4885f57fc2842fb852c6243a2f
Printing as pointers is more relevant to the result of the comparison.
PiperOrigin-RevId: 824656335
Change-Id: I3b586e633c1271c1728c961193db106e4f4e5a8b
StringResizeAndOverwrite has MSAN testing of the entire string.
This causes quadratic MSAN verification on small appends.
PiperOrigin-RevId: 824629932
Change-Id: Ibefff781f5923c8bd2c1dc364f5b63fcb1d0f5ab
StringResizeAndOverwrite() but optimized for repeated appends, using
exponential growth to ensure amortized complexity of increasing
a string size by a small amount is O(1).
Use this function to replace STLStringResizeUninitializedAmortized()
PiperOrigin-RevId: 824571998
Change-Id: I6fe4a9cadd469ceee6a3818d7b8709e2fa286b9c
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
where it does not work when it is in ${TMP} and also fix the quoting
which was causing it to incorrectly receive the argument
https://github.com/bazelbuild/bazel/issues/27156
PiperOrigin-RevId: 823141075
Change-Id: I465f6bda0d94f4e464fa7ce3c1ee019aec78db69
This replaces the __msan_test_shadow introduced in "Validate absl::StringResizeAndOverwrite op has written bytes as expected." with __msan_check_mem_is_initialized, because the __msan_test_shadow assertion gives terse output ("false && shadow == -1") and cannot benefit from MSan's track origins mode.
PiperOrigin-RevId: 822786851
Change-Id: I8927521b5c38a7491f3b4e77e479014bba75cb36
`from_chars` marks them as `nonnull`, and this is
the case for empty string.
Existing `from_chars` implementation returns
`invalid_argument` which results in `return false`
from `SimpleAtod`.
PiperOrigin-RevId: 820759784
Change-Id: I6635e4eaf339eb178d32f616189f7733808019f5