Skip to content

Commit

Permalink
treewide: include fmt/ostream.h for using fmt::print()
Browse files Browse the repository at this point in the history
explicitly include fmt/ostream.h for fmt::print()

The `fmt::print(std::ostream&, ...)` API is provided through `fmt/ostream.h`.
Previously, we relied on indirect inclusion of this header through other
fmt headers, which was fragile and broke with fmt 8.x.

Fix this by explicitly including `fmt/ostream.h` in all source files that
use the ostream API. This addresses build failures with fmt 8.x while
making the header dependencies more explicit.

See https://fmt.dev/11.0/api/#ostream-api
Fixes scylladb#2584

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
  • Loading branch information
tchaikov committed Dec 23, 2024
1 parent 613d8b3 commit 505fdf1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/seastar/core/print.hh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <seastar/util/modules.hh>
#ifndef SEASTAR_MODULE
#include <fmt/printf.h>
#include <fmt/ostream.h>
#include <iostream>
#include <iomanip>
#include <chrono>
Expand Down
1 change: 1 addition & 0 deletions src/core/prometheus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*/

#include <fmt/core.h>
#include <fmt/ostream.h>
#include <seastar/core/prometheus.hh>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
Expand Down
1 change: 1 addition & 0 deletions src/net/ethernet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include <seastar/core/print.hh>
#include <seastar/net/ethernet.hh>
#include <fmt/ostream.h>
#include <boost/algorithm/string.hpp>
#include <string>

Expand Down
1 change: 1 addition & 0 deletions src/rpc/rpc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <boost/range/adaptor/transformed.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/range/numeric.hpp>
#include <fmt/ostream.h>

#if FMT_VERSION >= 90000
template <> struct fmt::formatter<seastar::rpc::streaming_domain_type> : fmt::ostream_formatter {};
Expand Down

0 comments on commit 505fdf1

Please sign in to comment.