Implement modules support#15
Conversation
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
| #include <optional> | ||
| #include <ranges> | ||
| #include <type_traits> | ||
| #include <utility> |
There was a problem hiding this comment.
Putting standard library includes in the global module fragment is not the approved modules mechanism for this project. To merge this, you'll need to figure out how to get import std building. The best approach would be to do so by building with a supported container or with beman-local-ci.
There was a problem hiding this comment.
I solved it in yesmanchyk@f196c4b. However, the line 7 looks like a hack to me even though CI is passing. Maybe it's worth restoring the global module fragment with a single #include <version> inside? I don't know a way to export library feature-test macros with import std;.
There was a problem hiding this comment.
One way is import <version>, but I'm not sure header units are an approved mechanism, nor am I sure all targets support header units well enough...
As mentioned below, it seems that #include <version> (and things like <cstdarg>, <cassert>) is now allowed as a special exception in the GMF.
There was a problem hiding this comment.
import <version>; fails compilation with the following:
error: failed to read compiled module: No such file or directory
note: compiled module file is
'gcm.cache/./usr/lib/gcc/aarch64-unknown-linux-gnu/16/include/g++-v16/version.gcm'
note: imports must be built before being imported
plus I'm not sure macros will be visible that way
This reverts commit a18042b.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
ednolan
left a comment
There was a problem hiding this comment.
Great work! Just a few more small comments. By the way, you can use pre-commit run --all-files as a convenient way to apply clang-tidy and ensure that the lint check passes.
Mick235711
left a comment
There was a problem hiding this comment.
Thanks a lot for working on this!
|
Looks like I've addressed all comments - please merge if it looks good. |
|
Great job! |
This implementation is based on bemanproject/exemplar#380
There are some key differences, however:
I useimport beman.scan_view;instead of#include <beman/scan_view/scan.hpp>in tests and examples.all dependencieslibrary feature-test macros into global module fragment becauseimport std;resulted in compilation errors when I tried gcc 16 and clang 21.Due to above 2 reasons I extracted thebeman::scan_viewimplementation intoscan_view.hppwithout any changes.The
cmake --build buildstep takes longer when configured with-DBEMAN_SCAN_VIEW_USE_MODULES=On- here is what Jason Merrill from Red Hat replied about slowdown in gcc 16.1:I imagine it takes longer because it has to build module std, which includes the whole standard library, before building anything else. I don't know if there's a simple way to teach cmake to share std.gcm between projects/builds.