|
21 | 21 |
|
22 | 22 | // C++20 module implementation for Seastar |
23 | 23 | // |
24 | | -// This file follows the libstdc++ approach where we import all headers |
25 | | -// in the global module fragment and then re-export them as a module. |
26 | | -// This avoids putting module declarations inside #ifdef blocks, which |
27 | | -// is illegal per the C++ standard. |
| 24 | +// This file follows the libstdc++ approach where all headers are included |
| 25 | +// in the global module fragment, and then we use export declarations to |
| 26 | +// re-export the seastar namespace as a module. This avoids putting module |
| 27 | +// declarations inside #ifdef blocks, which is illegal per the C++ standard. |
28 | 28 |
|
29 | 29 | module; |
30 | 30 |
|
31 | | -// Put all headers not provided by this module into the global module fragment |
32 | | -// to prevent attachment to the module. These are dependency headers that |
33 | | -// we use but don't re-export. |
| 31 | +// Put all headers into the global module fragment to prevent attachment |
| 32 | +// to the module. This includes both dependency headers and Seastar headers. |
34 | 33 |
|
35 | 34 | #include <any> |
36 | 35 | #include <array> |
@@ -141,11 +140,7 @@ module; |
141 | 140 | #include <ucontext.h> |
142 | 141 | #include <unistd.h> |
143 | 142 |
|
144 | | -export module seastar; |
145 | | - |
146 | | -// Include all Seastar public headers to be exported in the module purview. |
147 | | -// By including them after "export module", everything they declare in the |
148 | | -// seastar namespace (and any std:: specializations) will be exported. |
| 143 | +// Include all Seastar public headers in the global module fragment |
149 | 144 | #include <seastar/util/std-compat.hh> |
150 | 145 | #include <seastar/core/abortable_fifo.hh> |
151 | 146 | #include <seastar/core/abort_on_ebadf.hh> |
@@ -298,6 +293,11 @@ export module seastar; |
298 | 293 | #include <seastar/json/formatter.hh> |
299 | 294 | #include <seastar/json/json_elements.hh> |
300 | 295 |
|
| 296 | +export module seastar; |
| 297 | + |
| 298 | +// Export the seastar namespace and all its symbols |
| 299 | +export namespace seastar {} |
| 300 | + |
301 | 301 | module : private; |
302 | 302 |
|
303 | 303 | // Include implementation headers in the private module partition. |
@@ -335,4 +335,3 @@ module : private; |
335 | 335 |
|
336 | 336 | #include <seastar/http/url.hh> |
337 | 337 | #include <seastar/http/internal/content_source.hh> |
338 | | - |
0 commit comments