From 70edbc57ebb199ab6f8f0dc3ffb59b017fa011b2 Mon Sep 17 00:00:00 2001 From: chrysn Date: Fri, 24 Nov 2023 16:19:25 +0100 Subject: [PATCH] build: Fix randomly missing -I entries 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. --- build.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build.rs b/build.rs index 0c7fa6f..0c380f6 100644 --- a/build.rs +++ b/build.rs @@ -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);