Skip to content

2.7.0: the C++20 module entry - #88

Closed
pippocao wants to merge 3 commits into
developfrom
feature/2.7.0-T09-module
Closed

pippocao wants to merge 3 commits into
developfrom
feature/2.7.0-T09-module

Conversation

@pippocao

Copy link
Copy Markdown
Collaborator

The module entry is a binary of its own now. A translation unit may not import and include the same library (MSVC refuses it with C2300), so it cannot be compiled into BqLogUnitTest next to the include entry; the test runners start it right after BqLogUnitTest, which is what keeps it compiled and run on every platform that can build modules.

Also in here:

  • the library builds once as an object library that both test binaries link;
  • the module target's file set is PUBLIC (CMake refuses an import from outside otherwise) and the importing target sets CXX_SCAN_FOR_MODULES, instead of a project wide CMP0155;
  • the global module fragment pre-includes bq's assert wrapper: <assert.h> has no include guard, so the purview includes it again and MSVC reports C5244, which /W4 /WX turns into an error;
  • type_tools names the destructor through the nested template's own parameter, which MSVC cannot do through the enclosing T inside a module;
  • test_fast_log uses strtol instead of the deprecated sscanf, which was failing the MSVC test build on its own;
  • the module test has its own main() and removes the log file of an earlier run, which it otherwise appended to and counted twice.

Verified locally, both binaries, full suite green: MSVC (VS 18 Insiders, /W4 /WX) and MinGW GCC 15.2. The module entry reports test_module 9/9 and is idempotent.

pippocao added 3 commits October 11, 2026 22:41
- A translation unit may not import and include the same library, so the module entry
  could not be compiled into BqLogUnitTest beside the include entry: MSVC rejects it
  with C2300. It is a binary of its own now, started by the test runners right after
  BqLogUnitTest, so it is still compiled and run by every platform that can build
  modules.
- The library is built once as an object library that both binaries link.
- The module target keeps its file set PUBLIC (CMake refuses the import otherwise) and
  the importing target sets CXX_SCAN_FOR_MODULES, rather than a project wide CMP0155.
- The system headers are pre-included in the global module fragment, which now includes
  bq's assert wrapper: <assert.h> has no include guard, so the purview would include it
  again and MSVC reports C5244.
- type_tools: name the destructor through the nested template's own parameter, which
  MSVC cannot do through the enclosing T inside a module (C2300).
- test_fast_log: strtol instead of sscanf, which is an error in the MSVC test build.
- Module test: main() of its own, and it removes the log file of an earlier run, which
  was otherwise appended to and counted twice.
The changelog gets the module entry back, and the integration guide says that a target
which only imports has to set CXX_SCAN_FOR_MODULES (or CMP0155), otherwise the compiler
is never told where the compiled module is.
@tencent-adm

Copy link
Copy Markdown
Member

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


pippocao seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@pippocao pippocao closed this Oct 11, 2026
@pippocao
pippocao deleted the feature/2.7.0-T09-module branch October 19, 2026 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants