Export of internal Abseil changes

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

Skip floating-point edge-case tests when using an x87

32-bit Intel CPUs use 80-bit floats for intermediate values, which can
change the results of floating point computations from what we normally
expect. Identify tests that are sensitive to the x87, and skip them when
we’re on 32-bit Intel.

PiperOrigin-RevId: 378722613

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

Build without -Wl,-no-undefined.

PiperOrigin-RevId: 378690619

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

Update CCTZ BUILD file.

PiperOrigin-RevId: 378688996

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

Change the CMake install test to use installed version of GoogleTest

PiperOrigin-RevId: 378537383

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

Internal change

PiperOrigin-RevId: 378525523

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

Mark btree_container::clear() with the ABSL_ATTRIBUTE_REINITIALIZES attribute.

This prevents false positives in the clang-tidy check bugprone-use-after-move;
it allows clear() to be called on a moved-from btree_container without any
warnings, and the btree_container will thereafter be regarded as initialized again.

PiperOrigin-RevId: 378472690
GitOrigin-RevId: ca5ce10fa5286f2bfb51890a37b547308b8d6d93
Change-Id: I4267246f418538c5baacb562d1a40213fb13f246
pull/974/head
Abseil Team 4 years ago committed by Andy Getz
parent 8f92175783
commit 311bbd2e50
  1. 24
      CMake/install_test_project/test.sh
  2. 5
      absl/base/BUILD.bazel
  3. 1
      absl/container/BUILD.bazel
  4. 3
      absl/container/internal/btree_container.h
  5. 10
      absl/flags/BUILD.bazel
  6. 1
      absl/hash/BUILD.bazel
  7. 1
      absl/numeric/BUILD.bazel
  8. 9
      absl/random/beta_distribution_test.cc
  9. 10
      absl/random/distributions_test.cc
  10. 10
      absl/random/exponential_distribution_test.cc
  11. 9
      absl/random/uniform_real_distribution_test.cc
  12. 2
      absl/status/BUILD.bazel
  13. 7
      absl/strings/BUILD.bazel
  14. 2
      absl/synchronization/BUILD.bazel
  15. 1
      absl/time/BUILD.bazel
  16. 9
      absl/time/duration_test.cc
  17. 2
      absl/time/internal/cctz/BUILD.bazel
  18. 3
      ci/cmake_install_test.sh

@ -19,10 +19,9 @@
# Fail on any error. Treat unset variables an error. Print commands as executed.
set -euox pipefail
source ci/cmake_common.sh
absl_dir=/abseil-cpp
absl_build_dir=/buildfs
googletest_builddir=/googletest_builddir
project_dir="${absl_dir}"/CMake/install_test_project
project_build_dir=/buildfs/project-build
@ -31,13 +30,30 @@ if [ "${LINK_TYPE:-}" = "DYNAMIC" ]; then
build_shared_libs="ON"
fi
# Build and install GoogleTest
mkdir "${googletest_builddir}"
pushd "${googletest_builddir}"
curl -L "${ABSL_GOOGLETEST_DOWNLOAD_URL}" --output "${ABSL_GOOGLETEST_COMMIT}".zip
unzip "${ABSL_GOOGLETEST_COMMIT}".zip
pushd "googletest-${ABSL_GOOGLETEST_COMMIT}"
mkdir build
pushd build
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS="${build_shared_libs}" ..
make -j $(nproc)
make install
ldconfig
popd
popd
popd
# Run the LTS transformations
./create_lts.py 99998877
# Install Abseil
# Build and install Abseil
pushd "${absl_build_dir}"
cmake "${absl_dir}" \
-DABSL_GOOGLETEST_DOWNLOAD_URL="${ABSL_GOOGLETEST_DOWNLOAD_URL}" \
-DABSL_USE_EXTERNAL_GOOGLETEST=ON \
-DABSL_FIND_GOOGLETEST=ON \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=ON \
-DBUILD_SHARED_LIBS="${build_shared_libs}"

@ -56,6 +56,7 @@ cc_library(
srcs = ["log_severity.cc"],
hdrs = ["log_severity.h"],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":config",
@ -159,6 +160,7 @@ cc_library(
"internal/low_level_alloc.h",
],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
linkopts = select({
"//absl:msvc_compiler": [],
"//absl:clang-cl_compiler": [],
@ -220,6 +222,7 @@ cc_library(
"internal/unscaledcycleclock.h",
],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
linkopts = select({
"//absl:msvc_compiler": [
"-DEFAULTLIB:advapi32.lib",
@ -290,6 +293,7 @@ cc_library(
srcs = ["internal/throw_delegate.cc"],
hdrs = ["internal/throw_delegate.h"],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
linkopts = ABSL_DEFAULT_LINKOPTS,
visibility = [
"//absl:__subpackages__",
@ -709,6 +713,7 @@ cc_library(
srcs = ["internal/strerror.cc"],
hdrs = ["internal/strerror.h"],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
linkopts = ABSL_DEFAULT_LINKOPTS,
visibility = [
"//absl:__subpackages__",

@ -505,6 +505,7 @@ cc_library(
],
hdrs = ["internal/hashtablez_sampler.h"],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":have_sse",

@ -20,6 +20,7 @@
#include <iterator>
#include <utility>
#include "absl/base/attributes.h"
#include "absl/base/internal/throw_delegate.h"
#include "absl/container/internal/btree.h" // IWYU pragma: export
#include "absl/container/internal/common.h"
@ -176,7 +177,7 @@ class btree_container {
}
// Utility routines.
void clear() { tree_.clear(); }
ABSL_ATTRIBUTE_REINITIALIZES void clear() { tree_.clear(); }
void swap(btree_container &other) { tree_.swap(other.tree_); }
void verify() const { tree_.verify(); }

@ -51,6 +51,7 @@ cc_library(
"internal/program_name.h",
],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
linkopts = ABSL_DEFAULT_LINKOPTS,
visibility = [
"//absl/flags:__pkg__",
@ -74,6 +75,7 @@ cc_library(
"usage_config.h",
],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":path_util",
@ -94,6 +96,7 @@ cc_library(
"marshalling.h",
],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
"//absl/base:config",
@ -113,6 +116,7 @@ cc_library(
"internal/commandlineflag.h",
],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
"//absl/base:config",
@ -129,6 +133,7 @@ cc_library(
"commandlineflag.h",
],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":commandlineflag_internal",
@ -170,6 +175,7 @@ cc_library(
"reflection.h",
],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":commandlineflag",
@ -194,6 +200,7 @@ cc_library(
"internal/sequence_lock.h",
],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
linkopts = ABSL_DEFAULT_LINKOPTS,
visibility = ["//absl/base:__subpackages__"],
deps = [
@ -244,6 +251,7 @@ cc_library(
"internal/usage.h",
],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
linkopts = ABSL_DEFAULT_LINKOPTS,
visibility = [
"//absl/flags:__pkg__",
@ -273,6 +281,7 @@ cc_library(
"usage.h",
],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":usage_internal",
@ -291,6 +300,7 @@ cc_library(
"parse.h",
],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":commandlineflag",

@ -34,6 +34,7 @@ cc_library(
],
hdrs = ["hash.h"],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":city",

@ -62,6 +62,7 @@ cc_library(
],
hdrs = ["int128.h"],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":bits",

@ -15,6 +15,7 @@
#include "absl/random/beta_distribution.h"
#include <algorithm>
#include <cfloat>
#include <cstddef>
#include <cstdint>
#include <iterator>
@ -558,6 +559,14 @@ TEST(BetaDistributionTest, StabilityTest) {
// dependencies of the distribution change, such as RandU64ToDouble, then this
// is also likely to change.
TEST(BetaDistributionTest, AlgorithmBounds) {
#if (defined(__i386__) || defined(_M_IX86)) && FLT_EVAL_METHOD != 0
// We're using an x87-compatible FPU, and intermediate operations are
// performed with 80-bit floats. This produces slightly different results from
// what we expect below.
GTEST_SKIP()
<< "Skipping the test because we detected x87 floating-point semantics";
#endif
{
absl::random_internal::sequence_urbg urbg(
{0x7fbe76c8b4395800ull, 0x8000000000000000ull});

@ -14,6 +14,7 @@
#include "absl/random/distributions.h"
#include <cfloat>
#include <cmath>
#include <cstdint>
#include <random>
@ -224,6 +225,15 @@ TEST_F(RandomDistributionsTest, UniformNoBounds) {
TEST_F(RandomDistributionsTest, UniformNonsenseRanges) {
// The ranges used in this test are undefined behavior.
// The results are arbitrary and subject to future changes.
#if (defined(__i386__) || defined(_M_IX86)) && FLT_EVAL_METHOD != 0
// We're using an x87-compatible FPU, and intermediate operations can be
// performed with 80-bit floats. This produces slightly different results from
// what we expect below.
GTEST_SKIP()
<< "Skipping the test because we detected x87 floating-point semantics";
#endif
absl::InsecureBitGen gen;
// <uint>

@ -15,6 +15,7 @@
#include "absl/random/exponential_distribution.h"
#include <algorithm>
#include <cfloat>
#include <cmath>
#include <cstddef>
#include <cstdint>
@ -384,6 +385,15 @@ TEST(ExponentialDistributionTest, StabilityTest) {
TEST(ExponentialDistributionTest, AlgorithmBounds) {
// Relies on absl::uniform_real_distribution, so some of these comments
// reference that.
#if (defined(__i386__) || defined(_M_IX86)) && FLT_EVAL_METHOD != 0
// We're using an x87-compatible FPU, and intermediate operations can be
// performed with 80-bit floats. This produces slightly different results from
// what we expect below.
GTEST_SKIP()
<< "Skipping the test because we detected x87 floating-point semantics";
#endif
absl::exponential_distribution<double> dist;
{

@ -14,6 +14,7 @@
#include "absl/random/uniform_real_distribution.h"
#include <cfloat>
#include <cmath>
#include <cstdint>
#include <iterator>
@ -70,6 +71,14 @@ using RealTypes =
TYPED_TEST_SUITE(UniformRealDistributionTest, RealTypes);
TYPED_TEST(UniformRealDistributionTest, ParamSerializeTest) {
#if (defined(__i386__) || defined(_M_IX86)) && FLT_EVAL_METHOD != 0
// We're using an x87-compatible FPU, and intermediate operations are
// performed with 80-bit floats. This produces slightly different results from
// what we expect below.
GTEST_SKIP()
<< "Skipping the test because we detected x87 floating-point semantics";
#endif
using param_type =
typename absl::uniform_real_distribution<TypeParam>::param_type;

@ -40,6 +40,7 @@ cc_library(
"status_payload_printer.h",
],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
deps = [
"//absl/base:atomic_hook",
"//absl/base:config",
@ -76,6 +77,7 @@ cc_library(
"statusor.h",
],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
deps = [
":status",
"//absl/base:core_headers",

@ -66,6 +66,7 @@ cc_library(
"substitute.h",
],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
deps = [
":internal",
"//absl/base",
@ -96,6 +97,7 @@ cc_library(
"internal/utf8.h",
],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
deps = [
"//absl/base:config",
"//absl/base:core_headers",
@ -278,6 +280,7 @@ cc_library(
"internal/cord_rep_ring_reader.h",
],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
visibility = [
"//visibility:private",
],
@ -327,6 +330,7 @@ cc_library(
"cord.h",
],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
deps = [
":cord_internal",
":cordz_functions",
@ -355,6 +359,7 @@ cc_library(
srcs = ["internal/cordz_handle.cc"],
hdrs = ["internal/cordz_handle.h"],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
visibility = [
"//absl:__subpackages__",
],
@ -371,6 +376,7 @@ cc_library(
srcs = ["internal/cordz_info.cc"],
hdrs = ["internal/cordz_info.h"],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
visibility = [
"//absl:__subpackages__",
],
@ -995,6 +1001,7 @@ cc_library(
"internal/str_format/parser.h",
],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
visibility = ["//visibility:private"],
deps = [
":strings",

@ -36,6 +36,7 @@ cc_library(
"internal/graphcycles.h",
],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
linkopts = ABSL_DEFAULT_LINKOPTS,
visibility = [
"//absl:__subpackages__",
@ -87,6 +88,7 @@ cc_library(
"notification.h",
],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
linkopts = select({
"//absl:msvc_compiler": [],
"//absl:clang-cl_compiler": [],

@ -43,6 +43,7 @@ cc_library(
"time.h",
],
copts = ABSL_DEFAULT_COPTS,
features = ["-no_undefined"],
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
"//absl/base",

@ -17,6 +17,7 @@
#endif
#include <chrono> // NOLINT(build/c++11)
#include <cfloat>
#include <cmath>
#include <cstdint>
#include <ctime>
@ -1390,6 +1391,14 @@ void VerifyApproxSameAsMul(double time_as_seconds, int* const misses) {
// Seconds(point) returns a duration near point * Seconds(1.0). (They may
// not be exactly equal due to fused multiply/add contraction.)
TEST(Duration, ToDoubleSecondsCheckEdgeCases) {
#if (defined(__i386__) || defined(_M_IX86)) && FLT_EVAL_METHOD != 0
// We're using an x87-compatible FPU, and intermediate operations can be
// performed with 80-bit floats. This means the edge cases are different than
// what we expect here, so just skip this test.
GTEST_SKIP()
<< "Skipping the test because we detected x87 floating-point semantics";
#endif
constexpr uint32_t kTicksPerSecond = absl::time_internal::kTicksPerSecond;
constexpr auto duration_tick = absl::time_internal::MakeDuration(0, 1u);
int misses = 0;

@ -45,6 +45,7 @@ cc_library(
hdrs = [
"include/cctz/civil_time.h",
],
features = ["-no_undefined"],
textual_hdrs = ["include/cctz/civil_time_detail.h"],
visibility = ["//visibility:public"],
deps = ["//absl/base:config"],
@ -74,6 +75,7 @@ cc_library(
"include/cctz/time_zone.h",
"include/cctz/zone_info_source.h",
],
features = ["-no_undefined"],
linkopts = select({
":osx": [
"-framework Foundation",

@ -36,8 +36,11 @@ for link_type in ${LINK_TYPE}; do
--tmpfs=/abseil-cpp:exec \
--workdir=/abseil-cpp \
--cap-add=SYS_PTRACE \
-e "ABSL_GOOGLETEST_COMMIT=${ABSL_GOOGLETEST_COMMIT}" \
-e "ABSL_GOOGLETEST_DOWNLOAD_URL=${ABSL_GOOGLETEST_DOWNLOAD_URL}" \
-e "LINK_TYPE=${link_type}" \
--rm \
${DOCKER_EXTRA_ARGS:-} \
${DOCKER_CONTAINER} \
/bin/bash -c "cp -r /abseil-cpp-ro/* . && CMake/install_test_project/test.sh"
done

Loading…
Cancel
Save