From 85928aff5eb9601520ca3e451728001fb25af0de Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 25 Nov 2022 16:52:29 +0800 Subject: [PATCH] *: include fmt/ostream.h if FMT_VERSION >= 9 before this change, we assume that `fmt/ostream.h` is included, and reference `fmt::ostream_formatter`. this breaks the build if the tree is compiled on {fmt} v9 and up. after this change, `fmt/ostream.h` is conditionally included. as the compiling unit is supposed to include fmt headers before including headers in this project, we can tell if fmt/ostream.h is needed or not by checking the FMT_VERSION macro. Signed-off-by: Kefu Chai --- src/common/ceph_time.h | 3 +++ src/crush/CrushLocation.h | 3 +++ src/include/uuid.h | 4 ++++ src/msg/Message.h | 3 +++ src/osd/osd_types_fmt.h | 3 +++ 5 files changed, 16 insertions(+) diff --git a/src/common/ceph_time.h b/src/common/ceph_time.h index 22429fa282a..2d3d1fda010 100644 --- a/src/common/ceph_time.h +++ b/src/common/ceph_time.h @@ -19,6 +19,9 @@ #include #include #include +#if FMT_VERSION >= 90000 +#include +#endif #include #if defined(__APPLE__) diff --git a/src/crush/CrushLocation.h b/src/crush/CrushLocation.h index 24f43068d61..2d2d4b52b96 100644 --- a/src/crush/CrushLocation.h +++ b/src/crush/CrushLocation.h @@ -7,6 +7,9 @@ #include #include #include +#if FMT_VERSION >= 90000 +#include +#endif #include "common/ceph_mutex.h" #include "include/common_fwd.h" diff --git a/src/include/uuid.h b/src/include/uuid.h index 6a30aa621c4..f6ef9878dae 100644 --- a/src/include/uuid.h +++ b/src/include/uuid.h @@ -16,6 +16,10 @@ #include #include +#if FMT_VERSION >= 90000 +#include +#endif + namespace ceph { class Formatter; } diff --git a/src/msg/Message.h b/src/msg/Message.h index 3a18c82a280..6ebf06346c3 100644 --- a/src/msg/Message.h +++ b/src/msg/Message.h @@ -21,6 +21,9 @@ #include #include +#if FMT_VERSION >= 90000 +#include +#endif #include "include/Context.h" #include "common/RefCountedObj.h" diff --git a/src/osd/osd_types_fmt.h b/src/osd/osd_types_fmt.h index 2a43fe893ee..5756abcb092 100644 --- a/src/osd/osd_types_fmt.h +++ b/src/osd/osd_types_fmt.h @@ -8,6 +8,9 @@ #include "common/hobject_fmt.h" #include "osd/osd_types.h" #include +#if FMT_VERSION >= 90000 +#include +#endif template <> struct fmt::formatter { -- 2.47.3