From 7343d0a8aa8f09e643fdd5886e58d5233c7b8b05 Mon Sep 17 00:00:00 2001 From: Burak Emir Date: Fri, 7 Jun 2024 16:49:11 +0200 Subject: [PATCH] Put support invocations of clang executable behind a feature. --- CHANGELOG.md | 5 +++++ Cargo.toml | 5 ++++- src/lib.rs | 2 ++ tests/lib.rs | 3 +++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd3548f5d..062197b9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## [1.8.3] - UNRELEASED +### Changed +- Introduce a feature "support" to guard all interactions with clang executable. +Enabled by default, for backwards compatibility. + ## [1.8.2] - 2024-05-29 ### Changed diff --git a/Cargo.toml b/Cargo.toml index b530ce399..305eb22ff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,7 @@ links = "clang" build = "build.rs" [features] +default = ["support"] clang_3_5 = [] clang_3_6 = ["clang_3_5"] @@ -41,11 +42,13 @@ clang_16_0 = ["clang_15_0"] clang_17_0 = ["clang_16_0"] clang_18_0 = ["clang_17_0"] -runtime = ["libloading"] +runtime = ["libloading", "support"] static = [] libcpp = [] +support = [] + [dependencies] glob = "0.3" diff --git a/src/lib.rs b/src/lib.rs index 35b93bfe5..d9e5efa1f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,6 +22,8 @@ #![allow(non_camel_case_types, non_snake_case, non_upper_case_globals)] #![cfg_attr(feature = "cargo-clippy", allow(clippy::unreadable_literal))] +// Keep all interactions with the clang executable in this module. +#[cfg(feature = "support")] pub mod support; #[macro_use] diff --git a/tests/lib.rs b/tests/lib.rs index ffcb56a3b..49e36fc66 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -38,12 +38,14 @@ fn test() { parse(); } +#[cfg(feature = "support")] #[test] fn test_support() { let clang = support::Clang::find(None, &[]).unwrap(); println!("{:?}", clang); } +#[cfg(feature = "support")] #[test] fn test_support_target() { let args = &["--target".into(), "x86_64-unknown-linux-gnu".into()]; @@ -51,6 +53,7 @@ fn test_support_target() { println!("{:?}", clang); } +#[cfg(feature = "support")] #[cfg(feature = "runtime")] #[test] fn test_support_runtime() {