Repository navigation
Tell the agent to map the build type to flags, not to a compilation mode - #48
Open
anakanemison wants to merge 1 commit into
Open
anakanemison wants to merge 1 commit into
anakanemison wants to merge 1 commit into
Conversation
The skill never mentioned CMAKE_BUILD_TYPE or --compilation_mode, and its canonicalization text called -O*/-g* "never your concern" (reworded in the levels commit). Agents therefore map the concept, Release to `-c opt`, and lose the number: CMake's Release is -O3 -DNDEBUG, Bazel's opt is -O2; CMake's Debug is -g, Bazel's default fastbuild has neither. Measured in any2bazel-lab: all nine migrations of pono, with and without the skill, wrote `build --compilation_mode=opt` as the counterpart of Release, several saying so in a comment on the line above, and eight of the nine compile at -O2 against a reference at -O3; the ninth added `build --copt=-O3` and matched. lensfun's CMakeLists.txt defaults the build type to Debug when none is given; no lensfun migration set a compilation mode, so every one dropped -g from all 40 TUs. Adds a short "Build type" section to docs/REFERENCE-cmake.md, under a new "Writing the BUILD files" heading that "Create initial BUILD.bazel files" points to: the two mappings that differ, the reminder that a project can set its own default build type, where to read the reference's actual level (diff.json's levels, or the cache), and the two .bazelrc lines that pin it. It also says that opt adds -DNDEBUG and so turns off assertions the reference may keep (diff.json's ndebug shows it), and that `build --copt=-UNDEBUG` undoes only the toolchain's -DNDEBUG, not one a rule passes in its copts, which come later on the command line. In the lab's later runs with this change, pono kept -O3, lensfun kept -g, and CMake's sources, whose reference sets no build type, gained neither -O2 nor NDEBUG in three runs (two earlier runs had added both). Lab-Proposal: P18 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Part 13 of 23 of a stacked series (tracking issue: #35). Based on
U12-reference-configuration, the previous part: review and merge that first.Kind: guidance. Lab proposal: P18.
What the migration runs showed
-c optadds-O2andNDEBUG; cmake's reference has neither. With this guidance, cmake migrations kept the reference's build type (runs 086, 087, 094).The change
The skill never mentioned CMAKE_BUILD_TYPE or --compilation_mode, and its
canonicalization text called -O*/-g* "never your concern" (reworded in the
levels commit). Agents therefore map the concept, Release to
-c opt,and lose the number: CMake's Release is -O3 -DNDEBUG, Bazel's opt is -O2;
CMake's Debug is -g, Bazel's default fastbuild has neither.
Measured in any2bazel-lab: all nine migrations of pono, with and without
the skill, wrote
build --compilation_mode=optas the counterpart of Release, severalsaying so in a comment on the line above, and eight of the nine compile at
-O2 against a reference at -O3; the ninth added
build --copt=-O3andmatched. lensfun's CMakeLists.txt defaults the build type to Debug when
none is given; no lensfun migration set a compilation mode, so every one
dropped -g from all 40 TUs.
Adds a short "Build type" section to docs/REFERENCE-cmake.md, under a new
"Writing the BUILD files" heading that "Create initial BUILD.bazel files"
points to: the two mappings that differ, the reminder that a project can set its own default build type,
where to read the reference's actual level (diff.json's levels, or the
cache), and the two .bazelrc lines that pin it. It also says that opt adds
-DNDEBUG and so turns off assertions the reference may keep (diff.json's
ndebug shows it), and that
build --copt=-UNDEBUGundoes only the toolchain's -DNDEBUG, not one arule passes in its copts, which come later on the command line.
In the lab's later runs with this change, pono kept -O3, lensfun kept -g,
and CMake's sources, whose reference sets no build type, gained neither -O2
nor NDEBUG in three runs (two earlier runs had added both).
Testing
pytest tests/at this commit: 196 passed (130 onmain).🤖 Generated with Claude Code