Skip to content

Commit 4fcf972

Browse files
committed
Add no_exceptions feature flag
1 parent d5dd976 commit 4fcf972

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ default = ["std", "cxxbridge-flags/default"] # c++11
1919
"c++14" = ["cxxbridge-flags/c++14"]
2020
"c++17" = ["cxxbridge-flags/c++17"]
2121
"c++20" = ["cxxbridge-flags/c++20"]
22+
"no_exceptions" = ["cxxbridge-flags/no_exceptions"]
2223
alloc = []
2324
std = ["alloc"]
2425

build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ fn main() {
1111
.cpp(true)
1212
.cpp_link_stdlib(None) // linked via link-cplusplus crate
1313
.std(cxxbridge_flags::STD)
14+
.define(cxxbridge_flags::EXCEPTIONS, None)
1415
.warnings_into_errors(cfg!(deny_warnings))
1516
.compile("cxxbridge1");
1617

flags/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ default = [] # c++11
1414
"c++14" = []
1515
"c++17" = []
1616
"c++20" = []
17+
"no_exceptions" = []
1718

1819
[package.metadata.docs.rs]
1920
targets = ["x86_64-unknown-linux-gnu"]

flags/src/impl.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#[allow(unused_assignments, unused_mut, unused_variables)]
1+
#![allow(unused_assignments, unused_mut, unused_variables)]
22
pub const STD: &str = {
33
let mut flag = "c++11";
44

@@ -13,3 +13,12 @@ pub const STD: &str = {
1313

1414
flag
1515
};
16+
17+
pub const EXCEPTIONS: &str = {
18+
let mut flag = "RUST_CXX_ALLOW_EXCEPTIONS";
19+
20+
#[cfg(feature = "no_exceptions")]
21+
(flag = "RUST_CXX_NO_EXCEPTIONS");
22+
23+
flag
24+
};

0 commit comments

Comments
 (0)