Apply LTS transformations for 20250512 LTS branch (#1886)
* Apply LTS transformations for 20250512 LTS branch
* Cherry-pick https://github.com/google/cctz/commit/306fd9b37247a72145ca3f39e59203fb7dfcc890
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a31c6a9..8d3059d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,8 +23,8 @@
cmake_policy(SET CMP0141 NEW)
endif (POLICY CMP0141)
-project(absl LANGUAGES CXX)
-set(ABSL_SOVERSION 0)
+project(absl LANGUAGES CXX VERSION 20250512)
+set(ABSL_SOVERSION "2505.0.0")
include(CTest)
# Output directory is correct by default for most build setups. However, when
@@ -170,17 +170,7 @@
add_subdirectory(absl)
if(ABSL_ENABLE_INSTALL)
- # absl:lts-remove-begin(system installation is supported for LTS releases)
- # We don't support system-wide installation
- list(APPEND SYSTEM_INSTALL_DIRS "/usr/local" "/usr" "/opt/" "/opt/local" "c:/Program Files/${PROJECT_NAME}")
- if(NOT DEFINED CMAKE_INSTALL_PREFIX OR CMAKE_INSTALL_PREFIX IN_LIST SYSTEM_INSTALL_DIRS)
- message(WARNING "\
- The default and system-level install directories are unsupported except in LTS \
- releases of Abseil. Please set CMAKE_INSTALL_PREFIX to install Abseil in your \
- source or build tree directly.\
- ")
- endif()
- # absl:lts-remove-end
+
# install as a subdirectory only
install(EXPORT ${PROJECT_NAME}Targets
diff --git a/MODULE.bazel b/MODULE.bazel
index 29e624a..10fc31b 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -16,7 +16,7 @@
module(
name = "abseil-cpp",
- version = "head",
+ version = "20250512.0",
compatibility_level = 1,
)
diff --git a/absl/base/config.h b/absl/base/config.h
index f3cafbd..9170a6f 100644
--- a/absl/base/config.h
+++ b/absl/base/config.h
@@ -117,8 +117,8 @@
//
// LTS releases can be obtained from
// https://github.com/abseil/abseil-cpp/releases.
-#undef ABSL_LTS_RELEASE_VERSION
-#undef ABSL_LTS_RELEASE_PATCH_LEVEL
+#define ABSL_LTS_RELEASE_VERSION 20250512
+#define ABSL_LTS_RELEASE_PATCH_LEVEL 0
// Helper macro to convert a CPP variable to a string literal.
#define ABSL_INTERNAL_DO_TOKEN_STR(x) #x
diff --git a/absl/base/options.h b/absl/base/options.h
index 71bafb3..f904f64 100644
--- a/absl/base/options.h
+++ b/absl/base/options.h
@@ -148,8 +148,8 @@
// be changed to a new, unique identifier name. In particular "head" is not
// allowed.
-#define ABSL_OPTION_USE_INLINE_NAMESPACE 0
-#define ABSL_OPTION_INLINE_NAMESPACE_NAME head
+#define ABSL_OPTION_USE_INLINE_NAMESPACE 1
+#define ABSL_OPTION_INLINE_NAMESPACE_NAME lts_20250512
// ABSL_OPTION_HARDENED
//
diff --git a/absl/time/internal/cctz/src/time_zone_lookup.cc b/absl/time/internal/cctz/src/time_zone_lookup.cc
index f791797..90b2972 100644
--- a/absl/time/internal/cctz/src/time_zone_lookup.cc
+++ b/absl/time/internal/cctz/src/time_zone_lookup.cc
@@ -57,6 +57,8 @@
#endif // __has_include
#endif // _WIN32
+#include <array>
+#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <string>
@@ -121,25 +123,25 @@
return "";
}
- UChar buffer[128];
+ std::array<UChar, 128> buffer;
UErrorCode status = U_ZERO_ERROR;
const auto num_chars_in_buffer = ucal_getTimeZoneIDForWindowsIDFunc(
- reinterpret_cast<const UChar*>(info.TimeZoneKeyName), -1, nullptr, buffer,
- ARRAYSIZE(buffer), &status);
+ reinterpret_cast<const UChar*>(info.TimeZoneKeyName), -1, nullptr,
+ buffer.data(), static_cast<int32_t>(buffer.size()), &status);
if (status != U_ZERO_ERROR || num_chars_in_buffer <= 0 ||
- num_chars_in_buffer > ARRAYSIZE(buffer)) {
+ num_chars_in_buffer > static_cast<int32_t>(buffer.size())) {
return "";
}
const int num_bytes_in_utf8 = ::WideCharToMultiByte(
- CP_UTF8, 0, reinterpret_cast<const wchar_t*>(buffer),
+ CP_UTF8, 0, reinterpret_cast<const wchar_t*>(buffer.data()),
static_cast<int>(num_chars_in_buffer), nullptr, 0, nullptr, nullptr);
std::string local_time_str;
local_time_str.resize(static_cast<size_t>(num_bytes_in_utf8));
- ::WideCharToMultiByte(CP_UTF8, 0, reinterpret_cast<const wchar_t*>(buffer),
- static_cast<int>(num_chars_in_buffer),
- &local_time_str[0], num_bytes_in_utf8, nullptr,
- nullptr);
+ ::WideCharToMultiByte(
+ CP_UTF8, 0, reinterpret_cast<const wchar_t*>(buffer.data()),
+ static_cast<int>(num_chars_in_buffer), &local_time_str[0],
+ num_bytes_in_utf8, nullptr, nullptr);
return local_time_str;
}
#endif // USE_WIN32_LOCAL_TIME_ZONE