73 Commits

Author SHA1 Message Date
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
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
Derek Mauro
f751e6186d absl::string_view: Upgrade the debug assert on the single argument
char* constructor to ABSL_HARDENING_ASSERT

PiperOrigin-RevId: 831936299
Change-Id: Idd2fad18fe8e8a07d8d8759026bd366b7ef479c2
2025-11-13 11:19:26 -08:00
Jesse Rosenstock
71c513c5f8 string_view: Enable std::view and std::borrowed_range
These are enabled for `std::string_view`.

https://en.cppreference.com/w/cpp/string/basic_string_view.html#Helper_templates

PiperOrigin-RevId: 822117252
Change-Id: I8b503a0612d33eabf1be3550c0ea735866c28d63
2025-10-21 07:56:05 -07:00
Jesse Rosenstock
fdb6e72c75 string_view: Fix include order
PiperOrigin-RevId: 821635144
Change-Id: I5e3e8457482c926aabf9ee016f28956f05064ed0
2025-10-20 07:14:20 -07:00
Derek Mauro
7dc8f4e04b Add the C++20 string_view contructor that uses iterators
https://cppreference.com/w/cpp/string/basic_string_view/basic_string_view.html

libc++: 3ecd331808/libcxx/include/string_view (L335-L343)

libstdc++: 11f7d5648c/libstdc%2B%2B-v3/include/std/string_view (L154-L162)

PiperOrigin-RevId: 799568810
Change-Id: Iebfd505e887654b0f72bd3ad27e031a8114dee0a
2025-08-26 08:09:10 -07:00
Abseil Team
c5e00729c3 Rollback C++20 string_view constructor that uses iterators
due to broken builds

PiperOrigin-RevId: 795243267
Change-Id: Ia0f795452dea70846aad842fd5ac8b4dab2f06c2
2025-08-14 16:24:28 -07:00
Derek Mauro
67538de1d4 Add the C++20 string_view contructor that uses iterators
https://cppreference.com/w/cpp/string/basic_string_view/basic_string_view.html

libc++: 3ecd331808/libcxx/include/string_view (L335-L343)

libstdc++: 11f7d5648c/libstdc%2B%2B-v3/include/std/string_view (L154-L162)

PiperOrigin-RevId: 795161174
Change-Id: Ic951dc04da21e4e6ccc30fe9f04c9da58a12e33f
2025-08-14 12:57:19 -07:00
Abseil Team
4f19baf125 Add ABSL_ATTRIBUTE_LIFETIME_BOUND to absl::ClippedSubstr
PiperOrigin-RevId: 790659770
Change-Id: I882eb8e76e6aed998d7cb2c646a6edac95197d0f
2025-08-04 02:34:32 -07:00
Derek Mauro
169c953aab absl::string_view: assert against (data() == nullptr && size() != 0)
PiperOrigin-RevId: 766242956
Change-Id: I7ef72e4abffcf0b0f1ce37f40d8580b4f6be387c
2025-06-02 10:17:16 -07:00
Derek Mauro
61103b948d absl::string_view: Add a debug assert to the single-argument constructor
that the argument is not `nullptr`.

Passing `nullptr` to the single-argument constructor of `std::string_view`
is undefined behavior. `absl::string_view` has long accepted `nullptr` arguments
to the single-argument constructor. This debug assert will assist users in
finding uses of `absl::string_view(nullptr)` to allow migration to
`std::string_view`.

If you find that this assert is firing, consider using
`absl::NullSafeStringView` to safely construct the `string_view`.

PiperOrigin-RevId: 764751809
Change-Id: I3d1ee1c01fd7faf71523122abc254372374374f8
2025-05-29 09:02:26 -07:00
Derek Mauro
4d8e467f28 Fix CI on macOS Sequoia
This includes fixes for both the CI scripts in the new
OS image and a fix for newly detected missing nullability
annotations in string_view with an upgraded Clang.
It is also no longer necessary to uninstall google-benchmark
since it is not installed by default in the new image.

PiperOrigin-RevId: 764725127
Change-Id: I6ea8c55b4d9a9afd261bf4ae9c5e8239675ea7ca
2025-05-29 07:47:29 -07:00
Abseil Team
d97663ee23 Automated Code Change
PiperOrigin-RevId: 744017203
Change-Id: I69b4418b306bdb5f89194bbcddaed9813e46ec6f
2025-04-04 11:43:03 -07:00
Lawrence Wolf-Sonkin
398e24a0b1 [absl] Use std::min in constexpr contexts in absl::string_view
* [As of C++14, `std::min` is defined `constexpr`](https://en.cppreference.com/w/cpp/algorithm/min), so we don't need to roll our own version
* Since [C++14 is Abseil's minimum supported C++ version](https://abseil.io/docs/cpp/quickstart-cmake.html#prerequisites), that makes this sufficient

PiperOrigin-RevId: 729563815
Change-Id: I80f0d7c352a880818c60642f296f9f06e1f62500
2025-02-21 09:53:14 -08:00
Abseil Team
f0e59054ff Move ABSL_HARDENING_ASSERTs in constexpr methods to their own lines.
Prior to this change, some ABSL_HARDENING_ASSERTs were sequenced with the main
work of some constexpr methods using the comma operator in order to satisfy
C++11's constexpr requirements. However, putting the assertion and the main
work of the function on the same line complicates measuring the performance
impact of the assertions. As C++11 is no longer supported, this change moves
the assertions to their own lines in order to make measuring their performance
impact easier.

PiperOrigin-RevId: 707614464
Change-Id: Idb621bb183b80db17e2db44c3ffc671b76bba92b
2024-12-18 11:25:36 -08:00
Abseil Team
85c701da92 string_view: Add defaulted copy constructor and assignment
The defaulted copy constructor and assignment were removed to work around
a gdb bug, but gdb now works without the workaround.

PiperOrigin-RevId: 706694737
Change-Id: I5da06a29094f28a45a5910eab1f7a5155b34d57f
2024-12-16 07:00:54 -08:00
Abseil Team
7bc6543deb string_view: Correct string_view(const char*, size_type) docs
This constructor has two arguments, so it is not "implicit" as was previously
stated.

PiperOrigin-RevId: 705084217
Change-Id: Ia94a2fc50c1946d45af26810b5728aa03e786746
2024-12-11 06:27:45 -08:00
Derek Mauro
ee5e49f171 Rewrite some string_view methods to avoid a -Wunreachable-code warning
The previous form was required for C++11 compatibility (C++11 support
was dropped in 2020).

PiperOrigin-RevId: 698018101
Change-Id: I814ec708ea211c4b90ee6a812db9961b5423c22e
2024-11-19 08:02:30 -08:00
Abseil Team
2abe94a3b0 Migrate ABSL_INTERNAL_ATTRIBUTE_OWNER and ABSL_INTERNAL_ATTRIBUTE_VIEW to ABSL_ATTRIBUTE_OWNER and ABSL_ATTRIBUTE_VIEW
PiperOrigin-RevId: 666390885
Change-Id: I85457d39cf5ecb1c6622c6d59cb1876b154d64c3
2024-08-22 09:59:40 -07:00
Abseil Team
567ebd0540 Add ABSL_INTERNAL_ATTRIBUTE_VIEW and ABSL_INTERNAL_ATTRIBUTE_OWNER attributes to types in Abseil
PiperOrigin-RevId: 642619703
Change-Id: I8d2e423a3c7f40709d0e8c82cac0395c75d601cf
2024-06-12 08:14:45 -07:00
Abseil Team
8f9e5f0203 Restore string_view detection check
PiperOrigin-RevId: 623195368
Change-Id: Iadb9bdedee4d9b5ced4fff9e6316ee63f9a89ea5
2024-04-09 09:42:59 -07:00
Abseil Team
d5e4260976 Temporarily revert dangling std::string_view detection until dependent is fixed
PiperOrigin-RevId: 621413395
Change-Id: I20e9fac94e81e59c0d723f115670c8cf68e9b44a
2024-04-02 23:42:08 -07:00
Abseil Team
5953a4885a Add internal traits to absl::string_view for lifetimebound detection
This helps compilers that understand `ABSL_ATTRIBUTE_LIFETIME_BOUND` flag constructs such as
`absl::StatusOr<std::string_view> str = std::string(...)`
as error-prone.

PiperOrigin-RevId: 621196818
Change-Id: I78d4c66854cde9d06eaaec05869d956376109d9c
2024-04-02 09:04:52 -07:00
Abseil Team
04d8afe7a3 Remove code pieces for no longer supported MSVC versions.
The current support policy is `_MSC_VER >= 1920`.

PiperOrigin-RevId: 599833619
Change-Id: I9cf7393a5b659d1680765e37e0328539ccb870fa
2024-01-19 07:53:58 -08:00
Dmitri Gribenko
55621d1af5 Add nullability annotations
PiperOrigin-RevId: 589842893
Change-Id: I9657761d1f71c665582406f278c6605f6d382f6d
2023-12-11 09:07:59 -08:00
Derek Mauro
0f110600fc absl::string_view: Add support for starts_with() and ends_with()
when targeting at least C++20

These methods were added to C++20, so they are not available in
earlier language standards. Users requiring compatibility prior to C++20
should use absl::StartsWith() and absl::EndsWith() from
//absl/strings/match.h.

Most users are not affected by this change. By default when targeting at least
C++20 absl::string_view will be an alias for std::string_view. Only users
that have modified //absl/base/options.h will see this change.

PiperOrigin-RevId: 575238435
Change-Id: I7b03fde02c987b30b88c794640c2a616851997d1
2023-10-20 09:22:00 -07:00
Derek Mauro
504229dfa4 string_view: conditional constexpr is no longer needed for C++14
PiperOrigin-RevId: 460407142
Change-Id: I9501d2e79cf8c20c5261ab0169bd4bbc3b02980c
2022-07-12 02:10:39 -07:00
Abseil Team
9fed77a6fe Export of internal Abseil changes
--
ef2bf829c333f378ecc12f3259e3187cdb75a3d5 by Abseil Team <absl-team@google.com>:

debugging: fix the VDSO symbol name used for unwinding on RISC-V Linux

The name listed in `man vdso` is incorrect. Instead, use the name from `linux-5.16/arch/riscv/kernel/vdso/rt_sigreturn.S`

PiperOrigin-RevId: 439654174
Change-Id: Ib39d066f416681720068e806e828a2c76a14a532

--
43dfad824afd36cfc3e5049b4fea71a2bccb066c by Benjamin Barenblat <bbaren@google.com>:

Check printf format strings in str_format_convert_test

Add ABSL_PRINTF_ATTRIBUTE to appropriate functions in
strings/internal/str_format/convert_test. Correct
TypedFormatConvertTest.Char, which was accidentally passing values of
types larger than int to StrPrint.

PiperOrigin-RevId: 439388148
Change-Id: I6cde4e8e0c6455064138192430f07f4c990be0bc

--
f84b4ab2c3b070c8af0c82742ac7a8a4bf443bca by Derek Mauro <dmauro@google.com>:

Use __builtin_memcmp in the absl::string_view implementation
starting with MSVC 16.9, where it first appeared

This enables more constexpr operations

PiperOrigin-RevId: 439317316
Change-Id: Iaf1ce76b60901d4b2d5b96be5900c56572f57b15
GitOrigin-RevId: ef2bf829c333f378ecc12f3259e3187cdb75a3d5
2022-04-06 13:17:53 -04:00
Martin Blais
7143e49e74 Fixed typo constuct to construct in 3 places. (#1022) 2021-09-27 14:06:52 -04:00
Abseil Team
bf31a10b65 Export of internal Abseil changes
--
93c607726d663800b4bfa472cba043fd3f5d0e97 by Derek Mauro <dmauro@google.com>:

Internal change

PiperOrigin-RevId: 389158822

--
55b3bb50bbc168567c6ba25d07df2c2c39e864af by Martijn Vels <mvels@google.com>:

Change CordRepRing alternative implementation to CordRepBtree alternative.

This changes makes CordRepBtree (BTREE) the alternative to CordRepConcat (CONCAT) trees, enabled through the internal / experimental 'cord_btree_enabled' latch.

PiperOrigin-RevId: 389030571

--
d6fc346143606c096bca8eb5029e4c429ac6e305 by Todd Lipcon <tlipcon@google.com>:

Fix a small typo in SequenceLock doc comment

PiperOrigin-RevId: 388972936

--
e46f9245dce8b4150e3ca2664e0cf42b75f90a83 by Martijn Vels <mvels@google.com>:

Add 'shallow' validation mode to CordRepBtree which will be the default for internal assertions.

PiperOrigin-RevId: 388753606

--
b5e74f163b490beb006f848ace67bb650433fe13 by Martijn Vels <mvels@google.com>:

Add btree statistics to CordzInfo, and reduce rounding errors

PiperOrigin-RevId: 388715878

--
105bcbf80de649937e693b29b18220f9e6841a51 by Evan Brown <ezb@google.com>:

Skip length checking when constructing absl::string_view from `const char*`.
The length check causes unnecessary code bloat.

PiperOrigin-RevId: 388271741

--
bed595158f24839efe49c65ae483f797d79fe0ae by Derek Mauro <dmauro@google.com>:

Internal change

PiperOrigin-RevId: 387713428
GitOrigin-RevId: 93c607726d663800b4bfa472cba043fd3f5d0e97
Change-Id: I2a4840f5ffcd7f70b7d7d45cce66f23c42cf565f
2021-08-06 13:27:35 +00:00
Abseil Team
4bb739310c Export of internal Abseil changes
--
69b5d0b2a5adb49a53e51f9da6848eaa484242fe by Derek Mauro <dmauro@google.com>:

Changes the absl::Duration factory functions to disallow types that
are convertible to int or double, instead requiring that the argument
itself is indeed an integer or a floating-point number. This will
prevent callers from passing arguments, such as std::atomic<T>.

This change is an API break. Information and a tool to fix issues
can be found at
https://abseil.io/docs/cpp/tools/upgrades/duration-conversions

PiperOrigin-RevId: 387153494

--
786063e438ab6a55ac4baa88ad4d20a8293be52a by Evan Brown <ezb@google.com>:

Make ctrl_t be an enum class.

This adds type safety, and also when strict aliasing is enabled, the compiler will know that control bytes can't alias non-control bytes.

Also make H2() return h2_t.

PiperOrigin-RevId: 387120717

--
7e537aabec1c255d6e7c9d21232c597c1c2077bf by Evan Brown <ezb@google.com>:

Add some missing `const` keywords to ctrl_t* function parameters.

PiperOrigin-RevId: 386976062

--
da53ac6d91cabd951e81dd0a145e1e52b918955f by Martijn Vels <mvels@google.com>:

Change Seek and InitOffset to return nullptr instead of assert / fail.

This makes it consistent with the rest of the API (Next, Previous, Skip) and hardens it against invariants that are harder (or less likey) to be upheld correctly by the caller.

PiperOrigin-RevId: 386963283

--
a4d1faac020d5025edf53ce81808e5db68da7d89 by Abseil Team <absl-team@google.com>:

PC / Backtrace / Symbolization for Emscripten.

PiperOrigin-RevId: 386957724

--
97f2c47d83ba9d3ac89e1f55bd06897686ffd063 by Martijn Vels <mvels@google.com>:

Fix static casts ([-Wimplicit-int-conversion])

PiperOrigin-RevId: 386951646

--
9530c795248543817cbc4013953baa09c35f5e1a by Abseil Team <absl-team@google.com>:

Fix incorrect header guard in cord_rep_btree_navigator.h

PiperOrigin-RevId: 386907904

--
90ce5872406df2b7f4c428683741dc13a572267e by Abseil Team <absl-team@google.com>:

Small grammar fixes for some StatusCode descriptions.

PiperOrigin-RevId: 386906217

--
b30a2fd777f12a04a4d512f37a34614b0d05ce99 by Derek Mauro <dmauro@google.com>:

Skip length checking when constructing absl::string_view from std::string.
The length check causes unnecessary code bloat.

PiperOrigin-RevId: 386857974

--
fa171536c359bfa2a1b80297e844519bb9ee7791 by Martijn Vels <mvels@google.com>:

Introduce CordRepBtreeNavigator

CordRepBtreeNavigator implements bi-directional navigation over all data edges stored inside a Cord Btree.

PiperOrigin-RevId: 386519102
GitOrigin-RevId: 69b5d0b2a5adb49a53e51f9da6848eaa484242fe
Change-Id: I1b35188d66133f8cb73d346bc5564aac4e0b3e80
2021-07-28 03:12:11 -04:00
Abseil Team
18045c4e32 Export of internal Abseil changes
--
d74f30ef0da7139c30a24eb6c1776bc0c257e642 by Derek Mauro <dmauro@google.com>:

Internal change

PiperOrigin-RevId: 375779441

--
25e33cde30d78dbafcb81ee3ce77c3d70c74db5a by Abseil Team <absl-team@google.com>:

Internal change

PiperOrigin-RevId: 375520720

--
46857d17d4dbc6fbd13a27dd82e14ec814dd117a by Samuel Benzaquen <sbenza@google.com>:

Add an explicit template parameter barrier to absl::HashOf.

PiperOrigin-RevId: 375103300

--
cf2bf52b9a425b0360ed1f46778f0ef1326a3658 by Abseil Team <absl-team@google.com>:

Improve string_view API compliance with C++17 std::basic_string_view.

This adds missing overloads, default values, and constexpr specifiers.

PiperOrigin-RevId: 374885658

--
41e55166dc5bd3ed7bce567c400781585d55e1ce by Derek Mauro <dmauro@google.com>:

Update CI to GCC 11.1, Bazel 4.0.0, CMake 3.20.2, and
LLVM git:7bcc0a1e399d461af7ec013ff33bc330a2de6641

PiperOrigin-RevId: 374858288
GitOrigin-RevId: d74f30ef0da7139c30a24eb6c1776bc0c257e642
Change-Id: I657c815c83522b030495ff54ca327e7012ed151e
2021-05-25 13:18:25 -07:00
Abseil Team
2faed9dd2a Export of internal Abseil changes
--
6cfac39ea1266f01f195de5eb4c9a6fc9ea9b20a by Matt Kulukundis <kfm@google.com>:

Fix a typo

PiperOrigin-RevId: 366174890

--
6ee8c58647aef171d394e59fa06f9bf8cd0306ec by Derek Mauro <dmauro@google.com>:

Adds `ABSL_ATTRIBUTE_LIFETIME_BOUND` and applies it to the
`const std::string&` constructor of `absl::string_view`.

Compilers that support this attribute will emit a warning
if the parameter does not have sufficient lifetime.

PiperOrigin-RevId: 366027738

--
b944427d96e4b436b8fa0fe396c2a1118dbbbd13 by Abseil Team <absl-team@google.com>:

Calls to `ResetToEmpty()` from `ClearSlow` use ~3% of the time in assignment. However, `ClearSlow()` is only used in contexts where `data_` is immediately reassigned.

Rename `ClearSlow()` into `UnrefTree()` and remove `data_` resetting.

PiperOrigin-RevId: 365977213

--
7428b3147a5672c8bb55649efa3a1cfe19b52a8b by Abseil Team <absl-team@google.com>:

Fix CordRepRing diabolical growth

The 'Mutable' function in CordRepRing was over-eager in doubling capacity, which lead to 'ludicrous' growth in the diabolical test case as added to cord_test. This CL fixes the doubling for growing shared reps, and tempers CordRepRing growth for non shared capacity to 1.5 instead of 2, which is more inline with a conservative growth we also have in tree cord.

After this change, CordRepRing no longer swamps the heap into the shadow realm, and is in effect reducing the memory used compared to the tree implementation. With a diabolical 5000 bytes growth pattern:

Tree cord: 1523520 bytes
Ring cord:  274232 bytes

PiperOrigin-RevId: 365915857

--
f24d4aee48b03c5a7980664df903f947cbb198e8 by Andy Getzendanner <durandal@google.com>:

Import of CCTZ from GitHub.

PiperOrigin-RevId: 365873932
GitOrigin-RevId: 6cfac39ea1266f01f195de5eb4c9a6fc9ea9b20a
Change-Id: I9737aa215ac732c9785a1d0032c77aba62330f12
2021-04-01 02:36:11 -04:00
Abseil Team
a09b5de0d5 Export of internal Abseil changes
--
3de7250f2988e360764479fa590d299a649987c0 by Derek Mauro <dmauro@google.com>:

Make the SOVERSION fit into 16 bits to make the MacOS linker happy

PiperOrigin-RevId: 364939757

--
dead27aa0734a89ccb25da807e08e61000a47f8f by Abseil Team <absl-team@google.com>:

Update `ABSL_ATTRIBUTE_UNUSED`'s documentation that `[[maybe_unused]]` in C++17 and up is now the preferred usage solution.

Also document why we can't update `ABSL_ATTRIBUTE_UNUSED` to use `[[maybe_unused]]` (differences in positioning requirements).

PiperOrigin-RevId: 364900016

--
0baf1b01dc9a2b5f9869ff5a52a1cf7a032055a3 by Abseil Team <absl-team@google.com>:

Slightly weaken the spec for `absl::string_view::compare` to match C++17.

The Abseil-specific implementation provides a stronger guarantee than required by `std::string_view`, returning +1, 0, or -1.  When `absl::string_view` is an alias for `std::string_view`, these are only guaranteed to be positive, zero, and negative.  Portable code should not depend on the stronger guarantee.

PiperOrigin-RevId: 364846419
GitOrigin-RevId: 3de7250f2988e360764479fa590d299a649987c0
Change-Id: I7c74004fc38c9f5eaad5b104a993b79518497c5b
2021-03-25 11:05:20 -04:00
Abseil Team
c03c18e7fe Export of internal Abseil changes
--
9c9eb300c95024ea4242bbb4835595f555cb1eed by Derek Mauro <dmauro@google.com>:

Sync string_view comments from the internal copy

PiperOrigin-RevId: 328582796

--
c0bc4e77a46889430a1a40d836a5ff426a4a5bc9 by Xiaoyi Zhang <zhangxy@google.com>:

Make `absl::allocator_traits` an alias to `std::allocator_traits` for C++17 or
above. `std::allocator_traits` should have all its members since C++17 so we
don't need a backport.

PiperOrigin-RevId: 328258154

--
5599a3c0f2d865128057b5e267a397011cd032d0 by Derek Mauro <dmauro@google.com>:

Fix an #endif comment

Reported at https://groups.google.com/g/abseil-io/c/GRUdB0bBrG8/m/852HrgchCQAJ

PiperOrigin-RevId: 328247093

--
abd7e98088267f436e6c10779e574153ece015be by Abseil Team <absl-team@google.com>:

Don't call win32 APIs for UWP builds

symbolize.cc is including symbolize_win32.inc for all Windows builds,
including UWP builds. However, UWP doesn't have access to win32 APIs, so
it should instead include symbolize_unimplemented.inc.

This allows the necessary functions to still exist and be called, but
the win32 calls are not made.

This is part of the effort to enable Abseil in ANGLE:
https://anglebug.com/4873

PiperOrigin-RevId: 328226766

--
f622d3dfb804a6f427c1fd86ee69f47785b49483 by Greg Falcon <gfalcon@google.com>:

Remove incorrect claims of HASH_NAMESPACE support in Abseil hash.

The documentation presently claims that absl::Hash will look for legacy hashers (e.g, in the __gnu_cxx namespace) as controlled by the HASH_NAMESPACE preprocessor define, but this has never been true.

(Vestigial support for this appears in the form `ABSL_INTERNAL_LEGACY_HASH_NAMESPACE`, but this is not a supported extension point, as indicated by the use of `INTERNAL` in the name.)

PiperOrigin-RevId: 328154123

--
32b40a25efe1f7f7da98ce8faf3482c825464ed4 by Abseil Team <absl-team@google.com>:

Switch ABSL_INTERNAL_IGNORE_READS_ATTRIBUTE_ENABLED checks to defined().

PiperOrigin-RevId: 328151556
GitOrigin-RevId: 9c9eb300c95024ea4242bbb4835595f555cb1eed
Change-Id: Ib0686286f7889a976311e8cd2b35655765a8d033
2020-08-26 19:59:45 -04:00
Abseil Team
fba8a316c3 Export of internal Abseil changes
--
2dd5008c7b4176859e320c7c337078adb173b662 by Tom Manshreck <shreck@google.com>:

Internal change

PiperOrigin-RevId: 304022549

--
6442abd78697b03cfe698b0d0dac7f1eb4b5cb38 by Andy Getzendanner <durandal@google.com>:

Internal change

PiperOrigin-RevId: 303890410

--
eb8b37b468b0f23da09d3de714272928ef61f942 by Gennadiy Rozental <rogeeff@google.com>:

Roll changes forward with ChunkIterator templatized.

This should facilitate usage of "small" chunk iterator for a regular usage and proper "big" iterator internally in Cord implementation. This way Cord users are not exposed to stack size overhead if they have a lot of chunk iterators or recursive implementation which relies on chunk iterators.

PiperOrigin-RevId: 303877118

--
9623c569e7c55b45254e95f2d14c5badf9c901aa by Gennadiy Rozental <rogeeff@google.com>:

Switch Flags implementation of fast type id to use absl/base/internal/fast_type_id.h

PiperOrigin-RevId: 303861019

--
e2931e8d53c86d0816da6bbc8ba58cf5a3a443bb by Matthew Brown <matthewbr@google.com>:

Internal Change

PiperOrigin-RevId: 303832407

--
b549ed6e441e920b8ad6f02a80b9fd543820ef86 by Tom Manshreck <shreck@google.com>:

Update Cord header file comments to Abseil standards

PiperOrigin-RevId: 303823232

--
fc633d4f31a2d058f2b6a7029fc7c9820cd71c92 by Evan Brown <ezb@google.com>:

Remove top-level const from K/V in map_slot_type::mutable_value and map_slot_type::key.

This allows us to move between `map_slot_type::mutable_value`s internally even when the key_type and/or mapped_type specified by the user are const.

PiperOrigin-RevId: 303811694

--
909b3ce7cb3583ee9c374d36ff5f82bba02a1b64 by Derek Mauro <dmauro@google.com>:

Add hardening assertions to the preconditions of absl::Cord

PiperOrigin-RevId: 303419537

--
9d32f79eabd54e6cb17bcc28b53e9bcfeb3cf6f4 by Greg Falcon <gfalcon@google.com>:

Don't use MSVC-specific bit manipulations when using Clang on Windows.

This fixes a compiler warning.  Note that we do not have continuous testing for this configuration; this CL is best-effort support.

PiperOrigin-RevId: 303322582

--
f6e0a35a2b9081d2a9eef73789b7bc1b5e46e5ad by Gennadiy Rozental <rogeeff@google.com>:

Introduce standlone FastTypeId utility to represent compile time unique type id.

PiperOrigin-RevId: 303180545

--
99120e9fbdb5b2d327139ab8f617533d7bc3345b by Abseil Team <absl-team@google.com>:

Changed absl's import of std::string_view to
using string_view = std::string_view.
This should help tools (e.g. include-what-you-use) discover where absl::string_view is defined.

PiperOrigin-RevId: 303169095
GitOrigin-RevId: 2dd5008c7b4176859e320c7c337078adb173b662
Change-Id: I1e18ae08e23686ac963e7ea5e5bd499e18d51048
2020-03-31 16:34:04 -04:00
Abseil Team
518f17501e Export of internal Abseil changes
--
79913a12f0cad4baf948430315aabf53f03b6475 by Abseil Team <absl-team@google.com>:

Don't inline (Un)LockSlow.

PiperOrigin-RevId: 302502344

--
6b340e80f0690655f24799c8de6707b3a95b8579 by Derek Mauro <dmauro@google.com>:

Add hardening assertions to absl::optional's dereference operators

PiperOrigin-RevId: 302492862

--
a9951bf4852d8c1aec472cb4b539830411270e4c by Derek Mauro <dmauro@google.com>:

Correctly add hardware AES compiler flags under Linux X86-64
Fixes #643

PiperOrigin-RevId: 302490673

--
314c3621ee4d57b6bc8d64338a1f1d48a69741d1 by Derek Mauro <dmauro@google.com>:

Upgrade to hardening assertions in absl::Span::remove_prefix and absl::Span::remove_suffix

PiperOrigin-RevId: 302481191

--
a142b8c6c62705c5f0d4fe3113150f0c0b7822b9 by Derek Mauro <dmauro@google.com>:

Update docker containers to Bazel 2.2.0, GCC 9.3, and new Clang snapshot

PiperOrigin-RevId: 302454042

--
afedeb70a2adc87010030c9ba6f06fe35ec26407 by Derek Mauro <dmauro@google.com>:

Add hardening assertions for the preconditions of absl::FixedArray

PiperOrigin-RevId: 302441767

--
44442bfbc0a9a742df32f07cee86a47712efb8b4 by Derek Mauro <dmauro@google.com>:

Fix new Clang warning about SpinLock doing operations on enums of different types

PiperOrigin-RevId: 302430387

--
69eaff7f97231779f696321c2ba8b88debf6dd9e by Derek Mauro <dmauro@google.com>:

Convert precondition assertions to ABSL_HARDENING_ASSERT for
absl::InlinedVector

PiperOrigin-RevId: 302427894

--
26b6db906a0942fd18583dc2cdd1bab32919d964 by Gennadiy Rozental <rogeeff@google.com>:

Internal change

PiperOrigin-RevId: 302425283

--
e62e81422979e922505d2cd9000e1de58123c088 by Derek Mauro <dmauro@google.com>:

Add an option to build Abseil in hardened mode

In hardened mode, the ABSL_HARDENING_ASSERT() macro is active even
when NDEBUG is defined. This allows Abseil to perform runtime checks
even in release mode. This should be used to implement things like
bounds checks that could otherwise lead to security vulnerabilities.

Use the new assertion in absl::string_view and absl::Span to test it.

PiperOrigin-RevId: 302119187
GitOrigin-RevId: 79913a12f0cad4baf948430315aabf53f03b6475
Change-Id: I0cc3341fd333a1df313167bab72dc5a759c4a048
2020-03-23 16:24:45 -04:00
Abseil Team
a877af1f29 Export of internal Abseil changes
--
ea0cfebeb69b25bec343652bbe1a203f5476c51a by Mark Barolak <mbar@google.com>:

Change "std::string" to "string" in places where a "std::" qualification was incorrectly inserted by automation.

PiperOrigin-RevId: 300108520
GitOrigin-RevId: ea0cfebeb69b25bec343652bbe1a203f5476c51a
Change-Id: Ie3621e63a6ebad67b9fe56a3ebe33e1d50dac602
2020-03-10 13:59:49 -04:00
Abseil Team
bcefbdcdf6 Export of internal Abseil changes
--
09c1e7877210fe85c43631538303af801c233e89 by Gennadiy Rozental <rogeeff@google.com>:

Change CordRep::length to size_t to be compatible with ChunkIterator.

PiperOrigin-RevId: 297901255

--
226d5e79fb4e20fb09d75f034624d5be770f4ece by Derek Mauro <dmauro@google.com>:

Makes absl::string_view::substr constexpr for std::string_view compatibility
Fixes #627

PiperOrigin-RevId: 297872778

--
851aa24a22d0ba5552098bf7e5735c95e4a8d4f7 by Abseil Team <absl-team@google.com>:

Reformat one line.

PiperOrigin-RevId: 297839574

--
4f449c462583797455375fa6f1365a6b2cfa7e0a by Benjamin Barenblat <bbaren@google.com>:

Internal change

PiperOrigin-RevId: 297677173

--
2d41a250e9a8f272946bc3262463e4025d88fba3 by Abseil Team <absl-team@google.com>:

Internal change

PiperOrigin-RevId: 297537076

--
6e7fbe1e90999a58556d41955bef44033c61876c by Gennadiy Rozental <rogeeff@google.com>:

Internal change

PiperOrigin-RevId: 297376994

--
5acf79338191b31cec158b06cd96ca8dfa3e81fe by Derek Mauro <dmauro@google.com>:

Add a debug-mode bounds-check on absl::Span::operator[].

PiperOrigin-RevId: 297355826

--
1c540d06a56c7e92bb07b90f16b4e00b014ef18f by CJ Johnson <johnsoncj@google.com>:

Adding new LTS to the list

PiperOrigin-RevId: 297235265

--
696ce48bea6927436ff89f59b887e5869b1b0f38 by Derek Mauro <dmauro@google.com>:

Fix build on FreeBSD/powerpc (implement UnscaledCycleClock)

Merges/Fixes GitHub #616

PiperOrigin-RevId: 297188640
GitOrigin-RevId: 09c1e7877210fe85c43631538303af801c233e89
Change-Id: I5d97b16bb6378792d2fcf7d29080cca18aa7729a
2020-02-28 16:01:26 -05:00
Abseil Team
98eb410c93 Export of internal Abseil changes
--
daa829a331a2316713681b5fe7630d1951e0fdec by Gennadiy Rozental <rogeeff@google.com>:

Eliminate Flag's destroy method.

The Abseil Flags are never destroyed. The only place where Destroy method was invoked was in some obscure place during flag registration, where we faces with duplicate retired flag registration. Regired Flag destruction is empty anyway. so we can just delete the duplicate object. The FLagImpl::Destroy is never invoked.

PiperOrigin-RevId: 294472413

--
3c159499ccde8ccdd6907b3a1ddb26be7d3f016f by Abseil Team <absl-team@google.com>:

Internal change.

PiperOrigin-RevId: 294401573

--
25910db425c50d9b9a8f8275af5a67c2935934fd by Shahriar Rouf <nafi@google.com>:

Optimize absl::string_view::compare.

Motivation: https://godbolt.org/z/Uz8DWV
PiperOrigin-RevId: 294286196
GitOrigin-RevId: daa829a331a2316713681b5fe7630d1951e0fdec
Change-Id: I818dad27ac5eb61bb7632e01224953cd882803bf
2020-02-11 13:50:53 -05:00
Abseil Team
0f86336b69 Export of internal Abseil changes
--
0b924fe4e9871200792617329d32beb8356daa9b by Derek Mauro <dmauro@google.com>:

Use less threads in the GetTID() test to avoid test timeouts

PiperOrigin-RevId: 292566826

--
0b519c4fd48d61b7c4ea94ed6a6be6e981b9c51a by Abseil Team <absl-team@google.com>:

Internal change.

PiperOrigin-RevId: 292563778

--
3204f6e07bcc2b5e9098d45f1a20998f25ab808e by Abseil Team <absl-team@google.com>:

Internal change.

PiperOrigin-RevId: 292550551

--
09fbbe73833478d3f26f3e33c8291b991fd3be51 by Derek Mauro <dmauro@google.com>:

Add a debug bounds-check to absl::string_view::operator[]

string_view accesses that are out-of-bounds are undefined behavior:
https://en.cppreference.com/w/cpp/string/basic_string_view/operator_at

This change causes code to abort in debug mode, indicating a bug and
possibly a security issue like a buffer overflow. Code broken by this
change should be investigated.

PiperOrigin-RevId: 292544735

--
bf2c19cb45682628f963d4067c0cd6deed7e656d by Derek Mauro <dmauro@google.com>:

Add debug assertions to absl::string_view::front and absl::string_view::back

Calling front() or back() on an empty string_view is undefined behavior. This
assertion is to help catch broken code.
https://en.cppreference.com/w/cpp/string/basic_string_view/front
https://en.cppreference.com/w/cpp/string/basic_string_view/back

PiperOrigin-RevId: 292453255

--
47f573679b322f8c0fd2cb037cc87e7bc822ac6b by Xiaoyi Zhang <zhangxy@google.com>:

Release functional/CMakeList.txt.

PiperOrigin-RevId: 292417025
GitOrigin-RevId: 0b924fe4e9871200792617329d32beb8356daa9b
Change-Id: Ie6980fb1ac351d72a2ce4468f25bd31db396f88a
2020-01-31 17:10:19 -05:00
Abseil Team
37dd2562ec Export of internal Abseil changes
--
8bdb2020150ed0fd4a4e520e454dc5f54e33f776 by Eric Fiselier <ericwf@google.com>:

Workaround bug in GCC 9.2 and after.

PiperOrigin-RevId: 291982551

--
47ff4820e595f96c082a90d733725f6882d83e3b by Abseil Team <absl-team@google.com>:

Improve ABSL_ATTRIBUTE_PACKED documentation

Recommend to apply ABSL_ATTRIBUTE_PACKED to structure members instead of to an entire structure because applying this attribute to an entire structure may cause the compiler to generate suboptimal code. It reduces the alignment of the data structure from a value larger than one to one. When applied to a structure, ABSL_ATTRIBUTE_PACKED reduces the alignment of a structure (alignof()) to 1. As a result, the compiler can no longer assume that e.g. uint32 members are aligned on a four byte boundary and hence is forced to use single-byte load and store instructions on CPU architectures that do not support non-aligned loads or stores.

PiperOrigin-RevId: 291977920

--
902b7a86f860da699d3a2e5c738be5ef73ede3b4 by Mark Barolak <mbar@google.com>:

Internal change

PiperOrigin-RevId: 291963048

--
bb3bd3247e376d53a3080b105f13ec7566d3ae50 by Abseil Team <absl-team@google.com>:

Support the C++17 insert_or_assign() API in btree_map.

PiperOrigin-RevId: 291945474

--
ff3b3cfcbbc64f086f95501f48d49426bcde356f by Gennadiy Rozental <rogeeff@google.com>:

Import of CCTZ from GitHub.

PiperOrigin-RevId: 291861110

--
fd465cd9cbbacd3962f67a7346d6462edaddd809 by Derek Mauro <dmauro@google.com>:

Add flaky=1 to beta_distribution_test.

PiperOrigin-RevId: 291757364

--
3603adfb59c4128c542b670952cce250d59e1f67 by Derek Mauro <dmauro@google.com>:

Separate the initialization of NumCPUs() and NominalCPUFrequency()

The OSS version of Abseil never needs to call NominalCPUFrequency().
In some configurations, initializing NominalCPUFrequency() requires
spending at least 3ms measuring the CPU frequency. By separating the
initialization from NumCPUs(), which is called in most configurations,
we can save at least 3ms of program startup time.

PiperOrigin-RevId: 291737273

--
bea9e4a6bff5a0351d340deab966641867e08c4d by Abseil Team <absl-team@google.com>:

Change the cmake library names not to have a redundant `absl_` prefix.

PiperOrigin-RevId: 291640501

--
501b602ef260cd7c8c527342581ceffb3c5b6d4c by Gennadiy Rozental <rogeeff@google.com>:

Introducing benchmark for absl::GetFlag.

PiperOrigin-RevId: 291433394

--
4eeaddc788da4b91c272a8adca77ca6dbbbc1d44 by Xiaoyi Zhang <zhangxy@google.com>:

fix: Add support for more ARM processors detection

Import of https://github.com/abseil/abseil-cpp/pull/608

PiperOrigin-RevId: 291420397

--
a3087a8e883c5d71de7d9bd4ec8f4db5142dfcf5 by Derek Mauro <dmauro@google.com>:

Removes the flaky raw_hash_set prefetch test

PiperOrigin-RevId: 291197079

--
aad6c2121c102ac36216e771c83227cf3e3bfd66 by Andy Soffer <asoffer@google.com>:

Enable building Abseil as a DLL.
This is currently experimental and unsupported.

This CL does a few things:
1. Adds the ABSL_DLL macro to any class holding a static data member, or to global constants in headers.
2. Adds a whitelist of all files in the DLL and all the build targets that are conglomerated into the DLL.
3. When BUILD_SHARED_LIBS is specified, any build target that would be in the DLL still exists, but we swap out all of it's dependencies so it just depends on abseil_dll

PiperOrigin-RevId: 291192055

--
5e888cd6f2a7722805d41f872108a03a84e421c7 by Mark Barolak <mbar@google.com>:

Move absl/strings/internal/escaping.{cc,h} into internal build targets.

This puts absl/strings/internal/escaping.h behind a whitelist and it also resolves https://github.com/abseil/abseil-cpp/issues/604.

PiperOrigin-RevId: 291173320

--
166836d24970da87587c1728036f53f05a28f0af by Eric Fiselier <ericwf@google.com>:

Internal Change.

PiperOrigin-RevId: 291012718

--
996ddb3dffda02440fa93f30ca5d71b14b688875 by Abseil Team <absl-team@google.com>:

Fix shared libraries log spam for built-in types in absl::GetFlag

PiperOrigin-RevId: 290772743
GitOrigin-RevId: 8bdb2020150ed0fd4a4e520e454dc5f54e33f776
Change-Id: I8bf2265dd14ebbace220a1b6b982bb5040ad2a26
2020-01-28 16:07:41 -05:00
Abseil Team
b3aaac8a37 Export of internal Abseil changes
--
9beb68204986a015c9cb065b9fae4f9a8879a788 by Abseil Team <absl-team@google.com>:

Move Base64EscapeInternal and CalculateBase64EscapedLenInternal to an internal header.

PiperOrigin-RevId: 288917378

--
90acfbe03b3f9f6de3ffa49c39343dfaa2c5d38c by Greg Falcon <gfalcon@google.com>:

Update macos CI script to support the ALTERNATE_OPTIONS environment variable.

PiperOrigin-RevId: 288913564

--
f1572e870678cdcda6b48cb39780d1ad984e4c1b by Derek Mauro <dmauro@google.com>:

Makes absl::NullSafeStringView constexpr
Fixes https://github.com/abseil/abseil-cpp/issues/583

PiperOrigin-RevId: 288906940

--
d28a8471e32c10caa64bfffe6d6d4d0a8d144013 by Abseil Team <absl-team@google.com>:

absl::GetFlag is lock free for small trivially copyable types.

PiperOrigin-RevId: 288768172

--
2643b8ed1a1dc836b38ab9e46538a1af129ffd67 by Gennadiy Rozental <rogeeff@google.com>:

Eliminate call to callback from flag initialization.

We do not need to have this invocation inside FlagImpl::Init since SetCallback performs invocation anyways. Calling InitCallback from inside of Init complicates separation of value initialization from data guard initialization, which is about to happen.

PiperOrigin-RevId: 288732526

--
22caa880b7a4cb6da34e16a2e064a473c99e880b by Abseil Team <absl-team@google.com>:

Fix the documentation on how to create a null string_view.

PiperOrigin-RevId: 288727968

--
10727c5cadc561837141176f4c9b9717cec9233a by Greg Falcon <gfalcon@google.com>:

Change CI scripts for gcc to use the ALTERNATE_OPTIONS file as well.

PiperOrigin-RevId: 288718855

--
5d1e2dd6c7fb12af8aa4337a0f61872f5f0c5992 by Greg Falcon <gfalcon@google.com>:

Add an option for using inline namespaces in Abseil.

PiperOrigin-RevId: 288614491
GitOrigin-RevId: 9beb68204986a015c9cb065b9fae4f9a8879a788
Change-Id: If9acd46301e3df8cb231b4c16f7ed651bf4fb3c3
2020-01-09 14:19:30 -05:00
Abseil Team
12bc53e031 Export of internal Abseil changes
--
c99f979ad34f155fbeeea69b88bdc7458d89a21c by Derek Mauro <dmauro@google.com>:

Remove a floating point division by zero test.

This isn't testing behavior related to the library, and MSVC warns
about it in opt mode.

PiperOrigin-RevId: 285220804

--
68b015491f0dbf1ab547994673281abd1f34cd4b by Gennadiy Rozental <rogeeff@google.com>:

This CL introduces following changes to the class FlagImpl:
* We eliminate the CommandLineFlagLocks struct. Instead callback guard and callback function are combined into a single CallbackData struct, while primary data lock is stored separately.
* CallbackData member of class FlagImpl is initially set to be nullptr and is only allocated and initialized when a flag's callback is being set. For most flags we do not pay for the extra space and extra absl::Mutex now.
* Primary data guard is stored in data_guard_ data member. This is a properly aligned character buffer of necessary size. During initialization of the flag we construct absl::Mutex in this space using placement new call.
* We now avoid extra value copy after successful attempt to parse value out of string. Instead we swap flag's current value with tentative value we just produced.

PiperOrigin-RevId: 285132636

--
ed45d118fb818969eb13094cf7827c885dfc562c by Tom Manshreck <shreck@google.com>:

Change null-term* (and nul-term*) to NUL-term* in comments

PiperOrigin-RevId: 285036610

--
729619017944db895ce8d6d29c1995aa2e5628a5 by Derek Mauro <dmauro@google.com>:

Use the Posix implementation of thread identity on MinGW.
Some versions of MinGW suffer from thread_local bugs.

PiperOrigin-RevId: 285022920

--
39a25493503c76885bc3254c28f66a251c5b5bb0 by Greg Falcon <gfalcon@google.com>:

Implementation detail change.

Add further ABSL_NAMESPACE_BEGIN and _END annotation macros to files in Abseil.

PiperOrigin-RevId: 285012012
GitOrigin-RevId: c99f979ad34f155fbeeea69b88bdc7458d89a21c
Change-Id: I4c85d3704e45d11a9ac50d562f39640a6adbedc1
2019-12-12 15:37:13 -05:00
Abseil Team
2103fd9acd Export of internal Abseil changes
--
d447fdcb801036cf08197eece193a5a706661120 by Gennadiy Rozental <rogeeff@google.com>:

Eliminate the need for static function holding help message. This decreases the cost of ABSL_FLAG abstraction by 120 bytes under clang.

PiperOrigin-RevId: 281107806

--
0aa6b91189f0e8b2381438c33465673a7ae02487 by Derek Mauro <dmauro@google.com>:

Disable the weak symbol CCTZ extension in the time test_util
on MinGW, which does not support it.

PiperOrigin-RevId: 280719769

--
67322c41c3e776eb541de90fa4526bdb49422eb6 by Abseil Team <absl-team@google.com>:

Tune PeriodicSampler implementation (for internal-use only)

PiperOrigin-RevId: 280708943

--
3a48c346340c7ed03816645cd327e1ff07729aa4 by Abseil Team <absl-team@google.com>:

Clean up public headers not to have warnings for "-Wcomma"

PiperOrigin-RevId: 280695373

--
981acd1ef3b13a83a84f04f11c8931f4ed4451c9 by Matthew Brown <matthewbr@google.com>:

Release absl::int128.

PiperOrigin-RevId: 280690817

--
d30fae9d2ec30b81322d2eb5afe7e13e45b4b422 by Derek Mauro <dmauro@google.com>:

Fix -Wundef warnings in random platform detection

PiperOrigin-RevId: 280669598
GitOrigin-RevId: d447fdcb801036cf08197eece193a5a706661120
Change-Id: Ie5e10e567c54b7de211833607689f233d4ddf734
2019-11-19 10:27:57 -05:00
Abseil Team
8207907f4f Export of internal Abseil changes
--
2f49cb9009386bc67bf54a2908c8720b749c8b7f by Greg Falcon <gfalcon@google.com>:

docs: fix typo

Import of https://github.com/abseil/abseil-cpp/pull/397

PiperOrigin-RevId: 277504420

--
f2bed362c1c12d3fa9c22d11f2b918668e8c37b7 by Abseil Team <absl-team@google.com>:

Avoid our is_[copy/move]_assignable workarounds in MSVC 19.20 and on, since that release introduces a regression that breaks our workaround. We should ideally use the std forms in more cases, but branching when our workarounds fail is simpler to maintain.

PiperOrigin-RevId: 277502334

--
e33de894ffd49848b9e088f59acc9743d1661948 by Derek Mauro <dmauro@google.com>:

Update rules_cc version. The mirror.bazel.build URL does not exist
(cache expiration?)

PiperOrigin-RevId: 277498394

--
b23757b0747c64634d2d701433782c969effef19 by Abseil Team <absl-team@google.com>:

Fix https://github.com/abseil/abseil-cpp/issues/394.

PiperOrigin-RevId: 277491405

--
54c75b8b29813531c52d67cf0ba7063baae4a4f3 by Abseil Team <absl-team@google.com>:

Fix comment typos: waker => waiter.

PiperOrigin-RevId: 277376952

--
874eeaa3b3af808fc88b6355245f643674f5e36e by Abseil Team <absl-team@google.com>:

Don't use atomic ops on waiter and wakeup counts in CONDVAR waiter mode.

Just guard the waiter and wakeup counts with the mutex. This eliminates the
race.

Also fix a typo in the error message for pthread_cond_timedwait.

PiperOrigin-RevId: 277366017

--
ce8c9a63109214519b5a7eaecef2c663c4d566df by Greg Falcon <gfalcon@google.com>:

Implement the config options for our four main C++ forward compatibility types.

These options control whether the names `any`, `optional`, `string_view`, and `variant` in namespace `absl` are aliases to the corresponding C++17 types in namespace `std`.  By default, we continue to auto-detect the configuration of the compiler being run.

These options are not intended to be modified on the command line (as -D flags, say).  Instead, the options.h file can be modified by distributors of Abseil (e.g., binary packagers, maintainers of local copies of Abseil, etc.)

Changing options will change Abseil in an ODR sense.  Any program must only link in a single version of Abseil.  Linking libraries that use Abseil configured with different options is an error: there is no ABI compatibility guarantee when linking different configurations, even if the Abseil versions used are otherwise exactly identical.

PiperOrigin-RevId: 277364298

--
5ed3ad42ae43a05862070f92f9ffd07f5c1f2b81 by Chris Kennelly <ckennelly@google.com>:

Suppress -Wimplicit-int-float-conversion.

On recent builds of Clang, this is an error/warning.

PiperOrigin-RevId: 277346168

--
9b9b0055243c705189bb27d912e6d45a7789cdee by Eric Fiselier <ericwf@google.com>:

Allow building Abseil as a shared library with CMake.

By default CMake's `add_library` creates the target as a static
library. However, users can override the default using the builtin
CMake option -DBUILD_SHARED_LIBS=ON.

This changes Abseil's CMake to respect this configuration option
by removing the explicit `STATIC` in our usages of `add_library`.

PiperOrigin-RevId: 277337753

--
63a8b7b8ede3a9d851916929d6b8537f4f2508ca by Abseil Team <absl-team@google.com>:

Improve AlphaNum Hex performance by using absl::numbers_internal::FastHexToBufferZeroPad16.

PiperOrigin-RevId: 277318108

--
dd047f7e92032682d94b27732df0e4d0670e24a4 by CJ Johnson <johnsoncj@google.com>:

Internal change

PiperOrigin-RevId: 277316913

--
d19ee7074929fed08973cc5b40a844573ce1e0a6 by Abseil Team <absl-team@google.com>:

Handle invoking [[nodiscard]] functions correctly in our tests.

PiperOrigin-RevId: 277301500

--
5373f3737894ba9b8481e95e5f58c7957c00d26a by Chris Kennelly <ckennelly@google.com>:

For internal reasons, loosen visibility restrictions of `//absl/base:malloc_internal`.

As an internal-namespace interface, this module remains unsupported.  We
reserve the right to change, delete, or re-restrict visibility to this target
at any time.

PiperOrigin-RevId: 277118689

--
44e4f6655e05393a375d09b3625c192b1fde5909 by Abseil Team <absl-team@google.com>:

Fix error in example civil day comment.

PiperOrigin-RevId: 277103315

--
7657392b4ce48469106f11cdb952a0bc76a28df3 by Abseil Team <absl-team@google.com>:

Internal change

PiperOrigin-RevId: 277056076

--
c75bda76f40b01fa249b75b5a70c1f5907e56c76 by Abseil Team <absl-team@google.com>:

Suppress lifetime constant-initialization tests when building with MSVC versions > 19.0.

These are broken due to non-compliant initialization order in these versions:
https://developercommunity.visualstudio.com/content/problem/336946/class-with-constexpr-constructor-not-using-static.html
We don't know when Microsoft will fix this bug.

PiperOrigin-RevId: 277049770

--
16c3b9bf2a1796efa57f97b00bcd6227fbccca1f by Matt Calabrese <calabrese@google.com>:

Avoid our is_[copy/move]_assignable workarounds in MSVC 19.20 and on, since that release introduces a regression that breaks our workaround. We should ideally use the std forms in more cases, but branching when our workarounds fail is simpler to maintain.

PiperOrigin-RevId: 277048670

--
e91003fa3ee6026d9b80624a23fc144fa5d74810 by Chris Kennelly <ckennelly@google.com>:

Fix -Wimplicit-int-float-conversion warning in latest clang

PiperOrigin-RevId: 276771618

--
53087ca6603e86ad815f3dd9ab795cc0f79792c1 by Andy Soffer <asoffer@google.com>:

Add documentation on absl::SNPrintF.

PiperOrigin-RevId: 276694032

--
a9426af8cbd4c3a8f9053e7446c821852e41ff61 by Jorg Brown <jorg@google.com>:

Stop including kern/OSByteOrder.h in order to support __APPLE__

Apple compiles with clang now anyway, and clang has support for the
built-in compiler swap functions that are much faster than any function call to
the OS.

PiperOrigin-RevId: 276625231

--
df974be5aa5b4dc1b09c356cb8816edfc7867e63 by Jorg Brown <jorg@google.com>:

Fix the build for Android x86-64 builds, where __SSE4_2__ is defined but
_bswap64 is not.

PiperOrigin-RevId: 276542642

--
d99dc092b3a5ad17643005e55f3b3cb6b9187ccc by Jorg Brown <jorg@google.com>:

Remove a byteswap from the non-SSE path of FastHexToBufferZeroPad16

Remove the need for including absl/base/internal/endian.h from the SSE case
(since if we have the Intel SSE intrinsics, then clearly we also have the
Intel Byte-Swap intrinsics.)

PiperOrigin-RevId: 276532608

--
d67b106dc930d8558810ae3983613bb2ab1e0d36 by Abseil Team <absl-team@google.com>:

Use explicit static_cast<double> for int64_t to double conversion

This uses an explicit static_cast<double>() in the int64_t to double comparisons in duration.cc's SafeAddRepHi. This satisfies clang's -Wimplicit-int-to-float-conversion warning (with https://reviews.llvm.org/D64666). This may also make it easier for humans to realize that the comparison is happening between two floating point double precision values.  It should have no impact on the behavior or generated code.
Tested:
No behavior change
PiperOrigin-RevId: 276529211
GitOrigin-RevId: 2f49cb9009386bc67bf54a2908c8720b749c8b7f
Change-Id: I71e0781893ce219960b8290d54b20532779cb0ff
2019-10-30 11:13:04 -04:00
Abseil Team
ab3552a189 Export of internal Abseil changes
--
f13697e3d33803f9667d124072da4f6dd8bfbf85 by Andy Soffer <asoffer@google.com>:

Addressing https://github.com/abseil/abseil-cpp/issues/314, fixing
CMakeLists.txt to reference ABSL_TEST_COPTS rather than ABSL_DEFAULT_COPTS.

ABSL_TEST_COPTS should be preferred for all tests so that they are configured consistently (moreover, CMake should agree with Bazel).

PiperOrigin-RevId: 274932312

--
c31c24a1fa6bb98136adf51ef37c0818ac366690 by Derek Mauro <dmauro@google.com>:

Silence MSAN in the stack consumption test utility

PiperOrigin-RevId: 274912950

--
2412913c05a246cd527cd4c31452f126e9129f3a by CJ Johnson <johnsoncj@google.com>:

Internal change

PiperOrigin-RevId: 274847103

--
75e984a93b5760873501b96ac3229ccfd955daf8 by Abseil Team <absl-team@google.com>:

Reformat BUILD file to current standards.

PiperOrigin-RevId: 274815392

--
a2780e085f1df1e4ca2c814a58c893d1b78a1d9c by Samuel Benzaquen <sbenza@google.com>:

Fix invalid result regarding leading zeros in the exponent.

PiperOrigin-RevId: 274808017

--
dd402e1cb5c4ebacb576372ae24bf289d729d323 by Samuel Benzaquen <sbenza@google.com>:

Make string_view's relational operators constexpr when possible.

PiperOrigin-RevId: 274807873

--
b4ef32565653a5da1cb8bb8d0351586d23519658 by Abseil Team <absl-team@google.com>:

Internal rework.

PiperOrigin-RevId: 274787159

--
70d81971c5914e6785b8e8a9d4f6eb2655dd62c0 by Gennadiy Rozental <rogeeff@google.com>:

Internal rework.

PiperOrigin-RevId: 274715557

--
14f5b0440e353b899cafaaa15b53e77f98f401af by Gennadiy Rozental <rogeeff@google.com>:

Make deprecated statements about ParseFLag/UnparseFlag consistent in a file.

PiperOrigin-RevId: 274668123

--
2e85adbdbb92612e4d750bc34fbca3333128b42d by Abseil Team <absl-team@google.com>:

Allow absl::c_equal to be used with arrays.

This is achieved by allowing container size computation for arrays.

PiperOrigin-RevId: 274426830

--
219719f107226d328773e6cec99fb473f5d3119c by Gennadiy Rozental <rogeeff@google.com>:

Release correct extension interfaces to support usage of absl::Time and absl::Duration as ABSL_FLAG

PiperOrigin-RevId: 274273788

--
47a77f93fda23b69b4a6bdbd506fe643c69a5579 by Gennadiy Rozental <rogeeff@google.com>:

Rework of flags persistence/FlagSaver internals.

PiperOrigin-RevId: 274225213

--
7807be3fe757c19e3b0c487298387683d4c9f5b3 by Abseil Team <absl-team@google.com>:

Switch reference to sdkddkver.h to lowercase, matching conventions used in the Windows SDK and other uses. This helps to avoid confusion on case-sensitive filesystems.

PiperOrigin-RevId: 274061877

--
561304090087a19f1d10f0475f564fe132ebf06e by Andy Getzendanner <durandal@google.com>:

Fix ABSL_WAITER_MODE detection for mingw

Import of https://github.com/abseil/abseil-cpp/pull/342

PiperOrigin-RevId: 274030071

--
9b3caac2cf202b9d440dfa1b4ffd538ac4bf715b by Derek Mauro <dmauro@google.com>:

Support using Abseil with the musl libc implementation.

Only test changes were required:
  * Workaround for a bug in sigaltstack() on musl
  * printf-style pointer formatting (%p) is implementation defined,
    so verify StrFromat produces something compatible
  * Fix detection of feenableexcept()

PiperOrigin-RevId: 274011666

--
73e8a938fc139e1cc8670d4513a445bacc855539 by Abseil Team <absl-team@google.com>:

nvcc workaround: explicitly specify the definition of node_handle::Base

PiperOrigin-RevId: 274011392

--
ab9cc6d042aca7d48e16c504ab10eab39433f4b2 by Andy Soffer <asoffer@google.com>:

Internal change

PiperOrigin-RevId: 273996318

--
e567c4979ca99c7e71821ec1523b8f5edd2c76ac by Abseil Team <absl-team@google.com>:

Introduce a type alias to work around an nvcc bug.

On the previous code, nvcc gets confused thinking that T has to be a parameter
pack, as IsDecomposable accepts one.

PiperOrigin-RevId: 273980472

--
105b6e6339b77a32f4432de05f44cd3f9c436751 by Eric Fiselier <ericwf@google.com>:

Import of CCTZ from GitHub.

PiperOrigin-RevId: 273955589

--
8feb87ff1d7e721fe094855e67c19539d5e582b7 by Abseil Team <absl-team@google.com>:

Avoid dual-exporting scheduling_mode.h

PiperOrigin-RevId: 273825112

--
fbc37854776d295dae98fb9d06a541f296daab95 by Andy Getzendanner <durandal@google.com>:

Fix ABSL_HAVE_ALARM check on mingw

Import of https://github.com/abseil/abseil-cpp/pull/341

PiperOrigin-RevId: 273817839

--
6aedcd63a735b9133e143b043744ba0a25407f6f by Andy Soffer <asoffer@google.com>:

Remove bit_gen_view.h now that all callers have been migrated to bit_gen_ref.h
Tested:
TGP - https://test.corp.google.com/ui#id=OCL:273762409:BASE:273743370:1570639020744:3001bcb5

PiperOrigin-RevId: 273810331

--
6573de24a66ba715c579f7f32b5c48a1d743c7f8 by Abseil Team <absl-team@google.com>:

Internal change.

PiperOrigin-RevId: 273589963

--
91c8c28b6dca26d98b39e8e06a8ed17c701ff793 by Abseil Team <absl-team@google.com>:

Update macro name for `ABSL_GUARDED_BY()` in the example section.

PiperOrigin-RevId: 273286983

--
0ff7d1a93d70f8ecd693f8dbb98b7a4a016ca2a4 by Abseil Team <absl-team@google.com>:

Fix potential integer overflow in the absl time library.

In absl::FromTM, the tm.tm_year is added by 1900 regarding that tm.tm_year represents the years since 1900. This change checks integer overflow before doing the arithmetic operation.

PiperOrigin-RevId: 273092952

--
b41c2a1310086807be09a833099ae6d4009f037c by Gennadiy Rozental <rogeeff@google.com>:

Correctly Unlock the global mutex in case of concurrent flag initialization.

Fixes #386

PiperOrigin-RevId: 272979749

--
c53103e71b2a6063af3c6d4ff68aa2d8f9ae9e06 by Abseil Team <absl-team@google.com>:

Try to become idle only when there is no wakeup.

Immediately after waking up (when futex wait returns), the current thread tries
to become idle doing bunch of memory loads and a branch.  Problem is that there
is a good chance that we woke up due to a wakeup, especially for actively used
threads.  For such wakeups, calling MaybeBecomeIdle() would be a waste of
cycles.

Instead, call MaybeBecomeIdle() only when we are sure there is no wakeup.  For
idle threads the net effect should be the same.  For active, threads this will
be more efficient.

Moreover, since MaybeBecomeIdle() is called before waiting on the futex, the
current thread will try to become idle before sleeping.  This should result
in more accurate idleness and more efficient release of thread resources.

PiperOrigin-RevId: 272940381
GitOrigin-RevId: f13697e3d33803f9667d124072da4f6dd8bfbf85
Change-Id: I36de05aec12595183725652dd362dfa58fb095d0
2019-10-16 10:42:51 -04:00
Abseil Team
aad33fefaa Export of internal Abseil changes
--
fb57c2d3598c81779c1bcd43c61b5abe748159c1 by Mark Barolak <mbar@google.com>:

Fix a typo in string_view.h

PiperOrigin-RevId: 272287080

--
69ac5819b786e50ec4c3e80847b868feb4ed94ca by Abseil Team <absl-team@google.com>:

Fix -Wmicrosoft-template on clang-cl.

PiperOrigin-RevId: 272260629
GitOrigin-RevId: fb57c2d3598c81779c1bcd43c61b5abe748159c1
Change-Id: Ib5b4486f6a991b340e640b0353fc89cae1100b14
2019-10-02 13:50:28 -04:00
Abseil Team
8fe7214fe2 Export of internal Abseil changes
--
406622c43f296eeedf00e0e9246acfb4ea6ecd5e by Abseil Team <absl-team@google.com>:

Avoid the compiler reloading __is_long() on string_view(const string&)

The underlying cause is that the compiler assume a scenario where string_view is created with placement new into memory occupied by the input, so the store to 'ptr' can affect the value / result of size(); i.e., __is_long() reloads the __size value).

Example code: string_view1 demonstrates the problem, string_view2 DTRT.

=== string_view1
struct string_view1 {
    string_view1(const char* ptr, size_t n) : ptr(ptr), n(n) {}
    string_view1(const std::string& s) : ptr(s.data()), n(s.length()) {}
    const char* ptr;
    size_t n;
};

struct S1 {
    S1(const std::string& s);
    string_view1 sv;
};
S1::S1(const std::string& s) : sv(s) {}

S1::S1
        test    byte ptr [rsi], 1
        je      .LBB0_1
        mov     rax, qword ptr [rsi + 16]
        mov     qword ptr [rdi], rax
        movzx   eax, byte ptr [rsi]
        test    al, 1
        jne     .LBB0_5
.LBB0_4:
        shr     rax
        mov     qword ptr [rdi + 8], rax
        ret
.LBB0_1:
        lea     rax, [rsi + 1]
        mov     qword ptr [rdi], rax
        movzx   eax, byte ptr [rsi]
        test    al, 1
        je      .LBB0_4
.LBB0_5:
        mov     rax, qword ptr [rsi + 8]
        mov     qword ptr [rdi + 8], rax
        ret

=== string_view2
struct string_view2 {
    string_view2(const char* ptr, size_t n) : ptr(ptr), n(n) {}
    string_view2(const std::string& s) : string_view2(s.data(), s.size()) {}
    const char* ptr;
    size_t n;
};

struct S2 {
    S2(const std::string& s);
    string_view2 sv;
};
S2::S2(const std::string& s) : sv(s) {}

S2::S2
        movzx   eax, byte ptr [rsi]
        test    al, 1
        je      .LBB1_1
        mov     rax, qword ptr [rsi + 8]
        mov     rsi, qword ptr [rsi + 16]
        mov     qword ptr [rdi], rsi
        mov     qword ptr [rdi + 8], rax
        ret
.LBB1_1:
        add     rsi, 1
        shr     rax
        mov     qword ptr [rdi], rsi
        mov     qword ptr [rdi + 8], rax
        ret
PiperOrigin-RevId: 272096771
GitOrigin-RevId: 406622c43f296eeedf00e0e9246acfb4ea6ecd5e
Change-Id: I70173a2db68cd9b597fff1c09e00198c632cfe95
2019-10-01 13:58:29 -04:00