diff --git a/CMake/AbseilHelpers.cmake b/CMake/AbseilHelpers.cmake index 94d10778b..96813b083 100644 --- a/CMake/AbseilHelpers.cmake +++ b/CMake/AbseilHelpers.cmake @@ -112,26 +112,30 @@ endfunction() # User can then use the library as absl::main_lib (although absl_main_lib is defined too). # # TODO: Implement "ALWAYSLINK" - function(absl_cc_library) + +function(absl_cc_library) cmake_parse_arguments(ABSL_CC_LIB "DISABLE_INSTALL;PUBLIC;TESTONLY" "NAME" "HDRS;SRCS;COPTS;DEFINES;LINKOPTS;DEPS" ${ARGN} ) - if (NOT ABSL_CC_LIB_TESTONLY OR ABSL_RUN_TESTS) + + if (NOT ABSL_CC_LIB_TESTONLY OR ABSL_RUN_TESTS) if (ABSL_CC_LIB_PUBLIC) set(_NAME "absl_${ABSL_CC_LIB_NAME}") else() set(_NAME "absl_internal_${ABSL_CC_LIB_NAME}") endif() - # Check if this is a header-only library + + # Check if this is a header-only library if ("${ABSL_CC_LIB_SRCS}" STREQUAL "") set(ABSL_CC_LIB_IS_INTERFACE 1) else() set(ABSL_CC_LIB_IS_INTERFACE 0) endif() - if(NOT ABSL_CC_LIB_IS_INTERFACE) + + if(NOT ABSL_CC_LIB_IS_INTERFACE) add_library(${_NAME} STATIC "") target_sources(${_NAME} PRIVATE ${ABSL_CC_LIB_SRCS} ${ABSL_CC_LIB_HDRS}) target_include_directories(${_NAME} @@ -144,7 +148,8 @@ endfunction() PRIVATE ${ABSL_CC_LIB_LINKOPTS} ) target_compile_definitions(${_NAME} PUBLIC ${ABSL_CC_LIB_DEFINES}) - # Add all Abseil targets to a a folder in the IDE for organization. + + # Add all Abseil targets to a a folder in the IDE for organization. set_property(TARGET ${_NAME} PROPERTY FOLDER ${ABSL_IDE_FOLDER}) else() # Generating header-only library @@ -155,7 +160,8 @@ endfunction() ) target_compile_definitions(${_NAME} INTERFACE ${ABSL_CC_LIB_DEFINES}) endif() - if(ABSL_CC_LIB_PUBLIC) + + if(ABSL_CC_LIB_PUBLIC) add_library(absl::${ABSL_CC_LIB_NAME} ALIAS ${_NAME}) endif() endif() diff --git a/absl/base/thread_annotations.h b/absl/base/thread_annotations.h index fbb2797b8..2241ace4a 100644 --- a/absl/base/thread_annotations.h +++ b/absl/base/thread_annotations.h @@ -108,13 +108,23 @@ // The mutex is expected to be held both on entry to, and exit from, the // function. // +// An exclusive lock allows read-write access to the guarded data member(s), and +// only one thread can acquire a lock exclusively at any one time. A shared lock +// allows read-only access, and any number of threads can acquire a shared lock +// concurrently. +// +// Generally, non-const methods should be annotated with +// EXCLUSIVE_LOCKS_REQUIRED, while const methods should be annotated with +// SHARED_LOCKS_REQUIRED. +// // Example: // // Mutex mu1, mu2; // int a GUARDED_BY(mu1); // int b GUARDED_BY(mu2); // -// void foo() EXCLUSIVE_LOCKS_REQUIRED(mu1, mu2) { ... }; +// void foo() EXCLUSIVE_LOCKS_REQUIRED(mu1, mu2) { ... } +// void bar() const SHARED_LOCKS_REQUIRED(mu1, mu2) { ... } #define EXCLUSIVE_LOCKS_REQUIRED(...) \ THREAD_ANNOTATION_ATTRIBUTE__(exclusive_locks_required(__VA_ARGS__)) diff --git a/absl/debugging/internal/stacktrace_config.h b/absl/debugging/internal/stacktrace_config.h index dd713da8c..578e4968b 100644 --- a/absl/debugging/internal/stacktrace_config.h +++ b/absl/debugging/internal/stacktrace_config.h @@ -41,8 +41,9 @@ #define ABSL_STACKTRACE_INL_HEADER \ "absl/debugging/internal/stacktrace_aarch64-inl.inc" # elif defined(__arm__) +// Note: When using glibc this may require -funwind-tables to function properly. #define ABSL_STACKTRACE_INL_HEADER \ - "absl/debugging/internal/stacktrace_arm-inl.inc" + "absl/debugging/internal/stacktrace_generic-inl.inc" # else #define ABSL_STACKTRACE_INL_HEADER \ "absl/debugging/internal/stacktrace_unimplemented-inl.inc" diff --git a/absl/debugging/internal/stacktrace_generic-inl.inc b/absl/debugging/internal/stacktrace_generic-inl.inc index 2c9ca410c..08b87bd6a 100644 --- a/absl/debugging/internal/stacktrace_generic-inl.inc +++ b/absl/debugging/internal/stacktrace_generic-inl.inc @@ -19,6 +19,7 @@ template static int UnwindImpl(void** result, int* sizes, int max_depth, int skip_count, const void *ucp, int *min_dropped_frames) { + static_cast(ucp); // Unused. static const int kStackLength = 64; void * stack[kStackLength]; int size; diff --git a/absl/strings/internal/charconv_bigint.h b/absl/strings/internal/charconv_bigint.h index aa70af2c2..5c579437e 100644 --- a/absl/strings/internal/charconv_bigint.h +++ b/absl/strings/internal/charconv_bigint.h @@ -57,17 +57,10 @@ class BigUnsigned { "unsupported max_words value"); BigUnsigned() : size_(0), words_{} {} - explicit BigUnsigned(uint32_t v) : size_(v > 0 ? 1 : 0), words_{v} {} - explicit BigUnsigned(uint64_t v) - : size_(0), - words_{static_cast(v & 0xffffffff), - static_cast(v >> 32)} { - if (words_[1]) { - size_ = 2; - } else if (words_[0]) { - size_ = 1; - } - } + explicit constexpr BigUnsigned(uint64_t v) + : size_((v >> 32) ? 2 : v ? 1 : 0), + words_{static_cast(v & 0xffffffffu), + static_cast(v >> 32)} {} // Constructs a BigUnsigned from the given string_view containing a decimal // value. If the input std::string is not a decimal integer, constructs a 0