From c97ac0516725cc838944157f15e61319d6ef0d31 Mon Sep 17 00:00:00 2001 From: Vladimir Vukicevic Date: Wed, 7 Sep 2016 23:44:16 -0400 Subject: Only strip the prefix _ on macos; windows needs it on gnu as well --- src/parser.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/parser.rs b/src/parser.rs index d8227f3a..0e531420 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -68,13 +68,10 @@ impl<'a> ClangParserCtx<'a> { } } -fn cursor_link_name(ctx: &mut ClangParserCtx, cursor: &Cursor) -> String { - let mut mangling = cursor.mangling(); - +fn cursor_link_name(_: &mut ClangParserCtx, cursor: &Cursor) -> String { // Try to undo backend linkage munging (prepended _, generally) - if cfg!(target_os = "macos") || - (cfg!(target_os = "windows") && !ctx.options.msvc_mangling) - { + let mut mangling = cursor.mangling(); + if cfg!(target_os = "macos") { mangling.remove(0); } mangling -- cgit v1.2.3 From 120dacb84e7db568560e381aeec931aa13c680f8 Mon Sep 17 00:00:00 2001 From: Vladimir Vukicevic Date: Wed, 7 Sep 2016 23:44:43 -0400 Subject: Don't add -isystem header args when --target is specified --- src/bin/bindgen.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/bin/bindgen.rs b/src/bin/bindgen.rs index 4ea2cd91..8c515131 100755 --- a/src/bin/bindgen.rs +++ b/src/bin/bindgen.rs @@ -199,11 +199,16 @@ pub fn main() { bind_args.push("--".to_owned()); } - // TODO: distinguish C and C++ paths? C++'s should be enough, I guess. - for path in clang.cpp_search_paths.into_iter() { - if let Ok(path) = path.into_os_string().into_string() { - bind_args.push("-isystem".to_owned()); - bind_args.push(path); + // If --target is specified, assume caller knows what they're doing and don't mess with + // include paths for them + let has_target_arg = bind_args.iter().rposition(|arg| arg.starts_with("--target")).is_some(); + if !has_target_arg { + // TODO: distinguish C and C++ paths? C++'s should be enough, I guess. + for path in clang.cpp_search_paths.into_iter() { + if let Ok(path) = path.into_os_string().into_string() { + bind_args.push("-isystem".to_owned()); + bind_args.push(path); + } } } } -- cgit v1.2.3