From bc2f324396762916bc9a3dbfdbe77e8f7b20e149 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sun, 19 May 2024 12:13:05 +0800 Subject: [PATCH] treewide: include required header files before this change, when building with C++20 modules enabled, some symbols are not accessible, when compiling source files like src/core/resource.cc if some features are enabled using macros like SEASTAR_HAVE_HWLOC and SEASTAR_HAVE_URING. in this change, we include the missing headers or move the include precessor directives, so that the .cc files can have access to the used declaration of the used symbols. please note, this change not only enables us to build C++20 modules with SEASTAR_HAVE_HWLOC and/or SEASTAR_HAVE_URING defined, it is also necessary also from the correctness point of view. Signed-off-by: Kefu Chai --- src/core/reactor_backend.cc | 1 + src/core/resource.cc | 8 ++++---- src/seastar.cc | 4 +++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/core/reactor_backend.cc b/src/core/reactor_backend.cc index 123d4e0c1c0..b0dc1be9fdc 100644 --- a/src/core/reactor_backend.cc +++ b/src/core/reactor_backend.cc @@ -36,6 +36,7 @@ module; #include #include #include +#include #ifdef SEASTAR_HAVE_URING #include diff --git a/src/core/resource.cc b/src/core/resource.cc index 70294f488e7..7dc64163a49 100644 --- a/src/core/resource.cc +++ b/src/core/resource.cc @@ -35,6 +35,10 @@ module; #include #include #include +#include +#if SEASTAR_HAVE_HWLOC +#include +#endif #ifdef SEASTAR_MODULE module seastar; @@ -49,10 +53,6 @@ module seastar; #include #include "cgroup.hh" -#if SEASTAR_HAVE_HWLOC -#include -#endif - #endif namespace seastar { diff --git a/src/seastar.cc b/src/seastar.cc index 416faa97c75..8e16732ad6c 100644 --- a/src/seastar.cc +++ b/src/seastar.cc @@ -118,7 +118,9 @@ module; #include #include #include - +#ifdef SEASTAR_HAVE_HWLOC +#include +#endif #if defined(__x86_64__) || defined(__i386__) #include #endif