fix(bench): generate compile-time TUs into the build tree - #48
Merged
Conversation
Problem
- _ptn_ct_add_lit_tu wrote ct_bench_lit_{8..128}.cpp into the
source tree on every CMake configure, so each configure dirtied
the working tree with regenerated files.
- The generated files were also committed, and their committed
formatting never matched the generator output.
Implementation
- Write the generated translation units to
CMAKE_CURRENT_BINARY_DIR instead of CMAKE_CURRENT_SOURCE_DIR.
- Remove the five generated files from version control; the
hand-written TUs (variant, compound, rdense) are unaffected.
Tests
- Reconfigured and built ptn_bench_ct: all generated TUs compile
from the build tree and the working tree stays clean.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Summary
_ptn_ct_add_lit_tuwrotect_bench_lit_{8,16,32,64,128}.cppinto the source tree on every CMake configure, dirtying the working tree each time. Worse, the generated files were committed to the repo, and their committed (clang-formatted) content never matched the generator output — so every configure produced spurious diffs.Changes
CMAKE_CURRENT_BINARY_DIRinstead ofCMAKE_CURRENT_SOURCE_DIR, with a comment recording why.ct_bench_variant_32,ct_bench_compound,ct_bench_lit_rdense) are unaffected.Testing
cmake --build build --target ptn_bench_ctcompiles all generated TUs from the build tree, andgit statusstays clean afterwards.