Commit 719d788
modules: make module support standards-compliant
C++ doesn't allow #ifdef tricks with modules. Specifically, the module
keywords can't be guarded with #ifdef.
Here, we change the approach towards module support. It is heavily
inspired by libstdc++ [1]. In the new approach, instead of two libraries,
seastar and seastar-module, one without and one with module support, there
is only one library. Module support comes in the form of a .cppm file
that declares the module and exports the symbols.
Changes in the patch:
1. remove SEASTAR_MODULE_EXPORT* defines; the export declarations are
moved to seastar.cppm (causing some duplication)
2. remove the SEASTAR_MODULE define and unifdef the code it guards. There
is a single complication pass rather than two.
3. The utils/modules.hh header is removed, since it no longer defines
anything.
4. seastar.cc is renamed to seastar.cppm so the compiler understands it's
a module definition. It now only includes headers that contain public
symbols. The symbols to be exported are listed explicitly.
5. The cmake seastar library now conditionally includes seastar.cppm.
6. Minor cmake changes for hello-cxx-module to make it build.
[1] https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/src/c%2B%2B23/std.cc.in
Tested with clang 21.
Fixes #3091
Closes #31011 parent cac1771 commit 719d788
File tree
186 files changed
+198
-1247
lines changed- demos
- include/seastar
- core
- internal
- http
- json
- net
- util
- internal
- src
- core
- http
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
186 files changed
+198
-1247
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
765 | 765 | | |
766 | 766 | | |
767 | 767 | | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
768 | 778 | | |
769 | 779 | | |
770 | 780 | | |
| |||
1176 | 1186 | | |
1177 | 1187 | | |
1178 | 1188 | | |
1179 | | - | |
1180 | 1189 | | |
1181 | 1190 | | |
1182 | 1191 | | |
| |||
1338 | 1347 | | |
1339 | 1348 | | |
1340 | 1349 | | |
1341 | | - | |
| 1350 | + | |
1342 | 1351 | | |
1343 | 1352 | | |
1344 | 1353 | | |
| |||
1347 | 1356 | | |
1348 | 1357 | | |
1349 | 1358 | | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
1350 | 1369 | | |
1351 | 1370 | | |
1352 | 1371 | | |
| |||
1404 | 1423 | | |
1405 | 1424 | | |
1406 | 1425 | | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
1407 | 1435 | | |
1408 | 1436 | | |
1409 | 1437 | | |
1410 | 1438 | | |
1411 | | - | |
| 1439 | + | |
1412 | 1440 | | |
1413 | 1441 | | |
1414 | 1442 | | |
1415 | 1443 | | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
1416 | 1450 | | |
1417 | 1451 | | |
1418 | 1452 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
134 | 138 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
28 | | - | |
29 | 27 | | |
30 | 28 | | |
31 | 29 | | |
| |||
37 | 35 | | |
38 | 36 | | |
39 | 37 | | |
40 | | - | |
41 | 38 | | |
42 | 39 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
| |||
34 | 33 | | |
35 | 34 | | |
36 | 35 | | |
37 | | - | |
38 | 36 | | |
39 | 37 | | |
40 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
29 | 28 | | |
30 | | - | |
31 | 29 | | |
32 | 30 | | |
33 | 31 | | |
34 | 32 | | |
35 | 33 | | |
36 | | - | |
37 | 34 | | |
38 | 35 | | |
39 | 36 | | |
40 | 37 | | |
41 | 38 | | |
42 | | - | |
43 | 39 | | |
44 | 40 | | |
45 | 41 | | |
| |||
224 | 220 | | |
225 | 221 | | |
226 | 222 | | |
227 | | - | |
228 | 223 | | |
229 | 224 | | |
230 | 225 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | 28 | | |
30 | | - | |
31 | 29 | | |
32 | 30 | | |
33 | 31 | | |
34 | | - | |
35 | 32 | | |
36 | 33 | | |
37 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
32 | | - | |
33 | 31 | | |
34 | 32 | | |
35 | 33 | | |
36 | 34 | | |
37 | 35 | | |
38 | | - | |
39 | 36 | | |
40 | 37 | | |
41 | 38 | | |
42 | 39 | | |
43 | 40 | | |
44 | | - | |
45 | 41 | | |
46 | 42 | | |
47 | 43 | | |
| |||
115 | 111 | | |
116 | 112 | | |
117 | 113 | | |
118 | | - | |
119 | 114 | | |
120 | 115 | | |
121 | 116 | | |
| |||
143 | 138 | | |
144 | 139 | | |
145 | 140 | | |
146 | | - | |
147 | 141 | | |
148 | 142 | | |
149 | 143 | | |
| |||
199 | 193 | | |
200 | 194 | | |
201 | 195 | | |
202 | | - | |
203 | 196 | | |
204 | 197 | | |
205 | 198 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | 24 | | |
27 | 25 | | |
28 | | - | |
29 | 26 | | |
30 | 27 | | |
31 | 28 | | |
32 | | - | |
33 | 29 | | |
34 | 30 | | |
35 | 31 | | |
| |||
57 | 53 | | |
58 | 54 | | |
59 | 55 | | |
60 | | - | |
61 | 56 | | |
62 | 57 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | 22 | | |
24 | 23 | | |
25 | | - | |
26 | | - | |
27 | 24 | | |
28 | 25 | | |
29 | 26 | | |
30 | 27 | | |
31 | 28 | | |
32 | 29 | | |
33 | 30 | | |
34 | | - | |
35 | 31 | | |
36 | 32 | | |
37 | 33 | | |
| |||
45 | 41 | | |
46 | 42 | | |
47 | 43 | | |
48 | | - | |
49 | 44 | | |
50 | 45 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
27 | | - | |
28 | 26 | | |
29 | 27 | | |
30 | 28 | | |
31 | 29 | | |
32 | 30 | | |
33 | 31 | | |
34 | 32 | | |
35 | | - | |
36 | 33 | | |
37 | 34 | | |
38 | 35 | | |
| |||
44 | 41 | | |
45 | 42 | | |
46 | 43 | | |
47 | | - | |
48 | 44 | | |
49 | 45 | | |
50 | 46 | | |
| |||
0 commit comments