GeezerVison is showing github.com — Cherry-picks for LTS 2020_09_23 Patch Release 2 · abseil/abseil-cpp@0f3bb46
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: absl/debugging/internal/address_is_readable.cc +5-4Lines changed: 5 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -68,6 +68,7 @@ static void Unpack(uint64_t x, int *pid, int *read_fd, int *write_fd) { | 68 | 68 | // unimplemented. | 69 | 69 | // This is a namespace-scoped variable for correct zero-initialization. | 70 | 70 | static std::atomic<uint64_t> pid_and_fds; // initially 0, an invalid pid. | | 71 | + | 71 | 72 | bool AddressIsReadable(const void *addr) { | 72 | 73 | absl::base_internal::ErrnoSaver errno_saver; | 73 | 74 | // We test whether a byte is readable by using write(). Normally, this would | @@ -86,7 +87,7 @@ bool AddressIsReadable(const void *addr) { | 86 | 87 | int pid; | 87 | 88 | int read_fd; | 88 | 89 | int write_fd; | 89 | | - uint64_t local_pid_and_fds = pid_and_fds.load(std::memory_order_relaxed); | | 90 | + uint64_t local_pid_and_fds = pid_and_fds.load(std::memory_order_acquire); | 90 | 91 | Unpack(local_pid_and_fds, &pid, &read_fd, &write_fd); | 91 | 92 | while (current_pid != pid) { | 92 | 93 | int p[2]; | @@ -98,13 +99,13 @@ bool AddressIsReadable(const void *addr) { | 98 | 99 | fcntl(p[1], F_SETFD, FD_CLOEXEC); | 99 | 100 | uint64_t new_pid_and_fds = Pack(current_pid, p[0], p[1]); | 100 | 101 | if (pid_and_fds.compare_exchange_strong( | 101 | | - local_pid_and_fds, new_pid_and_fds, std::memory_order_relaxed, | | 102 | + local_pid_and_fds, new_pid_and_fds, std::memory_order_release, | 102 | 103 | std::memory_order_relaxed)) { | 103 | 104 | local_pid_and_fds = new_pid_and_fds; // fds exposed to other threads | 104 | 105 | } else { // fds not exposed to other threads; we can close them. | 105 | 106 | close(p[0]); | 106 | 107 | close(p[1]); | 107 | | - local_pid_and_fds = pid_and_fds.load(std::memory_order_relaxed); | | 108 | + local_pid_and_fds = pid_and_fds.load(std::memory_order_acquire); | 108 | 109 | } | 109 | 110 | Unpack(local_pid_and_fds, &pid, &read_fd, &write_fd); | 110 | 111 | } | @@ -124,7 +125,7 @@ bool AddressIsReadable(const void *addr) { | 124 | 125 | // If pid_and_fds contains the problematic file descriptors we just used, | 125 | 126 | // this call will forget them, and the loop will try again. | 126 | 127 | pid_and_fds.compare_exchange_strong(local_pid_and_fds, 0, | 127 | | - std::memory_order_relaxed, | | 128 | + std::memory_order_release, | 128 | 129 | std::memory_order_relaxed); | 129 | 130 | } | 130 | 131 | } while (errno == EBADF); | |
Collapse file Copy file name to clipboardExpand all lines: absl/flags/CMakeLists.txt +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -183,6 +183,7 @@ absl_cc_library( | 183 | 183 | DEPS | 184 | 184 | absl::base | 185 | 185 | absl::config | | 186 | + absl::flags_commandlineflag | 186 | 187 | absl::flags_commandlineflag_internal | 187 | 188 | absl::flags_config | 188 | 189 | absl::flags_marshalling | |
Collapse file Copy file name to clipboardExpand all lines: absl/status/CMakeLists.txt +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -64,6 +64,7 @@ absl_cc_library( | 64 | 64 | COPTS | 65 | 65 | ${ABSL_DEFAULT_COPTS} | 66 | 66 | DEPS | | 67 | + absl::status | 67 | 68 | absl::core_headers | 68 | 69 | absl::raw_logging_internal | 69 | 70 | absl::type_traits | |
Collapse file Copy file name to clipboardExpand all lines: absl/synchronization/mutex.cc +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 50 | 50 | #include "absl/base/internal/spinlock.h" | 51 | 51 | #include "absl/base/internal/sysinfo.h" | 52 | 52 | #include "absl/base/internal/thread_identity.h" | | 53 | +#include "absl/base/internal/tsan_mutex_interface.h" | 53 | 54 | #include "absl/base/port.h" | 54 | 55 | #include "absl/debugging/stacktrace.h" | 55 | 56 | #include "absl/debugging/symbolize.h" | @@ -705,7 +706,7 @@ static constexpr bool kDebugMode = false; | 705 | 706 | static constexpr bool kDebugMode = true; | 706 | 707 | #endif | 707 | 708 |
| 708 | | -#ifdef ABSL_HAVE_THREAD_SANITIZER | | 709 | +#ifdef ABSL_INTERNAL_HAVE_TSAN_INTERFACE | 709 | 710 | static unsigned TsanFlags(Mutex::MuHow how) { | 710 | 711 | return how == kShared ? __tsan_mutex_read_lock : 0; | 711 | 712 | } | @@ -1767,7 +1768,7 @@ static inline bool EvalConditionAnnotated(const Condition *cond, Mutex *mu, | 1767 | 1768 | // All memory accesses are ignored inside of mutex operations + for unlock | 1768 | 1769 | // operation tsan considers that we've already released the mutex. | 1769 | 1770 | bool res = false; | 1770 | | -#ifdef ABSL_HAVE_THREAD_SANITIZER | | 1771 | +#ifdef ABSL_INTERNAL_HAVE_TSAN_INTERFACE | 1771 | 1772 | const int flags = read_lock ? __tsan_mutex_read_lock : 0; | 1772 | 1773 | const int tryflags = flags | (trylock ? __tsan_mutex_try_lock : 0); | 1773 | 1774 | #endif | |
Collapse file Copy file name to clipboardExpand all lines: ci/linux_gcc-latest_libstdcxx_cmake.sh +26-21Lines changed: 26 additions & 21 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -34,31 +34,36 @@ if [[ -z ${ABSL_CMAKE_BUILD_TYPES:-} ]]; then | 34 | 34 | ABSL_CMAKE_BUILD_TYPES="Debug Release" | 35 | 35 | fi | 36 | 36 |
| | 37 | +if [[ -z ${ABSL_CMAKE_BUILD_SHARED:-} ]]; then | | 38 | + ABSL_CMAKE_BUILD_SHARED="OFF ON" | | 39 | +fi | | 40 | + | 37 | 41 | source "${ABSEIL_ROOT}/ci/linux_docker_containers.sh" | 38 | 42 | readonly DOCKER_CONTAINER=${LINUX_GCC_LATEST_CONTAINER} | 39 | 43 |
| 40 | 44 | for std in ${ABSL_CMAKE_CXX_STANDARDS}; do | 41 | 45 | for compilation_mode in ${ABSL_CMAKE_BUILD_TYPES}; do | 42 | | - echo "--------------------------------------------------------------------" | 43 | | - echo "Testing with CMAKE_BUILD_TYPE=${compilation_mode} and -std=c++${std}" | 44 | | - | 45 | | - time docker run \ | 46 | | - --volume="${ABSEIL_ROOT}:/abseil-cpp:ro" \ | 47 | | - --workdir=/abseil-cpp \ | 48 | | - --tmpfs=/buildfs:exec \ | 49 | | - --cap-add=SYS_PTRACE \ | 50 | | - --rm \ | 51 | | - -e CFLAGS="-Werror" \ | 52 | | - -e CXXFLAGS="-Werror" \ | 53 | | - ${DOCKER_CONTAINER} \ | 54 | | - /bin/bash -c " | 55 | | - cd /buildfs && \ | 56 | | - cmake /abseil-cpp \ | 57 | | - -DABSL_USE_GOOGLETEST_HEAD=ON \ | 58 | | - -DABSL_RUN_TESTS=ON \ | 59 | | - -DCMAKE_BUILD_TYPE=${compilation_mode} \ | 60 | | - -DCMAKE_CXX_STANDARD=${std} && \ | 61 | | - make -j$(nproc) && \ | 62 | | - ctest -j$(nproc) --output-on-failure" | | 46 | + for build_shared in ${ABSL_CMAKE_BUILD_SHARED}; do | | 47 | + time docker run \ | | 48 | + --volume="${ABSEIL_ROOT}:/abseil-cpp:ro" \ | | 49 | + --workdir=/abseil-cpp \ | | 50 | + --tmpfs=/buildfs:exec \ | | 51 | + --cap-add=SYS_PTRACE \ | | 52 | + --rm \ | | 53 | + -e CFLAGS="-Werror" \ | | 54 | + -e CXXFLAGS="-Werror" \ | | 55 | + ${DOCKER_CONTAINER} \ | | 56 | + /bin/bash -c " | | 57 | + cd /buildfs && \ | | 58 | + cmake /abseil-cpp \ | | 59 | + -DABSL_USE_GOOGLETEST_HEAD=ON \ | | 60 | + -DABSL_RUN_TESTS=ON \ | | 61 | + -DBUILD_SHARED_LIBS=${build_shared} \ | | 62 | + -DCMAKE_BUILD_TYPE=${compilation_mode} \ | | 63 | + -DCMAKE_CXX_STANDARD=${std} \ | | 64 | + -DCMAKE_MODULE_LINKER_FLAGS=\"-Wl,--no-undefined\" && \ | | 65 | + make -j$(nproc) && \ | | 66 | + ctest -j$(nproc) --output-on-failure" | | 67 | + done | 63 | 68 | done | 64 | 69 | done |
Collapse file Copy file name to clipboardExpand all lines: ci/linux_gcc_alpine_cmake.sh +25-21Lines changed: 25 additions & 21 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -34,31 +34,35 @@ if [[ -z ${ABSL_CMAKE_BUILD_TYPES:-} ]]; then | 34 | 34 | ABSL_CMAKE_BUILD_TYPES="Debug Release" | 35 | 35 | fi | 36 | 36 |
| | 37 | +if [[ -z ${ABSL_CMAKE_BUILD_SHARED:-} ]]; then | | 38 | + ABSL_CMAKE_BUILD_SHARED="OFF ON" | | 39 | +fi | | 40 | + | 37 | 41 | source "${ABSEIL_ROOT}/ci/linux_docker_containers.sh" | 38 | 42 | readonly DOCKER_CONTAINER=${LINUX_ALPINE_CONTAINER} | 39 | 43 |
| 40 | 44 | for std in ${ABSL_CMAKE_CXX_STANDARDS}; do | 41 | 45 | for compilation_mode in ${ABSL_CMAKE_BUILD_TYPES}; do | 42 | | - echo "--------------------------------------------------------------------" | 43 | | - echo "Testing with CMAKE_BUILD_TYPE=${compilation_mode} and -std=c++${std}" | 44 | | - | 45 | | - time docker run \ | 46 | | - --volume="${ABSEIL_ROOT}:/abseil-cpp:ro" \ | 47 | | - --workdir=/abseil-cpp \ | 48 | | - --tmpfs=/buildfs:exec \ | 49 | | - --cap-add=SYS_PTRACE \ | 50 | | - --rm \ | 51 | | - -e CFLAGS="-Werror" \ | 52 | | - -e CXXFLAGS="-Werror" \ | 53 | | - "${DOCKER_CONTAINER}" \ | 54 | | - /bin/sh -c " | 55 | | - cd /buildfs && \ | 56 | | - cmake /abseil-cpp \ | 57 | | - -DABSL_USE_GOOGLETEST_HEAD=ON \ | 58 | | - -DABSL_RUN_TESTS=ON \ | 59 | | - -DCMAKE_BUILD_TYPE=${compilation_mode} \ | 60 | | - -DCMAKE_CXX_STANDARD=${std} && \ | 61 | | - make -j$(nproc) && \ | 62 | | - ctest -j$(nproc) --output-on-failure" | | 46 | + for build_shared in ${ABSL_CMAKE_BUILD_SHARED}; do | | 47 | + time docker run \ | | 48 | + --volume="${ABSEIL_ROOT}:/abseil-cpp:ro" \ | | 49 | + --workdir=/abseil-cpp \ | | 50 | + --tmpfs=/buildfs:exec \ | | 51 | + --cap-add=SYS_PTRACE \ | | 52 | + --rm \ | | 53 | + -e CFLAGS="-Werror" \ | | 54 | + -e CXXFLAGS="-Werror" \ | | 55 | + "${DOCKER_CONTAINER}" \ | | 56 | + /bin/sh -c " | | 57 | + cd /buildfs && \ | | 58 | + cmake /abseil-cpp \ | | 59 | + -DABSL_USE_GOOGLETEST_HEAD=ON \ | | 60 | + -DABSL_RUN_TESTS=ON \ | | 61 | + -DCMAKE_BUILD_TYPE=${compilation_mode} \ | | 62 | + -DCMAKE_CXX_STANDARD=${std} \ | | 63 | + -DCMAKE_MODULE_LINKER_FLAGS=\"-Wl,--no-undefined\" && \ | | 64 | + make -j$(nproc) && \ | | 65 | + ctest -j$(nproc) --output-on-failure" | | 66 | + done | 63 | 67 | done | 64 | 68 | done |
Collapse file Copy file name to clipboardExpand all lines: ci/macos_xcode_cmake.sh +19-11Lines changed: 19 additions & 11 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -28,17 +28,25 @@ if [[ -z ${ABSL_CMAKE_BUILD_TYPES:-} ]]; then | 28 | 28 | ABSL_CMAKE_BUILD_TYPES="Debug" | 29 | 29 | fi | 30 | 30 |
| | 31 | +if [[ -z ${ABSL_CMAKE_BUILD_SHARED:-} ]]; then | | 32 | + ABSL_CMAKE_BUILD_SHARED="OFF ON" | | 33 | +fi | | 34 | + | 31 | 35 | for compilation_mode in ${ABSL_CMAKE_BUILD_TYPES}; do | 32 | | - BUILD_DIR=$(mktemp -d ${compilation_mode}.XXXXXXXX) | 33 | | - cd ${BUILD_DIR} | | 36 | + for build_shared in ${ABSL_CMAKE_BUILD_SHARED}; do | | 37 | + BUILD_DIR=$(mktemp -d ${compilation_mode}.XXXXXXXX) | | 38 | + cd ${BUILD_DIR} | 34 | 39 |
| 35 | | - # TODO(absl-team): Enable -Werror once all warnings are fixed. | 36 | | - time cmake ${ABSEIL_ROOT} \ | 37 | | - -GXcode \ | 38 | | - -DCMAKE_BUILD_TYPE=${compilation_mode} \ | 39 | | - -DCMAKE_CXX_STANDARD=11 \ | 40 | | - -DABSL_USE_GOOGLETEST_HEAD=ON \ | 41 | | - -DABSL_RUN_TESTS=ON | 42 | | - time cmake --build . | 43 | | - time ctest -C ${compilation_mode} --output-on-failure | | 40 | + # TODO(absl-team): Enable -Werror once all warnings are fixed. | | 41 | + time cmake ${ABSEIL_ROOT} \ | | 42 | + -GXcode \ | | 43 | + -DBUILD_SHARED_LIBS=${build_shared} \ | | 44 | + -DCMAKE_BUILD_TYPE=${compilation_mode} \ | | 45 | + -DCMAKE_CXX_STANDARD=11 \ | | 46 | + -DCMAKE_MODULE_LINKER_FLAGS="-Wl,--no-undefined" \ | | 47 | + -DABSL_USE_GOOGLETEST_HEAD=ON \ | | 48 | + -DABSL_RUN_TESTS=ON | | 49 | + time cmake --build . | | 50 | + time ctest -C ${compilation_mode} --output-on-failure | | 51 | + done | 44 | 52 | done |
|