aboutsummaryrefslogtreecommitdiff
path: root/absl/base
Commit message (Collapse)AuthorAgeFilesLines
* Add nodiscard to SpinLockHolder.Chris Kennelly2024-03-131-0/+9
| | | | | PiperOrigin-RevId: 615473765 Change-Id: I03c3c16a0e178fce8a572ce272b7e1fd806a38a7
* [absl] Mark `absl::NoDestructor` methods with `absl::Nonnull` as appropriateLawrence Wolf-Sonkin2024-02-293-10/+15
| | | | | | | | * 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.Abseil Team2024-02-271-1/+1
| | | | | PiperOrigin-RevId: 610672905 Change-Id: I8e4ae98bb6e6421540a3073e3e6cb7de60fd32a9
* Minor documentation updates.Abseil Team2024-02-211-1/+1
| | | | | PiperOrigin-RevId: 609064443 Change-Id: Ifaeb53ae2d50bcef1ef6f67e662173b59c3fb8a2
* Annotate that SpinLock should warn when unused.Chris Kennelly2024-02-201-1/+1
| | | | | | | This often indicates a bug from adding synchronization logic but not using it. PiperOrigin-RevId: 608600311 Change-Id: I48bc3ae18b1e9a00b5e2152f33b486cd6be324a1
* Add ABSL_ATTRIBUTE_WARN_UNUSED.Chris Kennelly2024-02-121-0/+28
| | | | | | | | | | 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() macroDerek Mauro2024-02-081-0/+36
| | | | | | | | | 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 ↵Abseil Team2024-02-011-0/+19
| | | | | | | `uninitialized` PiperOrigin-RevId: 603344396 Change-Id: I06721246bf205284843065687378c6d905cbf879
* Replace `testonly = 1` with `testonly = True` in abseil BUILD files.Shahriar Rouf2024-01-311-9/+9
| | | | | | | https://bazel.build/build/style-guide#other-conventions PiperOrigin-RevId: 603084345 Change-Id: Ibd7c9573d820f88059d12c46ff82d7d322d002ae
* Remove code pieces for no longer supported GCC versions.Abseil Team2024-01-221-6/+2
| | | | | | | The minimum supported version today is GCC 7 (`__GNUC__ >= 7`). PiperOrigin-RevId: 600475215 Change-Id: I1aa46384f1e75f268649a48dbe2b42f3475bb07f
* Disable ABSL_ATTRIBUTE_TRIVIAL_ABI in open-source buildsDerek Mauro2024-01-221-8/+4
| | | | | | | | | 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.Daniel Cheng2024-01-111-1/+1
| | | | | | | | 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 conversionsAbseil Team2024-01-041-12/+0
| | | | | | | | | | | | | | | | | | | | | | 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`Lawrence Wolf-Sonkin2023-12-283-21/+24
| | | | | | | | * 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 ↵Abseil Team2023-12-281-0/+12
| | | | | | | | | 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 ↵Abseil Team2023-12-262-3/+7
| | | | | | | benchmarks. PiperOrigin-RevId: 593918110 Change-Id: Ide100c69b10e28011af17c7f82bb10eea072cad4
* Release a few bits and pieces of DFATAL that were left behind: flag parsing ↵Andy Getzendanner2023-12-212-2/+10
| | | | | | | & some tests. PiperOrigin-RevId: 592918704 Change-Id: Iacef0e069c012a04960211c032454244822f9634
* Cleanup build file by removing an empty srcs listDerek Mauro2023-12-181-2/+0
| | | | | PiperOrigin-RevId: 591928115 Change-Id: I55de0886d3ce2d58cc1c94a15ce0f3eefc5eeaaf
* Redirect `GetPageSize()` to C library `getpagesize()` on Hexagon DSP.Abseil Team2023-12-131-1/+1
| | | | | PiperOrigin-RevId: 590669848 Change-Id: Ibc703b0fbedede86ddaa9682049b7dcc2250fbfb
* Add nullability annotationsDmitri Gribenko2023-12-115-27/+45
| | | | | PiperOrigin-RevId: 589842893 Change-Id: I9657761d1f71c665582406f278c6605f6d382f6d
* Enable ABSL_HAVE_POSIX_WRITE for Hexagon DSP build.Abseil Team2023-12-071-2/+3
| | | | | PiperOrigin-RevId: 588893303 Change-Id: I3f9278f2f7f0bc4b8903a87cb4a740daf7349755
* Roll-forward: Honor ABSL_MIN_LOG_LEVEL in CHECK_XX, CHECK_STRXX, CHECK_OK, ↵Andy Getzendanner2023-12-051-10/+11
| | | | | | | | | | | 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::` orderingMarcin Kowalczyk2023-12-052-0/+58
| | | | | | | | | | | | 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 platformsDerek Mauro2023-11-281-2/+3
| | | | | | | | | without SSE) Closes #1575 PiperOrigin-RevId: 586009018 Change-Id: Icc34c1201268303dde96bfbb067506b861754b3a
* Fix documentation on when SpinLock is async-signal-safeAbseil Team2023-11-141-4/+4
| | | | | PiperOrigin-RevId: 582426024 Change-Id: Ic8650de4faff9688f4cb5529c1df9bc752878b5a
* Add absl::NoDestructor<T>Derek Mauro2023-11-085-0/+653
| | | | | | | | | 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
* Add a new microbenchmark for spinlock TryLock and codegen functions.Abseil Team2023-11-061-1/+26
| | | | | PiperOrigin-RevId: 579852413 Change-Id: I1eddd70a4bee974e3a5109109ddfc4b4fd8f421e
* Prefer builtin to inline assembly when built with -mprfchw.Chris Kennelly2023-10-261-1/+1
| | | | | PiperOrigin-RevId: 576884571 Change-Id: I7bfe68e5aedd8563f8e6dbdb5d7cc66e9af22567
* PR #1553: Adapt to syscall(2) removal in OpenBSDTheo Buehler2023-10-251-9/+6
| | | | | | | | | | | | | | | | | | | Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1553 OpenBSD will remove its generic syscall(2) interface, so setting the ABSL_HAVE_SYSCALL_WRITE define will result in a linking failure soon. Make direct use of the write(2) syscall instead. OpenBSD's libc does not do any buffering for write, so there is no change of behavior. A [variant of this patch][1] has been in use since early this year in OpenBSD's ports. There's no need to set ABSL_LOW_LEVEL_WRITE_SUPPORTED since that's already done a few lines up. [1]: https://github.com/openbsd/ports/commit/5f9e56cd982c1f1fa5af867e56355091e1817786 Merge 0dcc88a3cdab513c598587d85423135e85cec330 into b841db22f8d1d9cdbaacecf2e7c87ce270f8d96f Merging this change closes #1553 COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1553 from botovq:openbsd-syscall 0dcc88a3cdab513c598587d85423135e85cec330 PiperOrigin-RevId: 576552197 Change-Id: I13466703ddc9d50edf87da5d0c291aad642af49a
* Add internal interface to determine if a SpinLock is cooperative.Chris Kennelly2023-10-202-0/+26
| | | | | | | | Some use cases of SpinLock need to verify that it is configured for non-cooperative scheduling. PiperOrigin-RevId: 575278400 Change-Id: Ic49f57a989a3f7f67e346a1ec545f4cd5b94f849
* Optimize prefetch codegen.Dmitry Vyukov2023-10-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Currently we use "r" constraint to pass prefetched address. This forces the compiler to actually put it into a register. As the result some uses look as: 16bfb7c: 48 01 cf add %rcx,%rdi 16bfb7f: 0f 0d 0f prefetchw (%rdi) -- 16bfccf: 48 83 c1 60 add $0x60,%rcx 16bfcd3: 0f 0d 09 prefetchw (%rcx) Use "m" constraint instead. It's more relaxed and requires to just materialize the address in some form using whatever addressing modes the target supports (e.g. x86 off(base, index, scale)). With the change the same code becomes: 16bfb7c: 0f 0d 0c 39 prefetchw (%rcx,%rdi,1) -- 16bfccf: 0f 0d 49 60 prefetchw 0x60(%rcx) PiperOrigin-RevId: 574723975 Change-Id: Id0c8645f8c702d1842685343901da321f6513156
* Bazel: Enable the header_modules featureDerek Mauro2023-10-111-0/+1
| | | | | PiperOrigin-RevId: 572575394 Change-Id: Ic1c5ac2423b1634e50c43bad6daa14e82a8f3e2c
* Bazel: Support layering_check and parse_headersDerek Mauro2023-10-101-1/+30
| | | | | | | | | | | | | The layering_check feature ensures that rules that include a header explicitly depend on a rule that exports that header. Compiler support is required, and currently only Clang 16+ supports diagnoses layering_check failures. The parse_headers feature ensures headers are self-contained by compiling them with -fsyntax-only on supported compilers. PiperOrigin-RevId: 572350144 Change-Id: I37297f761566d686d9dd58d318979d688b7e36d1
* ABSL_INTERNAL_HAS_CXA_DEMANGLE: Check __GNUC__ is defined.Abseil Team2023-10-091-1/+2
| | | | | PiperOrigin-RevId: 571929102 Change-Id: I8fb907d047a4ff3bb42e7c7f99454fa687b8f1c9
* Re-submit with a fix for platforms without RTTI.Abseil Team2023-10-021-0/+13
| | | | | | | We test for `ABSL_INTERNAL_HAS_RTTI` in `absl::container_internal::TypeName` before calling `typeid`. PiperOrigin-RevId: 570101013 Change-Id: I1f2f9b2f475a6beae50d0b88718b17b296311155
* No public descriptionAbseil Team2023-09-271-1/+3
| | | | | PiperOrigin-RevId: 568845530 Change-Id: I8987053041423f1e8b122372f63b0a84e05eb594
* Add an internal wrapper for `abi::__cxa_demangle()`.Abseil Team2023-09-261-13/+0
| | | | | PiperOrigin-RevId: 568665135 Change-Id: I42ec9bc6cfe923777f7b60ea032c7b64428493c9
* Add an internal wrapper for `abi::__cxa_demangle()`.Abseil Team2023-09-261-0/+13
| | | | | PiperOrigin-RevId: 568652465 Change-Id: I9f72a11cb514eaf694dae589a19dc139891e7af2
* Rolling back cl/565792699Abseil Team2023-09-201-11/+10
| | | | | PiperOrigin-RevId: 567102456 Change-Id: I0750284c36850adbabc5ec0b4a2635aa8a967e53
* Honor ABSL_MIN_LOG_LEVEL in CHECK_XX, CHECK_STRXX, CHECK_OK, and the QCHECK ↵Andy Getzendanner2023-09-151-10/+11
| | | | | | | | | | | 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: 565792699 Change-Id: Ibb6a47d4956191bbbd0297e04492cddc354578e2
* Typo fix.Abseil Team2023-09-121-1/+1
| | | | | PiperOrigin-RevId: 564779671 Change-Id: I8cae825a533a00ff1983b48782486d5d00dae69a
* Fix GetTID() on FreeBSDDerek Mauro2023-09-071-1/+5
| | | | | | | | | | | | | https://github.com/abseil/abseil-cpp/issues/1518#issuecomment-1709098904 pointed out that the previous untested fix doesn't work because pthread_getthreadid_np() has a different signature on Darwin. Follow up to https://github.com/abseil/abseil-cpp/commit/b9707b7d7845f9710ae6d5906827b833fdcc2754 Fixes #1518 PiperOrigin-RevId: 563432451 Change-Id: Id0a9212e9c4413fa520a42934efaed2a06ca5dbc
* Use native methods to implement absl::base_internal::GetPID() onDerek Mauro2023-09-061-1/+17
| | | | | | | | | | | | | | | | FreeBSD, NetBSD, and OpenBSD https://man.freebsd.org/cgi/man.cgi?query=pthread_getthreadid_np https://man.netbsd.org/_lwp_self.2 https://man.openbsd.org/getthrid.2 This fixes a build break caused by https://github.com/abseil/abseil-cpp/commit/88cc63ef739d83277b492e881be72e9069fcb1fe Fixes #1518 PiperOrigin-RevId: 563200172 Change-Id: Ifd1b65c84e3631075248bc2e01b8f047dc72d201
* Delete //absl/base/internal/prefetch.hDerek Mauro2023-08-314-186/+2
| | | | | | | Public functions are now available in //absl/base/prefetch.h PiperOrigin-RevId: 561649346 Change-Id: Ic377ad5f21c9a44ea1f213dec17f5cf97795ebde
* Add missing #include options.h in optimization.h.Abseil Team2023-08-301-0/+1
| | | | | | | options.h was already included indirectly from config.h. This CL is just to include what you use. PiperOrigin-RevId: 561376910 Change-Id: I5b96b2aedc1e02eddc049f5bf0e6faa91799930d
* Remove the legacy thread annotation spellingsDerek Mauro2023-08-284-284/+0
| | | | | | | | | | | | | | | | The legacy thread annotations were spellings that were not prefixed with ABSL_ and caused conflicts with other libraries. These spellings have been removed by default for a while, but could have been added back with the temporary compile flag -DABSL_LEGACY_THREAD_ANNOTATIONS. This change completely removes the legacy spellings. If you were relying on the legacy spellings, the fix is straightforward. Simply add the ABSL_ prefix. For example, GUARDED_BY() becomes ABSL_GUARDED_BY(). PiperOrigin-RevId: 560874026 Change-Id: Id072e67435472220ea4f43ccbf267028c13feba7
* Implement ABSL_ATTRIBUTE_PURE_FUNCTION and ABSL_ATTRIBUTE_CONST_FUNCTIONDerek Mauro2023-08-281-3/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | Pure functions have no effects except to return a value, and their return value depends only on the parameters and global variables. Functions of this kind can be subject to data flow analysis and might be eliminated. In practice, this means that repeated calls to the same function with the same arguments may be optimized away and only evaluated once. Const functions are similar to pure functions, but may not depend on global variables at all. It is an error not to use the result of a function with one of these attributes, since these functions have no other visible effects. Since some Abseil functions are tagged with these attributes, this is potentially a breaking change for code that doesn't use the result of these functions. For example, absl::Minutes() is tagged with ABSL_ATTRIBUTE_CONST_FUNCTION. If, for example, the result of absl::Minutes(n) is unused, some compilers with issue a warning or error. If this is the case, it is likely that there is a typo in the code, or the call can be removed. PiperOrigin-RevId: 560803581 Change-Id: Icd6f218be2cfb7226f8ab6b2d97cd960c0d3d72f
* PR #1520: Make use of C++20 feature test macros to bestow better compatibilityYuriy Chernyshov2023-08-211-0/+14
| | | | | | | | | | | | | Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1520 Fixes #1519 and removes the burden of manually feature testing all the platforms supported by absl. Merge 26bc4ee13a93edaeee2a21b5eff3569b806acc91 into 94b37802217a9c9bb182bd99d55096683ef45b2c Merging this change closes #1520 COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1520 from georgthegreat:feature-test-macros 26bc4ee13a93edaeee2a21b5eff3569b806acc91 PiperOrigin-RevId: 558777775 Change-Id: Ie3e1f309761c67fa233a03e42762776cd93c69b4
* PR #1509: Allow building when targeting WASIAnuraag Agrawal2023-08-152-23/+31
| | | | | | | | | | | | | Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1509 WASI is similar to emscripten, providing a syscall layer to WebAssembly focused on server side applications. There are some config knobs that are in place to allow building the repo for emscripten which also need to support wasi (as built with LLVM). Aside from that, there are still some features it supports less than escripten, for example related to signals, causing the build to be even more limited for it. Merge ec9fa081609687035005dfdafd312754f31c3fbb into 861e53c8f075c8c4d67bd4c82217c57239fc97cf Merging this change closes #1509 COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1509 from anuraaga:wasi-sdk-build ec9fa081609687035005dfdafd312754f31c3fbb PiperOrigin-RevId: 557166498 Change-Id: Ic51149d8b092fd888c9a5c383275257fc8ff4232
* Always inline prefetches.Hannah Lin2023-08-141-9/+19
| | | | | PiperOrigin-RevId: 556914455 Change-Id: Ic0169e1099384eefe285e6d354e448eb5189e397