Commit Graph

753 Commits

Author SHA1 Message Date
Drishti Tripathi
a30bcb2c51 PR #2069: docs: fix documentation inconsistencies in escaping.h
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/2069

Fix documentation inconsistencies in absl/strings/escaping.h:

- Add missing `true` return value documentation to
  WebSafeBase64Unescape(), aligning it with the parallel
  Base64Unescape() which already documents this.

- Fix missing closing backtick in WebSafeBase64Escape() comment
  (`dest` was unterminated).

- Fix inconsistent single quotes to backticks on `src`/`dest`
  references, matching the style used elsewhere in the file.
Merge 0616be3080 into fe126c727b

Merging this change closes #2069

COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/2069 from DrishtiTripathi2230:docs/websafe-base64-unescape-return-value 0616be3080
PiperOrigin-RevId: 924786942
Change-Id: Idcd6d27e1da696614cd8c9417bb6facb277d1d47
2026-06-01 10:33:34 -07:00
Derek Mauro
64730a2348 Remove an obsolete //visibility:private tag
PiperOrigin-RevId: 924755156
Change-Id: I60faad5644dbcf53e1ca4a502f1eb4bf4dfd1b87
2026-06-01 09:35:26 -07:00
Drishti Tripathi
fe126c727b PR #2064: docs: document MSVC compile-time format checking limitation in str_format.h
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/2064

Fixes #1478

absl::StrFormat compile-time format string checking relies on
__attribute__((format(...))), a GCC/Clang-specific compiler extension
that MSVC does not support. This adds a note to the file-level
documentation so MSVC users are aware that format string errors will
only be caught at runtime, not at compile time.
Merge 81977d7954 into e7a10c8ec2

Merging this change closes #2064

COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/2064 from DrishtiTripathi2230:docs/strformat-msvc-compile-time-check 81977d7954
PiperOrigin-RevId: 922922072
Change-Id: I91f545b6a1e64f3d8aba3350ac6332cb9548a40a
2026-05-28 12:46:00 -07:00
Derek Mauro
9346a86073 Fix typo in the documentation of absl::CopyCordToSpan()
PiperOrigin-RevId: 918529786
Change-Id: I1cff5ae9a9571a97ea38e2b83de1d661675363a0
2026-05-20 10:40:25 -07:00
Abseil Team
c20be0a44d Add absl::StatusBuilder and status macros (ASSIGN_OR_RETURN, RETURN_IF_ERROR, etc.)
PiperOrigin-RevId: 915476143
Change-Id: If1ce23cf40e4e44c39164f81f6d5ca66988d405c
2026-05-14 09:45:04 -07:00
Derek Mauro
659ba44acf absl::Substitute: Set variables in the correct order to avoid an
uninitialized variable warning in GCC 10

PiperOrigin-RevId: 912616225
Change-Id: Ieb72a17cdfdbff66df6d04b9b87b8eb03bbfb30d
2026-05-08 11:34:47 -07:00
Derek Mauro
638e17aedd Add absl::CopyCordToSpan()
PiperOrigin-RevId: 912247630
Change-Id: Ie5d2837c9b878e6094dce4d2ec7e60441a7c6bb7
2026-05-07 17:55:11 -07:00
Abseil Team
bd6adb86c2 Change abseil hardening assertions in the strings directory from macros to functions
This associates debug information with the assertion sites, allowing clearer stack-traces for assertion failures and better accounting of the performance overhead of assertions.

PiperOrigin-RevId: 910863016
Change-Id: Ic615a9eeb8ad4b3f8c035074df4ff8347190e5c7
2026-05-05 13:00:46 -07:00
Derek Mauro
acbfcef618 Add an absl::StrCat floating-point formatter absl::HighPrecision
absl::HighPrecision produces a string with enough precision that it
can be parsed back to the original floating-point value.
PiperOrigin-RevId: 908689724
Change-Id: Ib076de9e32b0168ce587ea676088f05c8abe7e95
2026-05-01 05:50:23 -07:00
Abseil Team
bbdeb411c7 Add GenericPrint specialization for std::monostate.
`std::monostate` is a struct without any fields thus there is no content to be printed at all. However, the default printer prints it as `"unprintable value of size 1 @{some address}"` which is not very useful unless we're really interested in the address of struct having nothing.

PiperOrigin-RevId: 906966193
Change-Id: I7121bd9d58ac9930fa19432d76788d1df6dc5b78
2026-04-28 07:28:18 -07:00
Abseil Team
852fc61f31 Remove more lingering C++17 type traits polyfill usages
This will let us deprecate the declarations without triggering warnings in Abseil itself.

PiperOrigin-RevId: 906360966
Change-Id: Iee362ac0eac647909ef38003280f1179813f764d
2026-04-27 08:03:53 -07:00
Abseil Team
351086314d Update documentation for absl::StrSplit() to mention that
the input is processed sequentially from beginning to end.

PiperOrigin-RevId: 905243329
Change-Id: I9a6fe9be7254ceaeb02f070958f76f622563a028
2026-04-24 15:16:43 -07:00
Derek Mauro
cd0423dc25 Stop exporting internal Base64 escaping functions that do not need to
be exported. The one function that is currently using it is easily
implemented with absl::Base64Escape().

PiperOrigin-RevId: 900830658
Change-Id: I859d67efafd5ba96921bb75c9207438975d055d6
2026-04-16 11:38:13 -07:00
Abseil Team
9cb62a03a4 Remove unnecessary usages of absl::void_t
Most usages of absl::void_t compile fine with std::void_t, so we migrate them here. A few don't compile due to overly eager template instantiations, so we leave those.

PiperOrigin-RevId: 897231619
Change-Id: Iad34101916dac2b995257ebd5d6aacb9a0acfa32
2026-04-09 12:01:41 -07:00
Abhi Raman
354d4d9d13 StrFormat: format %g without heap allocation
PiperOrigin-RevId: 897196391
Change-Id: I0eeb47f4263344a7ce577d78c6029e31a7430385
2026-04-09 10:55:10 -07:00
Abseil Team
95619d531e Remove more lingering C++17 type traits polyfill usages
This will let us deprecate the declarations without triggering warnings in Abseil itself.

PiperOrigin-RevId: 895480358
Change-Id: I2e15877c15ed83f48ddb68cc73344c14b533bc68
2026-04-06 13:44:35 -07:00
Abseil Team
ed2114e8ff Stop using C++17 type traits polyfills
This will let us deprecate the declarations without triggering warnings in Abseil itself.

PiperOrigin-RevId: 894202105
Change-Id: I57bb2a1647be1fedf9b724a07042fd0f564ce074
2026-04-03 12:34:35 -07:00
Abseil Team
5c01794f79 Support passing I/O manipulators such as std::endl to StringifyStream
PiperOrigin-RevId: 892740803
Change-Id: I7c0c2d330080492d1451960bc21c04e6dbcbeb22
2026-03-31 23:34:03 -07:00
Derek Mauro
4ff7ff9ee9 Add cleanup dependency
PiperOrigin-RevId: 891759296
Change-Id: I315b927a89cbb7e8d25c77e994d07b0e545f6909
2026-03-30 09:32:24 -07:00
Mike Kruskal
6c1f120e3e Add //gloop/util/status:status_macros to Gloop
PiperOrigin-RevId: 885969057
Change-Id: I11d30ca91b576e61664efc68dd4c1df353eec6be
2026-03-18 22:32:30 -07:00
Derek Mauro
e8f3bb209b Add additional tests in str_split_test.cc
PiperOrigin-RevId: 884611329
Change-Id: I5944333d11c85867652fc5e596020381c445d562
2026-03-16 13:34:12 -07:00
Abseil Team
0a7fe7e8da Add absl::strings_internal::AbslStringifyStream
PiperOrigin-RevId: 883300728
Change-Id: Ib5c83114fdc4e292ad8fcf96a899878315707353
2026-03-13 13:01:43 -07:00
Abseil Team
81f4d83f38 Add supporting code for absl::SourceLocation
PiperOrigin-RevId: 883256961
Change-Id: I536f9dc76ce4f248b5c87eaf27515cd8a4a484ca
2026-03-13 11:25:47 -07:00
Samuel Benzaquen
93a7a9cfe1 Prepare GenericPrinter for the rename of ArenaSafeUniquePtr.
PiperOrigin-RevId: 882021829
Change-Id: Idf65e88bd3ba1f285195dd60a9d8fc82bb61e516
2026-03-11 08:15:53 -07:00
Derek Mauro
ab54e73e59 Use reserve() to grow in STLStringResizeUninitializedAmortized()
When falling back to resize(), the entire resized block gets
initialized, which causes pathological behavior in the case of many
small appends. reserve() fixes this problem.

PiperOrigin-RevId: 877497660
Change-Id: I3ae8b45d74a62f975b1050851fe6fd9561071bec
2026-03-02 11:30:27 -08:00
Abseil Team
ea40a529e1 Disable failing tests on ChromiumOS configurations.
PiperOrigin-RevId: 877419268
Change-Id: I38f33b8afbb0a756338e0b10c83eeffb076aaae6
2026-03-02 08:46:34 -08:00
Derek Mauro
443adb7497 Use reserve() to grow in absl::string_internal::StringAppendAndOverwrite()
When using the fallback, resize() is used, which initializes the
entire block, which causes pathological behavior in the case of many
small appends.

PiperOrigin-RevId: 877019230
Change-Id: If685b888ba55233c3c7436a6af19333561308424
2026-03-01 08:35:46 -08:00
Derek Mauro
dee6c62837 Remove unused include of resize_uninitialized.h
PiperOrigin-RevId: 875788912
Change-Id: I221428e693a26b59c69e3ef62a2c267f636737b8
2026-02-26 10:36:28 -08:00
Vitaly Goldshteyn
1ccf9eeabb Update the description of hexadecimal digits to include lowercase letters {a-f}.
PiperOrigin-RevId: 875297838
Change-Id: I8a3625bb00fa57abf8f89537d98f5d22e13a70d2
2026-02-25 12:59:00 -08:00
Mike Kruskal
45c8989b87 Add a visibility placeholder to Abseil for Gloop.
PiperOrigin-RevId: 875292936
Change-Id: I5622f33f8d6581ca3f55783579f612e3e5c4822f
2026-02-25 12:48:48 -08:00
Derek Mauro
5088cf5194 Cleanup the uses of the polyfills absl::any, absl::optional,
absl::variant, and related types

The corresponding headers are removed from cc files, but kept in
headers to prevent breakages from transitive dependencies.

PiperOrigin-RevId: 872421685
Change-Id: I867d4c3f7c9e422289c63816d44719b0530fb0a6
2026-02-19 08:53:17 -08:00
Abseil Team
90633b5020 Fix comment about releaser's operators in MakeCordFromExternal.
PiperOrigin-RevId: 871940822
Change-Id: I493f8e5e13de9b80f71b63d2ad8c96f649c0449f
2026-02-18 10:41:38 -08:00
Derek Mauro
6ec9964c32 Inline deprecated versions of absl::Base64Escape() and
absl::WebSafeBase64Escape()

PiperOrigin-RevId: 871304867
Change-Id: Id35fbc05d7f2f483333e6975e5a16f3a04d361fe
2026-02-17 07:26:05 -08:00
Derek Mauro
586a3fbe2a Deprecate the versions of Base64Escape() and WebSafeBase64Escape()
that use an output parameter.

These versions are clearly inferior to the versions that return
a string.

This is a response to https://github.com/abseil/abseil-cpp/issues/2015

Fixes #2015

PiperOrigin-RevId: 870281461
Change-Id: I92f23d51d05a243dde88c997c1e8448819c5bc77
2026-02-14 16:54:10 -08:00
Derek Mauro
919b8f9c21 Check for overflow on every iteration in a loop inside of CUnescapeInternal()
For example, \x100000041 could overflow a 32-bit integer and result in
0x41 ('A'), bypassing the exceeds 0xFF check. While this may be hard
to exploit, it is better to be safe and correct.

PiperOrigin-RevId: 868181068
Change-Id: I7d7763e0fe248f7cd7a4cfcc73554d7b20355795
2026-02-10 09:21:09 -08:00
Derek Mauro
7313246786 Fix sign-extension issue in absl::HexStringToBytes()
Fixes #2006

PiperOrigin-RevId: 867661246
Change-Id: Ia4ad66620e0298287993b228bf604b8b75302c7d
2026-02-09 10:15:20 -08:00
Derek Mauro
81839fc522 Open up the throw_delegate library to public usage
This library contains helper functions that allow throwing exceptions
consistently from anywhere, without risk of ODR violations. When
execptions are disabled, these functions abort the program.

The old internal spellings will be removed in a follow up change.

PiperOrigin-RevId: 867594519
Change-Id: Ibd7a447f5577247bced718617f5da662d983d185
2026-02-09 07:28:03 -08:00
Abseil Team
e56fcf42ab Removing template workaround as the ::benchmark::internal::Benchmark type has now been made non-internal.
PiperOrigin-RevId: 859601861
Change-Id: Ib227f9eea67863cf664f7094be11241d7bdf1a70
2026-01-22 07:34:28 -08:00
Derek Mauro
fa3783ec81 Reimplement STLStringResizeUninitializedAmortized() using
StringResizeAndOverwriteImpl()

This change bridges the gap between the legacy uninitialized resize
behavior and the modern absl::StringResizeAndOverwrite(). The internal
StringResizeAndOverwriteImpl function is used directly because the
public Abseil API requires the buffer to be initialized, whereas these
legacy functions rely on the behavior of leaving it uninitialized
(which is technically UB but relied upon here).

This is part of the work to migrate away from these legacy
utilities.

PiperOrigin-RevId: 855779916
Change-Id: If22484048024eae8ddedd29ebb08e8884e0198a3
2026-01-13 10:18:30 -08:00
Abseil Team
6715d82763 Update includes in Damerau-Levenshtein distance implementation.
PiperOrigin-RevId: 853729717
Change-Id: Ic4d761e12cfddcba8ada06b43963ca7988370399
2026-01-08 07:18:29 -08:00
Derek Mauro
d9d76ba372 Fix unused variable warning in GCC7
PiperOrigin-RevId: 853321697
Change-Id: I44b09e10e6ca1bb9b9f30a01a0f5acd5923371c1
2026-01-07 10:34:36 -08:00
Abseil Team
9391635247 StrFormat: format scientific notation without heap allocation
PiperOrigin-RevId: 852845312
Change-Id: I26dcfc5784383d1cf86fab795ba931445f24c575
2026-01-06 10:44:01 -08:00
Derek Mauro
2d4a5a87fd Delete absl::strings_internal::STLStringReserveAmortized()
PiperOrigin-RevId: 850064010
Change-Id: Ieb280f2ba70726bbd4f27d2aed1f0ff4e5a683d1
2025-12-29 08:15:26 -08:00
Derek Mauro
87c547923d Use StringAppendAndOverwrite() in CEscapeAndAppendInternal()
PiperOrigin-RevId: 850046633
Change-Id: I5ed7d3031c8e60ddac80df9d0bea073f07017236
2025-12-29 07:04:27 -08:00
Abseil Team
24a5eb08e7 Add support for absl::(u)int128 in FastIntToBuffer()
PiperOrigin-RevId: 849837011
Change-Id: I3b742863d328f01a2461f2b876b2aaf04ce9cd5f
2025-12-28 15:54:26 -08:00
Chris Kennelly
5d365d332a absl/strings: Prepare helper for printing objects to string representations.
PiperOrigin-RevId: 847935770
Change-Id: I7f96940e5ba11d6a602d34e7dc3dbfde112bb142
2025-12-22 17:29:23 -08:00
Derek Mauro
9ebd93a774 Remove the implementation of absl::string_view, which was only needed
prior to C++17. `absl::string_view` is now an alias for `std::string_view`.
It is recommended that clients simply use `std::string_view`.

PiperOrigin-RevId: 845822478
Change-Id: I220530c84118e5b9ef110baa002c232ac8f2c5f2
2025-12-17 10:23:48 -08:00
Chris Kennelly
6baba4dc59 Avoid discarding test matchers.
PiperOrigin-RevId: 838904511
Change-Id: I02f3bf3f2c51e4cdb21aa638a4f265f2ef4e2f25
2025-12-01 13:17:26 -08:00
Derek Mauro
18bd00ad42 Add further diagnostics under clang for string_view(nullptr)
Detection isn't perfect, but it is better than nothing:
https://godbolt.org/z/YzeMeb58j

PiperOrigin-RevId: 837204651
Change-Id: Id1027c4c27bd95ad923e4c5d242a28079b16db79
2025-11-26 11:46:47 -08:00
Derek Mauro
69e7e0a383 Add the deleted string_view(std::nullptr_t) constructor from C++23
This will reject string_view(nullptr) at compile-time.

PiperOrigin-RevId: 835352115
Change-Id: Ic68e55d3eba02e002ed5f1791c40efbb0f0daaf0
2025-11-21 14:07:24 -08:00