summaryrefslogtreecommitdiff
path: root/absl/base
Commit message (Collapse)AuthorAge
* Add an MSVC implementation of ABSL_ATTRIBUTE_LIFETIME_BOUNDGravatar Derek Mauro2024-07-07
| | | | | | | https://learn.microsoft.com/en-us/cpp/code-quality/c26816?view=msvc-170 PiperOrigin-RevId: 650044473 Change-Id: I2bf31f1e4b972e890194d21c5a6dcb4ee9993484
* Mark c_min_element, c_max_element, and c_minmax_element as constexpr in C++17.Gravatar Abseil Team2024-07-03
| | | | | | | This allows them to be used in constant expressions, such as static_asserts. PiperOrigin-RevId: 649292841 Change-Id: I76e31a94b933fa357276fee534b81c00c28c8b23
* Make c_begin, c_end, and c_distance conditionally constexpr.Gravatar Abseil Team2024-07-01
| | | | | | | | | | | | | This allows them to be used in constexpr expressions, such as the following: ``` constexpr int distance = absl::c_distance(std::array<int, 3>()); ``` Requires at least C++17 to be constexpr. PiperOrigin-RevId: 648435141 Change-Id: I8136e351a6dc4c25f06ef895fb449f4f11048480
* Deprecate `ABSL_ATTRIBUTE_NORETURN` in favor of the `[[noreturn]]`Gravatar Derek Mauro2024-07-01
| | | | | | | | | | | | | | | standardized in C++11 Migrate all Abseil code to `[[noreturn]]`. Notably, https://github.com/abseil/abseil-cpp/issues/1698 reports that `[[noreturn]]` works better here. We can't migrate `ABSL_ATTRIBUTE_NORETURN` to use `[[noreturn]]` because the difference in accepted attribute placement breaks some code. PiperOrigin-RevId: 648395324 Change-Id: Icd3e9b837aac25f128e8994de099f1edb3cabccf
* Rollback new poisoned pointer APIGravatar Derek Mauro2024-07-01
| | | | | | | | | This breaks Chromium due to global constructor and incorrectly assumes page size. https://github.com/abseil/abseil-cpp/pull/1697 PiperOrigin-RevId: 648377066 Change-Id: I19f8b2655971a0c314091e26e62e10a5a9c46e94
* Fix absl::NoDestructor documentation about its use as a globalGravatar Derek Mauro2024-06-27
| | | | | | | | | It is not possible to have a constant-initialized object of type absl::NoDestructor<T>. Fix the documentation so that it doesn't mention this possibility. Only recommend it use as a function-scope static variable, and discourage its use as a global variable. PiperOrigin-RevId: 647488395 Change-Id: Ifee052fce07609d3de72cddc30e86de67706cd91
* internal-only changeGravatar Abseil Team2024-06-26
| | | | | PiperOrigin-RevId: 646949076 Change-Id: I0d3fc57aee38e5b3a5b85e2301f5035bfd0e388b
* Remove erroneous preprocessor branch on SGX_SIM.Gravatar Evan Brown2024-06-25
| | | | | PiperOrigin-RevId: 646614152 Change-Id: Iee853bdc6f753d758c850a529a6adb05d0d0b1a7
* Add an internal API to get a poisoned pointer.Gravatar Evan Brown2024-06-24
| | | | | | | The motivation is to make destroyed/moved-from objects cause crashes when they are accessed. PiperOrigin-RevId: 646229564 Change-Id: I68d9c189b542df0933af08f5ad63dc1f5764d856
* optimization.h: Add missing <utility> header for C++Gravatar Abseil Team2024-06-24
| | | | | PiperOrigin-RevId: 646172195 Change-Id: I089f1d84f2d73b663f12e6818f96436e054e71ae
* Add a compile test for headers that require C compatibilityGravatar Derek Mauro2024-06-24
| | | | | | | | windows_clangcl_bazel.bat includes a change from --copt to --cxxopt to only pass /std:c++XX to C++ compiles PiperOrigin-RevId: 646157298 Change-Id: Ib6d9861a2b2d45eb0d664f23b6f3a7426f8e0ab3
* Roll back 6f972e239f668fa29cab43d7968692cd285997a9Gravatar Abseil Team2024-06-22
| | | | | | | | `optimization.h` needs to be compatible with C. `#include <utility>` is C++-only. PiperOrigin-RevId: 645651894 Change-Id: I55ebc3369b05788346cd0ab684b50bdfc2345fd4
* PR #1692: Add missing `<utility>` includeGravatar Patrick O'Connell2024-06-22
| | | | | | | | | | | | | Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1692 `optimization.h` uses `std::unreachable()` if available but does not include `<utility>`, causing errors in `absl/strings/ascii.cc`. Merge bf912bb4e38341d6152ee145ec2be00251c42552 into 8a28a0c8732ba3bf0191fb6292fcad6e5948a047 Merging this change closes #1692 COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1692 from poconn:optimization_missing_include bf912bb4e38341d6152ee145ec2be00251c42552 PiperOrigin-RevId: 645643983 Change-Id: I3966984afa81f2f6bce65dd872d326f0af114bfa
* Add `ABSL_NULLABILITY_COMPATIBLE` attribute.Gravatar Martin Brænne2024-06-17
| | | | | | | | | | | | | | | | This is a replacement for the `absl_nullability_compatible` tag. The attribute has the advantage that, unlike the tag, it can be applied to forward declarations. This does not yet change the implementation of the nullability annotations -- that will come in a followup patch. As the nullability annotations themselves have not been changed, the `absl_nullability_compatible` tag is currently still used to check whether the annotations can be applied to a given type; see also the comments in the code. PiperOrigin-RevId: 644238698 Change-Id: I5882606f82ce7a6dd98e83e6d920573437561b50
* Add the missing inline namespace to the nullability filesGravatar Derek Mauro2024-06-12
| | | | | PiperOrigin-RevId: 642621989 Change-Id: I95efa4bd9fe8fe3c449304706401374f851f0fbe
* Set ABSL_HAVE_THREAD_LOCAL to 1 on all platformsGravatar Derek Mauro2024-05-31
| | | | | | | | | | thread_local is supported on all supported platforms https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md ABSL_HAVE_THREAD_LOCAL should be considered deprecated at this point. PiperOrigin-RevId: 639029951 Change-Id: I6525766c428f897fa50148e5c6b5a0f3fff0d9be
* Add ABSL_INTERNAL_ATTRIBUTE_VIEW and ABSL_INTERNAL_ATTRIBUTE_OWNER ↵Gravatar Abseil Team2024-05-23
| | | | | | | | | | | | | attributes to Abseil. This will enable diagnoses similar to those enabled by ABSL_ATTRIBUTE_LIFETIME_BOUND. See the following links for details: https://reviews.llvm.org/D64448 https://lists.llvm.org/pipermail/cfe-dev/2018-November/060355.html PiperOrigin-RevId: 636650605 Change-Id: Iab3a768d57775863addcf0a7c773551ee8f424c6
* Remove Asylo from absl.Gravatar Abseil Team2024-05-21
| | | | | PiperOrigin-RevId: 635913776 Change-Id: I8c765caa918b1afee9f855cf3afbc6489d60735f
* Allow __cxa_demangle on MIPSGravatar Benjamin Barenblat2024-05-13
| | | | | | | | Both libstdc++ and libc++abi currently ship a __cxa_demangle on MIPS; there’s no reason to avoid using it. PiperOrigin-RevId: 633319823 Change-Id: I8d28a87f9998a62a25e0e149138395f8994e6fb5
* Apply ABSL_MUST_USE_RESULT to try lock functions.Gravatar Chris Kennelly2024-04-25
| | | | | PiperOrigin-RevId: 628091370 Change-Id: I2dd20b7f33ab99e78d63688832ab475a513aa3fd
* PR #1651: Implement ABSL_INTERNAL_DISABLE_DEPRECATED_DECLARATION_WARNING for ↵Gravatar Pavel P2024-04-18
| | | | | | | | | | | | | | MSVC compiler Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1651 Merge 6c02d45f193cb9d8e26f2f8e4db57cea384cefb2 into 9a61b00dde4031f17ed4fa4bdc0e0e9ad8859846 Merging this change closes #1651 COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1651 from pps83:ms-pragma-warn 6c02d45f193cb9d8e26f2f8e4db57cea384cefb2 PiperOrigin-RevId: 626108518 Change-Id: Idb00aca9bafbca92b231bdff7ef8c220948f134c
* Revert integer-to-string conversion optimizations pending more thorough analysisGravatar Abseil Team2024-03-26
| | | | | PiperOrigin-RevId: 619261152 Change-Id: Id3409b326c52ace0fda42537e0b91dbb2d6a2287
* PR #1644: unscaledcycleclock: remove RISC-V supportGravatar aurel322024-03-22
| | | | | | | | | | | | | | | | | | | | | | Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1644 Starting with Linux 6.6 [1], RDCYCLE is a privileged instruction on RISC-V and can't be used directly from userland. There is a sysctl option to change that as a transition period, but it will eventually disappear. The RDTIME instruction is another less accurate alternative, however its frequency varies from board to board, and there is currently now way to get its frequency from userland [2]. Therefore this patch just removes the code for unscaledcycleclock on RISC-V. Without processor specific implementation, abseil relies on std::chrono::steady_clock::now().time_since_epoch() which is basically a wrapper around clock_gettime (CLOCK_MONOTONIC), which in turns use __vdso_clock_gettime(). On RISC-V this VDSO is just a wrapper around RDTIME correctly scaled to use nanoseconds units. This fixes the testsuite on riscv64, tested on a VisionFive 2 board. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cc4c07c89aada16229084eeb93895c95b7eabaa3 [2] https://github.com/abseil/abseil-cpp/pull/1631 Merge 43356a2548cfde76e164d446cb69004b488c6a71 into 76f8011beabdaee872b5fde7546e02407b220cb1 Merging this change closes #1644 COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1644 from aurel32:rv64-no-unscaledcycleclock 43356a2548cfde76e164d446cb69004b488c6a71 PiperOrigin-RevId: 618286262 Change-Id: Ie4120a727e7d0bb185df6e06ea145c780ebe6652
* Delete ABSL_ANNOTATE_MEMORY_IS_INITIALIZED under Thread SanitizerGravatar Abseil Team2024-03-19
| | | | | PiperOrigin-RevId: 617266753 Change-Id: I6cac7b4616001c8d435fb1786da81b746f2d14cb
* Add nodiscard to SpinLockHolder.Gravatar Chris Kennelly2024-03-13
| | | | | PiperOrigin-RevId: 615473765 Change-Id: I03c3c16a0e178fce8a572ce272b7e1fd806a38a7
* [absl] Mark `absl::NoDestructor` methods with `absl::Nonnull` as appropriateGravatar Lawrence Wolf-Sonkin2024-02-29
| | | | | | | | * It is stated in prose that the methods on `absl::NoDestructor` can never return a null pointer * Now this is annotated via nullability annotations as well PiperOrigin-RevId: 611619075 Change-Id: I078a5628430b7b221c009a5dcb849efe30409c28
* Fix typo in example code snippet.Gravatar Abseil Team2024-02-27
| | | | | PiperOrigin-RevId: 610672905 Change-Id: I8e4ae98bb6e6421540a3073e3e6cb7de60fd32a9
* Minor documentation updates.Gravatar Abseil Team2024-02-21
| | | | | PiperOrigin-RevId: 609064443 Change-Id: Ifaeb53ae2d50bcef1ef6f67e662173b59c3fb8a2
* Annotate that SpinLock should warn when unused.Gravatar Chris Kennelly2024-02-20
| | | | | | | This often indicates a bug from adding synchronization logic but not using it. PiperOrigin-RevId: 608600311 Change-Id: I48bc3ae18b1e9a00b5e2152f33b486cd6be324a1
* Add ABSL_ATTRIBUTE_WARN_UNUSED.Gravatar Chris Kennelly2024-02-12
| | | | | | | | | | This allows us to annotate nontrivial types that should be flagged as unused variables. Compilers otherwise ignore nontrivial variables as their constructors/destructors may be desired and intentional (for example, a scoped lock). PiperOrigin-RevId: 606266618 Change-Id: I64b5f6d32a3cec2f18e0aa9029905f5e836c11a9
* Add the ABSL_DEPRECATE_AND_INLINE() macroGravatar Derek Mauro2024-02-08
| | | | | | | | | This macro is used by a Google-internal service for automated refactoring. It is being released so that Google projects that use this service can also open-source their code that uses it. PiperOrigin-RevId: 605322286 Change-Id: I16babcc56c454e07461690a8bb58be5da72d283f
* Add ABSL_ATTRIBUTE_UNINITIALIZED macros for use with clang and GCC's ↵Gravatar Abseil Team2024-02-01
| | | | | | | `uninitialized` PiperOrigin-RevId: 603344396 Change-Id: I06721246bf205284843065687378c6d905cbf879
* Replace `testonly = 1` with `testonly = True` in abseil BUILD files.Gravatar Shahriar Rouf2024-01-31
| | | | | | | https://bazel.build/build/style-guide#other-conventions PiperOrigin-RevId: 603084345 Change-Id: Ibd7c9573d820f88059d12c46ff82d7d322d002ae
* Remove code pieces for no longer supported GCC versions.Gravatar Abseil Team2024-01-22
| | | | | | | The minimum supported version today is GCC 7 (`__GNUC__ >= 7`). PiperOrigin-RevId: 600475215 Change-Id: I1aa46384f1e75f268649a48dbe2b42f3475bb07f
* Disable ABSL_ATTRIBUTE_TRIVIAL_ABI in open-source buildsGravatar Derek Mauro2024-01-22
| | | | | | | | | Since compiler support for this attribute differs, if for example system libraries compiled with GCC are mixed with libraries compiled with Clang, types will have different ideas about their ABI. PiperOrigin-RevId: 600467146 Change-Id: I5729e54d34176d019a2dee9afc36ed9da1da10fa
* Move default case to statement outside switch block in log_severity.h.Gravatar Daniel Cheng2024-01-11
| | | | | | | | Some compilers warn if a switch block that already covers all enumeration values also has a default label. PiperOrigin-RevId: 597583941 Change-Id: Ib3eb08dca0a19105522c61e47944cfc75280c15e
* Optimize integer-to-string conversionsGravatar Abseil Team2024-01-04
| | | | | | | | | | | | | | | | | | | | | | The updated code is designed to: - Be branch-predictor-friendly - Be cache-friendly - Minimize the lengths of critical paths - Minimize slow operations (particularly multiplications) - Minimize binary/codegen bloat The most notable performance trick here is perhaps the precomputation & caching of the number of digits, so that we can reuse/exploit it when writing the output. This precomputation of the exact length enables 2 further performance benefits: - It makes `StrCat` and `StrAppend` zero-copy when only integers are passed, by avoiding intermediate `AlphaNum` entirely in those cases. If needed in the future, we can probably also make many other mixtures of non-integer types zero-copy as well. - It avoids over-reservation of the string buffer, allowing for more strings to fit inside SSO, which will likely have further performance benefits. There is also a side benefit of preventing `FastIntToBuffer` from writing beyond the end of the buffer, which has caused buffer overflows in the past. The new code continues to use & extend some of the existing core tricks (such as the division-by-100 trick), as those are already efficient. PiperOrigin-RevId: 595785531 Change-Id: Id6920e7e038fec10b2c45f213de75dc7e2cbddd1
* [absl] Rename `absl::internal::identity` to `absl::internal::type_identity`Gravatar Lawrence Wolf-Sonkin2023-12-28
| | | | | | | | * Also does this for `absl::internal::identity_t` which is now `absl::internal::type_identity_t` * This is clearer naming as this is a backfill of `std::type_identity` (the identity type), and not `std::identity` (the identity function) PiperOrigin-RevId: 594316002 Change-Id: I5fb8cf7e3d07c1bc736cbecd202e7d556b6ea33e
* Add compile-checks to ensure the parameter to ↵Gravatar Abseil Team2023-12-28
| | | | | | | | | absl::numbers_internal::FastIntToBuffer isn't provably insufficient This performance-sensitive API is internal, and should not be used directly. Nevertheless, some do use it, so it's worth trying to block incorrect uses where we can. PiperOrigin-RevId: 594289730 Change-Id: Ib5df39b450ef2ceda795082cde10ec2ba2642172
* Migrate static objects to NoDestructor in tests, testing libraries and ↵Gravatar Abseil Team2023-12-26
| | | | | | | benchmarks. PiperOrigin-RevId: 593918110 Change-Id: Ide100c69b10e28011af17c7f82bb10eea072cad4
* Release a few bits and pieces of DFATAL that were left behind: flag parsing ↵Gravatar Andy Getzendanner2023-12-21
| | | | | | | & some tests. PiperOrigin-RevId: 592918704 Change-Id: Iacef0e069c012a04960211c032454244822f9634
* Cleanup build file by removing an empty srcs listGravatar Derek Mauro2023-12-18
| | | | | PiperOrigin-RevId: 591928115 Change-Id: I55de0886d3ce2d58cc1c94a15ce0f3eefc5eeaaf
* Redirect `GetPageSize()` to C library `getpagesize()` on Hexagon DSP.Gravatar Abseil Team2023-12-13
| | | | | PiperOrigin-RevId: 590669848 Change-Id: Ibc703b0fbedede86ddaa9682049b7dcc2250fbfb
* Add nullability annotationsGravatar Dmitri Gribenko2023-12-11
| | | | | PiperOrigin-RevId: 589842893 Change-Id: I9657761d1f71c665582406f278c6605f6d382f6d
* Enable ABSL_HAVE_POSIX_WRITE for Hexagon DSP build.Gravatar Abseil Team2023-12-07
| | | | | PiperOrigin-RevId: 588893303 Change-Id: I3f9278f2f7f0bc4b8903a87cb4a740daf7349755
* Roll-forward: Honor ABSL_MIN_LOG_LEVEL in CHECK_XX, CHECK_STRXX, CHECK_OK, ↵Gravatar Andy Getzendanner2023-12-05
| | | | | | | | | | | and the QCHECK flavors of these. In particular, if ABSL_MIN_LOG_LEVEL exceeds kFatal, these should, upon failure, terminate the program without logging anything. The lack of logging should be visible to the optimizer so that it can strip string literals and stringified variable names from the object file. Making some edge cases work under Clang required rewriting NormalizeLogSeverity to help make constraints on its return value more obvious to the optimizer. PiperOrigin-RevId: 588181755 Change-Id: I95db3bae39f8dadb52a307ca3b80775db23de766
* Make `absl::{partial,weak,strong}_ordering` aliases for the `std::` orderingGravatar Marcin Kowalczyk2023-12-05
| | | | | | | | | | | | types when they are available. This makes them interchangeable in contexts known to be compiled as C++20. This also makes `absl::` ordering types compatible with `<=>`, allowing to unconditionally use `absl::` spelling for types but conditionally use `<=>` when available. PiperOrigin-RevId: 588085408 Change-Id: I1aa5247f0e31acbb838ee76829b7a13c74b0a94f
* Avoid #pragma intrinsic(_mm_prefetch) on Arm64EC (and other platformsGravatar Derek Mauro2023-11-28
| | | | | | | | | without SSE) Closes #1575 PiperOrigin-RevId: 586009018 Change-Id: Icc34c1201268303dde96bfbb067506b861754b3a
* Fix documentation on when SpinLock is async-signal-safeGravatar Abseil Team2023-11-14
| | | | | PiperOrigin-RevId: 582426024 Change-Id: Ic8650de4faff9688f4cb5529c1df9bc752878b5a
* Add absl::NoDestructor<T>Gravatar Derek Mauro2023-11-08
| | | | | | | | | absl::NoDestructor<T> wraps an existing type and is used for defining a static type that does not need to be destructed upon program exit. Instead, such an object survives during program exit, and can be safely accessed at any time after construction. PiperOrigin-RevId: 580566259 Change-Id: I2cbb4cd9f6b50b98a793acd2ef0a4befd541f17f