2017-09-19 22:54:40 +02:00
|
|
|
//
|
|
|
|
// Copyright 2017 The Abseil Authors.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
2019-03-08 16:27:53 +01:00
|
|
|
// https://www.apache.org/licenses/LICENSE-2.0
|
2017-09-19 22:54:40 +02:00
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
//
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// File: config.h
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// This header file defines a set of macros for checking the presence of
|
|
|
|
// important compiler and platform features. Such macros can be used to
|
|
|
|
// produce portable code by parameterizing compilation based on the presence or
|
|
|
|
// lack of a given feature.
|
|
|
|
//
|
|
|
|
// We define a "feature" as some interface we wish to program to: for example,
|
|
|
|
// a library function or system call. A value of `1` indicates support for
|
|
|
|
// that feature; any other value indicates the feature support is undefined.
|
|
|
|
//
|
|
|
|
// Example:
|
|
|
|
//
|
|
|
|
// Suppose a programmer wants to write a program that uses the 'mmap()' system
|
|
|
|
// call. The Abseil macro for that feature (`ABSL_HAVE_MMAP`) allows you to
|
|
|
|
// selectively include the `mmap.h` header and bracket code using that feature
|
|
|
|
// in the macro:
|
|
|
|
//
|
|
|
|
// #include "absl/base/config.h"
|
|
|
|
//
|
|
|
|
// #ifdef ABSL_HAVE_MMAP
|
|
|
|
// #include "sys/mman.h"
|
|
|
|
// #endif //ABSL_HAVE_MMAP
|
|
|
|
//
|
|
|
|
// ...
|
|
|
|
// #ifdef ABSL_HAVE_MMAP
|
|
|
|
// void *ptr = mmap(...);
|
|
|
|
// ...
|
|
|
|
// #endif // ABSL_HAVE_MMAP
|
|
|
|
|
|
|
|
#ifndef ABSL_BASE_CONFIG_H_
|
|
|
|
#define ABSL_BASE_CONFIG_H_
|
|
|
|
|
|
|
|
// Included for the __GLIBC__ macro (or similar macros on other systems).
|
|
|
|
#include <limits.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
// Included for __GLIBCXX__, _LIBCPP_VERSION
|
|
|
|
#include <cstddef>
|
|
|
|
#endif // __cplusplus
|
|
|
|
|
2017-09-29 17:44:28 +02:00
|
|
|
#if defined(__APPLE__)
|
|
|
|
// Included for TARGET_OS_IPHONE, __IPHONE_OS_VERSION_MIN_REQUIRED,
|
|
|
|
// __IPHONE_8_0.
|
|
|
|
#include <Availability.h>
|
|
|
|
#include <TargetConditionals.h>
|
|
|
|
#endif
|
|
|
|
|
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 16:00:44 +01:00
|
|
|
#include "absl/base/options.h"
|
2017-09-19 22:54:40 +02:00
|
|
|
#include "absl/base/policy_checks.h"
|
|
|
|
|
Export of internal Abseil changes
--
c42a234e2c186bf697ce8d77e85628601fa514a6 by Abseil Team <absl-team@google.com>:
Enable the assertion in the iterator's operator++
PiperOrigin-RevId: 290134813
--
f8c53ba8e9c5bb16bbcc1e412a5c2519c912c83e by Abseil Team <absl-team@google.com>:
Define operator== and operator!= for absl::{weak,strong}_equality and
absl::{partial,weak,strong}_ordering types themselves.
PiperOrigin-RevId: 290111564
--
36bc574090cefad74a451719ce2761982647a51d by Tom Manshreck <shreck@google.com>:
Specify Time library flag formats
PiperOrigin-RevId: 289928010
--
26dd40281add260baab2b60fec05dfb9c5304aaa by Mark Barolak <mbar@google.com>:
Delete an extraneous forward declaration of absl::Cord.
PiperOrigin-RevId: 289708481
--
e60aea7f33554ff66d7699bb70e7af1d26323f1d by Abseil Team <absl-team@google.com>:
Release b-tree benchmarks.
PiperOrigin-RevId: 289654429
--
660aa83fa000d4bae072b2d1c790f81d0939bc7e by Greg Falcon <gfalcon@google.com>:
Use https links.
Import of https://github.com/abseil/abseil-cpp/pull/586
PiperOrigin-RevId: 289479559
--
0611ea4482dcf23d6b0a0389fe041eeb9052449a by Derek Mauro <dmauro@google.com>:
Removes the static initializer for LookupTables<absl::uint128>::kVmaxOverBase
Uses template specialization to hard code the resulting array.
Static initializers are problematic for a number of reasons. Not only
are they responsible for the static initialization order fiasco, but
they are in the critical path during program startup. For these
reasons, the Google C++ style guide strongly discourages them (and
forbids them when they are not trivially destructible), and Chromium
even has a test forbidding them.
https://google.github.io/styleguide/cppguide.html#Static_and_Global_Variables
https://chromium.googlesource.com/chromium/src.git/+/master/docs/static_initializers.md
http://neugierig.org/software/chromium/notes/2011/08/static-initializers.html
PiperOrigin-RevId: 289458677
--
c869362f6bb7a872314f74750d38d81bdaa73f95 by Greg Falcon <gfalcon@google.com>:
Step 2 of 2 to fix our CCTZ fork to respect inline namespaces.
Re-import of CCTZ from GitHub, applying new changes to honor Abseil's optional inline namespace in MSVC.
PiperOrigin-RevId: 289454407
--
fdb3474d76c2ee0371ccdf7593a78137c03a3f58 by Greg Falcon <gfalcon@google.com>:
Step 1 of 2 to fix our CCTZ fork to respect inline namespaces.
CCTZ uses a linker flag to simulate weak symbol support in MSVC. This takes the form of a #pragma that includes the mangled names of two types: the symbol to treat as weak, and the symbol to use as its default value if no override is provided.
When Abseil is configured to use inline namespaces, the mangled names of these symbols change, and the pragma should change to reflect that. Fortunately for us, MSVC name mangling is simple enough that we can generate the needed string literals in the preprocessor.
This CL introduces the new macros; the uses will be introduced in a follow-up CL.
PiperOrigin-RevId: 289435599
--
5f152cc36f008acb9ab78f30b5efa40ebaf2754b by Matt Kulukundis <kfm@google.com>:
Improve documentation for lazy_emplace
PiperOrigin-RevId: 289333112
GitOrigin-RevId: c42a234e2c186bf697ce8d77e85628601fa514a6
Change-Id: I139ce6c7044a70d083af53e428bcb987f0fd88c6
2020-01-16 22:38:39 +01:00
|
|
|
// Helper macro to convert a CPP variable to a string literal.
|
|
|
|
#define ABSL_INTERNAL_DO_TOKEN_STR(x) #x
|
|
|
|
#define ABSL_INTERNAL_TOKEN_STR(x) ABSL_INTERNAL_DO_TOKEN_STR(x)
|
|
|
|
|
2019-12-10 18:03:32 +01:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// Abseil namespace annotations
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// ABSL_NAMESPACE_BEGIN/ABSL_NAMESPACE_END
|
|
|
|
//
|
|
|
|
// An annotation placed at the beginning/end of each `namespace absl` scope.
|
|
|
|
// This is used to inject an inline namespace.
|
|
|
|
//
|
|
|
|
// The proper way to write Abseil code in the `absl` namespace is:
|
|
|
|
//
|
|
|
|
// namespace absl {
|
|
|
|
// ABSL_NAMESPACE_BEGIN
|
|
|
|
//
|
|
|
|
// void Foo(); // absl::Foo().
|
|
|
|
//
|
|
|
|
// ABSL_NAMESPACE_END
|
|
|
|
// } // namespace absl
|
|
|
|
//
|
|
|
|
// Users of Abseil should not use these macros, because users of Abseil should
|
|
|
|
// not write `namespace absl {` in their own code for any reason. (Abseil does
|
|
|
|
// not support forward declarations of its own types, nor does it support
|
|
|
|
// user-provided specialization of Abseil templates. Code that violates these
|
|
|
|
// rules may be broken without warning.)
|
2020-01-09 18:58:48 +01:00
|
|
|
#if !defined(ABSL_OPTION_USE_INLINE_NAMESPACE) || \
|
|
|
|
!defined(ABSL_OPTION_INLINE_NAMESPACE_NAME)
|
|
|
|
#error options.h is misconfigured.
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Check that ABSL_OPTION_INLINE_NAMESPACE_NAME is neither "head" nor ""
|
|
|
|
#if defined(__cplusplus) && ABSL_OPTION_USE_INLINE_NAMESPACE == 1
|
|
|
|
|
|
|
|
#define ABSL_INTERNAL_INLINE_NAMESPACE_STR \
|
|
|
|
ABSL_INTERNAL_TOKEN_STR(ABSL_OPTION_INLINE_NAMESPACE_NAME)
|
|
|
|
|
|
|
|
static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != '\0',
|
|
|
|
"options.h misconfigured: ABSL_OPTION_INLINE_NAMESPACE_NAME must "
|
|
|
|
"not be empty.");
|
|
|
|
static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
|
|
|
|
ABSL_INTERNAL_INLINE_NAMESPACE_STR[1] != 'e' ||
|
|
|
|
ABSL_INTERNAL_INLINE_NAMESPACE_STR[2] != 'a' ||
|
|
|
|
ABSL_INTERNAL_INLINE_NAMESPACE_STR[3] != 'd' ||
|
|
|
|
ABSL_INTERNAL_INLINE_NAMESPACE_STR[4] != '\0',
|
|
|
|
"options.h misconfigured: ABSL_OPTION_INLINE_NAMESPACE_NAME must "
|
|
|
|
"be changed to a new, unique identifier name.");
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ABSL_OPTION_USE_INLINE_NAMESPACE == 0
|
2019-12-10 18:03:32 +01:00
|
|
|
#define ABSL_NAMESPACE_BEGIN
|
|
|
|
#define ABSL_NAMESPACE_END
|
2020-01-09 18:58:48 +01:00
|
|
|
#elif ABSL_OPTION_USE_INLINE_NAMESPACE == 1
|
|
|
|
#define ABSL_NAMESPACE_BEGIN \
|
|
|
|
inline namespace ABSL_OPTION_INLINE_NAMESPACE_NAME {
|
|
|
|
#define ABSL_NAMESPACE_END }
|
|
|
|
#else
|
|
|
|
#error options.h is misconfigured.
|
|
|
|
#endif
|
2019-12-10 18:03:32 +01:00
|
|
|
|
2017-09-19 22:54:40 +02:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// Compiler Feature Checks
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// ABSL_HAVE_BUILTIN()
|
|
|
|
//
|
|
|
|
// Checks whether the compiler supports a Clang Feature Checking Macro, and if
|
|
|
|
// so, checks whether it supports the provided builtin function "x" where x
|
|
|
|
// is one of the functions noted in
|
|
|
|
// https://clang.llvm.org/docs/LanguageExtensions.html
|
|
|
|
//
|
|
|
|
// Note: Use this macro to avoid an extra level of #ifdef __has_builtin check.
|
|
|
|
// http://releases.llvm.org/3.3/tools/clang/docs/LanguageExtensions.html
|
|
|
|
#ifdef __has_builtin
|
|
|
|
#define ABSL_HAVE_BUILTIN(x) __has_builtin(x)
|
|
|
|
#else
|
|
|
|
#define ABSL_HAVE_BUILTIN(x) 0
|
|
|
|
#endif
|
|
|
|
|
2019-11-19 23:43:59 +01:00
|
|
|
#if defined(__is_identifier)
|
|
|
|
#define ABSL_INTERNAL_HAS_KEYWORD(x) !(__is_identifier(x))
|
|
|
|
#else
|
|
|
|
#define ABSL_INTERNAL_HAS_KEYWORD(x) 0
|
|
|
|
#endif
|
|
|
|
|
2020-11-21 14:43:54 +01:00
|
|
|
#ifdef __has_feature
|
|
|
|
#define ABSL_HAVE_FEATURE(f) __has_feature(f)
|
|
|
|
#else
|
|
|
|
#define ABSL_HAVE_FEATURE(f) 0
|
|
|
|
#endif
|
|
|
|
|
2017-09-19 22:54:40 +02:00
|
|
|
// ABSL_HAVE_TLS is defined to 1 when __thread should be supported.
|
|
|
|
// We assume __thread is supported on Linux when compiled with Clang or compiled
|
|
|
|
// against libstdc++ with _GLIBCXX_HAVE_TLS defined.
|
|
|
|
#ifdef ABSL_HAVE_TLS
|
|
|
|
#error ABSL_HAVE_TLS cannot be directly set
|
|
|
|
#elif defined(__linux__) && (defined(__clang__) || defined(_GLIBCXX_HAVE_TLS))
|
|
|
|
#define ABSL_HAVE_TLS 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
|
|
|
|
//
|
|
|
|
// Checks whether `std::is_trivially_destructible<T>` is supported.
|
|
|
|
//
|
|
|
|
// Notes: All supported compilers using libc++ support this feature, as does
|
|
|
|
// gcc >= 4.8.1 using libstdc++, and Visual Studio.
|
|
|
|
#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
|
|
|
|
#error ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE cannot be directly set
|
|
|
|
#elif defined(_LIBCPP_VERSION) || \
|
|
|
|
(!defined(__clang__) && defined(__GNUC__) && defined(__GLIBCXX__) && \
|
|
|
|
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))) || \
|
|
|
|
defined(_MSC_VER)
|
|
|
|
#define ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE
|
|
|
|
//
|
|
|
|
// Checks whether `std::is_trivially_default_constructible<T>` and
|
|
|
|
// `std::is_trivially_copy_constructible<T>` are supported.
|
|
|
|
|
|
|
|
// ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
|
|
|
|
//
|
|
|
|
// Checks whether `std::is_trivially_copy_assignable<T>` is supported.
|
|
|
|
|
|
|
|
// Notes: Clang with libc++ supports these features, as does gcc >= 5.1 with
|
2019-02-28 18:21:10 +01:00
|
|
|
// either libc++ or libstdc++, and Visual Studio (but not NVCC).
|
2017-09-19 22:54:40 +02:00
|
|
|
#if defined(ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE)
|
|
|
|
#error ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE cannot be directly set
|
|
|
|
#elif defined(ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE)
|
|
|
|
#error ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE cannot directly set
|
|
|
|
#elif (defined(__clang__) && defined(_LIBCPP_VERSION)) || \
|
|
|
|
(!defined(__clang__) && defined(__GNUC__) && \
|
2019-08-15 19:06:39 +02:00
|
|
|
(__GNUC__ > 7 || (__GNUC__ == 7 && __GNUC_MINOR__ >= 4)) && \
|
2017-09-19 22:54:40 +02:00
|
|
|
(defined(_LIBCPP_VERSION) || defined(__GLIBCXX__))) || \
|
2019-02-28 18:21:10 +01:00
|
|
|
(defined(_MSC_VER) && !defined(__NVCC__))
|
2017-09-19 22:54:40 +02:00
|
|
|
#define ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE 1
|
|
|
|
#define ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE 1
|
|
|
|
#endif
|
|
|
|
|
2019-11-19 23:43:59 +01:00
|
|
|
// ABSL_HAVE_SOURCE_LOCATION_CURRENT
|
|
|
|
//
|
|
|
|
// Indicates whether `absl::SourceLocation::current()` will return useful
|
|
|
|
// information in some contexts.
|
|
|
|
#ifndef ABSL_HAVE_SOURCE_LOCATION_CURRENT
|
|
|
|
#if ABSL_INTERNAL_HAS_KEYWORD(__builtin_LINE) && \
|
|
|
|
ABSL_INTERNAL_HAS_KEYWORD(__builtin_FILE)
|
|
|
|
#define ABSL_HAVE_SOURCE_LOCATION_CURRENT 1
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2017-09-19 22:54:40 +02:00
|
|
|
// ABSL_HAVE_THREAD_LOCAL
|
|
|
|
//
|
|
|
|
// Checks whether C++11's `thread_local` storage duration specifier is
|
|
|
|
// supported.
|
|
|
|
#ifdef ABSL_HAVE_THREAD_LOCAL
|
|
|
|
#error ABSL_HAVE_THREAD_LOCAL cannot be directly set
|
2018-04-09 17:30:09 +02:00
|
|
|
#elif defined(__APPLE__)
|
2018-11-13 22:22:00 +01:00
|
|
|
// Notes:
|
|
|
|
// * Xcode's clang did not support `thread_local` until version 8, and
|
|
|
|
// even then not for all iOS < 9.0.
|
|
|
|
// * Xcode 9.3 started disallowing `thread_local` for 32-bit iOS simulator
|
|
|
|
// targeting iOS 9.x.
|
|
|
|
// * Xcode 10 moves the deployment target check for iOS < 9.0 to link time
|
2020-11-21 14:43:54 +01:00
|
|
|
// making ABSL_HAVE_FEATURE unreliable there.
|
2018-11-13 22:22:00 +01:00
|
|
|
//
|
2020-11-21 14:43:54 +01:00
|
|
|
#if ABSL_HAVE_FEATURE(cxx_thread_local) && \
|
2018-11-13 22:22:00 +01:00
|
|
|
!(TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0)
|
2018-04-09 17:30:09 +02:00
|
|
|
#define ABSL_HAVE_THREAD_LOCAL 1
|
|
|
|
#endif
|
|
|
|
#else // !defined(__APPLE__)
|
2017-09-19 22:54:40 +02:00
|
|
|
#define ABSL_HAVE_THREAD_LOCAL 1
|
|
|
|
#endif
|
|
|
|
|
2017-10-30 15:44:54 +01:00
|
|
|
// There are platforms for which TLS should not be used even though the compiler
|
|
|
|
// makes it seem like it's supported (Android NDK < r12b for example).
|
|
|
|
// This is primarily because of linker problems and toolchain misconfiguration:
|
|
|
|
// Abseil does not intend to support this indefinitely. Currently, the newest
|
|
|
|
// toolchain that we intend to support that requires this behavior is the
|
|
|
|
// r11 NDK - allowing for a 5 year support window on that means this option
|
|
|
|
// is likely to be removed around June of 2021.
|
|
|
|
// TLS isn't supported until NDK r12b per
|
|
|
|
// https://developer.android.com/ndk/downloads/revision_history.html
|
|
|
|
// Since NDK r16, `__NDK_MAJOR__` and `__NDK_MINOR__` are defined in
|
|
|
|
// <android/ndk-version.h>. For NDK < r16, users should define these macros,
|
|
|
|
// e.g. `-D__NDK_MAJOR__=11 -D__NKD_MINOR__=0` for NDK r11.
|
|
|
|
#if defined(__ANDROID__) && defined(__clang__)
|
|
|
|
#if __has_include(<android/ndk-version.h>)
|
|
|
|
#include <android/ndk-version.h>
|
|
|
|
#endif // __has_include(<android/ndk-version.h>)
|
|
|
|
#if defined(__ANDROID__) && defined(__clang__) && defined(__NDK_MAJOR__) && \
|
|
|
|
defined(__NDK_MINOR__) && \
|
|
|
|
((__NDK_MAJOR__ < 12) || ((__NDK_MAJOR__ == 12) && (__NDK_MINOR__ < 1)))
|
|
|
|
#undef ABSL_HAVE_TLS
|
|
|
|
#undef ABSL_HAVE_THREAD_LOCAL
|
|
|
|
#endif
|
|
|
|
#endif // defined(__ANDROID__) && defined(__clang__)
|
|
|
|
|
2017-09-19 22:54:40 +02:00
|
|
|
// ABSL_HAVE_INTRINSIC_INT128
|
|
|
|
//
|
|
|
|
// Checks whether the __int128 compiler extension for a 128-bit integral type is
|
|
|
|
// supported.
|
|
|
|
//
|
2018-03-06 21:30:19 +01:00
|
|
|
// Note: __SIZEOF_INT128__ is defined by Clang and GCC when __int128 is
|
|
|
|
// supported, but we avoid using it in certain cases:
|
|
|
|
// * On Clang:
|
|
|
|
// * Building using Clang for Windows, where the Clang runtime library has
|
|
|
|
// 128-bit support only on LP64 architectures, but Windows is LLP64.
|
|
|
|
// * On Nvidia's nvcc:
|
|
|
|
// * nvcc also defines __GNUC__ and __SIZEOF_INT128__, but not all versions
|
|
|
|
// actually support __int128.
|
2017-09-19 22:54:40 +02:00
|
|
|
#ifdef ABSL_HAVE_INTRINSIC_INT128
|
|
|
|
#error ABSL_HAVE_INTRINSIC_INT128 cannot be directly set
|
2017-12-15 20:12:12 +01:00
|
|
|
#elif defined(__SIZEOF_INT128__)
|
2019-05-14 19:53:39 +02:00
|
|
|
#if (defined(__clang__) && !defined(_WIN32)) || \
|
2018-03-06 21:30:19 +01:00
|
|
|
(defined(__CUDACC__) && __CUDACC_VER_MAJOR__ >= 9) || \
|
|
|
|
(defined(__GNUC__) && !defined(__clang__) && !defined(__CUDACC__))
|
2017-09-19 22:54:40 +02:00
|
|
|
#define ABSL_HAVE_INTRINSIC_INT128 1
|
2017-12-15 20:12:12 +01:00
|
|
|
#elif defined(__CUDACC__)
|
2017-10-30 15:44:54 +01:00
|
|
|
// __CUDACC_VER__ is a full version number before CUDA 9, and is defined to a
|
2018-08-21 20:31:02 +02:00
|
|
|
// string explaining that it has been removed starting with CUDA 9. We use
|
2017-12-15 20:12:12 +01:00
|
|
|
// nested #ifs because there is no short-circuiting in the preprocessor.
|
|
|
|
// NOTE: `__CUDACC__` could be undefined while `__CUDACC_VER__` is defined.
|
|
|
|
#if __CUDACC_VER__ >= 70000
|
2017-10-30 15:44:54 +01:00
|
|
|
#define ABSL_HAVE_INTRINSIC_INT128 1
|
2017-12-15 20:12:12 +01:00
|
|
|
#endif // __CUDACC_VER__ >= 70000
|
|
|
|
#endif // defined(__CUDACC__)
|
|
|
|
#endif // ABSL_HAVE_INTRINSIC_INT128
|
2017-09-19 22:54:40 +02:00
|
|
|
|
|
|
|
// ABSL_HAVE_EXCEPTIONS
|
|
|
|
//
|
|
|
|
// Checks whether the compiler both supports and enables exceptions. Many
|
|
|
|
// compilers support a "no exceptions" mode that disables exceptions.
|
|
|
|
//
|
|
|
|
// Generally, when ABSL_HAVE_EXCEPTIONS is not defined:
|
|
|
|
//
|
|
|
|
// * Code using `throw` and `try` may not compile.
|
|
|
|
// * The `noexcept` specifier will still compile and behave as normal.
|
|
|
|
// * The `noexcept` operator may still return `false`.
|
|
|
|
//
|
|
|
|
// For further details, consult the compiler's documentation.
|
|
|
|
#ifdef ABSL_HAVE_EXCEPTIONS
|
|
|
|
#error ABSL_HAVE_EXCEPTIONS cannot be directly set.
|
|
|
|
|
|
|
|
#elif defined(__clang__)
|
2020-02-13 15:52:24 +01:00
|
|
|
|
|
|
|
#if __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 6)
|
|
|
|
// Clang >= 3.6
|
2020-11-21 14:43:54 +01:00
|
|
|
#if ABSL_HAVE_FEATURE(cxx_exceptions)
|
2020-02-13 15:52:24 +01:00
|
|
|
#define ABSL_HAVE_EXCEPTIONS 1
|
2020-11-21 14:43:54 +01:00
|
|
|
#endif // ABSL_HAVE_FEATURE(cxx_exceptions)
|
2020-02-13 15:52:24 +01:00
|
|
|
#else
|
|
|
|
// Clang < 3.6
|
|
|
|
// http://releases.llvm.org/3.6.0/tools/clang/docs/ReleaseNotes.html#the-exceptions-macro
|
2020-11-21 14:43:54 +01:00
|
|
|
#if defined(__EXCEPTIONS) && ABSL_HAVE_FEATURE(cxx_exceptions)
|
2017-09-19 22:54:40 +02:00
|
|
|
#define ABSL_HAVE_EXCEPTIONS 1
|
2020-11-21 14:43:54 +01:00
|
|
|
#endif // defined(__EXCEPTIONS) && ABSL_HAVE_FEATURE(cxx_exceptions)
|
2020-02-13 15:52:24 +01:00
|
|
|
#endif // __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 6)
|
2017-09-19 22:54:40 +02:00
|
|
|
|
|
|
|
// Handle remaining special cases and default to exceptions being supported.
|
|
|
|
#elif !(defined(__GNUC__) && (__GNUC__ < 5) && !defined(__EXCEPTIONS)) && \
|
|
|
|
!(defined(__GNUC__) && (__GNUC__ >= 5) && !defined(__cpp_exceptions)) && \
|
|
|
|
!(defined(_MSC_VER) && !defined(_CPPUNWIND))
|
|
|
|
#define ABSL_HAVE_EXCEPTIONS 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// Platform Feature Checks
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// Currently supported operating systems and associated preprocessor
|
|
|
|
// symbols:
|
|
|
|
//
|
|
|
|
// Linux and Linux-derived __linux__
|
|
|
|
// Android __ANDROID__ (implies __linux__)
|
|
|
|
// Linux (non-Android) __linux__ && !__ANDROID__
|
2019-08-08 19:56:58 +02:00
|
|
|
// Darwin (macOS and iOS) __APPLE__
|
2017-09-19 22:54:40 +02:00
|
|
|
// Akaros (http://akaros.org) __ros__
|
|
|
|
// Windows _WIN32
|
|
|
|
// NaCL __native_client__
|
|
|
|
// AsmJS __asmjs__
|
2018-03-21 05:10:15 +01:00
|
|
|
// WebAssembly __wasm__
|
2017-12-12 20:23:51 +01:00
|
|
|
// Fuchsia __Fuchsia__
|
2017-09-19 22:54:40 +02:00
|
|
|
//
|
|
|
|
// Note that since Android defines both __ANDROID__ and __linux__, one
|
|
|
|
// may probe for either Linux or Android by simply testing for __linux__.
|
|
|
|
|
|
|
|
// ABSL_HAVE_MMAP
|
|
|
|
//
|
|
|
|
// Checks whether the platform has an mmap(2) implementation as defined in
|
|
|
|
// POSIX.1-2001.
|
|
|
|
#ifdef ABSL_HAVE_MMAP
|
|
|
|
#error ABSL_HAVE_MMAP cannot be directly set
|
2017-12-13 21:02:15 +01:00
|
|
|
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
|
2017-12-13 21:02:50 +01:00
|
|
|
defined(__ros__) || defined(__native_client__) || defined(__asmjs__) || \
|
2018-11-15 20:55:00 +01:00
|
|
|
defined(__wasm__) || defined(__Fuchsia__) || defined(__sun) || \
|
2020-11-21 14:43:54 +01:00
|
|
|
defined(__ASYLO__) || defined(__myriad2__)
|
2017-09-19 22:54:40 +02:00
|
|
|
#define ABSL_HAVE_MMAP 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// ABSL_HAVE_PTHREAD_GETSCHEDPARAM
|
|
|
|
//
|
|
|
|
// Checks whether the platform implements the pthread_(get|set)schedparam(3)
|
|
|
|
// functions as defined in POSIX.1-2001.
|
|
|
|
#ifdef ABSL_HAVE_PTHREAD_GETSCHEDPARAM
|
|
|
|
#error ABSL_HAVE_PTHREAD_GETSCHEDPARAM cannot be directly set
|
2017-12-13 21:02:50 +01:00
|
|
|
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
|
|
|
|
defined(__ros__)
|
2017-09-19 22:54:40 +02:00
|
|
|
#define ABSL_HAVE_PTHREAD_GETSCHEDPARAM 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// ABSL_HAVE_SCHED_YIELD
|
|
|
|
//
|
|
|
|
// Checks whether the platform implements sched_yield(2) as defined in
|
|
|
|
// POSIX.1-2001.
|
|
|
|
#ifdef ABSL_HAVE_SCHED_YIELD
|
|
|
|
#error ABSL_HAVE_SCHED_YIELD cannot be directly set
|
|
|
|
#elif defined(__linux__) || defined(__ros__) || defined(__native_client__)
|
|
|
|
#define ABSL_HAVE_SCHED_YIELD 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// ABSL_HAVE_SEMAPHORE_H
|
|
|
|
//
|
Export of internal Abseil changes
--
e54b9c7bbb0c58475676c268e2e19c69f4bce48a by Jorg Brown <jorg@google.com>:
Tweak ABSL_PREDICT_TRUE slightly, for better code on some platforms and/or
optimization levels. "false || (x)" is more verbose than "!!(x)", but
ultimately more efficient.
For example, given this code:
void InitIfNecessary() {
if (ABSL_PREDICT_TRUE(NeedsInit())) {
SlowInitIfNecessary();
}
}
Clang with default optimization level will produce:
Before this CL After this CL
InitIfNecessary: InitIfNecessary:
push rbp push rbp
mov rbp, rsp mov rbp, rsp
call NeedsInit call NeedsInit
xor al, -1
xor al, -1
test al, 1 test al, 1
jne .LBB2_1 jne .LBB3_1
jmp .LBB2_2 jmp .LBB3_2
.LBB2_1: .LBB3_1:
call SlowInitIfNecessary call SlowInitIfNecessary
.LBB2_2: .LBB3_2:
pop rbp pop rbp
ret ret
PiperOrigin-RevId: 276401386
--
0a3c4dfd8342bf2b1b11a87f1c662c883f73cab7 by Abseil Team <absl-team@google.com>:
Fix comment nit: sem_open => sem_init.
The code calls sem_init, not sem_open, to initialize an unnamed semaphore.
(sem_open creates or opens a named semaphore.)
PiperOrigin-RevId: 276344072
--
b36a664e9459057509a90e83d3482e1d3a4c44c7 by Abseil Team <absl-team@google.com>:
Fix typo in flat_hash_map.h: exchaged -> exchanged
PiperOrigin-RevId: 276295792
--
7bbd8d18276eb110c8335743e35fceb662ddf3d6 by Samuel Benzaquen <sbenza@google.com>:
Add assertions to verify use of iterators.
PiperOrigin-RevId: 276283300
--
677398a8ffcb1f59182cffe57a4fe7ff147a0404 by Laramie Leavitt <lar@google.com>:
Migrate distribution_impl.h/cc to generate_real.h/cc.
Combine the methods RandU64To<Float,Double> into a single method:
GenerateRealFromBits().
Remove rejection sampling from absl::uniform_real_distribution.
PiperOrigin-RevId: 276158675
--
c60c9d11d24b0c546329d998e78e15a84b3153f5 by Abseil Team <absl-team@google.com>:
Internal change
PiperOrigin-RevId: 276126962
--
4c840cab6a8d86efa29b397cafaf7520eece68cc by Andy Soffer <asoffer@google.com>:
Update CMakeLists.txt to address https://github.com/abseil/abseil-cpp/issues/365.
This does not cover every platform, but it does at least address the
first-order issue of assuming gcc implies x86.
PiperOrigin-RevId: 276116253
--
98da366e6b5d51afe5d7ac6722126aca23d85ee6 by Abseil Team <absl-team@google.com>:
Internal change
PiperOrigin-RevId: 276097452
GitOrigin-RevId: e54b9c7bbb0c58475676c268e2e19c69f4bce48a
Change-Id: I02d84454bb71ab21ad3d39650acf6cc6e36f58d7
2019-10-24 04:35:39 +02:00
|
|
|
// Checks whether the platform supports the <semaphore.h> header and sem_init(3)
|
2017-09-19 22:54:40 +02:00
|
|
|
// family of functions as standardized in POSIX.1-2001.
|
|
|
|
//
|
|
|
|
// Note: While Apple provides <semaphore.h> for both iOS and macOS, it is
|
2018-04-19 20:11:44 +02:00
|
|
|
// explicitly deprecated and will cause build failures if enabled for those
|
2017-09-19 22:54:40 +02:00
|
|
|
// platforms. We side-step the issue by not defining it here for Apple
|
|
|
|
// platforms.
|
|
|
|
#ifdef ABSL_HAVE_SEMAPHORE_H
|
|
|
|
#error ABSL_HAVE_SEMAPHORE_H cannot be directly set
|
|
|
|
#elif defined(__linux__) || defined(__ros__)
|
|
|
|
#define ABSL_HAVE_SEMAPHORE_H 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// ABSL_HAVE_ALARM
|
|
|
|
//
|
|
|
|
// Checks whether the platform supports the <signal.h> header and alarm(2)
|
|
|
|
// function as standardized in POSIX.1-2001.
|
|
|
|
#ifdef ABSL_HAVE_ALARM
|
|
|
|
#error ABSL_HAVE_ALARM cannot be directly set
|
|
|
|
#elif defined(__GOOGLE_GRTE_VERSION__)
|
|
|
|
// feature tests for Google's GRTE
|
|
|
|
#define ABSL_HAVE_ALARM 1
|
|
|
|
#elif defined(__GLIBC__)
|
|
|
|
// feature test for glibc
|
|
|
|
#define ABSL_HAVE_ALARM 1
|
|
|
|
#elif defined(_MSC_VER)
|
|
|
|
// feature tests for Microsoft's library
|
2019-10-09 23:07:57 +02:00
|
|
|
#elif defined(__MINGW32__)
|
|
|
|
// mingw32 doesn't provide alarm(2):
|
|
|
|
// https://osdn.net/projects/mingw/scm/git/mingw-org-wsl/blobs/5.2-trunk/mingwrt/include/unistd.h
|
|
|
|
// mingw-w64 provides a no-op implementation:
|
|
|
|
// https://sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-crt/misc/alarm.c
|
2018-11-15 20:55:00 +01:00
|
|
|
#elif defined(__EMSCRIPTEN__)
|
|
|
|
// emscripten doesn't support signals
|
2019-09-09 17:20:10 +02:00
|
|
|
#elif defined(__Fuchsia__)
|
|
|
|
// Signals don't exist on fuchsia.
|
2017-09-19 22:54:40 +02:00
|
|
|
#elif defined(__native_client__)
|
|
|
|
#else
|
|
|
|
// other standard libraries
|
|
|
|
#define ABSL_HAVE_ALARM 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// ABSL_IS_LITTLE_ENDIAN
|
|
|
|
// ABSL_IS_BIG_ENDIAN
|
|
|
|
//
|
|
|
|
// Checks the endianness of the platform.
|
|
|
|
//
|
|
|
|
// Notes: uses the built in endian macros provided by GCC (since 4.6) and
|
|
|
|
// Clang (since 3.2); see
|
|
|
|
// https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html.
|
|
|
|
// Otherwise, if _WIN32, assume little endian. Otherwise, bail with an error.
|
|
|
|
#if defined(ABSL_IS_BIG_ENDIAN)
|
|
|
|
#error "ABSL_IS_BIG_ENDIAN cannot be directly set."
|
|
|
|
#endif
|
|
|
|
#if defined(ABSL_IS_LITTLE_ENDIAN)
|
|
|
|
#error "ABSL_IS_LITTLE_ENDIAN cannot be directly set."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if (defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
|
|
|
|
__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
|
|
|
|
#define ABSL_IS_LITTLE_ENDIAN 1
|
|
|
|
#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && \
|
|
|
|
__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
|
|
|
#define ABSL_IS_BIG_ENDIAN 1
|
|
|
|
#elif defined(_WIN32)
|
|
|
|
#define ABSL_IS_LITTLE_ENDIAN 1
|
|
|
|
#else
|
|
|
|
#error "absl endian detection needs to be set up for your compiler"
|
|
|
|
#endif
|
|
|
|
|
2019-08-08 19:56:58 +02:00
|
|
|
// macOS 10.13 and iOS 10.11 don't let you use <any>, <optional>, or <variant>
|
2019-07-19 00:07:49 +02:00
|
|
|
// even though the headers exist and are publicly noted to work. See
|
Export of internal Abseil changes.
--
da04b8cd21f6225d71397471474d34a77df0efd6 by Jon Cohen <cohenjon@google.com>:
Don't use std::any, std::optional, std::variant, and friends on MacOS versions older than 10.14.
Although Xcode 10 includes those headers and makes the types available to use, according to https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes, on MacOS 10.13 and earlier use of any functions (std::get, for example) results in an error message to upgrade to MacOS 10.14.
This fixes https://github.com/abseil/abseil-cpp/issues/207. See that issue for more information on the error generated.
PiperOrigin-RevId: 221844618
--
1d99f77b4c60c5b0d7984f46e8ed63a3f969c635 by Jon Cohen <cohenjon@google.com>:
raw_hash_set_test is still flaky under gcc 4.8. Since we now have the probe_test, we don't need the PerfectRatio tests. Just remove them.
PiperOrigin-RevId: 221843042
--
135cbb2a5d90963256518b3b59fe6710815e5dfa by Abseil Team <absl-team@google.com>:
Update absl/algorithm/CMakeLists.txt to use new functions
i.e. absl_cc_(library|test)
PiperOrigin-RevId: 221828348
--
1a5abde4f17f998ae89d87155d59f982a70202d8 by Jon Cohen <cohenjon@google.com>:
Internal change
PiperOrigin-RevId: 221708245
--
e03e031d4de39275989f695c768b0940cce1ff16 by Matt Armstrong <marmstrong@google.com>:
Log to FATAL in throw_delegate.h
ABSL_RAW_LOG(FATAL, ...) is guaranteed to abort.
Previously, the code was logging to ERROR and
calling abort() explicitly, which defeated any
integration with absl::raw_logging_internal::AbortHook().
These changes are limited to Abseil internal APIs.
PiperOrigin-RevId: 221696513
--
d13691523a3f9a5367fd1194cf9604bf4a969029 by Shahriar Rouf <nafi@google.com>:
Import of CCTZ from GitHub.
PiperOrigin-RevId: 221694877
--
f4044c56d44ba0ac2a9f218ed55f1b1f9e985eae by Abseil Team <absl-team@google.com>:
Update absl/base/CMakeLists.txt to use new functions
i.e. absl_cc_(library|test)
PiperOrigin-RevId: 221676669
GitOrigin-RevId: da04b8cd21f6225d71397471474d34a77df0efd6
Change-Id: If6621e10d096a39b6a056a072c2727a0df0b0620
2018-11-16 22:36:37 +01:00
|
|
|
// https://github.com/abseil/abseil-cpp/issues/207 and
|
|
|
|
// https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes
|
2019-07-19 00:07:49 +02:00
|
|
|
// libc++ spells out the availability requirements in the file
|
2019-07-30 16:36:25 +02:00
|
|
|
// llvm-project/libcxx/include/__config via the #define
|
|
|
|
// _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS.
|
Export of internal Abseil changes.
--
da04b8cd21f6225d71397471474d34a77df0efd6 by Jon Cohen <cohenjon@google.com>:
Don't use std::any, std::optional, std::variant, and friends on MacOS versions older than 10.14.
Although Xcode 10 includes those headers and makes the types available to use, according to https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes, on MacOS 10.13 and earlier use of any functions (std::get, for example) results in an error message to upgrade to MacOS 10.14.
This fixes https://github.com/abseil/abseil-cpp/issues/207. See that issue for more information on the error generated.
PiperOrigin-RevId: 221844618
--
1d99f77b4c60c5b0d7984f46e8ed63a3f969c635 by Jon Cohen <cohenjon@google.com>:
raw_hash_set_test is still flaky under gcc 4.8. Since we now have the probe_test, we don't need the PerfectRatio tests. Just remove them.
PiperOrigin-RevId: 221843042
--
135cbb2a5d90963256518b3b59fe6710815e5dfa by Abseil Team <absl-team@google.com>:
Update absl/algorithm/CMakeLists.txt to use new functions
i.e. absl_cc_(library|test)
PiperOrigin-RevId: 221828348
--
1a5abde4f17f998ae89d87155d59f982a70202d8 by Jon Cohen <cohenjon@google.com>:
Internal change
PiperOrigin-RevId: 221708245
--
e03e031d4de39275989f695c768b0940cce1ff16 by Matt Armstrong <marmstrong@google.com>:
Log to FATAL in throw_delegate.h
ABSL_RAW_LOG(FATAL, ...) is guaranteed to abort.
Previously, the code was logging to ERROR and
calling abort() explicitly, which defeated any
integration with absl::raw_logging_internal::AbortHook().
These changes are limited to Abseil internal APIs.
PiperOrigin-RevId: 221696513
--
d13691523a3f9a5367fd1194cf9604bf4a969029 by Shahriar Rouf <nafi@google.com>:
Import of CCTZ from GitHub.
PiperOrigin-RevId: 221694877
--
f4044c56d44ba0ac2a9f218ed55f1b1f9e985eae by Abseil Team <absl-team@google.com>:
Update absl/base/CMakeLists.txt to use new functions
i.e. absl_cc_(library|test)
PiperOrigin-RevId: 221676669
GitOrigin-RevId: da04b8cd21f6225d71397471474d34a77df0efd6
Change-Id: If6621e10d096a39b6a056a072c2727a0df0b0620
2018-11-16 22:36:37 +01:00
|
|
|
#if defined(__APPLE__) && defined(_LIBCPP_VERSION) && \
|
2019-07-19 00:07:49 +02:00
|
|
|
((defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
|
|
|
|
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101400) || \
|
|
|
|
(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && \
|
2019-07-30 16:36:25 +02:00
|
|
|
__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 120000) || \
|
|
|
|
(defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && \
|
2020-11-21 14:43:54 +01:00
|
|
|
__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 50000) || \
|
2019-07-30 16:36:25 +02:00
|
|
|
(defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && \
|
2020-11-21 14:43:54 +01:00
|
|
|
__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 120000))
|
2019-07-19 00:07:49 +02:00
|
|
|
#define ABSL_INTERNAL_APPLE_CXX17_TYPES_UNAVAILABLE 1
|
Export of internal Abseil changes.
--
da04b8cd21f6225d71397471474d34a77df0efd6 by Jon Cohen <cohenjon@google.com>:
Don't use std::any, std::optional, std::variant, and friends on MacOS versions older than 10.14.
Although Xcode 10 includes those headers and makes the types available to use, according to https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes, on MacOS 10.13 and earlier use of any functions (std::get, for example) results in an error message to upgrade to MacOS 10.14.
This fixes https://github.com/abseil/abseil-cpp/issues/207. See that issue for more information on the error generated.
PiperOrigin-RevId: 221844618
--
1d99f77b4c60c5b0d7984f46e8ed63a3f969c635 by Jon Cohen <cohenjon@google.com>:
raw_hash_set_test is still flaky under gcc 4.8. Since we now have the probe_test, we don't need the PerfectRatio tests. Just remove them.
PiperOrigin-RevId: 221843042
--
135cbb2a5d90963256518b3b59fe6710815e5dfa by Abseil Team <absl-team@google.com>:
Update absl/algorithm/CMakeLists.txt to use new functions
i.e. absl_cc_(library|test)
PiperOrigin-RevId: 221828348
--
1a5abde4f17f998ae89d87155d59f982a70202d8 by Jon Cohen <cohenjon@google.com>:
Internal change
PiperOrigin-RevId: 221708245
--
e03e031d4de39275989f695c768b0940cce1ff16 by Matt Armstrong <marmstrong@google.com>:
Log to FATAL in throw_delegate.h
ABSL_RAW_LOG(FATAL, ...) is guaranteed to abort.
Previously, the code was logging to ERROR and
calling abort() explicitly, which defeated any
integration with absl::raw_logging_internal::AbortHook().
These changes are limited to Abseil internal APIs.
PiperOrigin-RevId: 221696513
--
d13691523a3f9a5367fd1194cf9604bf4a969029 by Shahriar Rouf <nafi@google.com>:
Import of CCTZ from GitHub.
PiperOrigin-RevId: 221694877
--
f4044c56d44ba0ac2a9f218ed55f1b1f9e985eae by Abseil Team <absl-team@google.com>:
Update absl/base/CMakeLists.txt to use new functions
i.e. absl_cc_(library|test)
PiperOrigin-RevId: 221676669
GitOrigin-RevId: da04b8cd21f6225d71397471474d34a77df0efd6
Change-Id: If6621e10d096a39b6a056a072c2727a0df0b0620
2018-11-16 22:36:37 +01:00
|
|
|
#else
|
2019-07-19 00:07:49 +02:00
|
|
|
#define ABSL_INTERNAL_APPLE_CXX17_TYPES_UNAVAILABLE 0
|
Export of internal Abseil changes.
--
da04b8cd21f6225d71397471474d34a77df0efd6 by Jon Cohen <cohenjon@google.com>:
Don't use std::any, std::optional, std::variant, and friends on MacOS versions older than 10.14.
Although Xcode 10 includes those headers and makes the types available to use, according to https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes, on MacOS 10.13 and earlier use of any functions (std::get, for example) results in an error message to upgrade to MacOS 10.14.
This fixes https://github.com/abseil/abseil-cpp/issues/207. See that issue for more information on the error generated.
PiperOrigin-RevId: 221844618
--
1d99f77b4c60c5b0d7984f46e8ed63a3f969c635 by Jon Cohen <cohenjon@google.com>:
raw_hash_set_test is still flaky under gcc 4.8. Since we now have the probe_test, we don't need the PerfectRatio tests. Just remove them.
PiperOrigin-RevId: 221843042
--
135cbb2a5d90963256518b3b59fe6710815e5dfa by Abseil Team <absl-team@google.com>:
Update absl/algorithm/CMakeLists.txt to use new functions
i.e. absl_cc_(library|test)
PiperOrigin-RevId: 221828348
--
1a5abde4f17f998ae89d87155d59f982a70202d8 by Jon Cohen <cohenjon@google.com>:
Internal change
PiperOrigin-RevId: 221708245
--
e03e031d4de39275989f695c768b0940cce1ff16 by Matt Armstrong <marmstrong@google.com>:
Log to FATAL in throw_delegate.h
ABSL_RAW_LOG(FATAL, ...) is guaranteed to abort.
Previously, the code was logging to ERROR and
calling abort() explicitly, which defeated any
integration with absl::raw_logging_internal::AbortHook().
These changes are limited to Abseil internal APIs.
PiperOrigin-RevId: 221696513
--
d13691523a3f9a5367fd1194cf9604bf4a969029 by Shahriar Rouf <nafi@google.com>:
Import of CCTZ from GitHub.
PiperOrigin-RevId: 221694877
--
f4044c56d44ba0ac2a9f218ed55f1b1f9e985eae by Abseil Team <absl-team@google.com>:
Update absl/base/CMakeLists.txt to use new functions
i.e. absl_cc_(library|test)
PiperOrigin-RevId: 221676669
GitOrigin-RevId: da04b8cd21f6225d71397471474d34a77df0efd6
Change-Id: If6621e10d096a39b6a056a072c2727a0df0b0620
2018-11-16 22:36:37 +01:00
|
|
|
#endif
|
|
|
|
|
2017-09-19 22:54:40 +02:00
|
|
|
// ABSL_HAVE_STD_ANY
|
|
|
|
//
|
2017-10-04 07:13:32 +02:00
|
|
|
// Checks whether C++17 std::any is available by checking whether <any> exists.
|
2017-09-19 22:54:40 +02:00
|
|
|
#ifdef ABSL_HAVE_STD_ANY
|
|
|
|
#error "ABSL_HAVE_STD_ANY cannot be directly set."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __has_include
|
Export of internal Abseil changes.
--
da04b8cd21f6225d71397471474d34a77df0efd6 by Jon Cohen <cohenjon@google.com>:
Don't use std::any, std::optional, std::variant, and friends on MacOS versions older than 10.14.
Although Xcode 10 includes those headers and makes the types available to use, according to https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes, on MacOS 10.13 and earlier use of any functions (std::get, for example) results in an error message to upgrade to MacOS 10.14.
This fixes https://github.com/abseil/abseil-cpp/issues/207. See that issue for more information on the error generated.
PiperOrigin-RevId: 221844618
--
1d99f77b4c60c5b0d7984f46e8ed63a3f969c635 by Jon Cohen <cohenjon@google.com>:
raw_hash_set_test is still flaky under gcc 4.8. Since we now have the probe_test, we don't need the PerfectRatio tests. Just remove them.
PiperOrigin-RevId: 221843042
--
135cbb2a5d90963256518b3b59fe6710815e5dfa by Abseil Team <absl-team@google.com>:
Update absl/algorithm/CMakeLists.txt to use new functions
i.e. absl_cc_(library|test)
PiperOrigin-RevId: 221828348
--
1a5abde4f17f998ae89d87155d59f982a70202d8 by Jon Cohen <cohenjon@google.com>:
Internal change
PiperOrigin-RevId: 221708245
--
e03e031d4de39275989f695c768b0940cce1ff16 by Matt Armstrong <marmstrong@google.com>:
Log to FATAL in throw_delegate.h
ABSL_RAW_LOG(FATAL, ...) is guaranteed to abort.
Previously, the code was logging to ERROR and
calling abort() explicitly, which defeated any
integration with absl::raw_logging_internal::AbortHook().
These changes are limited to Abseil internal APIs.
PiperOrigin-RevId: 221696513
--
d13691523a3f9a5367fd1194cf9604bf4a969029 by Shahriar Rouf <nafi@google.com>:
Import of CCTZ from GitHub.
PiperOrigin-RevId: 221694877
--
f4044c56d44ba0ac2a9f218ed55f1b1f9e985eae by Abseil Team <absl-team@google.com>:
Update absl/base/CMakeLists.txt to use new functions
i.e. absl_cc_(library|test)
PiperOrigin-RevId: 221676669
GitOrigin-RevId: da04b8cd21f6225d71397471474d34a77df0efd6
Change-Id: If6621e10d096a39b6a056a072c2727a0df0b0620
2018-11-16 22:36:37 +01:00
|
|
|
#if __has_include(<any>) && __cplusplus >= 201703L && \
|
2019-07-19 00:07:49 +02:00
|
|
|
!ABSL_INTERNAL_APPLE_CXX17_TYPES_UNAVAILABLE
|
2017-09-19 22:54:40 +02:00
|
|
|
#define ABSL_HAVE_STD_ANY 1
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// ABSL_HAVE_STD_OPTIONAL
|
|
|
|
//
|
|
|
|
// Checks whether C++17 std::optional is available.
|
|
|
|
#ifdef ABSL_HAVE_STD_OPTIONAL
|
|
|
|
#error "ABSL_HAVE_STD_OPTIONAL cannot be directly set."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __has_include
|
Export of internal Abseil changes.
--
da04b8cd21f6225d71397471474d34a77df0efd6 by Jon Cohen <cohenjon@google.com>:
Don't use std::any, std::optional, std::variant, and friends on MacOS versions older than 10.14.
Although Xcode 10 includes those headers and makes the types available to use, according to https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes, on MacOS 10.13 and earlier use of any functions (std::get, for example) results in an error message to upgrade to MacOS 10.14.
This fixes https://github.com/abseil/abseil-cpp/issues/207. See that issue for more information on the error generated.
PiperOrigin-RevId: 221844618
--
1d99f77b4c60c5b0d7984f46e8ed63a3f969c635 by Jon Cohen <cohenjon@google.com>:
raw_hash_set_test is still flaky under gcc 4.8. Since we now have the probe_test, we don't need the PerfectRatio tests. Just remove them.
PiperOrigin-RevId: 221843042
--
135cbb2a5d90963256518b3b59fe6710815e5dfa by Abseil Team <absl-team@google.com>:
Update absl/algorithm/CMakeLists.txt to use new functions
i.e. absl_cc_(library|test)
PiperOrigin-RevId: 221828348
--
1a5abde4f17f998ae89d87155d59f982a70202d8 by Jon Cohen <cohenjon@google.com>:
Internal change
PiperOrigin-RevId: 221708245
--
e03e031d4de39275989f695c768b0940cce1ff16 by Matt Armstrong <marmstrong@google.com>:
Log to FATAL in throw_delegate.h
ABSL_RAW_LOG(FATAL, ...) is guaranteed to abort.
Previously, the code was logging to ERROR and
calling abort() explicitly, which defeated any
integration with absl::raw_logging_internal::AbortHook().
These changes are limited to Abseil internal APIs.
PiperOrigin-RevId: 221696513
--
d13691523a3f9a5367fd1194cf9604bf4a969029 by Shahriar Rouf <nafi@google.com>:
Import of CCTZ from GitHub.
PiperOrigin-RevId: 221694877
--
f4044c56d44ba0ac2a9f218ed55f1b1f9e985eae by Abseil Team <absl-team@google.com>:
Update absl/base/CMakeLists.txt to use new functions
i.e. absl_cc_(library|test)
PiperOrigin-RevId: 221676669
GitOrigin-RevId: da04b8cd21f6225d71397471474d34a77df0efd6
Change-Id: If6621e10d096a39b6a056a072c2727a0df0b0620
2018-11-16 22:36:37 +01:00
|
|
|
#if __has_include(<optional>) && __cplusplus >= 201703L && \
|
2019-07-19 00:07:49 +02:00
|
|
|
!ABSL_INTERNAL_APPLE_CXX17_TYPES_UNAVAILABLE
|
2017-09-19 22:54:40 +02:00
|
|
|
#define ABSL_HAVE_STD_OPTIONAL 1
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2018-04-20 18:16:52 +02:00
|
|
|
// ABSL_HAVE_STD_VARIANT
|
|
|
|
//
|
2018-04-23 17:17:58 +02:00
|
|
|
// Checks whether C++17 std::variant is available.
|
2018-04-20 18:16:52 +02:00
|
|
|
#ifdef ABSL_HAVE_STD_VARIANT
|
|
|
|
#error "ABSL_HAVE_STD_VARIANT cannot be directly set."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __has_include
|
Export of internal Abseil changes.
--
da04b8cd21f6225d71397471474d34a77df0efd6 by Jon Cohen <cohenjon@google.com>:
Don't use std::any, std::optional, std::variant, and friends on MacOS versions older than 10.14.
Although Xcode 10 includes those headers and makes the types available to use, according to https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes, on MacOS 10.13 and earlier use of any functions (std::get, for example) results in an error message to upgrade to MacOS 10.14.
This fixes https://github.com/abseil/abseil-cpp/issues/207. See that issue for more information on the error generated.
PiperOrigin-RevId: 221844618
--
1d99f77b4c60c5b0d7984f46e8ed63a3f969c635 by Jon Cohen <cohenjon@google.com>:
raw_hash_set_test is still flaky under gcc 4.8. Since we now have the probe_test, we don't need the PerfectRatio tests. Just remove them.
PiperOrigin-RevId: 221843042
--
135cbb2a5d90963256518b3b59fe6710815e5dfa by Abseil Team <absl-team@google.com>:
Update absl/algorithm/CMakeLists.txt to use new functions
i.e. absl_cc_(library|test)
PiperOrigin-RevId: 221828348
--
1a5abde4f17f998ae89d87155d59f982a70202d8 by Jon Cohen <cohenjon@google.com>:
Internal change
PiperOrigin-RevId: 221708245
--
e03e031d4de39275989f695c768b0940cce1ff16 by Matt Armstrong <marmstrong@google.com>:
Log to FATAL in throw_delegate.h
ABSL_RAW_LOG(FATAL, ...) is guaranteed to abort.
Previously, the code was logging to ERROR and
calling abort() explicitly, which defeated any
integration with absl::raw_logging_internal::AbortHook().
These changes are limited to Abseil internal APIs.
PiperOrigin-RevId: 221696513
--
d13691523a3f9a5367fd1194cf9604bf4a969029 by Shahriar Rouf <nafi@google.com>:
Import of CCTZ from GitHub.
PiperOrigin-RevId: 221694877
--
f4044c56d44ba0ac2a9f218ed55f1b1f9e985eae by Abseil Team <absl-team@google.com>:
Update absl/base/CMakeLists.txt to use new functions
i.e. absl_cc_(library|test)
PiperOrigin-RevId: 221676669
GitOrigin-RevId: da04b8cd21f6225d71397471474d34a77df0efd6
Change-Id: If6621e10d096a39b6a056a072c2727a0df0b0620
2018-11-16 22:36:37 +01:00
|
|
|
#if __has_include(<variant>) && __cplusplus >= 201703L && \
|
2019-07-19 00:07:49 +02:00
|
|
|
!ABSL_INTERNAL_APPLE_CXX17_TYPES_UNAVAILABLE
|
2018-04-20 18:16:52 +02:00
|
|
|
#define ABSL_HAVE_STD_VARIANT 1
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2017-09-19 22:54:40 +02:00
|
|
|
// ABSL_HAVE_STD_STRING_VIEW
|
|
|
|
//
|
|
|
|
// Checks whether C++17 std::string_view is available.
|
|
|
|
#ifdef ABSL_HAVE_STD_STRING_VIEW
|
|
|
|
#error "ABSL_HAVE_STD_STRING_VIEW cannot be directly set."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __has_include
|
|
|
|
#if __has_include(<string_view>) && __cplusplus >= 201703L
|
|
|
|
#define ABSL_HAVE_STD_STRING_VIEW 1
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2017-10-13 19:21:40 +02:00
|
|
|
// For MSVC, `__has_include` is supported in VS 2017 15.3, which is later than
|
2018-04-20 18:16:52 +02:00
|
|
|
// the support for <optional>, <any>, <string_view>, <variant>. So we use
|
|
|
|
// _MSC_VER to check whether we have VS 2017 RTM (when <optional>, <any>,
|
|
|
|
// <string_view>, <variant> is implemented) or higher. Also, `__cplusplus` is
|
|
|
|
// not correctly set by MSVC, so we use `_MSVC_LANG` to check the language
|
|
|
|
// version.
|
2018-08-30 00:09:00 +02:00
|
|
|
// TODO(zhangxy): fix tests before enabling aliasing for `std::any`.
|
2017-10-13 19:21:40 +02:00
|
|
|
#if defined(_MSC_VER) && _MSC_VER >= 1910 && \
|
|
|
|
((defined(_MSVC_LANG) && _MSVC_LANG > 201402) || __cplusplus > 201402)
|
|
|
|
// #define ABSL_HAVE_STD_ANY 1
|
|
|
|
#define ABSL_HAVE_STD_OPTIONAL 1
|
2018-04-20 18:16:52 +02:00
|
|
|
#define ABSL_HAVE_STD_VARIANT 1
|
2018-08-30 00:09:00 +02:00
|
|
|
#define ABSL_HAVE_STD_STRING_VIEW 1
|
2017-10-13 19:21:40 +02:00
|
|
|
#endif
|
|
|
|
|
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 16:00:44 +01:00
|
|
|
// ABSL_USES_STD_ANY
|
|
|
|
//
|
|
|
|
// Indicates whether absl::any is an alias for std::any.
|
|
|
|
#if !defined(ABSL_OPTION_USE_STD_ANY)
|
|
|
|
#error options.h is misconfigured.
|
|
|
|
#elif ABSL_OPTION_USE_STD_ANY == 0 || \
|
|
|
|
(ABSL_OPTION_USE_STD_ANY == 2 && !defined(ABSL_HAVE_STD_ANY))
|
|
|
|
#undef ABSL_USES_STD_ANY
|
|
|
|
#elif ABSL_OPTION_USE_STD_ANY == 1 || \
|
|
|
|
(ABSL_OPTION_USE_STD_ANY == 2 && defined(ABSL_HAVE_STD_ANY))
|
|
|
|
#define ABSL_USES_STD_ANY 1
|
|
|
|
#else
|
|
|
|
#error options.h is misconfigured.
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// ABSL_USES_STD_OPTIONAL
|
|
|
|
//
|
|
|
|
// Indicates whether absl::optional is an alias for std::optional.
|
|
|
|
#if !defined(ABSL_OPTION_USE_STD_OPTIONAL)
|
|
|
|
#error options.h is misconfigured.
|
|
|
|
#elif ABSL_OPTION_USE_STD_OPTIONAL == 0 || \
|
|
|
|
(ABSL_OPTION_USE_STD_OPTIONAL == 2 && !defined(ABSL_HAVE_STD_OPTIONAL))
|
|
|
|
#undef ABSL_USES_STD_OPTIONAL
|
|
|
|
#elif ABSL_OPTION_USE_STD_OPTIONAL == 1 || \
|
|
|
|
(ABSL_OPTION_USE_STD_OPTIONAL == 2 && defined(ABSL_HAVE_STD_OPTIONAL))
|
|
|
|
#define ABSL_USES_STD_OPTIONAL 1
|
|
|
|
#else
|
|
|
|
#error options.h is misconfigured.
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// ABSL_USES_STD_VARIANT
|
|
|
|
//
|
|
|
|
// Indicates whether absl::variant is an alias for std::variant.
|
|
|
|
#if !defined(ABSL_OPTION_USE_STD_VARIANT)
|
|
|
|
#error options.h is misconfigured.
|
|
|
|
#elif ABSL_OPTION_USE_STD_VARIANT == 0 || \
|
|
|
|
(ABSL_OPTION_USE_STD_VARIANT == 2 && !defined(ABSL_HAVE_STD_VARIANT))
|
|
|
|
#undef ABSL_USES_STD_VARIANT
|
|
|
|
#elif ABSL_OPTION_USE_STD_VARIANT == 1 || \
|
|
|
|
(ABSL_OPTION_USE_STD_VARIANT == 2 && defined(ABSL_HAVE_STD_VARIANT))
|
|
|
|
#define ABSL_USES_STD_VARIANT 1
|
|
|
|
#else
|
|
|
|
#error options.h is misconfigured.
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// ABSL_USES_STD_STRING_VIEW
|
|
|
|
//
|
|
|
|
// Indicates whether absl::string_view is an alias for std::string_view.
|
|
|
|
#if !defined(ABSL_OPTION_USE_STD_STRING_VIEW)
|
|
|
|
#error options.h is misconfigured.
|
|
|
|
#elif ABSL_OPTION_USE_STD_STRING_VIEW == 0 || \
|
|
|
|
(ABSL_OPTION_USE_STD_STRING_VIEW == 2 && \
|
|
|
|
!defined(ABSL_HAVE_STD_STRING_VIEW))
|
|
|
|
#undef ABSL_USES_STD_STRING_VIEW
|
|
|
|
#elif ABSL_OPTION_USE_STD_STRING_VIEW == 1 || \
|
|
|
|
(ABSL_OPTION_USE_STD_STRING_VIEW == 2 && \
|
|
|
|
defined(ABSL_HAVE_STD_STRING_VIEW))
|
|
|
|
#define ABSL_USES_STD_STRING_VIEW 1
|
|
|
|
#else
|
|
|
|
#error options.h is misconfigured.
|
|
|
|
#endif
|
|
|
|
|
2018-11-13 22:22:00 +01:00
|
|
|
// In debug mode, MSVC 2017's std::variant throws a EXCEPTION_ACCESS_VIOLATION
|
|
|
|
// SEH exception from emplace for variant<SomeStruct> when constructing the
|
|
|
|
// struct can throw. This defeats some of variant_test and
|
|
|
|
// variant_exception_safety_test.
|
|
|
|
#if defined(_MSC_VER) && _MSC_VER >= 1700 && defined(_DEBUG)
|
|
|
|
#define ABSL_INTERNAL_MSVC_2017_DBG_MODE
|
|
|
|
#endif
|
|
|
|
|
Export of internal Abseil changes
--
c42a234e2c186bf697ce8d77e85628601fa514a6 by Abseil Team <absl-team@google.com>:
Enable the assertion in the iterator's operator++
PiperOrigin-RevId: 290134813
--
f8c53ba8e9c5bb16bbcc1e412a5c2519c912c83e by Abseil Team <absl-team@google.com>:
Define operator== and operator!= for absl::{weak,strong}_equality and
absl::{partial,weak,strong}_ordering types themselves.
PiperOrigin-RevId: 290111564
--
36bc574090cefad74a451719ce2761982647a51d by Tom Manshreck <shreck@google.com>:
Specify Time library flag formats
PiperOrigin-RevId: 289928010
--
26dd40281add260baab2b60fec05dfb9c5304aaa by Mark Barolak <mbar@google.com>:
Delete an extraneous forward declaration of absl::Cord.
PiperOrigin-RevId: 289708481
--
e60aea7f33554ff66d7699bb70e7af1d26323f1d by Abseil Team <absl-team@google.com>:
Release b-tree benchmarks.
PiperOrigin-RevId: 289654429
--
660aa83fa000d4bae072b2d1c790f81d0939bc7e by Greg Falcon <gfalcon@google.com>:
Use https links.
Import of https://github.com/abseil/abseil-cpp/pull/586
PiperOrigin-RevId: 289479559
--
0611ea4482dcf23d6b0a0389fe041eeb9052449a by Derek Mauro <dmauro@google.com>:
Removes the static initializer for LookupTables<absl::uint128>::kVmaxOverBase
Uses template specialization to hard code the resulting array.
Static initializers are problematic for a number of reasons. Not only
are they responsible for the static initialization order fiasco, but
they are in the critical path during program startup. For these
reasons, the Google C++ style guide strongly discourages them (and
forbids them when they are not trivially destructible), and Chromium
even has a test forbidding them.
https://google.github.io/styleguide/cppguide.html#Static_and_Global_Variables
https://chromium.googlesource.com/chromium/src.git/+/master/docs/static_initializers.md
http://neugierig.org/software/chromium/notes/2011/08/static-initializers.html
PiperOrigin-RevId: 289458677
--
c869362f6bb7a872314f74750d38d81bdaa73f95 by Greg Falcon <gfalcon@google.com>:
Step 2 of 2 to fix our CCTZ fork to respect inline namespaces.
Re-import of CCTZ from GitHub, applying new changes to honor Abseil's optional inline namespace in MSVC.
PiperOrigin-RevId: 289454407
--
fdb3474d76c2ee0371ccdf7593a78137c03a3f58 by Greg Falcon <gfalcon@google.com>:
Step 1 of 2 to fix our CCTZ fork to respect inline namespaces.
CCTZ uses a linker flag to simulate weak symbol support in MSVC. This takes the form of a #pragma that includes the mangled names of two types: the symbol to treat as weak, and the symbol to use as its default value if no override is provided.
When Abseil is configured to use inline namespaces, the mangled names of these symbols change, and the pragma should change to reflect that. Fortunately for us, MSVC name mangling is simple enough that we can generate the needed string literals in the preprocessor.
This CL introduces the new macros; the uses will be introduced in a follow-up CL.
PiperOrigin-RevId: 289435599
--
5f152cc36f008acb9ab78f30b5efa40ebaf2754b by Matt Kulukundis <kfm@google.com>:
Improve documentation for lazy_emplace
PiperOrigin-RevId: 289333112
GitOrigin-RevId: c42a234e2c186bf697ce8d77e85628601fa514a6
Change-Id: I139ce6c7044a70d083af53e428bcb987f0fd88c6
2020-01-16 22:38:39 +01:00
|
|
|
// ABSL_INTERNAL_MANGLED_NS
|
|
|
|
// ABSL_INTERNAL_MANGLED_BACKREFERENCE
|
|
|
|
//
|
|
|
|
// Internal macros for building up mangled names in our internal fork of CCTZ.
|
|
|
|
// This implementation detail is only needed and provided for the MSVC build.
|
|
|
|
//
|
|
|
|
// These macros both expand to string literals. ABSL_INTERNAL_MANGLED_NS is
|
|
|
|
// the mangled spelling of the `absl` namespace, and
|
|
|
|
// ABSL_INTERNAL_MANGLED_BACKREFERENCE is a back-reference integer representing
|
|
|
|
// the proper count to skip past the CCTZ fork namespace names. (This number
|
|
|
|
// is one larger when there is an inline namespace name to skip.)
|
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#if ABSL_OPTION_USE_INLINE_NAMESPACE == 0
|
|
|
|
#define ABSL_INTERNAL_MANGLED_NS "absl"
|
|
|
|
#define ABSL_INTERNAL_MANGLED_BACKREFERENCE "5"
|
|
|
|
#else
|
|
|
|
#define ABSL_INTERNAL_MANGLED_NS \
|
|
|
|
ABSL_INTERNAL_TOKEN_STR(ABSL_OPTION_INLINE_NAMESPACE_NAME) "@absl"
|
|
|
|
#define ABSL_INTERNAL_MANGLED_BACKREFERENCE "6"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2019-11-19 23:43:59 +01:00
|
|
|
#undef ABSL_INTERNAL_HAS_KEYWORD
|
|
|
|
|
2020-01-28 20:50:11 +01:00
|
|
|
// ABSL_DLL
|
|
|
|
//
|
|
|
|
// When building Abseil as a DLL, this macro expands to `__declspec(dllexport)`
|
|
|
|
// so we can annotate symbols appropriately as being exported. When used in
|
|
|
|
// headers consuming a DLL, this macro expands to `__declspec(dllimport)` so
|
|
|
|
// that consumers know the symbol is defined inside the DLL. In all other cases,
|
|
|
|
// the macro expands to nothing.
|
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#if defined(ABSL_BUILD_DLL)
|
|
|
|
#define ABSL_DLL __declspec(dllexport)
|
|
|
|
#elif defined(ABSL_CONSUME_DLL)
|
|
|
|
#define ABSL_DLL __declspec(dllimport)
|
|
|
|
#else
|
|
|
|
#define ABSL_DLL
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#define ABSL_DLL
|
|
|
|
#endif // defined(_MSC_VER)
|
|
|
|
|
2020-11-21 14:43:54 +01:00
|
|
|
// ABSL_HAVE_MEMORY_SANITIZER
|
|
|
|
//
|
|
|
|
// MemorySanitizer (MSan) is a detector of uninitialized reads. It consists of
|
|
|
|
// a compiler instrumentation module and a run-time library.
|
|
|
|
#ifdef ABSL_HAVE_MEMORY_SANITIZER
|
|
|
|
#error "ABSL_HAVE_MEMORY_SANITIZER cannot be directly set."
|
|
|
|
#elif defined(MEMORY_SANITIZER)
|
|
|
|
// The MEMORY_SANITIZER macro is deprecated but we will continue to honor it
|
|
|
|
// for now.
|
|
|
|
#define ABSL_HAVE_MEMORY_SANITIZER 1
|
|
|
|
#elif defined(__SANITIZE_MEMORY__)
|
|
|
|
#define ABSL_HAVE_MEMORY_SANITIZER 1
|
|
|
|
#elif !defined(__native_client__) && ABSL_HAVE_FEATURE(memory_sanitizer)
|
|
|
|
#define ABSL_HAVE_MEMORY_SANITIZER 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// ABSL_HAVE_THREAD_SANITIZER
|
|
|
|
//
|
|
|
|
// ThreadSanitizer (TSan) is a fast data race detector.
|
|
|
|
#ifdef ABSL_HAVE_THREAD_SANITIZER
|
|
|
|
#error "ABSL_HAVE_THREAD_SANITIZER cannot be directly set."
|
|
|
|
#elif defined(THREAD_SANITIZER)
|
|
|
|
// The THREAD_SANITIZER macro is deprecated but we will continue to honor it
|
|
|
|
// for now.
|
|
|
|
#define ABSL_HAVE_THREAD_SANITIZER 1
|
|
|
|
#elif defined(__SANITIZE_THREAD__)
|
|
|
|
#define ABSL_HAVE_THREAD_SANITIZER 1
|
|
|
|
#elif ABSL_HAVE_FEATURE(thread_sanitizer)
|
|
|
|
#define ABSL_HAVE_THREAD_SANITIZER 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// ABSL_HAVE_ADDRESS_SANITIZER
|
|
|
|
//
|
|
|
|
// AddressSanitizer (ASan) is a fast memory error detector.
|
|
|
|
#ifdef ABSL_HAVE_ADDRESS_SANITIZER
|
|
|
|
#error "ABSL_HAVE_ADDRESS_SANITIZER cannot be directly set."
|
|
|
|
#elif defined(ADDRESS_SANITIZER)
|
|
|
|
// The ADDRESS_SANITIZER macro is deprecated but we will continue to honor it
|
|
|
|
// for now.
|
|
|
|
#define ABSL_HAVE_ADDRESS_SANITIZER 1
|
|
|
|
#elif defined(__SANITIZE_ADDRESS__)
|
|
|
|
#define ABSL_HAVE_ADDRESS_SANITIZER 1
|
|
|
|
#elif ABSL_HAVE_FEATURE(address_sanitizer)
|
|
|
|
#define ABSL_HAVE_ADDRESS_SANITIZER 1
|
|
|
|
#endif
|
|
|
|
|
2017-09-19 22:54:40 +02:00
|
|
|
#endif // ABSL_BASE_CONFIG_H_
|