Skip to content

build: default Seastar_DEPRECATED_OSTREAM_FORMATTERS to OFF#3439

Open
avikivity wants to merge 3 commits into
scylladb:masterfrom
avikivity:default-ostream-vector-operator-off
Open

build: default Seastar_DEPRECATED_OSTREAM_FORMATTERS to OFF#3439
avikivity wants to merge 3 commits into
scylladb:masterfrom
avikivity:default-ostream-vector-operator-off

Conversation

@avikivity

@avikivity avikivity commented May 31, 2026

Copy link
Copy Markdown
Member

In order for us to be able to eventually drop the deprecated functions, we must alert users that they are deprecated by defaulting to OFF.

Since some tests compare std::vectors which don't have std::ostream formatters, add a wrapper
to funnel printing to a fmt::formatter if available, and fall back to std::ostream if not.

@avikivity avikivity force-pushed the default-ostream-vector-operator-off branch 2 times, most recently from e8e13d5 to 5530dca Compare May 31, 2026 18:25
@avikivity

Copy link
Copy Markdown
Member Author

v2: convert all tests to prefer fmt to std::ostream

std::ignore = co_await i2e();
std::ignore = co_await e2i();
BOOST_REQUIRE_EQUAL(co_await co_return_vector(0), (std::vector<std::string>{}));
SEASTAR_BOOST_REQUIRE_EQUAL(co_await co_return_vector(0), (std::vector<std::string>{}));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'd need to #include <fmt/ranges.h> to format range-alike types like std::vector<std::string>. see https://godbolt.org/z/5n3KqTjj8 for a reproducer.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somehow it builds locally, I'll need to reproduce the CI environment.

@avikivity avikivity force-pushed the default-ostream-vector-operator-off branch from 5530dca to f9f60b5 Compare June 1, 2026 08:44
@avikivity

Copy link
Copy Markdown
Member Author

v3:L sprinkled #include <fmt/ranges.h> where needed

avikivity added 3 commits June 1, 2026 12:45
BOOST_REQUIRE_EQUAL and friends print the inputs to show
failures using operator<<(std::ostream&, ...). This isn't
available for many types with -DSeastar_DEPRECATED_OSTREAM_FORMATTERS=OFF.

To make is possible to use -DSeastar_DEPRECATED_OSTREAM_FORMATTERS=OFF,
introduce wrappers around that macro family (only available within
Seastar itself) to wrap the value with a comparable_formattable
wrapper, that supplies comparisons via the type's comparison operators
and formatting via fmt. Since not all types have formatters, the wrapper
is able to fall back to operator<<.

Since the existing tests contain many signed/unsigned comparisons,
suppress gcc warnings about them, since apparently Boost.Test does
as well.

Special-case const char*, as Boost.Test does, by promoting it to
a string_view, so it's compared by string value rather than address.
…ents

Support data types that don't have std::ostream support, but do have
formatters.

The two cases disabled by 4b1542d are re-enabled.
In order for us to be able to eventually drop the deprecated
functions, we must alert users that they are deprecated by
defaulting to OFF.
@avikivity avikivity force-pushed the default-ostream-vector-operator-off branch from f9f60b5 to 894fc82 Compare June 1, 2026 09:46
@avikivity

Copy link
Copy Markdown
Member Author

v4: special-case const char* to compare by string value rather than pointer address (following boost.test)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants