Repository navigation
Report compile-only flags on CMake link lines as a warning - #43
Open
anakanemison wants to merge 1 commit into
Open
anakanemison wants to merge 1 commit into
anakanemison wants to merge 1 commit into
Conversation
anakanemison
force-pushed
the
mschaller/u08-compile-only-link-flags-warning
branch
from
October 26, 2026 13:30
6e3b4d8 to
05429c2
Compare
anakanemison
changed the base branch from
mschaller/u07-align-executables-by-basename
to
mschaller/u06-say-what-convergence-covers
November 2, 2026 17:50
anakanemison
force-pushed
the
mschaller/u08-compile-only-link-flags-warning
branch
from
November 2, 2026 17:50
05429c2 to
306d4f1
Compare
CMake passes CMAKE_<LANG>_FLAGS to the link line as well as the compile line, so warning flags, -pedantic and -D/-U defines (including the -DNDEBUG of Release builds) appear in the File API's link flags. The driver ignores them when linking, and Bazel's link lines do not carry them, so each one was a link_flags_diff error that every migration had to suppress by hand in ignore.link_flags. Measured in any2bazel-lab: every converged migration of three small projects suppressed the same kinds of flag, each agent rediscovering and justifying them in its own words (-Wall -Wextra -Wformat-security -pedantic on one, -Wno-format-truncation on another, -DNDEBUG on a third). Agents also suppressed front-end flags by hand: -fexceptions on lensfun, -w and -fno-common on CMake's sources, -fvisibility=hidden on GDAL and QGIS. A hand suppression is also where a reviewer can wave a real difference through. _diff_link_flags now sends these missing CMake link flags to a new WARN kind, link_compile_only_flags, which does not block `converged`: - warnings and -Wp, preprocessor pass-throughs (-W..., but not -Wl, or -Wa,, the latter because an LTO link runs the assembler), -w and -pedantic*; - -D and -U; - front-end -f flags that steer only the compiler, listed one by one: -fexceptions, -fno-exceptions, -fcommon, -fno-common, -fvisibility-inlines-hidden and -fvisibility=. Everything else stays a link_flags_diff error. Most -f flags matter at link time, so the list is explicit rather than a prefix, and -fopenmp, -pthread, -static*, -fsanitize* and -flto* are not in it. When an -flto* flag is on either side of a link, warning controls and the front-end flags stay errors, because LTO runs code generation, and diagnostics such as -Werror=lto-type-mismatch, at link time. ignore.link_flags still silences any of them entirely. SKILL.md lists the new kind, and the front-end flags, with the other no-action WARNs. The upstream test that used -fvisibility=hidden as its example of a link error now uses -Wl,--no-undefined. A built-in list is a design choice the maintainers may prefer to own; this one is reported rather than dropped, so nothing disappears silently. Not done: raising an unreferenced <target>_EXPORTS define only when a source reads it, which would need the differ to read source files. In the lab's runs with this change, the first version of the list (without the front-end flags) still left agents suppressing -fexceptions on lensfun and -w and -fno-common on CMake. With the list above, neither project's next run suppressed a link flag by hand. Lab-Proposal: P11 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anakanemison
force-pushed
the
mschaller/u08-compile-only-link-flags-warning
branch
from
November 9, 2026 18:45
306d4f1 to
b6e3019
Compare
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.
CMake passes
CMAKE_<LANG>_FLAGSto the link line too, so warning flags,-pedantic,-D/-Uand some front-end-fflags appear among its link flags. The driver ignores them when linking, and each was alink_flags_differror that migrations suppressed by hand. They now go to a new WARN kind,link_compile_only_flags. The-fflags are an explicit list (-f[no-]exceptions,-f[no-]common,-fvisibility-inlines-hiddenand-fvisibility=); everything else stays an error, and with LTO on either side, warning and front-end flags stay errors.In any2bazel-lab, every converged migration of three small projects suppressed the same kinds of flag by hand. With this list, neither lensfun's nor CMake's next migration suppressed a link flag by hand. A built-in list is a design choice the maintainers may prefer to own.
Stacked on #41 (tracking issue: #35).
pytest tests/: 181 passed (132 onmain). Lab proposal: P11.🤖 Generated with Claude Code