Skip to content

Fix missing dylibs #1256

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

Merged
merged 2 commits into from
Feb 14, 2018
Merged
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
76 changes: 67 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,38 @@
- [Removed](#removed)
- [Fixed](#fixed)
- [Security](#security)
- [0.32.0](#0320)
- [0.33.1](#0331)
- [Fixed](#fixed-1)
- [0.33.0](#0330)
- [Added](#added-1)
- [Changed](#changed-1)
- [Fixed](#fixed-1)
- [0.31.0](#0310)
- [Added](#added-2)
- [Changed](#changed-2)
- [Deprecated](#deprecated-1)
- [Removed](#removed-1)
- [Fixed](#fixed-2)
- [0.30.0](#0300)
- [Security](#security-1)
- [0.32.2](#0322)
- [Fixed](#fixed-3)
- [0.32.1](#0321)
- [Fixed](#fixed-4)
- [0.32.0](#0320)
- [Added](#added-2)
- [Changed](#changed-2)
- [Fixed](#fixed-5)
- [0.31.0](#0310)
- [Added](#added-3)
- [Changed](#changed-3)
- [Deprecated](#deprecated-2)
- [Fixed](#fixed-3)
- [0.29.0](#0290)
- [Removed](#removed-2)
- [Fixed](#fixed-6)
- [0.30.0](#0300)
- [Added](#added-4)
- [Changed](#changed-4)
- [Fixed](#fixed-4)
- [Deprecated](#deprecated-3)
- [Fixed](#fixed-7)
- [0.29.0](#0290)
- [Added](#added-5)
- [Changed](#changed-5)
- [Fixed](#fixed-8)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

Expand Down Expand Up @@ -63,6 +76,51 @@ Released YYYY/MM/DD

--------------------------------------------------------------------------------

# 0.33.1

Released 2018/02/14

## Fixed

* Reverted the dependency update to `quote = "0.4"` and addition of the
`proc_macro2` dependency. The `proc_macro2` crate depends on `rustc` internal
libraries, which means that CLIs which use it must be run under `rustup`,
which is not acceptable for `bindgen`. [#1248][]

[#1248]: https://github.com/rust-lang-nursery/rust-bindgen/issues/1248

--------------------------------------------------------------------------------

# 0.33.0

Released YYYY/MM/DD

## Added

* TODO (or remove section if none)

## Changed

* TODO (or remove section if none)

## Deprecated

* TODO (or remove section if none)

## Removed

* TODO (or remove section if none)

## Fixed

* TODO (or remove section if none)

## Security

* TODO (or remove section if none)

--------------------------------------------------------------------------------

# 0.32.2

Released 2018/01/22
Expand Down
27 changes: 4 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ name = "bindgen"
readme = "README.md"
repository = "https://github.com/rust-lang-nursery/rust-bindgen"
documentation = "https://docs.rs/bindgen"
version = "0.33.0"
version = "0.33.1"
build = "build.rs"

include = [
Expand Down Expand Up @@ -47,10 +47,9 @@ clap = "2"
clang-sys = { version = "0.21.0", features = ["runtime", "clang_3_9"] }
lazy_static = "1"
peeking_take_while = "0.1.2"
quote = "0.4"
quote = "0.3.15"
regex = "0.2"
which = "1.0.2"
proc-macro2 = "0.2"

[dependencies.env_logger]
optional = true
Expand Down
49 changes: 30 additions & 19 deletions src/codegen/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,27 @@
use ir::context::BindgenContext;
use ir::layout::Layout;
use quote;
use proc_macro2;
use std::mem;

pub mod attributes {
use quote;
use proc_macro2;

pub fn repr(which: &str) -> quote::Tokens {
let which = proc_macro2::Term::intern(which);
let which = quote::Ident::new(which);
quote! {
#[repr( #which )]
}
}

pub fn repr_list(which_ones: &[&str]) -> quote::Tokens {
let which_ones = which_ones.iter().cloned().map(proc_macro2::Term::intern);
let which_ones = which_ones.iter().cloned().map(quote::Ident::new);
quote! {
#[repr( #( #which_ones ),* )]
}
}

pub fn derives(which_ones: &[&str]) -> quote::Tokens {
let which_ones = which_ones.iter().cloned().map(proc_macro2::Term::intern);
let which_ones = which_ones.iter().cloned().map(quote::Ident::new);
quote! {
#[derive( #( #which_ones ),* )]
}
Expand All @@ -41,8 +39,11 @@ pub mod attributes {
// Doc comments are already preprocessed into nice `///` formats by the
// time they get here. Just make sure that we have newlines around it so
// that nothing else gets wrapped into the comment.
let comment = proc_macro2::Literal::doccomment(&comment);
quote! {#comment}
let mut tokens = quote! {};
tokens.append("\n");
tokens.append(comment);
tokens.append("\n");
tokens
}

pub fn link_name(name: &str) -> quote::Tokens {
Expand Down Expand Up @@ -72,7 +73,7 @@ pub fn blob(layout: Layout) -> quote::Tokens {
}
};

let ty_name = proc_macro2::Term::intern(ty_name);
let ty_name = quote::Ident::new(ty_name);

let data_len = opaque.array_size().unwrap_or(layout.size);

Expand Down Expand Up @@ -102,7 +103,7 @@ pub fn bitfield_unit(ctx: &BindgenContext, layout: Layout) -> quote::Tokens {
let mut tokens = quote! {};

if ctx.options().enable_cxx_namespaces {
tokens.append_all(quote! { root:: });
tokens.append(quote! { root:: });
}

let align = match layout.align {
Expand All @@ -113,7 +114,7 @@ pub fn bitfield_unit(ctx: &BindgenContext, layout: Layout) -> quote::Tokens {
};

let size = layout.size;
tokens.append_all(quote! {
tokens.append(quote! {
__BindgenBitfieldUnit<[u8; #size], #align>
});

Expand All @@ -125,7 +126,6 @@ pub mod ast_ty {
use ir::function::FunctionSig;
use ir::ty::FloatKind;
use quote;
use proc_macro2;

pub fn raw_type(ctx: &BindgenContext, name: &str) -> quote::Tokens {
let ident = ctx.rust_ident_raw(name);
Expand Down Expand Up @@ -166,25 +166,29 @@ pub mod ast_ty {

pub fn int_expr(val: i64) -> quote::Tokens {
// Don't use quote! { #val } because that adds the type suffix.
let val = proc_macro2::Literal::integer(val);
quote!(#val)
let mut tokens = quote! {};
tokens.append(val.to_string());
tokens
}

pub fn uint_expr(val: u64) -> quote::Tokens {
// Don't use quote! { #val } because that adds the type suffix.
let val = proc_macro2::Term::intern(&val.to_string());
quote!(#val)
let mut tokens = quote! {};
tokens.append(val.to_string());
tokens
}

pub fn byte_array_expr(bytes: &[u8]) -> quote::Tokens {
let mut bytes: Vec<_> = bytes.iter().cloned().collect();
bytes.push(0);
quote! { [ #(#bytes),* ] }
quote! {
#bytes
}
}

pub fn cstr_expr(mut string: String) -> quote::Tokens {
string.push('\0');
let b = proc_macro2::Literal::byte_string(&string.as_bytes());
let b = quote::ByteStr(&string);
quote! {
#b
}
Expand All @@ -195,9 +199,16 @@ pub mod ast_ty {
f: f64,
) -> Result<quote::Tokens, ()> {
if f.is_finite() {
let val = proc_macro2::Literal::float(f);
let mut string = f.to_string();

// So it gets properly recognised as a floating point constant.
if !string.contains('.') {
string.push('.');
}

return Ok(quote!(#val));
let mut tokens = quote! {};
tokens.append(string);
return Ok(tokens);
}

let prefix = ctx.trait_prefix();
Expand Down
3 changes: 1 addition & 2 deletions src/codegen/impl_partialeq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use ir::context::BindgenContext;
use ir::item::{IsOpaque, Item};
use ir::ty::{TypeKind, RUST_DERIVE_IN_ARRAY_LIMIT};
use quote;
use proc_macro2;

/// Generate a manual implementation of `PartialEq` trait for the
/// specified compound type.
Expand Down Expand Up @@ -72,7 +71,7 @@ pub fn gen_partialeq_impl(
}

fn gen_field(ctx: &BindgenContext, ty_item: &Item, name: &str) -> quote::Tokens {
fn quote_equals(name_ident: proc_macro2::Term) -> quote::Tokens {
fn quote_equals(name_ident: quote::Ident) -> quote::Tokens {
quote! { self.#name_ident == other.#name_ident }
}

Expand Down
Loading