Skip to content

Commit

Permalink
build: Fix randomly missing -I entries
Browse files Browse the repository at this point in the history
The algorithm for building the consensus CFLAGS was flawed in that the
special-casing of `-I path` options only succeeded if the given option
was in the first entry of the compile commands list.

While the algorithm can certainly need an overhaul, this is the
minimally intrusive fix.
  • Loading branch information
chrysn committed Nov 24, 2023
1 parent c985a6b commit 70edbc5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ fn main() {
keep
})
.collect();
// Hot-fixing the merging algorithm to even work when an (always to be kept) -I
// is not in the initial set
for group in cflag_groups.drain(..) {
if group[0].starts_with("-I") {
if !consensus_cflag_groups.contains(&group) {
consensus_cflag_groups.push(group);
}
}
}
}
} else {
consensus_cflag_groups = Some(cflag_groups);
Expand Down

0 comments on commit 70edbc5

Please sign in to comment.