diff options
author | Emilio Cobos Álvarez <ecoal95@gmail.com> | 2016-04-02 04:51:16 +0200 |
---|---|---|
committer | Emilio Cobos Álvarez <ecoal95@gmail.com> | 2016-04-02 04:51:16 +0200 |
commit | 6de91cbb8ddf87f8080ab4a381b4ba7f55ed11bc (patch) | |
tree | 6bda0a63b2443b4ff067b9a38749682d74b3dab1 | |
parent | 3fa69fc8d54d60a8f3fdfa17188890f22e573521 (diff) |
gen: Generate a dummy pointer-aligned field into vtables
-rw-r--r-- | src/gen.rs | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -938,6 +938,14 @@ fn cstruct_to_rs(ctx: &mut GenCtx, name: &str, ci: CompInfo) -> Vec<P<ast::Item> vffields.push(respan(ctx.span, field)); } + // FIXME: rustc actually generates tons of warnings + // due to an empty repr(C) type, so we just generate + // a dummy field with pointer-alignment to supress it. + if vffields.is_empty() { + vffields.push(mk_blob_field(ctx, "_bindgen_empty_ctype_warning_fix", + Layout::new(::std::mem::size_of::<*mut ()>(), ::std::mem::align_of::<*mut ()>()))); + } + let vf_name = format!("_vftable_{}", name); let item = P(ast::Item { ident: ctx.ext_cx.ident_of(&vf_name), |