summaryrefslogtreecommitdiff
path: root/absl/strings/internal
Commit message (Collapse)AuthorAge
* Remove obsolete TODOGravatar Abseil Team2024-06-04
| | | | | PiperOrigin-RevId: 640138527 Change-Id: I650dd91d76824cfd3a57b36eca282f41b3667125
* Workaround symbol resolution bug in Clang 19Gravatar Derek Mauro2024-05-24
| | | | | | | | | | | | | | Clang 19 seems to see the old usage of absl::string_internal::HasAbslStringify in GoogleTest 1.14.0 and incorrectly resolves absl::HasAbslStringify sometimes. This issue is fixed when a version of GoogleTest that removes absl::string_internal::HasAbslStringify is used. This workaround is ugly but will be removed after the next GoogleTest release. PiperOrigin-RevId: 636993564 Change-Id: Ic166edbd4ddc2c716afbedec34be629cfc988e00
* Silence a bogus GCC14 -Warray-bounds warningGravatar Derek Mauro2024-05-24
| | | | | PiperOrigin-RevId: 636990118 Change-Id: Ib90ed852b899a976679a8eb6352a9161c27e17ce
* PR #1672: Optimize StrJoin with tuple without user defined formatterGravatar Valery Mironov2024-05-15
| | | | | | | | | | | | | | Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1672 https://github.com/abseil/abseil-cpp/discussions/1671 Merge ddcbb2466b2c9c4048d60be7e58cf47f935c257d into eba8db7baf6c326870f28e58977075b7b2fb243d Merging this change closes #1672 COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1672 from MBkkt:optimize-str-join ddcbb2466b2c9c4048d60be7e58cf47f935c257d PiperOrigin-RevId: 633988391 Change-Id: I2b3904211a29de3a768fb90a7fc106d7ff6c03e7
* `convert_test`: Delete obsolete condition around ASSERT_EQ in ↵Gravatar Dino Radakovic2024-05-10
| | | | | | | | | TestWithMultipleFormatsHelper The `if (actual != expected)` makes the `ASSERT_EQ(actual, expected)` trigger only when the assertion fails. However, a successful `ASSERT_EQ` takes a negligible amount of time, which means the `if` is useless and only makes the test harder to read. PiperOrigin-RevId: 632487285 Change-Id: I1f78136cf4895295c88a5ff3e0bcdce6b08c1d0b
* `convert_test`: Extract loop over tested floats from helper functionGravatar Dino Radakovic2024-05-06
| | | | | | | | | | This change is a step towards simplifying `TestWithMultipleFormatsHelper` to the point where we'll be able to handle special cases (e.g. apple's handling of nan) by changing which inputs are fed into the helper, instead of skipping them within the helper and not testing them at all. Extracting the loop also improves readability by reducing indentation. PiperOrigin-RevId: 631038465 Change-Id: I8b2458539d9d276093d8e7b5f373efba6a33800c
* `convert_test`: Delete obsolete `skip_verify` parameter in test helperGravatar Dino Radakovic2024-04-24
| | | | | | | | It is unused. We already use code within the `TestWithMultipleFormatsHelper` to skip output verification for Apple and MSVC. PiperOrigin-RevId: 627783586 Change-Id: Ib51374e8571aa5f4b5f1e836815188bd9bdc1536
* `str_format/convert_test`: Delete workaround for [glibc ↵Gravatar Dino Radakovic2024-04-18
| | | | | | | | | bug](https://sourceware.org/bugzilla/show_bug.cgi?id=22142) RHEL7 ships an affected version of glibc, but this bug is specific to powerpc, which abseil [does not support](https://github.com/google/oss-policies-info/blob/4ec9f2a979a6c6b7bb148040347c8d2b1def09fa/foundational-cxx-support-matrix.md). PiperOrigin-RevId: 626018125 Change-Id: I1875aee6c37e69f712ef91e41da455af9d00fb5f
* Add explicit #include directives for <tuple>, "absl/base/config.h", and ↵Gravatar Abseil Team2024-03-19
| | | | | | | "absl/strings/string_view.h". PiperOrigin-RevId: 617232899 Change-Id: I5e6c0bd4545d7f7ad9c5c494017269e247f620a3
* Record sampling stride in cord profiling to facilitate unsampling.Gravatar Chris Kennelly2024-03-18
| | | | | | | | The sampling rate may change over time, so this allows us to weight samples by the value observed when we made the sampling decision. PiperOrigin-RevId: 616900100 Change-Id: I9b1affdba93f5f48367cb7503916296b2d84709a
* Add additional checks for size_t overflowsGravatar Derek Mauro2024-03-14
| | | | | | | | | This change mainly affects 32-bit platforms. Similar to 4618865caf8596742a9fd7c28a70a46b5e277794, check for size_t overflow in all places where string result sizes are precomputed before allocation. PiperOrigin-RevId: 615792028 Change-Id: I71c774c5ef2c2978bd812c70e9bab36d266b7c90
* Work around an implicit conversion signedness compiler warningGravatar Abseil Team2024-03-07
| | | | | | | | | | | Addition and subtraction operators std::array::iterator are defined only for ptrdiff_t, which is signed, instead of size_t, which is unsigned. Therefore, adding the index variable to ar.begin() will trigger -Wsign-conversion if std::array::iterator is not a raw pointer because the index variable will be implicitly converted from size_t (an unsigned type) to ptrdiff_t (a signed type). To fix this, we explicitly static_cast index to a ptrdiff_t. PiperOrigin-RevId: 613662928 Change-Id: I5e06c2261d7b8f167fae7bb6acece076257f8579
* Switch rank structs to be consistent with written guidance in ↵Gravatar Matt Kulukundis2024-02-07
| | | | | | | go/ranked-overloads PiperOrigin-RevId: 605125821 Change-Id: I2ee260eaf283acafd80abfd2b7419a0e9f597a78
* Optimize `Cord::Swap()` for missed compiler optimization in clang.Gravatar Martijn Vels2024-02-01
| | | | | PiperOrigin-RevId: 603342563 Change-Id: I1cd80103377f457770d5178dad8b56ae459cbd55
* Use absl::NoDestructor for cordz global queue.Gravatar Abseil Team2024-01-30
| | | | | | | Also updated the return value to reference to clarify non-nullability. PiperOrigin-RevId: 602730828 Change-Id: Ia36f7fde3cc87ac597ba4f194eebe9ebb90a1a09
* Re-add the internal file //absl/string/internal/has_absl_stringify.h to unblockGravatar Derek Mauro2024-01-09
| | | | | | | | | | | | | | | releasing Abseil and GoogleTest. GoogleTest referenced this internal file and this internal trait. Since simultaneous releases are not possible since once release must reference another, we will temporarily add this back. https://github.com/google/googletest/blob/v1.14.x/googletest/include/gtest/gtest-printers.h#L119 https://github.com/google/googletest/pull/4368#issuecomment-1717699895 https://github.com/google/googletest/pull/4368#issuecomment-1717699895 PiperOrigin-RevId: 597073935 Change-Id: I7c2697a212dc477fd25770777445c64cfee73745
* Add a pragma to disable a stringop-overflow warning for GCC12+Gravatar Abseil Team2023-12-18
| | | | | PiperOrigin-RevId: 591894838 Change-Id: Ib3fe72d255f49320e2728c210ba1faabc81e0ef8
* Adds support for wchar_t/wchar_t*/std::wstring{_view} arguments to StrFormat().Gravatar Abseil Team2023-12-05
| | | | | | | This converts to UTF-8 regardless of locale. PiperOrigin-RevId: 588186076 Change-Id: I2c9598279b413d460e13ad65da2ba421c0b40b83
* Optimize memcasecmp. Benchmarks shows slight improvement.Gravatar Ilya Tokar2023-10-30
| | | | | | | | | | | | | | | We are also avoiding potential cache-misses, by avoiding load. name old speed new speed delta BM_Searchcase 3.09GB/s ±13% 3.20GB/s ±16% +3.69% (p=0.039 n=20+17) BM_SearchcaseMedium 1.08GB/s ± 7% 1.04GB/s ±14% ~ (p=0.814 n=16+20) BM_SearchcasePathological 618kB/s ±13% 652kB/s ± 6% +5.55% (p=0.043 n=20+16) BM_Memcasematch 2.43GB/s ± 3% 2.45GB/s ± 3% ~ (p=0.488 n=17+16) BM_MemcasematchMedium 230MB/s ± 8% 261MB/s ±14% +13.77% (p=0.000 n=16+20) BM_MemcasematchPathological 624kB/s ±14% 619kB/s ±14% ~ (p=0.836 n=20+20) PiperOrigin-RevId: 577919033 Change-Id: I31324e04b6a577c582ad630d171d3b41d826f1e4
* Fix an unreachable code warning on some platformsGravatar Derek Mauro2023-10-30
| | | | | | | #1558 PiperOrigin-RevId: 577874842 Change-Id: I1d56f3f4b445f6c4a9df2fe06fec542cb00e0e92
* Add `AbslStringify()` support to `absl::Cord`Gravatar Abseil Team2023-10-24
| | | | | PiperOrigin-RevId: 576149980 Change-Id: I0a7e3df7a01edc78ee5d15d8d8e82e7bbc5fc0f3
* Delete `absl::strings_internal::HasAbslStringify`.Gravatar Abseil Team2023-10-12
| | | | | | | Users should use `absl::HasAbslStringify` instead. PiperOrigin-RevId: 572916854 Change-Id: Ie67e076e0335b108d23f886a28074f7557ba045a
* Make `HasAbslStringify` public.Gravatar Abseil Team2023-09-13
| | | | | PiperOrigin-RevId: 565050503 Change-Id: I8f4c463be4ef513a2788745d1b454a7ede489152
* Remove CordRepRing experiment.Gravatar Martijn Vels2023-09-08
| | | | | | | We have no intention to use it instead of the CordRepBtree implementation, so cleanup up and remove all code and references. PiperOrigin-RevId: 563803813 Change-Id: I95a67318d0f722f3eb7ecdcc7b6c87e28f2e26dd
* Fix strict weak ordering in convert_test.ccGravatar Abseil Team2023-09-08
| | | | | | | It sorts NaNs and the test became flaky. Flakiness arises from the fact that sorting checks randomize and check for 100 elements but we sort here around a thousand PiperOrigin-RevId: 563783036 Change-Id: Id25bcb47483acf9c40be3fd1747c37d046197330
* Remove unused ReservedFlag.Gravatar Tomas Dzetkulic2023-08-30
| | | | | PiperOrigin-RevId: 561444343 Change-Id: I26c648b28b626e11caa32b0a34aef92932d5ddb9
* Add absl::CharSet.Gravatar Abseil Team2023-08-23
| | | | | PiperOrigin-RevId: 559415517 Change-Id: I5bbc744bf00be2fd15ec7544b725d699e0d982fb
* Check CRC cordrep child nodes for nullptr.Gravatar Martijn Vels2023-08-18
| | | | | | | Some time ago the invariant for CRC cordreps was relaxed to allow for nullptr values on empty cords with an explicit empty CRC value. The CordzInfo analysis never checked for nullptr values causing cord sampling to crash if the sampling happened to include a (very unlikely) empty Cord value. PiperOrigin-RevId: 558202613 Change-Id: Ib0e1eadd08047167e4df5d3035b36dca2c285a0d
* Undefine internal `ABSL_FORMAT_PARSER_INTERNAL_GET_CHAR` macro after usageGravatar Abseil Team2023-07-26
| | | | | PiperOrigin-RevId: 551287955 Change-Id: Ic77831cec71f6ffe0a4e091baabe932b245269ea
* Cleanup `//absl/strings/internal/memutil.h`Gravatar Derek Mauro2023-07-11
| | | | | | | | | | | | | `memmatch()` is only used in `string_view.cc`, so move it there. The moving of `memmatch()` to `string_view.cc` decouples `string_view` from `memutil`, which will allow us to move `string_view` into its own target in a followup. The only other function that is used is `memcasecmp()`, so delete all other functions. PiperOrigin-RevId: 547238386 Change-Id: Id6fad47dd24191c8e8f26dd923fffa1007c8db4a
* Remove two_ASCII_digits and replace with a scalar algorithmGravatar Abseil Team2023-06-13
| | | | | PiperOrigin-RevId: 539900072 Change-Id: I675386e3184f6f5ab70b851add970c91d1dde9c5
* Fix behaviors of StrCat() and StrFormat() regarding char types and enum types.Gravatar Greg Falcon2023-06-12
| | | | | | | | | | | | | | | | | | | This is a conservative change, in that it only contains bugfixes and allows new patterns that used to be compile errors. There are other changes we would like to make (as reflected in the comments in char_formatting_test.cc), but we are being careful about the implications of such behavior changes. The two implementation changes are: * Apply integral promotions to enums before printing them, so they are always treated as integers (and not chars) by StrCat and StrFormat. * Classify `unsigned char` and `signed char` as integer-like rather than char-like, so that `StrFormat("%v", v)` accepts those types as integers (consistent with `StrCat()`.) The behavior changes are: * StrCat() now accepts char-backed enums (rather than failing to compile). * StrFormat("%v") now accepts `signed char` and `unsigned char` as integral (rather than failing to compile). * StrFormat("%v") now correctly formats 8-bit enums as integers (rather than failing internally and emitting nothing). Tested: Modified the char_formatting_test.cc case to reflect changes. Re-ran all other tests. PiperOrigin-RevId: 539659674 Change-Id: Ief56335f5a57e4582af396d00eaa9e7b6be4ddc6
* Optimize Cord Refcount decrement.Gravatar Connal de Souza2023-06-09
| | | | | | | Introduce kHighRefcountMask which masks off flags and the LSb of the refcount value. In the cases where this mask is used, we don't need to check the LSb because we can assume the refcount is 1 when the rest of the masked RefcountAndFlags is empty, and the LSb doesn't matter if the masked value is not empty (either it's immortal or refcount > 1). This saves an instruction and a cycle (and + cmp -> tst) https://godbolt.org/z/Kz69eqfhq PiperOrigin-RevId: 539151659 Change-Id: I2ec7d72918f052c4b0938edd746af9d5b3052c7e
* Merge pull request #1472 from pateldeev:ivGravatar Copybara-Service2023-06-09
|\ | | | | | | | | PiperOrigin-RevId: 539145188 Change-Id: Ic8dc8112f77ca720a8871de57ee389f15693ab00
* | StrFormat() simplification: Treat %v unconditionally as %d when formatting ↵Gravatar Greg Falcon2023-06-09
| | | | | | | | | | | | | | | | | | integers. This is a simplification but not a behavior change; we used to choose %u for unsigned ints, but %u and %d generate the same output for these types. PiperOrigin-RevId: 539104599 Change-Id: I9d7ff561b969a6287889f95063636d6b77a4a78b
| * Use InlinedVectorGravatar pateldeev2023-06-08
|/
* Lifetime checks for `absl::StrSplit()`Gravatar Abseil Team2023-06-02
| | | | | PiperOrigin-RevId: 537400816 Change-Id: I06794a6b8b6a441e34121047024380190d42869a
* Migrate most RAW_LOGs and RAW_CHECKs in tests to regular LOG and CHECK.Gravatar Andy Getzendanner2023-05-23
| | | | | | | | | | | The non-RAW_ versions provide better output but weren't available when most of these tests were written. There are just a couple spots where RAW_ is actually needed, e.g. signal handlers and malloc hooks. Also fix a couple warnings in layout_test.cc newly surfaced because the optimizer understands CHECK_XX differently than INTERNAL_CHECK. PiperOrigin-RevId: 534584435 Change-Id: I8d36fa809ffdaae5a3813064bd602cb8611c1613
* CI: Move the GCC-latest testing to GCC 13.1 on LinuxGravatar Derek Mauro2023-05-22
| | | | | | | | | | This includes an upgrade to CMake 3.26.3 and Bazel 6.2.0 This change includes support for both GCC 12 and 13 since we were only testing GCC 11 before this change. PiperOrigin-RevId: 534235753 Change-Id: I4183a02469b1c3425c52a31b71fcefe403315a42
* Merge pull request #1115 from h-vetinari:dll_targetsGravatar Copybara-Service2023-05-15
| | | | | PiperOrigin-RevId: 532174747 Change-Id: I39dc6d5c369e8bfbdde5c826836e42f5baa69dc5
* Fixed Windows DLL builds of test targetsGravatar Derek Mauro2023-05-12
| | | | | | | | | | | | | | | | | | | | | | | | | | This is a heavily modified version of https://github.com/abseil/abseil-cpp/pull/1445, which adds some missing test libraries to the test DLL. Unlike #1445, this change moves several global variables out of headers that did not need to be in headers. For instance, cord_btree_exhaustive_validation was a global defined/declared in cord_internal, but only used in cord_rep_btree and its test. cordz_handle defined a queue in its header even though it wasn't needed, which also led to ODR problems. The Spinlock used in CordzHandle is replaced with a Mutex. This was originally a Mutex, but Chromium asked us to change it to a Spinlock to avoid a static initializer. After this change, the static initializer is no longer an issue. #1407 PiperOrigin-RevId: 531516991 Change-Id: I0e431a193698b20ba03fac6e414c26f153f330a7
* Stop moving an absl::FunctionRef, since the class isn't movable, itGravatar Derek Mauro2023-05-09
| | | | | | | | | | will just be a copy anyway. Also remove the typedef so that it is clear from the type at the callsite that moving it isn't necessary. Fixes #1443 PiperOrigin-RevId: 530596294 Change-Id: I58ffc370bbccc0816bca4c4f85c3bb12c7ee2eb2
* Fix spelling mistakesGravatar Vertexwahn2023-05-02
|
* Merge pull request #1438 from Vertexwahn:fix-spellingGravatar Copybara-Service2023-05-01
|\ | | | | | | | | PiperOrigin-RevId: 528547013 Change-Id: I9b57ee062ef666d6a34696778ff16a46c5ccb17d
| * Fix spelling mistakesGravatar Vertexwahn2023-04-27
|/
* Merge pull request #1434 from Vertexwahn:fix-spellingGravatar Copybara-Service2023-04-25
|\ | | | | | | | | PiperOrigin-RevId: 527066823 Change-Id: Ifa1e9a43c7490b34f9f4dbfa12d3acbed6b49777
| * Fix some spelling mistakesGravatar Vertexwahn2023-04-24
|/
* Merge pull request #1416 from AtariDreams:fillGravatar Copybara-Service2023-04-24
|\ | | | | | | | | PiperOrigin-RevId: 526675031 Change-Id: Ib84423ccea2d0183166194a0916a97a7ed32915c
| * Prefer copy_n and fill_n over copy and fill where appropriate.Gravatar Rose2023-04-19
|/ | | | This lets us avoid having to do the addition manually.
* Be more consistent in the documentation and variable declarations for base64 ↵Gravatar Abseil Team2023-03-16
| | | | | | | | | | | escaping vs unescaping: * Move table documenting escaping conversions to be next to the internal escaping code that implements it. Mention it from the internal _un_escaping code (which reverses it) too. * Centralize the two arrays which map from normal chars to escaped chars (k(WebSafe)Base64Chars), and make bidirectional documentation links between them and their reverse (unescaping) maps (kUn(WebSafe)Base64). * Remove redundant list of escaping/unescaping methods in the public escaping.cc. PiperOrigin-RevId: 517142667 Change-Id: I627e59a196ef855e5bf61ef7f4b509920e8d7acd