diff options
-rw-r--r-- | bindgen/src/main.rs | 2 | ||||
-rw-r--r-- | libbindgen/src/codegen/mod.rs | 4 | ||||
-rw-r--r-- | libbindgen/src/ir/context.rs | 2 | ||||
-rw-r--r-- | libbindgen/src/ir/ty.rs | 4 | ||||
-rw-r--r-- | libbindgen/src/regex_set.rs | 2 | ||||
-rw-r--r-- | libbindgen/tests/expectations/tests/typedefd-array-as-function-arg.rs | 10 | ||||
-rw-r--r-- | libbindgen/tests/headers/typedefd-array-as-function-arg.h | 3 |
7 files changed, 20 insertions, 7 deletions
diff --git a/bindgen/src/main.rs b/bindgen/src/main.rs index b54d4af5..515d1d1a 100644 --- a/bindgen/src/main.rs +++ b/bindgen/src/main.rs @@ -35,7 +35,7 @@ pub fn main() { match version.parsed { None => warn!("Couldn't parse libclang version"), Some(version) if version != expected_version => { - error!("Using clang {:?}, expected {:?}", + warn!("Using clang {:?}, expected {:?}", version, expected_version); } diff --git a/libbindgen/src/codegen/mod.rs b/libbindgen/src/codegen/mod.rs index 5515527e..24b862be 100644 --- a/libbindgen/src/codegen/mod.rs +++ b/libbindgen/src/codegen/mod.rs @@ -529,7 +529,7 @@ impl CodeGenerator for Type { if template_arg.is_named() { let name = template_arg.name().unwrap(); if name.contains("typename ") { - error!("Item contained `typename`'d template \ + warn!("Item contained `typename`'d template \ parameter: {:?}", item); return; } @@ -1946,7 +1946,7 @@ impl ToRustTy for FunctionSig { // the array type derivation. // // [1]: http://c0x.coding-guidelines.com/6.7.5.3.html - let arg_ty = if let TypeKind::Array(t, _) = *arg_ty.kind() { + let arg_ty = if let TypeKind::Array(t, _) = *arg_ty.canonical_type(ctx).kind() { t.to_rust_ty(ctx).to_ptr(arg_ty.is_const(), ctx.span()) } else { arg_item.to_rust_ty(ctx) diff --git a/libbindgen/src/ir/context.rs b/libbindgen/src/ir/context.rs index 5dc7886b..d87c8f29 100644 --- a/libbindgen/src/ir/context.rs +++ b/libbindgen/src/ir/context.rs @@ -247,7 +247,7 @@ impl<'ctx> BindgenContext<'ctx> { } else if let Some(usr) = declaration.usr() { TypeKey::USR(usr) } else { - error!("Valid declaration with no USR: {:?}, {:?}", + warn!("Valid declaration with no USR: {:?}, {:?}", declaration, location); TypeKey::Declaration(declaration) diff --git a/libbindgen/src/ir/ty.rs b/libbindgen/src/ir/ty.rs index f1561612..df3baf91 100644 --- a/libbindgen/src/ir/ty.rs +++ b/libbindgen/src/ir/ty.rs @@ -732,7 +732,7 @@ impl Type { // // https://github.com/jamesmunns/teensy3-rs/issues/9 if !ty.spelling().is_empty() { - error!("invalid type {:?}", ty); + warn!("invalid type {:?}", ty); } else { warn!("invalid type {:?}", ty); } @@ -747,7 +747,7 @@ impl Type { } if !ty.spelling().is_empty() { - error!("invalid type {:?}", ty); + warn!("invalid type {:?}", ty); } else { warn!("invalid type {:?}", ty); } diff --git a/libbindgen/src/regex_set.rs b/libbindgen/src/regex_set.rs index 93130590..8747d285 100644 --- a/libbindgen/src/regex_set.rs +++ b/libbindgen/src/regex_set.rs @@ -37,7 +37,7 @@ impl RegexSet { self.items.push(r); } Err(err) => { - error!("Invalid pattern provided: {}, {:?}", s, err); + warn!("Invalid pattern provided: {}, {:?}", s, err); } } } diff --git a/libbindgen/tests/expectations/tests/typedefd-array-as-function-arg.rs b/libbindgen/tests/expectations/tests/typedefd-array-as-function-arg.rs new file mode 100644 index 00000000..56074f75 --- /dev/null +++ b/libbindgen/tests/expectations/tests/typedefd-array-as-function-arg.rs @@ -0,0 +1,10 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(non_snake_case)] + + +pub type myVector3 = [f32; 3usize]; +extern "C" { + pub fn modifyVectorFunc(v: *mut f32); +} diff --git a/libbindgen/tests/headers/typedefd-array-as-function-arg.h b/libbindgen/tests/headers/typedefd-array-as-function-arg.h new file mode 100644 index 00000000..93790591 --- /dev/null +++ b/libbindgen/tests/headers/typedefd-array-as-function-arg.h @@ -0,0 +1,3 @@ +// foo.h +typedef float myVector3[3]; +void modifyVectorFunc(myVector3 v); |