Rollforward of https://github.com/bazelbuild/bazel/commit/2d3adfb93c023f9752f00d4bf3440ee9869f64f2: Add a warning if the same rc file is read multiple times.
Prerequisite for fixing #5765, to minimize the risk that multiple rc files import the same file, which is slightly more likely with try-import.
Added extra test for double-load rcs imported using different syntax, fixing an issue where paths were not canonicalized for reliable comparison.
RELNOTES: None.
PiperOrigin-RevId: 210140725
diff --git a/src/main/cpp/option_processor-internal.h b/src/main/cpp/option_processor-internal.h
index c552db4..b25db9c 100644
--- a/src/main/cpp/option_processor-internal.h
+++ b/src/main/cpp/option_processor-internal.h
@@ -31,6 +31,11 @@
std::vector<std::string> DedupeBlazercPaths(
const std::vector<std::string>& paths);
+// Given the set of already-ready files, warns if any of the newly loaded_rcs
+// are duplicates. All paths are expected to be canonical.
+void WarnAboutDuplicateRcFiles(const std::set<std::string>& read_files,
+ const std::deque<std::string>& loaded_rcs);
+
// Get the legacy list of rc files that would have been loaded - this is to
// provide a useful warning if files are being ignored that were loaded in a
// previous version of Bazel.