diff --git a/absl/base/config.h b/absl/base/config.h index b247d08..a38c582 100644 --- a/absl/base/config.h +++ b/absl/base/config.h
@@ -360,7 +360,6 @@ // Darwin (macOS and iOS) __APPLE__ // Akaros (http://akaros.org) __ros__ // Windows _WIN32 -// NaCL __native_client__ // AsmJS __asmjs__ // WebAssembly (Emscripten) __EMSCRIPTEN__ // Fuchsia __Fuchsia__ @@ -375,12 +374,12 @@ // POSIX.1-2001. #ifdef ABSL_HAVE_MMAP #error ABSL_HAVE_MMAP cannot be directly set -#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \ - defined(_AIX) || defined(__ros__) || defined(__native_client__) || \ - defined(__asmjs__) || defined(__EMSCRIPTEN__) || defined(__Fuchsia__) || \ - defined(__sun) || defined(__myriad2__) || defined(__HAIKU__) || \ - defined(__OpenBSD__) || defined(__NetBSD__) || defined(__QNX__) || \ - defined(__VXWORKS__) || defined(__hexagon__) || defined(__XTENSA__) || \ +#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \ + defined(_AIX) || defined(__ros__) || defined(__asmjs__) || \ + defined(__EMSCRIPTEN__) || defined(__Fuchsia__) || defined(__sun) || \ + defined(__myriad2__) || defined(__HAIKU__) || defined(__OpenBSD__) || \ + defined(__NetBSD__) || defined(__QNX__) || defined(__VXWORKS__) || \ + defined(__hexagon__) || defined(__XTENSA__) || \ defined(_WASI_EMULATED_MMAN) #define ABSL_HAVE_MMAP 1 #endif @@ -457,8 +456,6 @@ // WASI doesn't support signals #elif defined(__Fuchsia__) // Signals don't exist on fuchsia. -#elif defined(__native_client__) -// Signals don't exist on hexagon/QuRT #elif defined(__hexagon__) #else // other standard libraries
diff --git a/absl/base/internal/dynamic_annotations.h b/absl/base/internal/dynamic_annotations.h index b23c5ec..537a2fe 100644 --- a/absl/base/internal/dynamic_annotations.h +++ b/absl/base/internal/dynamic_annotations.h
@@ -89,7 +89,7 @@ #endif // Memory annotations are also made available to LLVM's Memory Sanitizer -#if defined(ABSL_HAVE_MEMORY_SANITIZER) && !defined(__native_client__) +#if defined(ABSL_HAVE_MEMORY_SANITIZER) #define ABSL_INTERNAL_MEMORY_ANNOTATIONS_ENABLED 1 #endif
diff --git a/absl/base/internal/raw_logging.cc b/absl/base/internal/raw_logging.cc index 35a08f0..8537f3e 100644 --- a/absl/base/internal/raw_logging.cc +++ b/absl/base/internal/raw_logging.cc
@@ -41,9 +41,8 @@ // // This preprocessor token is also defined in raw_io.cc. If you need to copy // this, consider moving both to config.h instead. -#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \ - defined(__hexagon__) || defined(__Fuchsia__) || \ - defined(__native_client__) || defined(__OpenBSD__) || \ +#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \ + defined(__hexagon__) || defined(__Fuchsia__) || defined(__OpenBSD__) || \ defined(__EMSCRIPTEN__) || defined(__ASYLO__) #include <unistd.h> @@ -158,7 +157,7 @@ #endif #ifdef ABSL_MIN_LOG_LEVEL - if (severity < static_cast<absl::LogSeverity>(ABSL_MIN_LOG_LEVEL) && + if (severity < static_cast<absl::LogSeverityAtLeast>(ABSL_MIN_LOG_LEVEL) && severity < absl::LogSeverity::kFatal) { enabled = false; }
diff --git a/absl/base/internal/sysinfo.cc b/absl/base/internal/sysinfo.cc index 1937db3..a62dd31 100644 --- a/absl/base/internal/sysinfo.cc +++ b/absl/base/internal/sysinfo.cc
@@ -456,15 +456,6 @@ pid_t GetTID() { return static_cast<pid_t>(_lwp_self()); } -#elif defined(__native_client__) - -pid_t GetTID() { - auto* thread = pthread_self(); - static_assert(sizeof(pid_t) == sizeof(thread), - "In NaCL int expected to be the same size as a pointer"); - return reinterpret_cast<pid_t>(thread); -} - #elif defined(__Fuchsia__) pid_t GetTID() {
diff --git a/absl/base/internal/sysinfo_test.cc b/absl/base/internal/sysinfo_test.cc index 0fbd163..b4c75f5 100644 --- a/absl/base/internal/sysinfo_test.cc +++ b/absl/base/internal/sysinfo_test.cc
@@ -39,12 +39,6 @@ TEST(SysinfoTest, GetTID) { EXPECT_EQ(GetTID(), GetTID()); // Basic compile and equality test. -#ifdef __native_client__ - // Native Client has a race condition bug that leads to memory - // exhaustion when repeatedly creating and joining threads. - // https://bugs.chromium.org/p/nativeclient/issues/detail?id=1027 - return; -#endif // Test that TIDs are unique to each thread. // Uses a few loops to exercise implementations that reallocate IDs. for (int i = 0; i < 10; ++i) {
diff --git a/absl/base/internal/unscaledcycleclock_config.h b/absl/base/internal/unscaledcycleclock_config.h index 43a3dab..9a0841d 100644 --- a/absl/base/internal/unscaledcycleclock_config.h +++ b/absl/base/internal/unscaledcycleclock_config.h
@@ -34,7 +34,7 @@ // CycleClock that runs at atleast 1 MHz. We've found some Android // ARM64 devices where this is not the case, so we disable it by // default on Android ARM64. -#if defined(__native_client__) || (defined(__APPLE__)) || \ +#if defined(__APPLE__) || \ (defined(__ANDROID__) && defined(__aarch64__)) #define ABSL_USE_UNSCALED_CYCLECLOCK_DEFAULT 0 #else
diff --git a/absl/base/optimization.h b/absl/base/optimization.h index 429ea9c..04678c4 100644 --- a/absl/base/optimization.h +++ b/absl/base/optimization.h
@@ -53,9 +53,7 @@ // ABSL_BLOCK_TAIL_CALL_OPTIMIZATION(); // return result; // } -#if defined(__pnacl__) -#define ABSL_BLOCK_TAIL_CALL_OPTIMIZATION() if (volatile int x = 0) { (void)x; } -#elif defined(__clang__) +#if defined(__clang__) // Clang will not tail call given inline volatile assembly. #define ABSL_BLOCK_TAIL_CALL_OPTIMIZATION() __asm__ __volatile__("") #elif defined(__GNUC__)
diff --git a/absl/container/internal/raw_hash_set.h b/absl/container/internal/raw_hash_set.h index 23d64bb..4850e7e 100644 --- a/absl/container/internal/raw_hash_set.h +++ b/absl/container/internal/raw_hash_set.h
@@ -2390,13 +2390,13 @@ // s.insert({"abc", 42}); std::pair<iterator, bool> insert(init_type&& value) ABSL_ATTRIBUTE_LIFETIME_BOUND -#if __cplusplus >= 202002L +#if ABSL_INTERNAL_CPLUSPLUS_LANG >= 202002L requires(!IsLifetimeBoundAssignmentFrom<init_type>::value) #endif { return emplace(std::move(value)); } -#if __cplusplus >= 202002L +#if ABSL_INTERNAL_CPLUSPLUS_LANG >= 202002L std::pair<iterator, bool> insert( init_type&& value ABSL_INTERNAL_ATTRIBUTE_CAPTURED_BY(this)) ABSL_ATTRIBUTE_LIFETIME_BOUND @@ -3184,31 +3184,41 @@ auto seq = probe(common(), hash); const h2_t h2 = H2(hash); const ctrl_t* ctrl = control(); - while (true) { + size_t index; + bool inserted; + // We use a lambda function to be able to exit from the nested loop without + // duplicating generated code for the return statement (e.g. iterator_at). + [&] { + while (true) { #ifndef ABSL_HAVE_MEMORY_SANITIZER - absl::PrefetchToLocalCache(slot_array() + seq.offset()); + absl::PrefetchToLocalCache(slot_array() + seq.offset()); #endif - Group g{ctrl + seq.offset()}; - for (uint32_t i : g.Match(h2)) { - if (ABSL_PREDICT_TRUE(equal_to(key, slot_array() + seq.offset(i)))) - return {iterator_at(seq.offset(i)), false}; + Group g{ctrl + seq.offset()}; + for (uint32_t i : g.Match(h2)) { + if (ABSL_PREDICT_TRUE(equal_to(key, slot_array() + seq.offset(i)))) { + index = seq.offset(i); + inserted = false; + return; + } + } + auto mask_empty = g.MaskEmpty(); + if (ABSL_PREDICT_TRUE(mask_empty)) { + size_t target = seq.offset(mask_empty.LowestBitSet()); + index = SwisstableGenerationsEnabled() + ? PrepareInsertLargeGenerationsEnabled( + common(), GetPolicyFunctions(), hash, + FindInfo{target, seq.index()}, + HashKey<hasher, K, kIsDefaultHash>{hash_ref(), key}) + : PrepareInsertLarge(common(), GetPolicyFunctions(), hash, + FindInfo{target, seq.index()}); + inserted = true; + return; + } + seq.next(); + ABSL_SWISSTABLE_ASSERT(seq.index() <= capacity() && "full table!"); } - auto mask_empty = g.MaskEmpty(); - if (ABSL_PREDICT_TRUE(mask_empty)) { - size_t target = seq.offset(mask_empty.LowestBitSet()); - size_t index = - SwisstableGenerationsEnabled() - ? PrepareInsertLargeGenerationsEnabled( - common(), GetPolicyFunctions(), hash, - FindInfo{target, seq.index()}, - HashKey<hasher, K, kIsDefaultHash>{hash_ref(), key}) - : PrepareInsertLarge(common(), GetPolicyFunctions(), hash, - FindInfo{target, seq.index()}); - return {iterator_at(index), true}; - } - seq.next(); - ABSL_SWISSTABLE_ASSERT(seq.index() <= capacity() && "full table!"); - } + }(); + return {iterator_at(index), inserted}; } protected:
diff --git a/absl/debugging/internal/elf_mem_image.h b/absl/debugging/internal/elf_mem_image.h index 1fac29c..c8a1036 100644 --- a/absl/debugging/internal/elf_mem_image.h +++ b/absl/debugging/internal/elf_mem_image.h
@@ -32,10 +32,10 @@ #error ABSL_HAVE_ELF_MEM_IMAGE cannot be directly set #endif -#if defined(__ELF__) && !defined(__OpenBSD__) && !defined(__QNX__) && \ - !defined(__native_client__) && !defined(__asmjs__) && \ - !defined(__wasm__) && !defined(__HAIKU__) && !defined(__sun) && \ - !defined(__VXWORKS__) && !defined(__hexagon__) && !defined(__XTENSA__) +#if defined(__ELF__) && !defined(__OpenBSD__) && !defined(__QNX__) && \ + !defined(__asmjs__) && !defined(__wasm__) && !defined(__HAIKU__) && \ + !defined(__sun) && !defined(__VXWORKS__) && !defined(__hexagon__) && \ + !defined(__XTENSA__) #define ABSL_HAVE_ELF_MEM_IMAGE 1 #endif
diff --git a/absl/debugging/internal/stacktrace_aarch64-inl.inc b/absl/debugging/internal/stacktrace_aarch64-inl.inc index 1746b5d..bbdce77 100644 --- a/absl/debugging/internal/stacktrace_aarch64-inl.inc +++ b/absl/debugging/internal/stacktrace_aarch64-inl.inc
@@ -123,7 +123,7 @@ // earlier in the stack than the old_frame_pointer, then use it. If it is // later, then we have already unwound through it and it needs no special // handling. - if (pre_signal_frame_pointer >= old_frame_pointer) { + if (pre_signal_frame_pointer > old_frame_pointer) { new_frame_pointer = pre_signal_frame_pointer; } }
diff --git a/absl/debugging/internal/stacktrace_riscv-inl.inc b/absl/debugging/internal/stacktrace_riscv-inl.inc index f9919c6..7ae7fef 100644 --- a/absl/debugging/internal/stacktrace_riscv-inl.inc +++ b/absl/debugging/internal/stacktrace_riscv-inl.inc
@@ -162,7 +162,8 @@ absl::debugging_internal::StripPointerMetadata(frame_pointer); } if (sizes != nullptr) { - sizes[n] = ComputeStackFrameSize(frame_pointer, next_frame_pointer); + sizes[n] = static_cast<int>( + ComputeStackFrameSize(frame_pointer, next_frame_pointer)); } } n++;
diff --git a/absl/debugging/internal/symbolize.h b/absl/debugging/internal/symbolize.h index 5593fde..509f426 100644 --- a/absl/debugging/internal/symbolize.h +++ b/absl/debugging/internal/symbolize.h
@@ -28,8 +28,8 @@ #ifdef ABSL_INTERNAL_HAVE_ELF_SYMBOLIZE #error ABSL_INTERNAL_HAVE_ELF_SYMBOLIZE cannot be directly set -#elif defined(__ELF__) && defined(__GLIBC__) && !defined(__native_client__) \ - && !defined(__asmjs__) && !defined(__wasm__) +#elif defined(__ELF__) && defined(__GLIBC__) && !defined(__asmjs__) \ + && !defined(__wasm__) #define ABSL_INTERNAL_HAVE_ELF_SYMBOLIZE 1 #include <elf.h>
diff --git a/absl/log/check_test_impl.inc b/absl/log/check_test_impl.inc index 7bcedd4..495f85a 100644 --- a/absl/log/check_test_impl.inc +++ b/absl/log/check_test_impl.inc
@@ -292,8 +292,7 @@ ExampleTypeThatHasNoStreamOperator a{true}; ExampleTypeThatHasNoStreamOperator b{false}; ABSL_TEST_CHECK_EQ(a, a); - EXPECT_DEATH(ABSL_TEST_CHECK_EQ(a, b), - "Check failed: a == b \\(UNPRINTABLE vs. UNPRINTABLE\\)"); + EXPECT_DEATH(ABSL_TEST_CHECK_EQ(a, b), "Check failed: a == b"); ABSL_TEST_CHECK_EQ(a, true); EXPECT_DEATH(ABSL_TEST_CHECK_EQ(a, false), "Check failed: a == false \\(UNPRINTABLE vs. 0\\)");
diff --git a/absl/log/internal/check_op.cc b/absl/log/internal/check_op.cc index 5db98dd..be8ceaf 100644 --- a/absl/log/internal/check_op.cc +++ b/absl/log/internal/check_op.cc
@@ -101,7 +101,9 @@ } } -void MakeCheckOpUnprintableString(std::ostream& os) { os << "UNPRINTABLE"; } +std::ostream& operator<<(std::ostream& os, UnprintableWrapper) { + return os << "UNPRINTABLE"; +} // Helper functions for string comparisons. #define DEFINE_CHECK_STROP_IMPL(name, func, expected) \
diff --git a/absl/log/internal/check_op.h b/absl/log/internal/check_op.h index c607864..c9dcc05 100644 --- a/absl/log/internal/check_op.h +++ b/absl/log/internal/check_op.h
@@ -46,10 +46,10 @@ // `ABSL_LOG_INTERNAL_STRIP_STRING_LITERAL` wraps string literals that // should be stripped when `ABSL_MIN_LOG_LEVEL` exceeds `kFatal`. #ifdef ABSL_MIN_LOG_LEVEL -#define ABSL_LOG_INTERNAL_STRIP_STRING_LITERAL(literal) \ - (::absl::LogSeverity::kFatal >= \ - static_cast<::absl::LogSeverity>(ABSL_MIN_LOG_LEVEL) \ - ? (literal) \ +#define ABSL_LOG_INTERNAL_STRIP_STRING_LITERAL(literal) \ + (::absl::LogSeverity::kFatal >= \ + static_cast<::absl::LogSeverityAtLeast>(ABSL_MIN_LOG_LEVEL) \ + ? (literal) \ : "") #else #define ABSL_LOG_INTERNAL_STRIP_STRING_LITERAL(literal) (literal) @@ -225,17 +225,12 @@ void MakeCheckOpValueString(std::ostream& os, unsigned char v); void MakeCheckOpValueString(std::ostream& os, const void* absl_nullable p); -void MakeCheckOpUnprintableString(std::ostream& os); - // A wrapper for types that have no operator<<. struct UnprintableWrapper { template <typename T> explicit UnprintableWrapper(const T&) {} - friend std::ostream& operator<<(std::ostream& os, const UnprintableWrapper&) { - MakeCheckOpUnprintableString(os); - return os; - } + friend std::ostream& operator<<(std::ostream& os, UnprintableWrapper); }; namespace detect_specialization { @@ -400,10 +395,16 @@ template <typename T1, typename T2> const char* absl_nonnull MakeCheckOpString(T1 v1, T2 v2, const char* absl_nonnull exprtext) { - CheckOpMessageBuilder comb(exprtext); - MakeCheckOpValueString(comb.ForVar1(), v1); - MakeCheckOpValueString(comb.ForVar2(), v2); - return comb.NewString(); + if constexpr (std::is_same_v<CheckOpStreamType<T1>, UnprintableWrapper> && + std::is_same_v<CheckOpStreamType<T2>, UnprintableWrapper>) { + // No sense printing " (UNPRINTABLE vs. UNPRINTABLE)" + return exprtext; + } else { + CheckOpMessageBuilder comb(exprtext); + MakeCheckOpValueString(comb.ForVar1(), v1); + MakeCheckOpValueString(comb.ForVar2(), v2); + return comb.NewString(); + } } // Add a few commonly used instantiations as extern to reduce size of objects @@ -434,7 +435,7 @@ #ifdef ABSL_MIN_LOG_LEVEL #define ABSL_LOG_INTERNAL_CHECK_OP_IMPL_RESULT(U1, U2, v1, v2, exprtext) \ ((::absl::LogSeverity::kFatal >= \ - static_cast<::absl::LogSeverity>(ABSL_MIN_LOG_LEVEL)) \ + static_cast<::absl::LogSeverityAtLeast>(ABSL_MIN_LOG_LEVEL)) \ ? MakeCheckOpString<U1, U2>(v1, v2, exprtext) \ : "") #else
diff --git a/absl/log/internal/conditions.h b/absl/log/internal/conditions.h index 6fb74b1..3325a31 100644 --- a/absl/log/internal/conditions.h +++ b/absl/log/internal/conditions.h
@@ -108,46 +108,49 @@ #ifdef ABSL_MIN_LOG_LEVEL #define ABSL_LOG_INTERNAL_CONDITION_INFO(type, condition) \ ABSL_LOG_INTERNAL_##type##_CONDITION( \ - (condition) && ::absl::LogSeverity::kInfo >= \ - static_cast<::absl::LogSeverity>(ABSL_MIN_LOG_LEVEL)) + (condition) && \ + ::absl::LogSeverity::kInfo >= \ + static_cast<::absl::LogSeverityAtLeast>(ABSL_MIN_LOG_LEVEL)) #define ABSL_LOG_INTERNAL_CONDITION_WARNING(type, condition) \ ABSL_LOG_INTERNAL_##type##_CONDITION( \ - (condition) && ::absl::LogSeverity::kWarning >= \ - static_cast<::absl::LogSeverity>(ABSL_MIN_LOG_LEVEL)) + (condition) && \ + ::absl::LogSeverity::kWarning >= \ + static_cast<::absl::LogSeverityAtLeast>(ABSL_MIN_LOG_LEVEL)) #define ABSL_LOG_INTERNAL_CONDITION_ERROR(type, condition) \ ABSL_LOG_INTERNAL_##type##_CONDITION( \ - (condition) && ::absl::LogSeverity::kError >= \ - static_cast<::absl::LogSeverity>(ABSL_MIN_LOG_LEVEL)) + (condition) && \ + ::absl::LogSeverity::kError >= \ + static_cast<::absl::LogSeverityAtLeast>(ABSL_MIN_LOG_LEVEL)) #define ABSL_LOG_INTERNAL_CONDITION_DO_NOT_SUBMIT(type, condition) \ ABSL_LOG_INTERNAL_CONDITION_ERROR(type, condition) // NOTE: Use ternary operators instead of short-circuiting to mitigate // https://bugs.llvm.org/show_bug.cgi?id=51928. #define ABSL_LOG_INTERNAL_CONDITION_FATAL(type, condition) \ ABSL_LOG_INTERNAL_##type##_CONDITION( \ - ((condition) \ - ? (::absl::LogSeverity::kFatal >= \ - static_cast<::absl::LogSeverity>(ABSL_MIN_LOG_LEVEL) \ - ? true \ - : (::absl::log_internal::AbortQuietly(), false)) \ - : false)) + ((condition) ? (::absl::LogSeverity::kFatal >= \ + static_cast<::absl::LogSeverityAtLeast>( \ + ABSL_MIN_LOG_LEVEL) \ + ? true \ + : (::absl::log_internal::AbortQuietly(), false)) \ + : false)) // NOTE: Use ternary operators instead of short-circuiting to mitigate // https://bugs.llvm.org/show_bug.cgi?id=51928. -#define ABSL_LOG_INTERNAL_CONDITION_QFATAL(type, condition) \ - ABSL_LOG_INTERNAL_##type##_CONDITION( \ - ((condition) \ - ? (::absl::LogSeverity::kFatal >= \ - static_cast<::absl::LogSeverity>(ABSL_MIN_LOG_LEVEL) \ - ? true \ - : (::absl::log_internal::ExitQuietly(), false)) \ - : false)) -#define ABSL_LOG_INTERNAL_CONDITION_DFATAL(type, condition) \ - ABSL_LOG_INTERNAL_##type##_CONDITION( \ - (ABSL_ASSUME(absl::kLogDebugFatal == absl::LogSeverity::kError || \ - absl::kLogDebugFatal == absl::LogSeverity::kFatal), \ - (condition) && \ - (::absl::kLogDebugFatal >= \ - static_cast<::absl::LogSeverity>(ABSL_MIN_LOG_LEVEL) || \ - (::absl::kLogDebugFatal == ::absl::LogSeverity::kFatal && \ +#define ABSL_LOG_INTERNAL_CONDITION_QFATAL(type, condition) \ + ABSL_LOG_INTERNAL_##type##_CONDITION( \ + ((condition) ? (::absl::LogSeverity::kFatal >= \ + static_cast<::absl::LogSeverityAtLeast>( \ + ABSL_MIN_LOG_LEVEL) \ + ? true \ + : (::absl::log_internal::ExitQuietly(), false)) \ + : false)) +#define ABSL_LOG_INTERNAL_CONDITION_DFATAL(type, condition) \ + ABSL_LOG_INTERNAL_##type##_CONDITION( \ + (ABSL_ASSUME(absl::kLogDebugFatal == absl::LogSeverity::kError || \ + absl::kLogDebugFatal == absl::LogSeverity::kFatal), \ + (condition) && \ + (::absl::kLogDebugFatal >= \ + static_cast<::absl::LogSeverityAtLeast>(ABSL_MIN_LOG_LEVEL) || \ + (::absl::kLogDebugFatal == ::absl::LogSeverity::kFatal && \ (::absl::log_internal::AbortQuietly(), false))))) #define ABSL_LOG_INTERNAL_CONDITION_LEVEL(severity) \ @@ -157,13 +160,13 @@ ::absl::NormalizeLogSeverity(severity); \ absl_log_internal_severity_loop; absl_log_internal_severity_loop = 0) \ ABSL_LOG_INTERNAL_CONDITION_LEVEL_IMPL -#define ABSL_LOG_INTERNAL_CONDITION_LEVEL_IMPL(type, condition) \ - ABSL_LOG_INTERNAL_##type##_CONDITION(( \ - (condition) && \ - (absl_log_internal_severity >= \ - static_cast<::absl::LogSeverity>(ABSL_MIN_LOG_LEVEL) || \ - (absl_log_internal_severity == ::absl::LogSeverity::kFatal && \ - (::absl::log_internal::AbortQuietly(), false))))) +#define ABSL_LOG_INTERNAL_CONDITION_LEVEL_IMPL(type, condition) \ + ABSL_LOG_INTERNAL_##type##_CONDITION( \ + ((condition) && \ + (absl_log_internal_severity >= \ + static_cast<::absl::LogSeverityAtLeast>(ABSL_MIN_LOG_LEVEL) || \ + (absl_log_internal_severity == ::absl::LogSeverity::kFatal && \ + (::absl::log_internal::AbortQuietly(), false))))) #else // ndef ABSL_MIN_LOG_LEVEL #define ABSL_LOG_INTERNAL_CONDITION_INFO(type, condition) \ ABSL_LOG_INTERNAL_##type##_CONDITION(condition)
diff --git a/absl/meta/type_traits.h b/absl/meta/type_traits.h index 02c1e63..e2f4600 100644 --- a/absl/meta/type_traits.h +++ b/absl/meta/type_traits.h
@@ -40,6 +40,7 @@ #include <string> #include <string_view> #include <type_traits> +#include <utility> #include <vector> #include "absl/base/attributes.h" @@ -451,7 +452,7 @@ // Detects if a class's definition has declared itself to be an owner by // declaring -// using absl_internal_is_view = std::true_type; +// using absl_internal_is_view = std::false_type; // as a member. // Types that don't want either must either omit this declaration entirely, or // (if e.g. inheriting from a base class) define the member to something that @@ -479,6 +480,17 @@ template <typename T> struct IsOwner : IsOwnerImpl<T> {}; +// This allows incomplete types to be used for associative containers, and also +// expands the set of types we can handle to include std::pair. +template <typename T1, typename T2> +struct IsOwner<std::pair<T1, T2>> + : std::integral_constant< + bool, std::conditional_t<std::is_reference_v<T1>, std::false_type, + IsOwner<std::remove_cv_t<T1>>>::value && + std::conditional_t<std::is_reference_v<T2>, std::false_type, + IsOwner<std::remove_cv_t<T2>>>::value> { +}; + template <typename T, typename Traits, typename Alloc> struct IsOwner<std::basic_string<T, Traits, Alloc>> : std::true_type {}; @@ -513,6 +525,13 @@ struct IsView : std::integral_constant<bool, std::is_pointer<T>::value || IsViewImpl<T>::value> {}; +// This allows incomplete types to be used for associative containers, and also +// expands the set of types we can handle to include std::pair. +template <typename T1, typename T2> +struct IsView<std::pair<T1, T2>> + : std::integral_constant<bool, IsView<std::remove_cv_t<T1>>::value && + IsView<std::remove_cv_t<T2>>::value> {}; + template <typename Char, typename Traits> struct IsView<std::basic_string_view<Char, Traits>> : std::true_type {};
diff --git a/absl/meta/type_traits_test.cc b/absl/meta/type_traits_test.cc index 3d55a00..8142290 100644 --- a/absl/meta/type_traits_test.cc +++ b/absl/meta/type_traits_test.cc
@@ -36,6 +36,9 @@ absl::conjunction<absl::type_traits_internal::IsOwner<T>, absl::negation<absl::type_traits_internal::IsView<T>>>; +static_assert( + IsOwnerAndNotView<std::pair<std::vector<int>, std::string>>::value, + "pair of owners is an owner, not a view"); static_assert(IsOwnerAndNotView<std::vector<int>>::value, "vector is an owner, not a view"); static_assert(IsOwnerAndNotView<std::string>::value,
diff --git a/absl/random/internal/fastmath_test.cc b/absl/random/internal/fastmath_test.cc index 0d6f9dc..0b9ae5e 100644 --- a/absl/random/internal/fastmath_test.cc +++ b/absl/random/internal/fastmath_test.cc
@@ -16,12 +16,10 @@ #include "gtest/gtest.h" -#if defined(__native_client__) || defined(__EMSCRIPTEN__) -// NACL has a less accurate implementation of std::log2 than most of +#if defined(__EMSCRIPTEN__) +// Emscripten has a less accurate implementation of std::log2 than most of // the other platforms. For some values which should have integral results, -// sometimes NACL returns slightly larger values. -// -// The MUSL libc used by emscripten also has a similar bug. +// sometimes Emscripten returns slightly larger values. #define ABSL_RANDOM_INACCURATE_LOG2 #endif
diff --git a/absl/random/internal/platform.h b/absl/random/internal/platform.h index bd2993e..a6fde4b 100644 --- a/absl/random/internal/platform.h +++ b/absl/random/internal/platform.h
@@ -35,7 +35,6 @@ // Darwin (macOS and iOS) __APPLE__ // Akaros (http://akaros.org) __ros__ // Windows _WIN32 -// NaCL __native_client__ // AsmJS __asmjs__ // WebAssembly __wasm__ // Fuchsia __Fuchsia__ @@ -125,12 +124,6 @@ #endif -// NaCl does not allow AES. -#if defined(__native_client__) -#undef ABSL_HAVE_ACCELERATED_AES -#define ABSL_HAVE_ACCELERATED_AES 0 -#endif - // ABSL_RANDOM_INTERNAL_AES_DISPATCH indicates whether the currently active // platform has, or should use run-time dispatch for selecting the // accelerated Randen implementation. @@ -162,10 +155,4 @@ #define ABSL_RANDOM_INTERNAL_AES_DISPATCH 1 #endif -// NaCl does not allow dispatch. -#if defined(__native_client__) -#undef ABSL_RANDOM_INTERNAL_AES_DISPATCH -#define ABSL_RANDOM_INTERNAL_AES_DISPATCH 0 -#endif - #endif // ABSL_RANDOM_INTERNAL_PLATFORM_H_
diff --git a/absl/random/internal/randen_engine_test.cc b/absl/random/internal/randen_engine_test.cc index a94f491..122d90b 100644 --- a/absl/random/internal/randen_engine_test.cc +++ b/absl/random/internal/randen_engine_test.cc
@@ -632,7 +632,6 @@ // // linux, optimized ~5ns // ppc, optimized ~7ns - // nacl (slow), ~1100ns // // `kCount` is chosen below so that, in debug builds and without hardware // acceleration, the test (assuming ~1us per call) should finish in ~0.1s
diff --git a/absl/random/internal/seed_material.cc b/absl/random/internal/seed_material.cc index 8099ec7..b6380c8 100644 --- a/absl/random/internal/seed_material.cc +++ b/absl/random/internal/seed_material.cc
@@ -41,12 +41,7 @@ #include "absl/types/optional.h" #include "absl/types/span.h" -#if defined(__native_client__) - -#include <nacl/nacl_random.h> -#define ABSL_RANDOM_USE_NACL_SECURE_RANDOM 1 - -#elif defined(_WIN32) +#if defined(_WIN32) #include <windows.h> #define ABSL_RANDOM_USE_BCRYPT 1 @@ -109,27 +104,6 @@ return BCRYPT_SUCCESS(ret); } -#elif defined(ABSL_RANDOM_USE_NACL_SECURE_RANDOM) - -// On NaCL use nacl_secure_random to acquire bytes. -bool ReadSeedMaterialFromOSEntropyImpl(absl::Span<uint32_t> values) { - auto buffer = reinterpret_cast<uint8_t*>(values.data()); - size_t buffer_size = sizeof(uint32_t) * values.size(); - - uint8_t* output_ptr = buffer; - while (buffer_size > 0) { - size_t nread = 0; - const int error = nacl_secure_random(output_ptr, buffer_size, &nread); - if (error != 0 || nread > buffer_size) { - ABSL_RAW_LOG(ERROR, "Failed to read secure_random seed data: %d", error); - return false; - } - output_ptr += nread; - buffer_size -= nread; - } - return true; -} - #elif defined(__Fuchsia__) bool ReadSeedMaterialFromOSEntropyImpl(absl::Span<uint32_t> values) {
diff --git a/absl/strings/cord.cc b/absl/strings/cord.cc index e53f914..a7e0994 100644 --- a/absl/strings/cord.cc +++ b/absl/strings/cord.cc
@@ -161,8 +161,10 @@ // -------------------------------------------------------------------- // Cord::InlineRep functions -inline void Cord::InlineRep::set_data(const char* absl_nonnull data, size_t n) { +inline void Cord::InlineRep::set_data(const char* absl_nullable data, + size_t n) { static_assert(kMaxInline == 15, "set_data is hard-coded for a length of 15"); + assert(data != nullptr || n == 0); data_.set_inline_data(data, n); }
diff --git a/absl/strings/cord.h b/absl/strings/cord.h index edda551..fa6eb8a 100644 --- a/absl/strings/cord.h +++ b/absl/strings/cord.h
@@ -921,7 +921,7 @@ // Returns nullptr if holding pointer const char* absl_nullable data() const; // Discards pointer, if any - void set_data(const char* absl_nonnull data, size_t n); + void set_data(const char* absl_nullable data, size_t n); char* absl_nonnull set_data(size_t n); // Write data to the result // Returns nullptr if holding bytes absl::cord_internal::CordRep* absl_nullable tree() const;
diff --git a/absl/strings/internal/str_format/checker.h b/absl/strings/internal/str_format/checker.h index eab6ab9..ee3df26 100644 --- a/absl/strings/internal/str_format/checker.h +++ b/absl/strings/internal/str_format/checker.h
@@ -28,11 +28,9 @@ // We disable format checker under vscode intellisense compilation. // See https://github.com/microsoft/vscode-cpptools/issues/3683 for // more details. -#if ABSL_HAVE_ATTRIBUTE(enable_if) && !defined(__native_client__) && \ - !defined(__INTELLISENSE__) +#if ABSL_HAVE_ATTRIBUTE(enable_if) && !defined(__INTELLISENSE__) #define ABSL_INTERNAL_ENABLE_FORMAT_CHECKER 1 -#endif // ABSL_HAVE_ATTRIBUTE(enable_if) && !defined(__native_client__) && - // !defined(__INTELLISENSE__) +#endif // ABSL_HAVE_ATTRIBUTE(enable_if) && !defined(__INTELLISENSE__) #endif // ABSL_INTERNAL_ENABLE_FORMAT_CHECKER namespace absl {
diff --git a/absl/strings/str_format_test.cc b/absl/strings/str_format_test.cc index 3f265d1..a4c877a 100644 --- a/absl/strings/str_format_test.cc +++ b/absl/strings/str_format_test.cc
@@ -65,8 +65,8 @@ "", "a", "%80d", -#if !defined(_MSC_VER) && !defined(__ANDROID__) && !defined(__native_client__) - // MSVC, NaCL and Android don't support positional syntax. +#if !defined(_MSC_VER) && !defined(__ANDROID__) + // MSVC and Android don't support positional syntax. "complicated multipart %% %1$d format %1$0999d", #endif // _MSC_VER }; @@ -266,8 +266,8 @@ "a", "%80d", "%d %u %c %s %f %g", -#if !defined(_MSC_VER) && !defined(__ANDROID__) && !defined(__native_client__) - // MSVC, NaCL and Android don't support positional syntax. +#if !defined(_MSC_VER) && !defined(__ANDROID__) + // MSVC and Android don't support positional syntax. "complicated multipart %% %1$d format %1$080d", #endif // _MSC_VER };
diff --git a/absl/synchronization/mutex.h b/absl/synchronization/mutex.h index 77ab7c4..dce8b8f 100644 --- a/absl/synchronization/mutex.h +++ b/absl/synchronization/mutex.h
@@ -1123,7 +1123,7 @@ void Release() ABSL_UNLOCK_FUNCTION(); private: - Mutex* absl_nonnull mu_; + Mutex* absl_nullable mu_; ReleasableMutexLock(const ReleasableMutexLock&) = delete; ReleasableMutexLock(ReleasableMutexLock&&) = delete; ReleasableMutexLock& operator=(const ReleasableMutexLock&) = delete;