Repository navigation
feat: optional C++20 module support (PSI_FUNCTIONOID_MODULE, opt-in) - #14
Merged
Merged
Conversation
Adds PsiFunctionoidModule (alias Psi::FunctionoidModule), exporting the library's public headers as `import psi.functionoid;` instead of textual includes, for toolchains with usable C++20 module support (clang-cl, GNU-driver clang). Off by default and purely additive: the existing PsiFunctionoid interface target and every header-only consumer are unaffected regardless of whether the option is set. Same shape as psiha/vm's own module support: the global module fragment carries the STL plus the two macro-only psiha deps these headers use (boost/assert.hpp, boost/config_ex.hpp) textually - modules never export macros, so a consumer wanting BOOST_ASSERT after importing still includes it directly, same as consuming Boost anywhere else. The purview exports every real header via file(GLOB_RECURSE), so a header added later is picked up automatically. Verified with a smoke test (test/module_smoke_test.cpp, gated the same way) that imports the module and exercises real callable<> usage, linked against a real executable producing the correct result - and by running the existing 27-test suite unmodified with the option at its default (off).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PSI_FUNCTIONOID_MODULE(off by default): buildsPsiFunctionoidModule(aliasPsi::FunctionoidModule), exporting the library's public headers asimport psi.functionoid;instead of textual#include, for toolchains with usable C++20 module support (clang-cl, GNU-driver clang). Purely additive — the existingPsiFunctionoidinterface target and every consumer vendoring these headers directly are unaffected regardless of whether this option exists.Same shape as psiha/vm#173: the global module fragment carries the STL plus the two macro-only psiha deps these headers use (
boost/assert.hpp,boost/config_ex.hpp) textually — modules never export macros, so a consumer wantingBOOST_ASSERTafterimport psi.functionoid;still includes it directly, same as consuming Boost anywhere else. The purview exports every real header viafile(GLOB_RECURSE), so a header added later is picked up automatically.No pre-existing issues surfaced here (unlike psiha/vm, this library is header-only with no compiled-source PCH-propagation to route around, and every header included cleanly).
Verified
PsiFunctionoidModulebuilds clean (clang-cl, Release).test/module_smoke_test.cpp(gated the same way as the option):import psi.functionoid;, exercisescallable<>construction, invocation, and reassignment, links against a real executable, produces the correct result.functionoid_smoke+functionoid_vtable_attrs) run unmodified with the option at its default (off): all pass.