Export of internal Abseil changes

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

Remove a floating point division by zero test.

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

PiperOrigin-RevId: 285220804

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

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

PiperOrigin-RevId: 285132636

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

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

PiperOrigin-RevId: 285036610

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

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

PiperOrigin-RevId: 285022920

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

Implementation detail change.

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

PiperOrigin-RevId: 285012012
GitOrigin-RevId: c99f979ad34f155fbeeea69b88bdc7458d89a21c
Change-Id: I4c85d3704e45d11a9ac50d562f39640a6adbedc1
This commit is contained in:
Abseil Team 2019-12-12 10:36:03 -08:00 committed by Matt Calabrese
parent 1e39f8626a
commit 12bc53e031
339 changed files with 948 additions and 82 deletions

View file

@ -38,6 +38,7 @@ cc_library(
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":debugging_internal",
"//absl/base:config",
"//absl/base:core_headers",
],
)
@ -63,6 +64,7 @@ cc_library(
":debugging_internal",
":demangle_internal",
"//absl/base",
"//absl/base:config",
"//absl/base:core_headers",
"//absl/base:dynamic_annotations",
"//absl/base:malloc_internal",
@ -106,6 +108,7 @@ cc_library(
deps = [
":stacktrace",
":symbolize",
"//absl/base:config",
"//absl/base:core_headers",
"//absl/base:raw_logging_internal",
],
@ -168,6 +171,7 @@ cc_library(
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
"//absl/base:config",
"//absl/base:core_headers",
"//absl/base:dynamic_annotations",
"//absl/base:raw_logging_internal",
@ -181,6 +185,7 @@ cc_library(
copts = ABSL_DEFAULT_COPTS,
deps = [
"//absl/base",
"//absl/base:config",
"//absl/base:core_headers",
],
)
@ -205,7 +210,10 @@ cc_library(
srcs = ["leak_check.cc"],
hdrs = ["leak_check.h"],
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = ["//absl/base:core_headers"],
deps = [
"//absl/base:config",
"//absl/base:core_headers",
],
)
# Adding a dependency to leak_check_disable will disable
@ -216,6 +224,7 @@ cc_library(
srcs = ["leak_check_disable.cc"],
linkopts = ABSL_DEFAULT_LINKOPTS,
linkstatic = 1,
deps = ["//absl/base:config"],
alwayslink = 1,
)
@ -237,6 +246,9 @@ cc_library(
}),
linkopts = ABSL_DEFAULT_LINKOPTS,
visibility = ["//visibility:private"],
deps = [
"//absl/base:config",
],
)
cc_library(
@ -247,6 +259,9 @@ cc_library(
copts = ["-ULEAK_SANITIZER"],
linkopts = ABSL_DEFAULT_LINKOPTS,
visibility = ["//visibility:private"],
deps = [
"//absl/base:config",
],
)
cc_test(
@ -304,6 +319,7 @@ cc_library(
linkopts = ABSL_DEFAULT_LINKOPTS,
visibility = ["//visibility:private"],
deps = [
"//absl/base:config",
"//absl/base:core_headers",
"//absl/base:raw_logging_internal",
],

View file

@ -25,6 +25,7 @@ absl_cc_library(
${ABSL_DEFAULT_COPTS}
DEPS
absl::debugging_internal
absl::config
absl::core_headers
PUBLIC
)
@ -49,6 +50,7 @@ absl_cc_library(
absl::debugging_internal
absl::demangle_internal
absl::base
absl::config
absl::core_headers
absl::dynamic_annotations
absl::malloc_internal
@ -88,6 +90,7 @@ absl_cc_library(
DEPS
absl::stacktrace
absl::symbolize
absl::config
absl::core_headers
absl::raw_logging_internal
)
@ -151,6 +154,7 @@ absl_cc_library(
${ABSL_DEFAULT_COPTS}
DEPS
absl::core_headers
absl::config
absl::dynamic_annotations
absl::raw_logging_internal
)
@ -196,6 +200,7 @@ absl_cc_library(
COPTS
${ABSL_DEFAULT_COPTS}
DEPS
absl::config
absl::core_headers
PUBLIC
)
@ -293,6 +298,7 @@ absl_cc_library(
COPTS
${ABSL_DEFAULT_COPTS}
DEPS
absl::config
absl::core_headers
absl::raw_logging_internal
TESTONLY

View file

@ -47,6 +47,7 @@
#endif
namespace absl {
ABSL_NAMESPACE_BEGIN
ABSL_CONST_INIT static FailureSignalHandlerOptions fsh_options;
@ -356,4 +357,5 @@ void InstallFailureSignalHandler(const FailureSignalHandlerOptions& options) {
}
}
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -44,7 +44,10 @@
#ifndef ABSL_DEBUGGING_FAILURE_SIGNAL_HANDLER_H_
#define ABSL_DEBUGGING_FAILURE_SIGNAL_HANDLER_H_
#include "absl/base/config.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
// FailureSignalHandlerOptions
//
@ -112,6 +115,7 @@ namespace debugging_internal {
const char* FailureSignalToString(int signo);
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_DEBUGGING_FAILURE_SIGNAL_HANDLER_H_

View file

@ -20,12 +20,14 @@
#if !defined(__linux__) || defined(__ANDROID__)
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
// On platforms other than Linux, just return true.
bool AddressIsReadable(const void* /* addr */) { return true; }
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl
#else
@ -40,6 +42,7 @@ bool AddressIsReadable(const void* /* addr */) { return true; }
#include "absl/base/internal/raw_logging.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
// Pack a pid and two file descriptors into a 64-bit word,
@ -128,6 +131,7 @@ bool AddressIsReadable(const void *addr) {
}
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif

View file

@ -15,7 +15,10 @@
#ifndef ABSL_DEBUGGING_INTERNAL_ADDRESS_IS_READABLE_H_
#define ABSL_DEBUGGING_INTERNAL_ADDRESS_IS_READABLE_H_
#include "absl/base/config.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
// Return whether the byte at *addr is readable, without faulting.
@ -23,6 +26,7 @@ namespace debugging_internal {
bool AddressIsReadable(const void *addr);
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_DEBUGGING_INTERNAL_ADDRESS_IS_READABLE_H_

View file

@ -24,6 +24,7 @@
#include <limits>
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
typedef struct {
@ -1890,4 +1891,5 @@ bool Demangle(const char *mangled, char *out, int out_size) {
}
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -53,7 +53,10 @@
#ifndef ABSL_DEBUGGING_INTERNAL_DEMANGLE_H_
#define ABSL_DEBUGGING_INTERNAL_DEMANGLE_H_
#include "absl/base/config.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
// Demangle `mangled`. On success, return true and write the
@ -62,6 +65,7 @@ namespace debugging_internal {
bool Demangle(const char *mangled, char *out, int out_size);
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_DEBUGGING_INTERNAL_DEMANGLE_H_

View file

@ -23,6 +23,7 @@
#include "absl/memory/memory.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
namespace {
@ -190,4 +191,5 @@ TEST(DemangleRegression, DeeplyNestedArrayType) {
} // namespace
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -38,6 +38,7 @@
#define VERSYM_VERSION 0x7fff
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
namespace {
@ -375,6 +376,7 @@ void ElfMemImage::SymbolIterator::Update(int increment) {
}
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_HAVE_ELF_MEM_IMAGE

View file

@ -23,6 +23,8 @@
// used.
#include <climits>
#include "absl/base/config.h"
// Maybe one day we can rewrite this file not to require the elf
// symbol extensions in glibc, but for right now we need them.
#ifdef ABSL_HAVE_ELF_MEM_IMAGE
@ -39,6 +41,7 @@
#include <link.h> // for ElfW
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
// An in-memory ELF image (may not exist on disk).
@ -123,6 +126,7 @@ class ElfMemImage {
};
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_HAVE_ELF_MEM_IMAGE

View file

@ -30,6 +30,7 @@
#include "absl/debugging/symbolize.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
// Returns the program counter from signal context, nullptr if
@ -150,4 +151,5 @@ void DumpPCAndFrameSizesAndStackTrace(
}
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -17,7 +17,10 @@
#ifndef ABSL_DEBUGGING_INTERNAL_EXAMINE_STACK_H_
#define ABSL_DEBUGGING_INTERNAL_EXAMINE_STACK_H_
#include "absl/base/config.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
// Returns the program counter from signal context, or nullptr if
@ -33,6 +36,7 @@ void DumpPCAndFrameSizesAndStackTrace(
void (*writerfn)(const char*, void*), void* writerfn_arg);
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_DEBUGGING_INTERNAL_EXAMINE_STACK_H_

View file

@ -27,6 +27,7 @@
#include "absl/base/internal/raw_logging.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
namespace {
@ -177,6 +178,7 @@ int GetSignalHandlerStackConsumption(void (*signal_handler)(int)) {
}
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION

View file

@ -18,6 +18,8 @@
#ifndef ABSL_DEBUGGING_INTERNAL_STACK_CONSUMPTION_H_
#define ABSL_DEBUGGING_INTERNAL_STACK_CONSUMPTION_H_
#include "absl/base/config.h"
// The code in this module is not portable.
// Use this feature test macro to detect its availability.
#ifdef ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION
@ -27,6 +29,7 @@
#define ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION 1
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
// Returns the stack consumption in bytes for the code exercised by
@ -38,6 +41,7 @@ namespace debugging_internal {
int GetSignalHandlerStackConsumption(void (*signal_handler)(int));
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION

View file

@ -23,6 +23,7 @@
#include "absl/base/internal/raw_logging.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
namespace {
@ -43,6 +44,7 @@ TEST(SignalHandlerStackConsumptionTest, MeasuresStackConsumption) {
} // namespace
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION

View file

@ -180,11 +180,13 @@ static int UnwindImpl(void** result, int* sizes, int max_depth, int skip_count,
}
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
bool StackTraceWorksForTest() {
return true;
}
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_DEBUGGING_INTERNAL_STACKTRACE_AARCH64_INL_H_

View file

@ -113,11 +113,13 @@ static int UnwindImpl(void** result, int* sizes, int max_depth, int skip_count,
}
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
bool StackTraceWorksForTest() {
return false;
}
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_DEBUGGING_INTERNAL_STACKTRACE_ARM_INL_H_

View file

@ -87,11 +87,13 @@ static int UnwindImpl(void** result, int* sizes, int max_depth, int skip_count,
}
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
bool StackTraceWorksForTest() {
return true;
}
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_DEBUGGING_INTERNAL_STACKTRACE_GENERIC_INL_H_

View file

@ -236,11 +236,13 @@ static int UnwindImpl(void** result, int* sizes, int max_depth, int skip_count,
}
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
bool StackTraceWorksForTest() {
return true;
}
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_DEBUGGING_INTERNAL_STACKTRACE_POWERPC_INL_H_

View file

@ -12,11 +12,13 @@ static int UnwindImpl(void** /* result */, int* /* sizes */,
}
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
bool StackTraceWorksForTest() {
return false;
}
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_DEBUGGING_INTERNAL_STACKTRACE_UNIMPLEMENTED_INL_H_

View file

@ -73,11 +73,13 @@ static int UnwindImpl(void** result, int* sizes, int max_depth, int skip_count,
}
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
bool StackTraceWorksForTest() {
return false;
}
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_DEBUGGING_INTERNAL_STACKTRACE_WIN32_INL_H_

View file

@ -330,11 +330,13 @@ static int UnwindImpl(void **result, int *sizes, int max_depth, int skip_count,
}
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
bool StackTraceWorksForTest() {
return true;
}
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_DEBUGGING_INTERNAL_STACKTRACE_X86_INL_INC_

View file

@ -21,6 +21,8 @@
#include <cstddef>
#include <cstdint>
#include "absl/base/config.h"
#ifdef ABSL_INTERNAL_HAVE_ELF_SYMBOLIZE
#error ABSL_INTERNAL_HAVE_ELF_SYMBOLIZE cannot be directly set
#elif defined(__ELF__) && defined(__GLIBC__) && !defined(__native_client__) && \
@ -33,6 +35,7 @@
#include <string>
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
// Iterates over all sections, invoking callback on each with the section name
@ -51,11 +54,13 @@ bool GetSectionHeaderByName(int fd, const char *name, size_t name_len,
ElfW(Shdr) *out);
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_INTERNAL_HAVE_ELF_SYMBOLIZE
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
struct SymbolDecoratorArgs {
@ -117,6 +122,7 @@ bool GetFileMappingHint(const void** start,
const char** filename);
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_DEBUGGING_INTERNAL_SYMBOLIZE_H_

View file

@ -38,6 +38,7 @@
#endif
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
ABSL_CONST_INIT
@ -187,6 +188,7 @@ static class VDSOInitHelper {
} vdso_init_helper;
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_HAVE_VDSO_SUPPORT

View file

@ -53,6 +53,7 @@
#endif
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
// NOTE: this class may be used from within tcmalloc, and can not
@ -149,6 +150,7 @@ class VDSOSupport {
int GetCPU();
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_HAVE_ELF_MEM_IMAGE

View file

@ -21,12 +21,14 @@
#ifndef LEAK_SANITIZER
namespace absl {
ABSL_NAMESPACE_BEGIN
bool HaveLeakSanitizer() { return false; }
void DoIgnoreLeak(const void*) { }
void RegisterLivePointers(const void*, size_t) { }
void UnRegisterLivePointers(const void*, size_t) { }
LeakCheckDisabler::LeakCheckDisabler() { }
LeakCheckDisabler::~LeakCheckDisabler() { }
ABSL_NAMESPACE_END
} // namespace absl
#else
@ -34,6 +36,7 @@ LeakCheckDisabler::~LeakCheckDisabler() { }
#include <sanitizer/lsan_interface.h>
namespace absl {
ABSL_NAMESPACE_BEGIN
bool HaveLeakSanitizer() { return true; }
void DoIgnoreLeak(const void* ptr) { __lsan_ignore_object(ptr); }
void RegisterLivePointers(const void* ptr, size_t size) {
@ -44,6 +47,7 @@ void UnRegisterLivePointers(const void* ptr, size_t size) {
}
LeakCheckDisabler::LeakCheckDisabler() { __lsan_disable(); }
LeakCheckDisabler::~LeakCheckDisabler() { __lsan_enable(); }
ABSL_NAMESPACE_END
} // namespace absl
#endif // LEAK_SANITIZER

View file

@ -32,7 +32,10 @@
#include <cstddef>
#include "absl/base/config.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
// HaveLeakSanitizer()
//
@ -104,6 +107,7 @@ void RegisterLivePointers(const void* ptr, size_t size);
// `RegisterLivePointers()`, enabling leak checking of those pointers.
void UnRegisterLivePointers(const void* ptr, size_t size);
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_DEBUGGING_LEAK_CHECK_H_

View file

@ -57,6 +57,7 @@
#endif
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace {
typedef int (*Unwinder)(void**, int*, int, int, const void*, int*);
@ -135,4 +136,5 @@ int DefaultStackUnwinder(void** pcs, int* sizes, int depth, int skip,
return n;
}
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -31,7 +31,10 @@
#ifndef ABSL_DEBUGGING_STACKTRACE_H_
#define ABSL_DEBUGGING_STACKTRACE_H_
#include "absl/base/config.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
// GetStackFrames()
//
@ -222,6 +225,7 @@ namespace debugging_internal {
// working.
extern bool StackTraceWorksForTest();
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_DEBUGGING_STACKTRACE_H_

View file

@ -55,6 +55,7 @@
#include "absl/debugging/internal/symbolize.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
// InitializeSymbolizer()
//
@ -92,6 +93,7 @@ void InitializeSymbolizer(const char* argv0);
// }
bool Symbolize(const void *pc, char *out, int out_size);
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_DEBUGGING_SYMBOLIZE_H_

View file

@ -76,6 +76,7 @@
#include "absl/debugging/internal/vdso_support.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
// Value of argv[0]. Used by MaybeInitializeObjFile().
static char *argv0_value = nullptr;
@ -1475,4 +1476,5 @@ bool Symbolize(const void *pc, char *out, int out_size) {
return ok;
}
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -17,6 +17,7 @@
#include "absl/base/internal/raw_logging.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
@ -35,4 +36,5 @@ bool GetFileMappingHint(const void **, const void **, uint64_t *, const char **)
void InitializeSymbolizer(const char*) {}
bool Symbolize(const void *, char *, int) { return false; }
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -31,6 +31,7 @@
#include "absl/base/internal/raw_logging.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
static HANDLE process = NULL;
@ -76,4 +77,5 @@ bool Symbolize(const void* pc, char* out, int out_size) {
return true;
}
ABSL_NAMESPACE_END
} // namespace absl