Draft
Conversation
…ring
Prior to commit a6ddf2534 ("backend/ninja: Extend IncludeDirs.rel_string_list
for backend use"), when include_directories() was called with
`is_system: true` and multiple directories, the resulting `-isystem`
flags appeared on the command line in the opposite order from what was
specified: the last-listed directory was searched first by the compiler.
This was the opposite convention from non-system -I includes, where the
first-listed directory is searched first.
The asymmetry was not intentional; it was a side effect of how
CompilerArgs.__iadd__ handles flags that are not in prepend_prefixes:
- `-I` is in CLikeCompilerArgs.prepend_prefixes, so `__iadd__`
prepends it. The ninja backend iterates directories in reversed
order and adds them one at a time; the prepend-on-each-add
counteracts the reversal, producing the original order.
- `-isystem` was not in prepend_prefixes, so __iadd__ appended it.
The same reversed one-at-a-time iteration then produced a reversed
sequence — the last-listed directory ended up first on the command line.
Commit a6ddf25 changed generate_inc_dir to add all directories
in a single bulk commands += call instead of one at a time. This
preserved the correct order for -I (the double reversal in
__iadd__ still works for a bulk add) but silently broke -isystem,
because appending a list at once preserves input order rather than
reversing it.
Fix this by adding -isystem to CLikeCompilerArgs.prepend_prefixes
so that both -I and -isystem are handled uniformly. This also
means the bulk generate_inc_dir approach works correctly for both
flag types, so the per-directory reversed loop from before commt
a6ddf25 is no longer needed.
Adding -isystem to prepend_prefixes now makes the ordering
consistent, but projects that relied on the old reversed
behaviour would silently break. To preserve backwards compatibility,
emit a FeatureBroken and reverse the directory list when 1) `is_system:
true` 2) the project declares meson_version: '>=1.11.0'.
Unlike normal FeatureBroken, the bug with include_directories(is_system: true) isn't a feature going away, it just suboptimal behaviour that could be fixed. Introduce a new kind of feature check for something that is fixed and has a behavior change when meson_version is bumped. It uses mlog.warning() instead of mlog.deprecation(), and has the same check as FeatureNew so that the warning disappears with new versions of Meson. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Contributor
Author
|
This is a dead end - |
This was referenced Feb 23, 2026
Contributor
Author
|
Related: #2155 - reopening as draft |
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.
Fixes: #2155