blob: 52d4f42d52920ed6f07f58022ac56126a318aa05 [file] [log] [blame]
From a9831f1cbf93fb18dd951453635f488037454ce9 Mon Sep 17 00:00:00 2001
From: Abseil Team <absl-team@google.com>
Date: Mon, 3 May 2021 07:37:39 -0700
Subject: [PATCH] Export of internal Abseil changes
--
cf88f9cf40eab54c06bca7f20795352ec23bb583 by Derek Mauro <dmauro@google.com>:
Fixes build with latest glibc
Fixes #952
PiperOrigin-RevId: 371693908
--
99bcd0f4a747ce7a401e23c745adf34d0ec5131b by Samuel Benzaquen <sbenza@google.com>:
Add support for std::string_view in StrFormat even when
absl::string_view != std::string_view.
PiperOrigin-RevId: 371693633
--
e35463572149a6c2d4a0d439b9300ce03fd6b96d by Abseil Team <absl-team@google.com>:
Cmake builds should only install pkg-config when explicitly requested.
PiperOrigin-RevId: 371403419
GitOrigin-RevId: cf88f9cf40eab54c06bca7f20795352ec23bb583
Change-Id: I4360a18c638a4d901ff44ab1e0a9d8f321c302ea
---
CMake/AbseilHelpers.cmake | 3 ++-
absl/debugging/failure_signal_handler.cc | 3 ++-
absl/strings/internal/str_format/arg.h | 8 ++++++++
absl/strings/internal/str_format/convert_test.cc | 3 +++
4 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/CMake/AbseilHelpers.cmake b/CMake/AbseilHelpers.cmake
index 1f754392..1a80b5b4 100644
--- a/CMake/AbseilHelpers.cmake
+++ b/CMake/AbseilHelpers.cmake
@@ -141,7 +141,8 @@ function(absl_cc_library)
endif()
# Generate a pkg-config file for every library:
- if(_build_type STREQUAL "static" OR _build_type STREQUAL "shared")
+ if((_build_type STREQUAL "static" OR _build_type STREQUAL "shared")
+ AND ABSL_ENABLE_INSTALL)
if(NOT ABSL_CC_LIB_TESTONLY)
if(absl_VERSION)
set(PC_VERSION "${absl_VERSION}")
diff --git a/absl/debugging/failure_signal_handler.cc b/absl/debugging/failure_signal_handler.cc
index e458a795..689e5979 100644
--- a/absl/debugging/failure_signal_handler.cc
+++ b/absl/debugging/failure_signal_handler.cc
@@ -136,7 +136,8 @@ static bool SetupAlternateStackOnce() {
#else
const size_t page_mask = sysconf(_SC_PAGESIZE) - 1;
#endif
- size_t stack_size = (std::max(SIGSTKSZ, 65536) + page_mask) & ~page_mask;
+ size_t stack_size =
+ (std::max<size_t>(SIGSTKSZ, 65536) + page_mask) & ~page_mask;
#if defined(ABSL_HAVE_ADDRESS_SANITIZER) || \
defined(ABSL_HAVE_MEMORY_SANITIZER) || defined(ABSL_HAVE_THREAD_SANITIZER)
// Account for sanitizer instrumentation requiring additional stack space.
diff --git a/absl/strings/internal/str_format/arg.h b/absl/strings/internal/str_format/arg.h
index 7040c866..3c91be70 100644
--- a/absl/strings/internal/str_format/arg.h
+++ b/absl/strings/internal/str_format/arg.h
@@ -122,6 +122,14 @@ StringConvertResult FormatConvertImpl(const std::string& v,
StringConvertResult FormatConvertImpl(string_view v,
FormatConversionSpecImpl conv,
FormatSinkImpl* sink);
+#if defined(ABSL_HAVE_STD_STRING_VIEW) && !defined(ABSL_USES_STD_STRING_VIEW)
+inline StringConvertResult FormatConvertImpl(std::string_view v,
+ FormatConversionSpecImpl conv,
+ FormatSinkImpl* sink) {
+ return FormatConvertImpl(absl::string_view(v.data(), v.size()), conv, sink);
+}
+#endif // ABSL_HAVE_STD_STRING_VIEW && !ABSL_USES_STD_STRING_VIEW
+
ArgConvertResult<FormatConversionCharSetUnion(
FormatConversionCharSetInternal::s, FormatConversionCharSetInternal::p)>
FormatConvertImpl(const char* v, const FormatConversionSpecImpl conv,
diff --git a/absl/strings/internal/str_format/convert_test.cc b/absl/strings/internal/str_format/convert_test.cc
index 926283cf..91e03609 100644
--- a/absl/strings/internal/str_format/convert_test.cc
+++ b/absl/strings/internal/str_format/convert_test.cc
@@ -229,6 +229,9 @@ TEST_F(FormatConvertTest, BasicString) {
TestStringConvert(static_cast<const char*>("hello"));
TestStringConvert(std::string("hello"));
TestStringConvert(string_view("hello"));
+#if defined(ABSL_HAVE_STD_STRING_VIEW)
+ TestStringConvert(std::string_view("hello"));
+#endif // ABSL_HAVE_STD_STRING_VIEW
}
TEST_F(FormatConvertTest, NullString) {
--
2.31.1