Skip to content

dll: boost::dll::fs follows boost::filesystem (policy republish), smoke test asserts it - #9

Merged
ZheFeng7110 merged 3 commits into
mcpplibs:mainfrom
ZheFeng7110:fix/dll-fs-follow-filesystem
Nov 29, 2026
Merged

ZheFeng7110 merged 3 commits into
mcpplibs:mainfrom
ZheFeng7110:fix/dll-fs-follow-filesystem

Conversation

@ZheFeng7110

Copy link
Copy Markdown
Collaborator

Part of #2: the first acceptance criterion and the boost::dll::fs part of suggested direction 1. The detail-namespace groups, the unanalysed small groups and the reachable-export check in verify-scripts are still open.

Problem

boost/dll/config.hpp spells boost::dll::fs as using namespace boost::filesystem;, and an importer never sees a using-directive. The generator follows a directive only in the ADL-barrier shape, so #5 re-declared 33 filesystem names by hand in a [[dll.extra]]. Compared with main before #1, 49 dll::fs:: spellings were still missing. 28 of them are not operators: symlink_status, space, permissions, create_symlink, hard_link_count, resize_file, unique_path, system_complete, … The tests used only path, recursive_directory_iterator and is_regular_file.

Change

  • New policy rule [[<lib>.republish]] (namespace, reason, optional if):

    • The generator finds the using-directive in that namespace and re-exports through it every name the owning module emitted directly in the target namespace. These are the names after the owner's drops, under the owner's guards combined with if.
    • The owner becomes a .deps edge.
    • The rule fails loudly when the directive or the owner's names are missing.
    • A cached entry holds only while the owner's emitted names are unchanged.
  • dll:

    • boost::dll::fs now carries filesystem's 138 boost::filesystem names under #if !defined(BOOST_DLL_USE_STD_FS).
    • The std::filesystem branch stays an extra, completed to the standard's 54 names.
    • A regeneration changes only dll's outputs.
  • tests/dll/smoke.cpp:

    • same-type static_asserts against boost::filesystem, including program_location()'s return type;
    • enumerators (dll::fs::regular_file);
    • Boost-only functions, checked unevaluated;
    • a temp-directory round trip through functions the hand-kept list lacked, on the error_code overloads.

    With main's dll.inc the file fails to compile on exactly those names.

  • tools/tests/test_gen_exports_republish.py: tests for the new rule.

  • Docs: docs/architecture{,.zh}.md and the design record .agents/docs/2026-11-28-dll-fs-republish-design.md. The record also covers the rejected options: following every non-detail cross-library directive automatically, and an else branch on republish.

Verified locally

  • gen_exports.py: a cold full run, then --check. gen_features.py --check and test_coverage.py check also pass.
  • tools/tests: 49 tests pass.
  • mcpp test -p boost-m-tests-dll on gcc@16.1.0 and llvm@22.1.8, both with mcpp 2026.11.27.1: 4/4 passed.
  • Not run locally: Windows and macOS (left to CI). The BOOST_DLL_USE_STD_FS branch was syntax-checked as plain C++ against libstdc++ with gcc and clang, but not built as a module.

boost/dll/config.hpp spells boost::dll::fs as `using namespace
boost::filesystem;`. The generator follows a using-directive only in the
ADL-barrier shape, so mcpplibs#5 re-declared 33 filesystem names by hand; 28
non-operator spellings of main before #1 (symlink_status, space,
permissions, unique_path, ...) stayed unreachable.

A [[<lib>.republish]] policy entry names the directive's namespace: every
name the owning module emitted directly in the target namespace (after its
drops, with its guards) is re-exported through it, and the owner becomes a
.deps edge. dll::fs now carries filesystem's 138 names under
!defined(BOOST_DLL_USE_STD_FS); the std::filesystem branch stays an extra,
completed to the standard's 54 names. Cached entries hold only while the
owner's emitted names are unchanged.
Same-type checks against boost::filesystem, program_location's return
type, enumerators, Boost-only functions (unevaluated) and a temp-directory
round trip through functions the hand-kept list lacked, on the error_code
overloads. With main's dll.inc the file fails to compile on exactly those
names.
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.

1 participant