Skip to content

Commit d38452e

Browse files
authored
Abseil LTS branch, Aug 2025, Patch 1 (#1940)
* Fix CHECK_<OP> ambiguous overload for operator<< in older versions of GCC (ba9a180) * Fix CHECK_<OP> compilation failures on older versions of GCC which eagerly tries to instantiate std::underlying_type for non-enum types (e8c1a5f) * Add missing rules_cc loads (2370ccf)
1 parent 987c57f commit d38452e

File tree

8 files changed

+48
-25
lines changed

8 files changed

+48
-25
lines changed

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
module(
1818
name = "abseil-cpp",
19-
version = "20250814.0",
19+
version = "20250814.1",
2020
compatibility_level = 1,
2121
)
2222

absl/base/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
// LTS releases can be obtained from
119119
// https://github.com/abseil/abseil-cpp/releases.
120120
#define ABSL_LTS_RELEASE_VERSION 20250814
121-
#define ABSL_LTS_RELEASE_PATCH_LEVEL 0
121+
#define ABSL_LTS_RELEASE_PATCH_LEVEL 1
122122

123123
// Helper macro to convert a CPP variable to a string literal.
124124
#define ABSL_INTERNAL_DO_TOKEN_STR(x) #x

absl/container/internal/raw_hash_set.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ void ResizeNonSooImpl(CommonFields& common,
679679
ABSL_SWISSTABLE_ASSERT(IsValidCapacity(new_capacity));
680680
ABSL_SWISSTABLE_ASSERT(new_capacity > policy.soo_capacity());
681681

682-
const size_t old_capacity = common.capacity();
682+
[[maybe_unused]] const size_t old_capacity = common.capacity();
683683
[[maybe_unused]] ctrl_t* old_ctrl;
684684
[[maybe_unused]] void* old_slots;
685685
if constexpr (kMode == ResizeNonSooMode::kGuaranteedAllocated) {
@@ -688,7 +688,7 @@ void ResizeNonSooImpl(CommonFields& common,
688688
}
689689

690690
const size_t slot_size = policy.slot_size;
691-
const size_t slot_align = policy.slot_align;
691+
[[maybe_unused]] const size_t slot_align = policy.slot_align;
692692
const bool has_infoz = infoz.IsSampled();
693693
void* alloc = policy.get_char_alloc(common);
694694

absl/debugging/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
# limitations under the License.
1515
#
1616

17+
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
18+
load("@rules_cc//cc:cc_library.bzl", "cc_library")
19+
load("@rules_cc//cc:cc_test.bzl", "cc_test")
1720
load(
1821
"//absl:copts/configure_copts.bzl",
1922
"ABSL_DEFAULT_COPTS",

absl/log/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ absl_cc_library(
4747
absl::base
4848
absl::config
4949
absl::core_headers
50+
absl::has_ostream_operator
5051
absl::leak_check
5152
absl::log_internal_nullguard
5253
absl::log_internal_nullstream

absl/log/check_test_impl.inc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
// See the License for the specific language governing permissions and
1414
// limitations under the License.
1515

16+
// SKIP_ABSL_INLINE_NAMESPACE_CHECK
17+
1618
#ifndef ABSL_LOG_CHECK_TEST_IMPL_H_
1719
#define ABSL_LOG_CHECK_TEST_IMPL_H_
1820

@@ -241,6 +243,18 @@ TEST(CHECKTest, TestBinaryChecksWithPrimitives) {
241243
ABSL_TEST_CHECK_LT(1, 2);
242244
}
243245

246+
TEST(CHECKTest, TestBinaryChecksWithStringComparison) {
247+
const std::string a = "a";
248+
ABSL_TEST_CHECK_EQ(a, "a");
249+
ABSL_TEST_CHECK_NE(a, "b");
250+
ABSL_TEST_CHECK_GE(a, a);
251+
ABSL_TEST_CHECK_GE("b", a);
252+
ABSL_TEST_CHECK_LE(a, "a");
253+
ABSL_TEST_CHECK_LE(a, "b");
254+
ABSL_TEST_CHECK_GT("b", a);
255+
ABSL_TEST_CHECK_LT(a, "b");
256+
}
257+
244258
// For testing using CHECK*() on anonymous enums.
245259
enum { CASE_A, CASE_B };
246260

absl/log/internal/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ cc_library(
8282
"//absl/base:nullability",
8383
"//absl/debugging:leak_check",
8484
"//absl/strings",
85+
"//absl/strings:has_ostream_operator",
8586
],
8687
)
8788

absl/log/internal/check_op.h

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include "absl/log/internal/nullstream.h"
4141
#include "absl/log/internal/strip.h"
4242
#include "absl/strings/has_absl_stringify.h"
43+
#include "absl/strings/has_ostream_operator.h"
4344
#include "absl/strings/string_view.h"
4445

4546
// `ABSL_LOG_INTERNAL_STRIP_STRING_LITERAL` wraps string literals that
@@ -357,42 +358,45 @@ std::enable_if_t<HasAbslStringify<T>::value,
357358
StringifyToStreamWrapper<T>>
358359
Detect(...); // Ellipsis has lowest preference when int passed.
359360

360-
// is_streamable is true for types that have an output stream operator<<.
361-
template <class T, class = void>
362-
struct is_streamable : std::false_type {};
363-
364-
template <class T>
365-
struct is_streamable<T, std::void_t<decltype(std::declval<std::ostream&>()
366-
<< std::declval<T>())>>
367-
: std::true_type {};
368-
369361
// This overload triggers when T is neither possible to print nor an enum.
370362
template <typename T>
371363
std::enable_if_t<std::negation_v<std::disjunction<
372364
std::is_convertible<T, int>, std::is_enum<T>,
373365
std::is_pointer<T>, std::is_same<T, std::nullptr_t>,
374-
is_streamable<T>, HasAbslStringify<T>>>,
366+
HasOstreamOperator<T>, HasAbslStringify<T>>>,
375367
UnprintableWrapper>
376368
Detect(...);
377369

370+
// Equivalent to the updated std::underlying_type from C++20, which is no
371+
// longer undefined behavior for non-enum types.
372+
template <typename T, typename EnableT = void>
373+
struct UnderlyingType {};
374+
375+
template <typename T>
376+
struct UnderlyingType<T, std::enable_if_t<std::is_enum_v<T>>> {
377+
using type = std::underlying_type_t<T>;
378+
};
379+
template <typename T>
380+
using UnderlyingTypeT = typename UnderlyingType<T>::type;
381+
378382
// This overload triggers when T is a scoped enum that has not defined an output
379383
// stream operator (operator<<) or AbslStringify. It causes the enum value to be
380384
// converted to a type that can be streamed. For consistency with other enums, a
381385
// scoped enum backed by a bool or char is converted to its underlying type, and
382386
// one backed by another integer is converted to (u)int64_t.
383387
template <typename T>
384388
std::enable_if_t<
385-
std::conjunction_v<
386-
std::is_enum<T>, std::negation<std::is_convertible<T, int>>,
387-
std::negation<is_streamable<T>>, std::negation<HasAbslStringify<T>>>,
388-
std::conditional_t<
389-
std::is_same_v<std::underlying_type_t<T>, bool> ||
390-
std::is_same_v<std::underlying_type_t<T>, char> ||
391-
std::is_same_v<std::underlying_type_t<T>, signed char> ||
392-
std::is_same_v<std::underlying_type_t<T>, unsigned char>,
393-
std::underlying_type_t<T>,
394-
std::conditional_t<std::is_signed_v<std::underlying_type_t<T>>, int64_t,
395-
uint64_t>>>
389+
std::conjunction_v<std::is_enum<T>,
390+
std::negation<std::is_convertible<T, int>>,
391+
std::negation<HasOstreamOperator<T>>,
392+
std::negation<HasAbslStringify<T>>>,
393+
std::conditional_t<std::is_same_v<UnderlyingTypeT<T>, bool> ||
394+
std::is_same_v<UnderlyingTypeT<T>, char> ||
395+
std::is_same_v<UnderlyingTypeT<T>, signed char> ||
396+
std::is_same_v<UnderlyingTypeT<T>, unsigned char>,
397+
UnderlyingTypeT<T>,
398+
std::conditional_t<std::is_signed_v<UnderlyingTypeT<T>>,
399+
int64_t, uint64_t>>>
396400
Detect(...);
397401
} // namespace detect_specialization
398402

0 commit comments

Comments
 (0)