Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add no_exceptions feature flag #1343

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ default = ["std", "cxxbridge-flags/default"] # c++11
"c++14" = ["cxxbridge-flags/c++14"]
"c++17" = ["cxxbridge-flags/c++17"]
"c++20" = ["cxxbridge-flags/c++20"]
"no_exceptions" = ["cxxbridge-flags/no_exceptions"]
alloc = []
std = ["alloc"]

Expand Down
1 change: 1 addition & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ fn main() {
.cpp(true)
.cpp_link_stdlib(None) // linked via link-cplusplus crate
.std(cxxbridge_flags::STD)
.define(cxxbridge_flags::EXCEPTIONS, None)
.warnings_into_errors(cfg!(deny_warnings))
.compile("cxxbridge1");

Expand Down
1 change: 1 addition & 0 deletions flags/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ default = [] # c++11
"c++14" = []
"c++17" = []
"c++20" = []
"no_exceptions" = []

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
Expand Down
11 changes: 10 additions & 1 deletion flags/src/impl.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[allow(unused_assignments, unused_mut, unused_variables)]
#![allow(unused_assignments, unused_mut, unused_variables)]
pub const STD: &str = {
let mut flag = "c++11";

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

flag
};

pub const EXCEPTIONS: &str = {
let mut flag = "RUST_CXX_ALLOW_EXCEPTIONS";

#[cfg(feature = "no_exceptions")]
(flag = "RUST_CXX_NO_EXCEPTIONS");

flag
};