diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-12-09 18:09:02 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-09 18:09:02 -0800 |
commit | 68061ddc596e6edddc2207dbfe7dcb7c083d9386 (patch) | |
tree | 563dfe00731d9c7861d0d8c654f1ed404ee45b86 | |
parent | 452319f22008bf822f4fe7e48c6c2bfb36e09924 (diff) | |
parent | 322d1f21130da1b49f912fd386380975b3d1b352 (diff) |
Auto merge of #329 - upsuper:upgrade-syntex, r=emilio
Upgrade syntex to 0.50 for sync with servo
-rw-r--r-- | libbindgen/Cargo.toml | 8 | ||||
-rw-r--r-- | libbindgen/src/codegen/helpers.rs | 9 | ||||
-rw-r--r-- | libbindgen/src/codegen/mod.rs | 60 | ||||
-rw-r--r-- | libbindgen/src/ir/context.rs | 2 |
4 files changed, 32 insertions, 47 deletions
diff --git a/libbindgen/Cargo.toml b/libbindgen/Cargo.toml index 4b3a4f49..bc3137db 100644 --- a/libbindgen/Cargo.toml +++ b/libbindgen/Cargo.toml @@ -21,7 +21,7 @@ clap = "2" shlex = "0.1" [build-dependencies] -quasi_codegen = "0.21" +quasi_codegen = "0.26" [dependencies] cfg-if = "0.1.0" @@ -29,13 +29,13 @@ clang-sys = "0.11.1" lazy_static = "0.1.*" libc = "0.2" rustc-serialize = "0.3.19" -syntex_syntax = "0.44" +syntex_syntax = "0.50" regex = "0.1" cexpr = "0.2" [dependencies.aster] features = ["with-syntex"] -version = "0.29" +version = "0.34" [dependencies.clippy] optional = true @@ -51,7 +51,7 @@ version = "0.3" [dependencies.quasi] features = ["with-syntex"] -version = "0.21" +version = "0.26" [features] default = ["logging"] diff --git a/libbindgen/src/codegen/helpers.rs b/libbindgen/src/codegen/helpers.rs index 7284ab80..f1a0f314 100644 --- a/libbindgen/src/codegen/helpers.rs +++ b/libbindgen/src/codegen/helpers.rs @@ -93,11 +93,6 @@ pub mod ast_ty { pub fn float_kind_rust_type(ctx: &BindgenContext, fk: FloatKind) -> P<ast::Ty> { - macro_rules! raw { - ($ty: ident) => { - raw_type(ctx, stringify!($ty)) - } - } // TODO: we probably should just take the type layout into // account? // @@ -109,9 +104,9 @@ pub mod ast_ty { (FloatKind::Float, true) => aster::ty::TyBuilder::new().f32(), (FloatKind::Double, true) | (FloatKind::LongDouble, true) => aster::ty::TyBuilder::new().f64(), - (FloatKind::Float, false) => raw!(c_float), + (FloatKind::Float, false) => raw_type(ctx, "c_float"), (FloatKind::Double, false) | - (FloatKind::LongDouble, false) => raw!(c_double), + (FloatKind::LongDouble, false) => raw_type(ctx, "c_double"), (FloatKind::Float128, _) => { aster::ty::TyBuilder::new().array(16).u8() } diff --git a/libbindgen/src/codegen/mod.rs b/libbindgen/src/codegen/mod.rs index a88e7d73..31946964 100644 --- a/libbindgen/src/codegen/mod.rs +++ b/libbindgen/src/codegen/mod.rs @@ -1723,29 +1723,24 @@ impl ToRustTy for Type { fn to_rust_ty(&self, ctx: &BindgenContext, item: &Item) -> P<ast::Ty> { use self::helpers::ast_ty::*; - macro_rules! raw { - ($ty: ident) => { - raw_type(ctx, stringify!($ty)) - } - } match *self.kind() { - TypeKind::Void => raw!(c_void), + TypeKind::Void => raw_type(ctx, "c_void"), // TODO: we should do something smart with nullptr, or maybe *const // c_void is enough? - TypeKind::NullPtr => raw!(c_void).to_ptr(true, ctx.span()), + TypeKind::NullPtr => raw_type(ctx, "c_void").to_ptr(true, ctx.span()), TypeKind::Int(ik) => { match ik { IntKind::Bool => aster::ty::TyBuilder::new().bool(), - IntKind::Char => raw!(c_char), - IntKind::UChar => raw!(c_uchar), - IntKind::Short => raw!(c_short), - IntKind::UShort => raw!(c_ushort), - IntKind::Int => raw!(c_int), - IntKind::UInt => raw!(c_uint), - IntKind::Long => raw!(c_long), - IntKind::ULong => raw!(c_ulong), - IntKind::LongLong => raw!(c_longlong), - IntKind::ULongLong => raw!(c_ulonglong), + IntKind::Char => raw_type(ctx, "c_char"), + IntKind::UChar => raw_type(ctx, "c_uchar"), + IntKind::Short => raw_type(ctx, "c_short"), + IntKind::UShort => raw_type(ctx, "c_ushort"), + IntKind::Int => raw_type(ctx, "c_int"), + IntKind::UInt => raw_type(ctx, "c_uint"), + IntKind::Long => raw_type(ctx, "c_long"), + IntKind::ULong => raw_type(ctx, "c_ulong"), + IntKind::LongLong => raw_type(ctx, "c_longlong"), + IntKind::ULongLong => raw_type(ctx, "c_ulonglong"), IntKind::I8 => aster::ty::TyBuilder::new().i8(), IntKind::U8 => aster::ty::TyBuilder::new().u8(), @@ -1843,7 +1838,7 @@ impl ToRustTy for Type { utils::build_templated_path(item, ctx, false) } TypeKind::BlockPointer => { - let void = raw!(c_void); + let void = raw_type(ctx, "c_void"); void.to_ptr(/* is_const = */ false, ctx.span()) @@ -2204,24 +2199,19 @@ mod utils { -> Option<P<ast::Ty>> { // FIXME: We could use the inner item to check this is really a // primitive type but, who the heck overrides these anyway? - macro_rules! ty { - ($which:ident) => {{ - primitive_ty(ctx, stringify!($which)) - }} - } Some(match name { - "int8_t" => ty!(i8), - "uint8_t" => ty!(u8), - "int16_t" => ty!(i16), - "uint16_t" => ty!(u16), - "int32_t" => ty!(i32), - "uint32_t" => ty!(u32), - "int64_t" => ty!(i64), - "uint64_t" => ty!(u64), - - "uintptr_t" | "size_t" => ty!(usize), - - "intptr_t" | "ptrdiff_t" | "ssize_t" => ty!(isize), + "int8_t" => primitive_ty(ctx, "i8"), + "uint8_t" => primitive_ty(ctx, "u8"), + "int16_t" => primitive_ty(ctx, "i16"), + "uint16_t" => primitive_ty(ctx, "u16"), + "int32_t" => primitive_ty(ctx, "i32"), + "uint32_t" => primitive_ty(ctx, "u32"), + "int64_t" => primitive_ty(ctx, "i64"), + "uint64_t" => primitive_ty(ctx, "u64"), + + "uintptr_t" | "size_t" => primitive_ty(ctx, "usize"), + + "intptr_t" | "ptrdiff_t" | "ssize_t" => primitive_ty(ctx, "isize"), _ => return None, }) } diff --git a/libbindgen/src/ir/context.rs b/libbindgen/src/ir/context.rs index b1c40cb3..8be064b8 100644 --- a/libbindgen/src/ir/context.rs +++ b/libbindgen/src/ir/context.rs @@ -429,7 +429,7 @@ impl<'ctx> BindgenContext<'ctx> { let sess = parse::ParseSess::new(); let mut loader = base::DummyResolver; let mut ctx = - GenContext(base::ExtCtxt::new(&sess, vec![], cfg, &mut loader)); + GenContext(base::ExtCtxt::new(&sess, cfg, &mut loader)); ctx.0.bt_push(ExpnInfo { call_site: self.span, |