summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2017-01-22 12:58:12 +0100
committerEmilio Cobos Álvarez <emilio@crisal.io>2017-01-23 10:22:08 +0100
commitb83da2729fc83663f979da05201920e039ae3c3f (patch)
tree27e1c8b1b7f0fef74b064740238da843d4cfc1f6 /tests
parent7373a4258f652c23e5fe00ad14740393caa40082 (diff)
Unify under the `bindgen` name.
Diffstat (limited to 'tests')
-rw-r--r--tests/expectations/Cargo.toml11
-rw-r--r--tests/expectations/lib.rs0
-rw-r--r--tests/expectations/src/lib.rs0
-rw-r--r--tests/expectations/tests/accessors.rs204
-rw-r--r--tests/expectations/tests/annotation_hide.rs35
-rw-r--r--tests/expectations/tests/anon_enum.rs30
-rw-r--r--tests/expectations/tests/anon_enum_trait.rs47
-rw-r--r--tests/expectations/tests/anon_enum_whitelist.rs11
-rw-r--r--tests/expectations/tests/anon_union.rs84
-rw-r--r--tests/expectations/tests/arg_keyword.rs10
-rw-r--r--tests/expectations/tests/auto.rs30
-rw-r--r--tests/expectations/tests/bad-namespace-parenthood-inheritance.rs20
-rw-r--r--tests/expectations/tests/base-to-derived.rs19
-rw-r--r--tests/expectations/tests/bitfield-enum-basic.rs77
-rw-r--r--tests/expectations/tests/bitfield_method_mangling.rs49
-rw-r--r--tests/expectations/tests/blocks.rs9
-rw-r--r--tests/expectations/tests/canonical_path_without_namespacing.rs23
-rw-r--r--tests/expectations/tests/class.rs127
-rw-r--r--tests/expectations/tests/class_nested.rs59
-rw-r--r--tests/expectations/tests/class_no_members.rs45
-rw-r--r--tests/expectations/tests/class_static.rs32
-rw-r--r--tests/expectations/tests/class_static_const.rs22
-rw-r--r--tests/expectations/tests/class_use_as.rs35
-rw-r--r--tests/expectations/tests/class_with_dtor.rs29
-rw-r--r--tests/expectations/tests/class_with_inner_struct.rs199
-rw-r--r--tests/expectations/tests/class_with_typedef.rs72
-rw-r--r--tests/expectations/tests/complex.rs64
-rw-r--r--tests/expectations/tests/complex_global.rs24
-rw-r--r--tests/expectations/tests/const_bool.rs23
-rw-r--r--tests/expectations/tests/const_enum_unnamed.rs28
-rw-r--r--tests/expectations/tests/const_ptr.rs9
-rw-r--r--tests/expectations/tests/const_resolved_ty.rs9
-rw-r--r--tests/expectations/tests/const_tparam.rs12
-rw-r--r--tests/expectations/tests/constant-evaluate.rs20
-rw-r--r--tests/expectations/tests/constify-enum.rs20
-rw-r--r--tests/expectations/tests/constructor-tp.rs37
-rw-r--r--tests/expectations/tests/constructors.rs67
-rw-r--r--tests/expectations/tests/convert-floats.rs30
-rw-r--r--tests/expectations/tests/crtp.rs55
-rw-r--r--tests/expectations/tests/dash_language.rs12
-rw-r--r--tests/expectations/tests/decl_extern_int_twice.rs10
-rw-r--r--tests/expectations/tests/decl_ptr_to_array.rs10
-rw-r--r--tests/expectations/tests/disable-namespacing.rs7
-rw-r--r--tests/expectations/tests/duplicated-namespaces-definitions.rs45
-rw-r--r--tests/expectations/tests/duplicated-namespaces.rs10
-rw-r--r--tests/expectations/tests/duplicated_constants_in_ns.rs20
-rw-r--r--tests/expectations/tests/elaborated.rs11
-rw-r--r--tests/expectations/tests/empty_template_param_name.rs13
-rw-r--r--tests/expectations/tests/enum.rs12
-rw-r--r--tests/expectations/tests/enum_alias.rs9
-rw-r--r--tests/expectations/tests/enum_and_vtable_mangling.rs28
-rw-r--r--tests/expectations/tests/enum_dupe.rs10
-rw-r--r--tests/expectations/tests/enum_explicit_type.rs24
-rw-r--r--tests/expectations/tests/enum_in_template_with_typedef.rs18
-rw-r--r--tests/expectations/tests/enum_negative.rs9
-rw-r--r--tests/expectations/tests/enum_packed.rs15
-rw-r--r--tests/expectations/tests/eval-variadic-template-parameter.rs12
-rw-r--r--tests/expectations/tests/extern.rs9
-rw-r--r--tests/expectations/tests/float128.rs7
-rw-r--r--tests/expectations/tests/forward-inherit-struct-with-fields.rs17
-rw-r--r--tests/expectations/tests/forward-inherit-struct.rs18
-rw-r--r--tests/expectations/tests/forward_declared_struct.rs32
-rw-r--r--tests/expectations/tests/func_proto.rs9
-rw-r--r--tests/expectations/tests/func_ptr.rs15
-rw-r--r--tests/expectations/tests/func_ptr_in_struct.rs25
-rw-r--r--tests/expectations/tests/func_with_array_arg.rs9
-rw-r--r--tests/expectations/tests/func_with_func_ptr_arg.rs9
-rw-r--r--tests/expectations/tests/in_class_typedef.rs21
-rw-r--r--tests/expectations/tests/inherit-namespaced.rs18
-rw-r--r--tests/expectations/tests/inherit_named.rs17
-rw-r--r--tests/expectations/tests/inherit_typedef.rs33
-rw-r--r--tests/expectations/tests/inline-function.rs7
-rw-r--r--tests/expectations/tests/inline_namespace.rs28
-rw-r--r--tests/expectations/tests/inline_namespace_conservative.rs33
-rw-r--r--tests/expectations/tests/inline_namespace_whitelist.rs15
-rw-r--r--tests/expectations/tests/inner_const.rs27
-rw-r--r--tests/expectations/tests/inner_template_self.rs25
-rw-r--r--tests/expectations/tests/int128_t.rs7
-rw-r--r--tests/expectations/tests/issue-358.rs20
-rw-r--r--tests/expectations/tests/issue-372.rs63
-rw-r--r--tests/expectations/tests/issue_311.rs38
-rw-r--r--tests/expectations/tests/issue_315.rs8
-rw-r--r--tests/expectations/tests/jsval_layout_opaque.rs200
-rw-r--r--tests/expectations/tests/keywords.rs202
-rw-r--r--tests/expectations/tests/macro-expr-basic.rs15
-rw-r--r--tests/expectations/tests/macro-redef.rs9
-rw-r--r--tests/expectations/tests/macro_const.rs12
-rw-r--r--tests/expectations/tests/maddness-is-avoidable.rs20
-rw-r--r--tests/expectations/tests/method-mangling.rs29
-rw-r--r--tests/expectations/tests/module-whitelisted.rs23
-rw-r--r--tests/expectations/tests/msvc-no-usr.rs19
-rw-r--r--tests/expectations/tests/multiple-inherit-empty-correct-layout.rs45
-rw-r--r--tests/expectations/tests/mutable.rs42
-rw-r--r--tests/expectations/tests/namespace.rs87
-rw-r--r--tests/expectations/tests/nested.rs59
-rw-r--r--tests/expectations/tests/nested_vtable.rs48
-rw-r--r--tests/expectations/tests/nested_within_namespace.rs53
-rw-r--r--tests/expectations/tests/no-std.rs23
-rw-r--r--tests/expectations/tests/no_copy.rs13
-rw-r--r--tests/expectations/tests/nsStyleAutoArray.rs22
-rw-r--r--tests/expectations/tests/only_bitfields.rs45
-rw-r--r--tests/expectations/tests/opaque-tracing.rs23
-rw-r--r--tests/expectations/tests/opaque_in_struct.rs33
-rw-r--r--tests/expectations/tests/opaque_pointer.rs45
-rw-r--r--tests/expectations/tests/opaque_typedef.rs15
-rw-r--r--tests/expectations/tests/overflowed_enum.rs16
-rw-r--r--tests/expectations/tests/overloading.rs23
-rw-r--r--tests/expectations/tests/private.rs52
-rw-r--r--tests/expectations/tests/public-dtor.rs16
-rw-r--r--tests/expectations/tests/redeclaration.rs9
-rw-r--r--tests/expectations/tests/ref_argument_array.rs23
-rw-r--r--tests/expectations/tests/reparented_replacement.rs29
-rw-r--r--tests/expectations/tests/replace_template_alias.rs15
-rw-r--r--tests/expectations/tests/replace_use.rs28
-rw-r--r--tests/expectations/tests/replaces_double.rs15
-rw-r--r--tests/expectations/tests/resolved_type_def_function.rs10
-rw-r--r--tests/expectations/tests/same_struct_name_in_different_namespaces.rs28
-rw-r--r--tests/expectations/tests/size_t_template.rs19
-rw-r--r--tests/expectations/tests/struct_containing_forward_declared_struct.rs32
-rw-r--r--tests/expectations/tests/struct_with_anon_struct.rs33
-rw-r--r--tests/expectations/tests/struct_with_anon_struct_array.rs48
-rw-r--r--tests/expectations/tests/struct_with_anon_struct_pointer.rs33
-rw-r--r--tests/expectations/tests/struct_with_anon_union.rs58
-rw-r--r--tests/expectations/tests/struct_with_anon_unnamed_struct.rs33
-rw-r--r--tests/expectations/tests/struct_with_anon_unnamed_union.rs58
-rw-r--r--tests/expectations/tests/struct_with_bitfields.rs122
-rw-r--r--tests/expectations/tests/struct_with_derive_debug.rs50
-rw-r--r--tests/expectations/tests/struct_with_nesting.rs94
-rw-r--r--tests/expectations/tests/struct_with_packing.rs20
-rw-r--r--tests/expectations/tests/struct_with_struct.rs33
-rw-r--r--tests/expectations/tests/struct_with_typedef_template_arg.rs15
-rw-r--r--tests/expectations/tests/template.rs184
-rw-r--r--tests/expectations/tests/template_alias.rs12
-rw-r--r--tests/expectations/tests/template_alias_basic.rs7
-rw-r--r--tests/expectations/tests/template_alias_namespace.rs24
-rw-r--r--tests/expectations/tests/template_typedef_transitive_param.rs18
-rw-r--r--tests/expectations/tests/template_typedefs.rs22
-rw-r--r--tests/expectations/tests/templateref_opaque.rs20
-rw-r--r--tests/expectations/tests/type-referenced-by-whitelisted-function.rs22
-rw-r--r--tests/expectations/tests/type_alias_empty.rs7
-rw-r--r--tests/expectations/tests/type_alias_partial_template_especialization.rs12
-rw-r--r--tests/expectations/tests/type_alias_template_specialized.rs21
-rw-r--r--tests/expectations/tests/typedefd-array-as-function-arg.rs10
-rw-r--r--tests/expectations/tests/typeref.rs96
-rw-r--r--tests/expectations/tests/union-in-ns.rs52
-rw-r--r--tests/expectations/tests/union_dtor.rs42
-rw-r--r--tests/expectations/tests/union_fields.rs47
-rw-r--r--tests/expectations/tests/union_template.rs62
-rw-r--r--tests/expectations/tests/union_with_anon_struct.rs58
-rw-r--r--tests/expectations/tests/union_with_anon_struct_bitfield.rs86
-rw-r--r--tests/expectations/tests/union_with_anon_union.rs59
-rw-r--r--tests/expectations/tests/union_with_anon_unnamed_struct.rs61
-rw-r--r--tests/expectations/tests/union_with_anon_unnamed_union.rs60
-rw-r--r--tests/expectations/tests/union_with_big_member.rs75
-rw-r--r--tests/expectations/tests/union_with_nesting.rs93
-rw-r--r--tests/expectations/tests/unknown_attr.rs16
-rw-r--r--tests/expectations/tests/use-core.rs24
-rw-r--r--tests/expectations/tests/using.rs14
-rw-r--r--tests/expectations/tests/var-tracing.rs48
-rw-r--r--tests/expectations/tests/variadic-method.rs27
-rw-r--r--tests/expectations/tests/variadic_template_function.rs12
-rw-r--r--tests/expectations/tests/vector.rs19
-rw-r--r--tests/expectations/tests/virtual_dtor.rs19
-rw-r--r--tests/expectations/tests/virtual_inheritance.rs68
-rw-r--r--tests/expectations/tests/virtual_overloaded.rs22
-rw-r--r--tests/expectations/tests/vtable_recursive_sig.rs35
-rw-r--r--tests/expectations/tests/weird_bitfields.rs128
-rw-r--r--tests/expectations/tests/what_is_going_on.rs28
-rw-r--r--tests/expectations/tests/whitelist-namespaces-basic.rs31
-rw-r--r--tests/expectations/tests/whitelist-namespaces.rs44
-rw-r--r--tests/expectations/tests/whitelist_basic.rs18
-rw-r--r--tests/expectations/tests/whitelist_fix.rs10
-rw-r--r--tests/expectations/tests/whitelist_vars.rs10
-rw-r--r--tests/headers/accessors.hpp46
-rw-r--r--tests/headers/annotation_hide.hpp16
-rw-r--r--tests/headers/anon_enum.hpp10
-rw-r--r--tests/headers/anon_enum_trait.hpp22
-rw-r--r--tests/headers/anon_enum_whitelist.h6
-rw-r--r--tests/headers/anon_union.hpp20
-rw-r--r--tests/headers/arg_keyword.hpp1
-rw-r--r--tests/headers/auto.hpp19
-rw-r--r--tests/headers/bad-namespace-parenthood-inheritance.hpp15
-rw-r--r--tests/headers/base-to-derived.hpp19
-rw-r--r--tests/headers/bitfield-enum-basic.hpp27
-rw-r--r--tests/headers/bitfield_method_mangling.h5
-rw-r--r--tests/headers/blocks.h3
-rw-r--r--tests/headers/canonical_path_without_namespacing.hpp7
-rw-r--r--tests/headers/class.hpp29
-rw-r--r--tests/headers/class_nested.hpp24
-rw-r--r--tests/headers/class_no_members.hpp16
-rw-r--r--tests/headers/class_static.hpp7
-rw-r--r--tests/headers/class_static_const.hpp8
-rw-r--r--tests/headers/class_use_as.hpp15
-rw-r--r--tests/headers/class_with_dtor.hpp13
-rw-r--r--tests/headers/class_with_inner_struct.hpp43
-rw-r--r--tests/headers/class_with_typedef.hpp22
-rw-r--r--tests/headers/complex.h16
-rw-r--r--tests/headers/complex_global.h3
-rw-r--r--tests/headers/const_bool.hpp9
-rw-r--r--tests/headers/const_enum_unnamed.hpp9
-rw-r--r--tests/headers/const_ptr.hpp3
-rw-r--r--tests/headers/const_resolved_ty.h3
-rw-r--r--tests/headers/const_tparam.hpp5
-rw-r--r--tests/headers/constant-evaluate.h19
-rw-r--r--tests/headers/constify-enum.h13
-rw-r--r--tests/headers/constructor-tp.hpp26
-rw-r--r--tests/headers/constructors.hpp13
-rw-r--r--tests/headers/convert-floats.h9
-rw-r--r--tests/headers/crtp.hpp12
-rw-r--r--tests/headers/dash_language.h6
-rw-r--r--tests/headers/decl_extern_int_twice.h2
-rw-r--r--tests/headers/decl_ptr_to_array.h1
-rw-r--r--tests/headers/disable-namespacing.hpp9
-rw-r--r--tests/headers/duplicated-namespaces-definitions.hpp18
-rw-r--r--tests/headers/duplicated-namespaces.hpp4
-rw-r--r--tests/headers/duplicated_constants_in_ns.hpp7
-rw-r--r--tests/headers/elaborated.hpp5
-rw-r--r--tests/headers/empty_template_param_name.hpp6
-rw-r--r--tests/headers/enum.h9
-rw-r--r--tests/headers/enum_alias.hpp7
-rw-r--r--tests/headers/enum_and_vtable_mangling.hpp11
-rw-r--r--tests/headers/enum_dupe.h4
-rw-r--r--tests/headers/enum_explicit_type.hpp28
-rw-r--r--tests/headers/enum_in_template_with_typedef.hpp16
-rw-r--r--tests/headers/enum_negative.h4
-rw-r--r--tests/headers/enum_packed.h14
-rw-r--r--tests/headers/eval-variadic-template-parameter.hpp8
-rw-r--r--tests/headers/extern.hpp3
-rw-r--r--tests/headers/float128.hpp13
-rw-r--r--tests/headers/forward-inherit-struct-with-fields.hpp8
-rw-r--r--tests/headers/forward-inherit-struct.hpp5
-rw-r--r--tests/headers/forward_declared_struct.h11
-rw-r--r--tests/headers/func_proto.h1
-rw-r--r--tests/headers/func_ptr.h1
-rw-r--r--tests/headers/func_ptr_in_struct.h6
-rw-r--r--tests/headers/func_with_array_arg.h1
-rw-r--r--tests/headers/func_with_func_ptr_arg.h1
-rw-r--r--tests/headers/in_class_typedef.hpp10
-rw-r--r--tests/headers/inherit-namespaced.hpp4
-rw-r--r--tests/headers/inherit_named.hpp5
-rw-r--r--tests/headers/inherit_typedef.hpp5
-rw-r--r--tests/headers/inline-function.h6
-rw-r--r--tests/headers/inline_namespace.hpp11
-rw-r--r--tests/headers/inline_namespace_conservative.hpp12
-rw-r--r--tests/headers/inline_namespace_whitelist.hpp7
-rw-r--r--tests/headers/inner_const.hpp6
-rw-r--r--tests/headers/inner_template_self.hpp10
-rw-r--r--tests/headers/int128_t.h7
-rw-r--r--tests/headers/issue-358.hpp8
-rw-r--r--tests/headers/issue-372.hpp16
-rw-r--r--tests/headers/issue_311.hpp5
-rw-r--r--tests/headers/issue_315.hpp2
-rw-r--r--tests/headers/jsval_layout_opaque.hpp424
-rw-r--r--tests/headers/keywords.h49
-rw-r--r--tests/headers/macro-expr-basic.h14
-rw-r--r--tests/headers/macro-redef.h5
-rw-r--r--tests/headers/macro_const.h7
-rw-r--r--tests/headers/maddness-is-avoidable.hpp9
-rw-r--r--tests/headers/method-mangling.hpp5
-rw-r--r--tests/headers/module-whitelisted.hpp2
-rw-r--r--tests/headers/msvc-no-usr.hpp8
-rw-r--r--tests/headers/multiple-inherit-empty-correct-layout.hpp3
-rw-r--r--tests/headers/mutable.hpp14
-rw-r--r--tests/headers/namespace.hpp47
-rw-r--r--tests/headers/nested.hpp15
-rw-r--r--tests/headers/nested_vtable.hpp8
-rw-r--r--tests/headers/nested_within_namespace.hpp15
-rw-r--r--tests/headers/no-std.h5
-rw-r--r--tests/headers/no_copy.hpp6
-rw-r--r--tests/headers/nsStyleAutoArray.hpp57
-rw-r--r--tests/headers/only_bitfields.hpp5
-rw-r--r--tests/headers/opaque-tracing.hpp21
-rw-r--r--tests/headers/opaque_in_struct.hpp10
-rw-r--r--tests/headers/opaque_pointer.hpp22
-rw-r--r--tests/headers/opaque_typedef.hpp17
-rw-r--r--tests/headers/overflowed_enum.hpp12
-rw-r--r--tests/headers/overloading.hpp9
-rw-r--r--tests/headers/private.hpp21
-rw-r--r--tests/headers/public-dtor.hpp15
-rw-r--r--tests/headers/redeclaration.hpp7
-rw-r--r--tests/headers/ref_argument_array.hpp6
-rw-r--r--tests/headers/reparented_replacement.hpp16
-rw-r--r--tests/headers/replace_template_alias.hpp23
-rw-r--r--tests/headers/replace_use.hpp15
-rw-r--r--tests/headers/replaces_double.hpp20
-rw-r--r--tests/headers/resolved_type_def_function.h2
-rw-r--r--tests/headers/same_struct_name_in_different_namespaces.hpp12
-rw-r--r--tests/headers/size_t_template.hpp8
-rw-r--r--tests/headers/struct_containing_forward_declared_struct.h7
-rw-r--r--tests/headers/struct_with_anon_struct.h6
-rw-r--r--tests/headers/struct_with_anon_struct_array.h10
-rw-r--r--tests/headers/struct_with_anon_struct_pointer.h6
-rw-r--r--tests/headers/struct_with_anon_union.h6
-rw-r--r--tests/headers/struct_with_anon_unnamed_struct.h6
-rw-r--r--tests/headers/struct_with_anon_unnamed_union.h6
-rw-r--r--tests/headers/struct_with_bitfields.h13
-rw-r--r--tests/headers/struct_with_derive_debug.h15
-rw-r--r--tests/headers/struct_with_nesting.h17
-rw-r--r--tests/headers/struct_with_packing.h4
-rw-r--r--tests/headers/struct_with_struct.h6
-rw-r--r--tests/headers/struct_with_typedef_template_arg.hpp4
-rw-r--r--tests/headers/template.hpp144
-rw-r--r--tests/headers/template_alias.hpp13
-rw-r--r--tests/headers/template_alias_basic.hpp4
-rw-r--r--tests/headers/template_alias_namespace.hpp13
-rw-r--r--tests/headers/template_typedef_transitive_param.hpp7
-rw-r--r--tests/headers/template_typedefs.hpp8
-rw-r--r--tests/headers/templateref_opaque.hpp11
-rw-r--r--tests/headers/type-referenced-by-whitelisted-function.h7
-rw-r--r--tests/headers/type_alias_empty.hpp10
-rw-r--r--tests/headers/type_alias_partial_template_especialization.hpp7
-rw-r--r--tests/headers/type_alias_template_specialized.hpp9
-rw-r--r--tests/headers/typedefd-array-as-function-arg.h3
-rw-r--r--tests/headers/typeref.hpp28
-rw-r--r--tests/headers/union-in-ns.hpp5
-rw-r--r--tests/headers/union_dtor.hpp5
-rw-r--r--tests/headers/union_fields.hpp5
-rw-r--r--tests/headers/union_template.hpp19
-rw-r--r--tests/headers/union_with_anon_struct.h6
-rw-r--r--tests/headers/union_with_anon_struct_bitfield.h8
-rw-r--r--tests/headers/union_with_anon_union.h6
-rw-r--r--tests/headers/union_with_anon_unnamed_struct.h9
-rw-r--r--tests/headers/union_with_anon_unnamed_union.h7
-rw-r--r--tests/headers/union_with_big_member.h14
-rw-r--r--tests/headers/union_with_nesting.h14
-rw-r--r--tests/headers/unknown_attr.h6
-rw-r--r--tests/headers/use-core.h8
-rw-r--r--tests/headers/using.hpp11
-rw-r--r--tests/headers/var-tracing.hpp10
-rw-r--r--tests/headers/variadic-method.hpp6
-rw-r--r--tests/headers/variadic_template_function.hpp6
-rw-r--r--tests/headers/vector.hpp3
-rw-r--r--tests/headers/virtual_dtor.hpp3
-rw-r--r--tests/headers/virtual_inheritance.hpp16
-rw-r--r--tests/headers/virtual_overloaded.hpp5
-rw-r--r--tests/headers/vtable_recursive_sig.hpp11
-rw-r--r--tests/headers/weird_bitfields.hpp35
-rw-r--r--tests/headers/what_is_going_on.hpp19
-rw-r--r--tests/headers/whitelist-namespaces-basic.hpp10
-rw-r--r--tests/headers/whitelist-namespaces.hpp10
-rw-r--r--tests/headers/whitelist_basic.hpp16
-rw-r--r--tests/headers/whitelist_fix.hpp4
-rw-r--r--tests/headers/whitelist_vars.h4
-rw-r--r--tests/tests.rs140
-rw-r--r--tests/uses/.gitignore2
345 files changed, 8762 insertions, 0 deletions
diff --git a/tests/expectations/Cargo.toml b/tests/expectations/Cargo.toml
new file mode 100644
index 00000000..034aa141
--- /dev/null
+++ b/tests/expectations/Cargo.toml
@@ -0,0 +1,11 @@
+[package]
+name = "tests_expectations"
+description = "bindgen results when ran on ../headers/*"
+version = "0.1.0"
+authors = [
+ "Jyun-Yan You <jyyou.tw@gmail.com>",
+ "Emilio Cobos Álvarez <emilio@crisal.io>",
+ "The Servo project developers",
+]
+
+[dependencies]
diff --git a/tests/expectations/lib.rs b/tests/expectations/lib.rs
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/expectations/lib.rs
diff --git a/tests/expectations/src/lib.rs b/tests/expectations/src/lib.rs
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/expectations/src/lib.rs
diff --git a/tests/expectations/tests/accessors.rs b/tests/expectations/tests/accessors.rs
new file mode 100644
index 00000000..b721980c
--- /dev/null
+++ b/tests/expectations/tests/accessors.rs
@@ -0,0 +1,204 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct SomeAccessors {
+ pub mNoAccessor: ::std::os::raw::c_int,
+ /** <div rustbindgen accessor></div> */
+ pub mBothAccessors: ::std::os::raw::c_int,
+ /** <div rustbindgen accessor="unsafe"></div> */
+ pub mUnsafeAccessors: ::std::os::raw::c_int,
+ /** <div rustbindgen accessor="immutable"></div> */
+ pub mImmutableAccessor: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_SomeAccessors() {
+ assert_eq!(::std::mem::size_of::<SomeAccessors>() , 16usize);
+ assert_eq!(::std::mem::align_of::<SomeAccessors>() , 4usize);
+}
+impl Clone for SomeAccessors {
+ fn clone(&self) -> Self { *self }
+}
+impl SomeAccessors {
+ #[inline]
+ pub fn get_mBothAccessors(&self) -> &::std::os::raw::c_int {
+ &self.mBothAccessors
+ }
+ #[inline]
+ pub fn get_mBothAccessors_mut(&mut self) -> &mut ::std::os::raw::c_int {
+ &mut self.mBothAccessors
+ }
+ #[inline]
+ pub unsafe fn get_mUnsafeAccessors(&self) -> &::std::os::raw::c_int {
+ &self.mUnsafeAccessors
+ }
+ #[inline]
+ pub unsafe fn get_mUnsafeAccessors_mut(&mut self)
+ -> &mut ::std::os::raw::c_int {
+ &mut self.mUnsafeAccessors
+ }
+ #[inline]
+ pub fn get_mImmutableAccessor(&self) -> &::std::os::raw::c_int {
+ &self.mImmutableAccessor
+ }
+}
+/** <div rustbindgen accessor></div> */
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct AllAccessors {
+ pub mBothAccessors: ::std::os::raw::c_int,
+ pub mAlsoBothAccessors: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_AllAccessors() {
+ assert_eq!(::std::mem::size_of::<AllAccessors>() , 8usize);
+ assert_eq!(::std::mem::align_of::<AllAccessors>() , 4usize);
+}
+impl Clone for AllAccessors {
+ fn clone(&self) -> Self { *self }
+}
+impl AllAccessors {
+ #[inline]
+ pub fn get_mBothAccessors(&self) -> &::std::os::raw::c_int {
+ &self.mBothAccessors
+ }
+ #[inline]
+ pub fn get_mBothAccessors_mut(&mut self) -> &mut ::std::os::raw::c_int {
+ &mut self.mBothAccessors
+ }
+ #[inline]
+ pub fn get_mAlsoBothAccessors(&self) -> &::std::os::raw::c_int {
+ &self.mAlsoBothAccessors
+ }
+ #[inline]
+ pub fn get_mAlsoBothAccessors_mut(&mut self)
+ -> &mut ::std::os::raw::c_int {
+ &mut self.mAlsoBothAccessors
+ }
+}
+/** <div rustbindgen accessor="unsafe"></div> */
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct AllUnsafeAccessors {
+ pub mBothAccessors: ::std::os::raw::c_int,
+ pub mAlsoBothAccessors: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_AllUnsafeAccessors() {
+ assert_eq!(::std::mem::size_of::<AllUnsafeAccessors>() , 8usize);
+ assert_eq!(::std::mem::align_of::<AllUnsafeAccessors>() , 4usize);
+}
+impl Clone for AllUnsafeAccessors {
+ fn clone(&self) -> Self { *self }
+}
+impl AllUnsafeAccessors {
+ #[inline]
+ pub unsafe fn get_mBothAccessors(&self) -> &::std::os::raw::c_int {
+ &self.mBothAccessors
+ }
+ #[inline]
+ pub unsafe fn get_mBothAccessors_mut(&mut self)
+ -> &mut ::std::os::raw::c_int {
+ &mut self.mBothAccessors
+ }
+ #[inline]
+ pub unsafe fn get_mAlsoBothAccessors(&self) -> &::std::os::raw::c_int {
+ &self.mAlsoBothAccessors
+ }
+ #[inline]
+ pub unsafe fn get_mAlsoBothAccessors_mut(&mut self)
+ -> &mut ::std::os::raw::c_int {
+ &mut self.mAlsoBothAccessors
+ }
+}
+/** <div rustbindgen accessor></div> */
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct ContradictAccessors {
+ pub mBothAccessors: ::std::os::raw::c_int,
+ /** <div rustbindgen accessor="false"></div> */
+ pub mNoAccessors: ::std::os::raw::c_int,
+ /** <div rustbindgen accessor="unsafe"></div> */
+ pub mUnsafeAccessors: ::std::os::raw::c_int,
+ /** <div rustbindgen accessor="immutable"></div> */
+ pub mImmutableAccessor: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_ContradictAccessors() {
+ assert_eq!(::std::mem::size_of::<ContradictAccessors>() , 16usize);
+ assert_eq!(::std::mem::align_of::<ContradictAccessors>() , 4usize);
+}
+impl Clone for ContradictAccessors {
+ fn clone(&self) -> Self { *self }
+}
+impl ContradictAccessors {
+ #[inline]
+ pub fn get_mBothAccessors(&self) -> &::std::os::raw::c_int {
+ &self.mBothAccessors
+ }
+ #[inline]
+ pub fn get_mBothAccessors_mut(&mut self) -> &mut ::std::os::raw::c_int {
+ &mut self.mBothAccessors
+ }
+ #[inline]
+ pub unsafe fn get_mUnsafeAccessors(&self) -> &::std::os::raw::c_int {
+ &self.mUnsafeAccessors
+ }
+ #[inline]
+ pub unsafe fn get_mUnsafeAccessors_mut(&mut self)
+ -> &mut ::std::os::raw::c_int {
+ &mut self.mUnsafeAccessors
+ }
+ #[inline]
+ pub fn get_mImmutableAccessor(&self) -> &::std::os::raw::c_int {
+ &self.mImmutableAccessor
+ }
+}
+/** <div rustbindgen accessor replaces="Replaced"></div> */
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Replaced {
+ pub mAccessor: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_Replaced() {
+ assert_eq!(::std::mem::size_of::<Replaced>() , 4usize);
+ assert_eq!(::std::mem::align_of::<Replaced>() , 4usize);
+}
+impl Clone for Replaced {
+ fn clone(&self) -> Self { *self }
+}
+impl Replaced {
+ #[inline]
+ pub fn get_mAccessor(&self) -> &::std::os::raw::c_int { &self.mAccessor }
+ #[inline]
+ pub fn get_mAccessor_mut(&mut self) -> &mut ::std::os::raw::c_int {
+ &mut self.mAccessor
+ }
+}
+/** <div rustbindgen accessor></div> */
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Wrapper {
+ pub mReplaced: Replaced,
+}
+#[test]
+fn bindgen_test_layout_Wrapper() {
+ assert_eq!(::std::mem::size_of::<Wrapper>() , 4usize);
+ assert_eq!(::std::mem::align_of::<Wrapper>() , 4usize);
+}
+impl Clone for Wrapper {
+ fn clone(&self) -> Self { *self }
+}
+impl Wrapper {
+ #[inline]
+ pub fn get_mReplaced(&self) -> &Replaced { &self.mReplaced }
+ #[inline]
+ pub fn get_mReplaced_mut(&mut self) -> &mut Replaced {
+ &mut self.mReplaced
+ }
+}
diff --git a/tests/expectations/tests/annotation_hide.rs b/tests/expectations/tests/annotation_hide.rs
new file mode 100644
index 00000000..dcaf7997
--- /dev/null
+++ b/tests/expectations/tests/annotation_hide.rs
@@ -0,0 +1,35 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+/**
+ * <div rustbindgen opaque></div>
+ */
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct D {
+ pub _bindgen_opaque_blob: u32,
+}
+#[test]
+fn bindgen_test_layout_D() {
+ assert_eq!(::std::mem::size_of::<D>() , 4usize);
+ assert_eq!(::std::mem::align_of::<D>() , 4usize);
+}
+impl Clone for D {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct NotAnnotated {
+ pub f: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_NotAnnotated() {
+ assert_eq!(::std::mem::size_of::<NotAnnotated>() , 4usize);
+ assert_eq!(::std::mem::align_of::<NotAnnotated>() , 4usize);
+}
+impl Clone for NotAnnotated {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/anon_enum.rs b/tests/expectations/tests/anon_enum.rs
new file mode 100644
index 00000000..3b05eab8
--- /dev/null
+++ b/tests/expectations/tests/anon_enum.rs
@@ -0,0 +1,30 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Test {
+ pub foo: ::std::os::raw::c_int,
+ pub bar: f32,
+}
+pub const Test_T_NONE: Test__bindgen_ty_1 = Test__bindgen_ty_1::T_NONE;
+#[repr(u32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum Test__bindgen_ty_1 { T_NONE = 0, }
+#[test]
+fn bindgen_test_layout_Test() {
+ assert_eq!(::std::mem::size_of::<Test>() , 8usize);
+ assert_eq!(::std::mem::align_of::<Test>() , 4usize);
+}
+impl Clone for Test {
+ fn clone(&self) -> Self { *self }
+}
+pub const Foo: _bindgen_ty_1 = _bindgen_ty_1::Foo;
+pub const Bar: _bindgen_ty_1 = _bindgen_ty_1::Bar;
+#[repr(u32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum _bindgen_ty_1 { Foo = 0, Bar = 1, }
+pub use self::_bindgen_ty_1 as Baz;
diff --git a/tests/expectations/tests/anon_enum_trait.rs b/tests/expectations/tests/anon_enum_trait.rs
new file mode 100644
index 00000000..8198bc15
--- /dev/null
+++ b/tests/expectations/tests/anon_enum_trait.rs
@@ -0,0 +1,47 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct DataType<_Tp> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<_Tp>,
+}
+pub type DataType_value_type<_Tp> = _Tp;
+pub type DataType_work_type<_Tp> = DataType_value_type<_Tp>;
+pub type DataType_channel_type<_Tp> = DataType_value_type<_Tp>;
+pub type DataType_vec_type<_Tp> = DataType_value_type<_Tp>;
+pub const DataType_generic_type: DataType__bindgen_ty_1 =
+ DataType__bindgen_ty_1::generic_type;
+pub const DataType_depth: DataType__bindgen_ty_1 =
+ DataType__bindgen_ty_1::generic_type;
+pub const DataType_channels: DataType__bindgen_ty_1 =
+ DataType__bindgen_ty_1::generic_type;
+pub const DataType_fmt: DataType__bindgen_ty_1 =
+ DataType__bindgen_ty_1::generic_type;
+pub const DataType_type_: DataType__bindgen_ty_1 =
+ DataType__bindgen_ty_1::generic_type;
+#[repr(i32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum DataType__bindgen_ty_1 { generic_type = 0, }
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Foo {
+ pub _address: u8,
+}
+pub const Foo_Bar: Foo__bindgen_ty_1 = Foo__bindgen_ty_1::Bar;
+pub const Foo_Baz: Foo__bindgen_ty_1 = Foo__bindgen_ty_1::Bar;
+#[repr(u32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum Foo__bindgen_ty_1 { Bar = 0, }
+#[test]
+fn bindgen_test_layout_Foo() {
+ assert_eq!(::std::mem::size_of::<Foo>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Foo>() , 1usize);
+}
+impl Clone for Foo {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/anon_enum_whitelist.rs b/tests/expectations/tests/anon_enum_whitelist.rs
new file mode 100644
index 00000000..b32396a0
--- /dev/null
+++ b/tests/expectations/tests/anon_enum_whitelist.rs
@@ -0,0 +1,11 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub const NODE_FLAG_FOO: _bindgen_ty_1 = _bindgen_ty_1::NODE_FLAG_FOO;
+pub const NODE_FLAG_BAR: _bindgen_ty_1 = _bindgen_ty_1::NODE_FLAG_BAR;
+#[repr(u32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum _bindgen_ty_1 { NODE_FLAG_FOO = 0, NODE_FLAG_BAR = 1, }
diff --git a/tests/expectations/tests/anon_union.rs b/tests/expectations/tests/anon_union.rs
new file mode 100644
index 00000000..f8559ca9
--- /dev/null
+++ b/tests/expectations/tests/anon_union.rs
@@ -0,0 +1,84 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[inline]
+ pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
+ #[inline]
+ pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
+ #[inline]
+ pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
+}
+impl <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct TErrorResult<T> {
+ pub mResult: ::std::os::raw::c_int,
+ pub __bindgen_anon_1: TErrorResult__bindgen_ty_1<T>,
+ pub mMightHaveUnreported: bool,
+ pub mUnionState: TErrorResult_UnionState,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+pub const TErrorResult_UnionState_HasException: TErrorResult_UnionState =
+ TErrorResult_UnionState::HasMessage;
+#[repr(i32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum TErrorResult_UnionState { HasMessage = 0, }
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct TErrorResult_Message<T> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct TErrorResult_DOMExceptionInfo<T> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct TErrorResult__bindgen_ty_1<T> {
+ pub mMessage: __BindgenUnionField<*mut TErrorResult_Message<T>>,
+ pub mDOMExceptionInfo: __BindgenUnionField<*mut TErrorResult_DOMExceptionInfo<T>>,
+ pub bindgen_union_field: u64,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct ErrorResult {
+ pub _base: TErrorResult<::std::os::raw::c_int>,
+}
+#[test]
+fn bindgen_test_layout_ErrorResult() {
+ assert_eq!(::std::mem::size_of::<ErrorResult>() , 24usize);
+ assert_eq!(::std::mem::align_of::<ErrorResult>() , 8usize);
+}
+impl Clone for ErrorResult {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn __bindgen_test_layout_template_1() {
+ assert_eq!(::std::mem::size_of::<TErrorResult<::std::os::raw::c_int>>() ,
+ 24usize);
+ assert_eq!(::std::mem::align_of::<TErrorResult<::std::os::raw::c_int>>() ,
+ 8usize);
+}
diff --git a/tests/expectations/tests/arg_keyword.rs b/tests/expectations/tests/arg_keyword.rs
new file mode 100644
index 00000000..cb1cc432
--- /dev/null
+++ b/tests/expectations/tests/arg_keyword.rs
@@ -0,0 +1,10 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+extern "C" {
+ #[link_name = "_Z3fooPKc"]
+ pub fn foo(type_: *const ::std::os::raw::c_char);
+}
diff --git a/tests/expectations/tests/auto.rs b/tests/expectations/tests/auto.rs
new file mode 100644
index 00000000..6224e807
--- /dev/null
+++ b/tests/expectations/tests/auto.rs
@@ -0,0 +1,30 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Foo {
+ pub _address: u8,
+}
+pub const Foo_kFoo: bool = true;
+#[test]
+fn bindgen_test_layout_Foo() {
+ assert_eq!(::std::mem::size_of::<Foo>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Foo>() , 1usize);
+}
+impl Clone for Foo {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Bar<T> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+extern "C" {
+ #[link_name = "_Z5Test2v"]
+ pub fn Test2() -> ::std::os::raw::c_uint;
+}
diff --git a/tests/expectations/tests/bad-namespace-parenthood-inheritance.rs b/tests/expectations/tests/bad-namespace-parenthood-inheritance.rs
new file mode 100644
index 00000000..553879b7
--- /dev/null
+++ b/tests/expectations/tests/bad-namespace-parenthood-inheritance.rs
@@ -0,0 +1,20 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct std_char_traits<_CharT> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<_CharT>,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct __gnu_cxx_char_traits {
+ pub _address: u8,
+}
+impl Clone for __gnu_cxx_char_traits {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/base-to-derived.rs b/tests/expectations/tests/base-to-derived.rs
new file mode 100644
index 00000000..c2af2c43
--- /dev/null
+++ b/tests/expectations/tests/base-to-derived.rs
@@ -0,0 +1,19 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct false_type {
+ pub _address: u8,
+}
+#[test]
+fn bindgen_test_layout_false_type() {
+ assert_eq!(::std::mem::size_of::<false_type>() , 1usize);
+ assert_eq!(::std::mem::align_of::<false_type>() , 1usize);
+}
+impl Clone for false_type {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/bitfield-enum-basic.rs b/tests/expectations/tests/bitfield-enum-basic.rs
new file mode 100644
index 00000000..03e07de6
--- /dev/null
+++ b/tests/expectations/tests/bitfield-enum-basic.rs
@@ -0,0 +1,77 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub const Foo_Bar: Foo = Foo(2);
+pub const Foo_Baz: Foo = Foo(4);
+pub const Foo_Duplicated: Foo = Foo(4);
+pub const Foo_Negative: Foo = Foo(-3);
+impl ::std::ops::BitOr<Foo> for Foo {
+ type
+ Output
+ =
+ Self;
+ #[inline]
+ fn bitor(self, other: Self) -> Self { Foo(self.0 | other.0) }
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub struct Foo(pub i32);
+pub const Buz_Bar: Buz = Buz(2);
+pub const Buz_Baz: Buz = Buz(4);
+pub const Buz_Duplicated: Buz = Buz(4);
+pub const Buz_Negative: Buz = Buz(-3);
+impl ::std::ops::BitOr<Buz> for Buz {
+ type
+ Output
+ =
+ Self;
+ #[inline]
+ fn bitor(self, other: Self) -> Self { Buz(self.0 | other.0) }
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub struct Buz(pub i8);
+pub const NS_FOO: _bindgen_ty_1 = _bindgen_ty_1(1);
+pub const NS_BAR: _bindgen_ty_1 = _bindgen_ty_1(2);
+impl ::std::ops::BitOr<_bindgen_ty_1> for _bindgen_ty_1 {
+ type
+ Output
+ =
+ Self;
+ #[inline]
+ fn bitor(self, other: Self) -> Self { _bindgen_ty_1(self.0 | other.0) }
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub struct _bindgen_ty_1(pub u32);
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Dummy {
+ pub _address: u8,
+}
+pub const Dummy_DUMMY_FOO: Dummy__bindgen_ty_1 = Dummy__bindgen_ty_1(1);
+pub const Dummy_DUMMY_BAR: Dummy__bindgen_ty_1 = Dummy__bindgen_ty_1(2);
+impl ::std::ops::BitOr<Dummy__bindgen_ty_1> for Dummy__bindgen_ty_1 {
+ type
+ Output
+ =
+ Self;
+ #[inline]
+ fn bitor(self, other: Self) -> Self {
+ Dummy__bindgen_ty_1(self.0 | other.0)
+ }
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub struct Dummy__bindgen_ty_1(pub u32);
+#[test]
+fn bindgen_test_layout_Dummy() {
+ assert_eq!(::std::mem::size_of::<Dummy>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Dummy>() , 1usize);
+}
+impl Clone for Dummy {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/bitfield_method_mangling.rs b/tests/expectations/tests/bitfield_method_mangling.rs
new file mode 100644
index 00000000..b650a38f
--- /dev/null
+++ b/tests/expectations/tests/bitfield_method_mangling.rs
@@ -0,0 +1,49 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct _bindgen_ty_1 {
+ pub _bitfield_1: u32,
+}
+#[test]
+fn bindgen_test_layout__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<_bindgen_ty_1>() , 4usize);
+ assert_eq!(::std::mem::align_of::<_bindgen_ty_1>() , 4usize);
+}
+impl Clone for _bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+}
+impl _bindgen_ty_1 {
+ #[inline]
+ pub fn pad3(&self) -> ::std::os::raw::c_uint {
+ unsafe {
+ ::std::mem::transmute(((self._bitfield_1 & (16777215usize as u32))
+ >> 0u32) as u32)
+ }
+ }
+ #[inline]
+ pub fn set_pad3(&mut self, val: ::std::os::raw::c_uint) {
+ self._bitfield_1 &= !(16777215usize as u32);
+ self._bitfield_1 |=
+ ((val as u32 as u32) << 0u32) & (16777215usize as u32);
+ }
+ #[inline]
+ pub fn type_(&self) -> ::std::os::raw::c_uint {
+ unsafe {
+ ::std::mem::transmute(((self._bitfield_1 &
+ (4278190080usize as u32)) >> 24u32) as
+ u32)
+ }
+ }
+ #[inline]
+ pub fn set_type(&mut self, val: ::std::os::raw::c_uint) {
+ self._bitfield_1 &= !(4278190080usize as u32);
+ self._bitfield_1 |=
+ ((val as u32 as u32) << 24u32) & (4278190080usize as u32);
+ }
+}
+pub use self::_bindgen_ty_1 as mach_msg_type_descriptor_t;
diff --git a/tests/expectations/tests/blocks.rs b/tests/expectations/tests/blocks.rs
new file mode 100644
index 00000000..528ea518
--- /dev/null
+++ b/tests/expectations/tests/blocks.rs
@@ -0,0 +1,9 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+extern "C" {
+ pub fn atexit_b(arg1: *mut ::std::os::raw::c_void);
+}
diff --git a/tests/expectations/tests/canonical_path_without_namespacing.rs b/tests/expectations/tests/canonical_path_without_namespacing.rs
new file mode 100644
index 00000000..0b1f561c
--- /dev/null
+++ b/tests/expectations/tests/canonical_path_without_namespacing.rs
@@ -0,0 +1,23 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Bar {
+ pub _address: u8,
+}
+#[test]
+fn bindgen_test_layout_Bar() {
+ assert_eq!(::std::mem::size_of::<Bar>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Bar>() , 1usize);
+}
+impl Clone for Bar {
+ fn clone(&self) -> Self { *self }
+}
+extern "C" {
+ #[link_name = "_Z3bazPN3foo3BarE"]
+ pub fn baz(arg1: *mut Bar);
+}
diff --git a/tests/expectations/tests/class.rs b/tests/expectations/tests/class.rs
new file mode 100644
index 00000000..579c24a4
--- /dev/null
+++ b/tests/expectations/tests/class.rs
@@ -0,0 +1,127 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[inline]
+ pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
+ #[inline]
+ pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
+ #[inline]
+ pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
+}
+impl <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+pub struct C {
+ pub a: ::std::os::raw::c_int,
+ pub big_array: [::std::os::raw::c_char; 33usize],
+}
+#[test]
+fn bindgen_test_layout_C() {
+ assert_eq!(::std::mem::size_of::<C>() , 40usize);
+ assert_eq!(::std::mem::align_of::<C>() , 4usize);
+}
+#[repr(C)]
+#[derive(Debug)]
+pub struct WithDtor {
+ pub b: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_WithDtor() {
+ assert_eq!(::std::mem::size_of::<WithDtor>() , 4usize);
+ assert_eq!(::std::mem::align_of::<WithDtor>() , 4usize);
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Union {
+ pub d: __BindgenUnionField<f32>,
+ pub i: __BindgenUnionField<::std::os::raw::c_int>,
+ pub bindgen_union_field: u32,
+}
+#[test]
+fn bindgen_test_layout_Union() {
+ assert_eq!(::std::mem::size_of::<Union>() , 4usize);
+ assert_eq!(::std::mem::align_of::<Union>() , 4usize);
+}
+impl Clone for Union {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct WithUnion {
+ pub data: Union,
+}
+#[test]
+fn bindgen_test_layout_WithUnion() {
+ assert_eq!(::std::mem::size_of::<WithUnion>() , 4usize);
+ assert_eq!(::std::mem::align_of::<WithUnion>() , 4usize);
+}
+impl Clone for WithUnion {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct RealAbstractionWithTonsOfMethods {
+ pub _address: u8,
+}
+#[test]
+fn bindgen_test_layout_RealAbstractionWithTonsOfMethods() {
+ assert_eq!(::std::mem::size_of::<RealAbstractionWithTonsOfMethods>() ,
+ 1usize);
+ assert_eq!(::std::mem::align_of::<RealAbstractionWithTonsOfMethods>() ,
+ 1usize);
+}
+extern "C" {
+ #[link_name = "_ZNK32RealAbstractionWithTonsOfMethods3barEv"]
+ pub fn RealAbstractionWithTonsOfMethods_bar(this:
+ *const RealAbstractionWithTonsOfMethods);
+}
+extern "C" {
+ #[link_name = "_ZN32RealAbstractionWithTonsOfMethods3barEv"]
+ pub fn RealAbstractionWithTonsOfMethods_bar1(this:
+ *mut RealAbstractionWithTonsOfMethods);
+}
+extern "C" {
+ #[link_name = "_ZN32RealAbstractionWithTonsOfMethods3barEi"]
+ pub fn RealAbstractionWithTonsOfMethods_bar2(this:
+ *mut RealAbstractionWithTonsOfMethods,
+ foo: ::std::os::raw::c_int);
+}
+extern "C" {
+ #[link_name = "_ZN32RealAbstractionWithTonsOfMethods3staEv"]
+ pub fn RealAbstractionWithTonsOfMethods_sta();
+}
+impl Clone for RealAbstractionWithTonsOfMethods {
+ fn clone(&self) -> Self { *self }
+}
+impl RealAbstractionWithTonsOfMethods {
+ #[inline]
+ pub unsafe fn bar(&self) { RealAbstractionWithTonsOfMethods_bar(&*self) }
+ #[inline]
+ pub unsafe fn bar1(&mut self) {
+ RealAbstractionWithTonsOfMethods_bar1(&mut *self)
+ }
+ #[inline]
+ pub unsafe fn bar2(&mut self, foo: ::std::os::raw::c_int) {
+ RealAbstractionWithTonsOfMethods_bar2(&mut *self, foo)
+ }
+ #[inline]
+ pub unsafe fn sta() { RealAbstractionWithTonsOfMethods_sta() }
+}
diff --git a/tests/expectations/tests/class_nested.rs b/tests/expectations/tests/class_nested.rs
new file mode 100644
index 00000000..593e156d
--- /dev/null
+++ b/tests/expectations/tests/class_nested.rs
@@ -0,0 +1,59 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct A {
+ pub member_a: ::std::os::raw::c_int,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct A_B {
+ pub member_b: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_A_B() {
+ assert_eq!(::std::mem::size_of::<A_B>() , 4usize);
+ assert_eq!(::std::mem::align_of::<A_B>() , 4usize);
+}
+impl Clone for A_B {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn bindgen_test_layout_A() {
+ assert_eq!(::std::mem::size_of::<A>() , 4usize);
+ assert_eq!(::std::mem::align_of::<A>() , 4usize);
+}
+impl Clone for A {
+ fn clone(&self) -> Self { *self }
+}
+extern "C" {
+ #[link_name = "var"]
+ pub static mut var: A_B;
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct D {
+ pub member: A_B,
+}
+#[test]
+fn bindgen_test_layout_D() {
+ assert_eq!(::std::mem::size_of::<D>() , 4usize);
+ assert_eq!(::std::mem::align_of::<D>() , 4usize);
+}
+impl Clone for D {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Templated<T> {
+ pub member: T,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Templated_Templated_inner<T> {
+ pub member_ptr: *mut T,
+}
diff --git a/tests/expectations/tests/class_no_members.rs b/tests/expectations/tests/class_no_members.rs
new file mode 100644
index 00000000..017f7c22
--- /dev/null
+++ b/tests/expectations/tests/class_no_members.rs
@@ -0,0 +1,45 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct whatever {
+ pub _address: u8,
+}
+#[test]
+fn bindgen_test_layout_whatever() {
+ assert_eq!(::std::mem::size_of::<whatever>() , 1usize);
+ assert_eq!(::std::mem::align_of::<whatever>() , 1usize);
+}
+impl Clone for whatever {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct whatever_child {
+ pub _address: u8,
+}
+#[test]
+fn bindgen_test_layout_whatever_child() {
+ assert_eq!(::std::mem::size_of::<whatever_child>() , 1usize);
+ assert_eq!(::std::mem::align_of::<whatever_child>() , 1usize);
+}
+impl Clone for whatever_child {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct whatever_child_with_member {
+ pub m_member: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_whatever_child_with_member() {
+ assert_eq!(::std::mem::size_of::<whatever_child_with_member>() , 4usize);
+ assert_eq!(::std::mem::align_of::<whatever_child_with_member>() , 4usize);
+}
+impl Clone for whatever_child_with_member {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/class_static.rs b/tests/expectations/tests/class_static.rs
new file mode 100644
index 00000000..8108be2d
--- /dev/null
+++ b/tests/expectations/tests/class_static.rs
@@ -0,0 +1,32 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct MyClass {
+ pub _address: u8,
+}
+extern "C" {
+ #[link_name = "_ZN7MyClass7exampleE"]
+ pub static mut MyClass_example: *const ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "_ZN7MyClass26example_check_no_collisionE"]
+ pub static mut MyClass_example_check_no_collision:
+ *const ::std::os::raw::c_int;
+}
+#[test]
+fn bindgen_test_layout_MyClass() {
+ assert_eq!(::std::mem::size_of::<MyClass>() , 1usize);
+ assert_eq!(::std::mem::align_of::<MyClass>() , 1usize);
+}
+impl Clone for MyClass {
+ fn clone(&self) -> Self { *self }
+}
+extern "C" {
+ #[link_name = "_ZL26example_check_no_collision"]
+ pub static mut example_check_no_collision: *const ::std::os::raw::c_int;
+}
diff --git a/tests/expectations/tests/class_static_const.rs b/tests/expectations/tests/class_static_const.rs
new file mode 100644
index 00000000..eed6590c
--- /dev/null
+++ b/tests/expectations/tests/class_static_const.rs
@@ -0,0 +1,22 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct A {
+ pub _address: u8,
+}
+pub const A_a: ::std::os::raw::c_int = 0;
+pub const A_b: i32 = 63;
+pub const A_c: u32 = 255;
+#[test]
+fn bindgen_test_layout_A() {
+ assert_eq!(::std::mem::size_of::<A>() , 1usize);
+ assert_eq!(::std::mem::align_of::<A>() , 1usize);
+}
+impl Clone for A {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/class_use_as.rs b/tests/expectations/tests/class_use_as.rs
new file mode 100644
index 00000000..c3843b31
--- /dev/null
+++ b/tests/expectations/tests/class_use_as.rs
@@ -0,0 +1,35 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+/**
+ * <div rustbindgen="true" replaces="whatever"></div>
+ */
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct whatever {
+ pub replacement: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_whatever() {
+ assert_eq!(::std::mem::size_of::<whatever>() , 4usize);
+ assert_eq!(::std::mem::align_of::<whatever>() , 4usize);
+}
+impl Clone for whatever {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct container {
+ pub c: whatever,
+}
+#[test]
+fn bindgen_test_layout_container() {
+ assert_eq!(::std::mem::size_of::<container>() , 4usize);
+ assert_eq!(::std::mem::align_of::<container>() , 4usize);
+}
+impl Clone for container {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/class_with_dtor.rs b/tests/expectations/tests/class_with_dtor.rs
new file mode 100644
index 00000000..8fa0951f
--- /dev/null
+++ b/tests/expectations/tests/class_with_dtor.rs
@@ -0,0 +1,29 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug)]
+pub struct HandleWithDtor<T> {
+ pub ptr: *mut T,
+}
+pub type HandleValue = HandleWithDtor<::std::os::raw::c_int>;
+#[repr(C)]
+#[derive(Debug)]
+pub struct WithoutDtor {
+ pub shouldBeWithDtor: HandleValue,
+}
+#[test]
+fn bindgen_test_layout_WithoutDtor() {
+ assert_eq!(::std::mem::size_of::<WithoutDtor>() , 8usize);
+ assert_eq!(::std::mem::align_of::<WithoutDtor>() , 8usize);
+}
+#[test]
+fn __bindgen_test_layout_template_1() {
+ assert_eq!(::std::mem::size_of::<HandleWithDtor<::std::os::raw::c_int>>()
+ , 8usize);
+ assert_eq!(::std::mem::align_of::<HandleWithDtor<::std::os::raw::c_int>>()
+ , 8usize);
+}
diff --git a/tests/expectations/tests/class_with_inner_struct.rs b/tests/expectations/tests/class_with_inner_struct.rs
new file mode 100644
index 00000000..a1bacbdb
--- /dev/null
+++ b/tests/expectations/tests/class_with_inner_struct.rs
@@ -0,0 +1,199 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[inline]
+ pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
+ #[inline]
+ pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
+ #[inline]
+ pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
+}
+impl <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct A {
+ pub c: ::std::os::raw::c_uint,
+ pub named_union: A__bindgen_ty_1,
+ pub __bindgen_anon_1: A__bindgen_ty_2,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct A_Segment {
+ pub begin: ::std::os::raw::c_int,
+ pub end: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_A_Segment() {
+ assert_eq!(::std::mem::size_of::<A_Segment>() , 8usize);
+ assert_eq!(::std::mem::align_of::<A_Segment>() , 4usize);
+}
+impl Clone for A_Segment {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct A__bindgen_ty_1 {
+ pub f: __BindgenUnionField<::std::os::raw::c_int>,
+ pub bindgen_union_field: u32,
+}
+#[test]
+fn bindgen_test_layout_A__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<A__bindgen_ty_1>() , 4usize);
+ assert_eq!(::std::mem::align_of::<A__bindgen_ty_1>() , 4usize);
+}
+impl Clone for A__bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct A__bindgen_ty_2 {
+ pub d: __BindgenUnionField<::std::os::raw::c_int>,
+ pub bindgen_union_field: u32,
+}
+#[test]
+fn bindgen_test_layout_A__bindgen_ty_2() {
+ assert_eq!(::std::mem::size_of::<A__bindgen_ty_2>() , 4usize);
+ assert_eq!(::std::mem::align_of::<A__bindgen_ty_2>() , 4usize);
+}
+impl Clone for A__bindgen_ty_2 {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn bindgen_test_layout_A() {
+ assert_eq!(::std::mem::size_of::<A>() , 12usize);
+ assert_eq!(::std::mem::align_of::<A>() , 4usize);
+}
+impl Clone for A {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct B {
+ pub d: ::std::os::raw::c_uint,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct B_Segment {
+ pub begin: ::std::os::raw::c_int,
+ pub end: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_B_Segment() {
+ assert_eq!(::std::mem::size_of::<B_Segment>() , 8usize);
+ assert_eq!(::std::mem::align_of::<B_Segment>() , 4usize);
+}
+impl Clone for B_Segment {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn bindgen_test_layout_B() {
+ assert_eq!(::std::mem::size_of::<B>() , 4usize);
+ assert_eq!(::std::mem::align_of::<B>() , 4usize);
+}
+impl Clone for B {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(i32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum StepSyntax {
+ Keyword = 0,
+ FunctionalWithoutKeyword = 1,
+ FunctionalWithStartKeyword = 2,
+ FunctionalWithEndKeyword = 3,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct C {
+ pub d: ::std::os::raw::c_uint,
+ pub __bindgen_anon_1: C__bindgen_ty_1,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct C__bindgen_ty_1 {
+ pub mFunc: __BindgenUnionField<C__bindgen_ty_1__bindgen_ty_1>,
+ pub __bindgen_anon_1: __BindgenUnionField<C__bindgen_ty_1__bindgen_ty_2>,
+ pub bindgen_union_field: [u32; 4usize],
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct C__bindgen_ty_1__bindgen_ty_1 {
+ pub mX1: f32,
+ pub mY1: f32,
+ pub mX2: f32,
+ pub mY2: f32,
+}
+#[test]
+fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<C__bindgen_ty_1__bindgen_ty_1>() ,
+ 16usize);
+ assert_eq!(::std::mem::align_of::<C__bindgen_ty_1__bindgen_ty_1>() ,
+ 4usize);
+}
+impl Clone for C__bindgen_ty_1__bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct C__bindgen_ty_1__bindgen_ty_2 {
+ pub mStepSyntax: StepSyntax,
+ pub mSteps: ::std::os::raw::c_uint,
+}
+#[test]
+fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_2() {
+ assert_eq!(::std::mem::size_of::<C__bindgen_ty_1__bindgen_ty_2>() ,
+ 8usize);
+ assert_eq!(::std::mem::align_of::<C__bindgen_ty_1__bindgen_ty_2>() ,
+ 4usize);
+}
+impl Clone for C__bindgen_ty_1__bindgen_ty_2 {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn bindgen_test_layout_C__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<C__bindgen_ty_1>() , 16usize);
+ assert_eq!(::std::mem::align_of::<C__bindgen_ty_1>() , 4usize);
+}
+impl Clone for C__bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct C_Segment {
+ pub begin: ::std::os::raw::c_int,
+ pub end: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_C_Segment() {
+ assert_eq!(::std::mem::size_of::<C_Segment>() , 8usize);
+ assert_eq!(::std::mem::align_of::<C_Segment>() , 4usize);
+}
+impl Clone for C_Segment {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn bindgen_test_layout_C() {
+ assert_eq!(::std::mem::size_of::<C>() , 20usize);
+ assert_eq!(::std::mem::align_of::<C>() , 4usize);
+}
+impl Clone for C {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/class_with_typedef.rs b/tests/expectations/tests/class_with_typedef.rs
new file mode 100644
index 00000000..bc19f2bd
--- /dev/null
+++ b/tests/expectations/tests/class_with_typedef.rs
@@ -0,0 +1,72 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub type AnotherInt = ::std::os::raw::c_int;
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct C {
+ pub c: C_MyInt,
+ pub ptr: *mut C_MyInt,
+ pub arr: [C_MyInt; 10usize],
+ pub d: AnotherInt,
+ pub other_ptr: *mut AnotherInt,
+}
+pub type C_MyInt = ::std::os::raw::c_int;
+pub type C_Lookup = *const ::std::os::raw::c_char;
+#[test]
+fn bindgen_test_layout_C() {
+ assert_eq!(::std::mem::size_of::<C>() , 72usize);
+ assert_eq!(::std::mem::align_of::<C>() , 8usize);
+}
+extern "C" {
+ #[link_name = "_ZN1C6methodEi"]
+ pub fn C_method(this: *mut C, c: C_MyInt);
+}
+extern "C" {
+ #[link_name = "_ZN1C9methodRefERi"]
+ pub fn C_methodRef(this: *mut C, c: *mut C_MyInt);
+}
+extern "C" {
+ #[link_name = "_ZN1C16complexMethodRefERPKc"]
+ pub fn C_complexMethodRef(this: *mut C, c: *mut C_Lookup);
+}
+extern "C" {
+ #[link_name = "_ZN1C13anotherMethodEi"]
+ pub fn C_anotherMethod(this: *mut C, c: AnotherInt);
+}
+impl Clone for C {
+ fn clone(&self) -> Self { *self }
+}
+impl C {
+ #[inline]
+ pub unsafe fn method(&mut self, c: C_MyInt) { C_method(&mut *self, c) }
+ #[inline]
+ pub unsafe fn methodRef(&mut self, c: *mut C_MyInt) {
+ C_methodRef(&mut *self, c)
+ }
+ #[inline]
+ pub unsafe fn complexMethodRef(&mut self, c: *mut C_Lookup) {
+ C_complexMethodRef(&mut *self, c)
+ }
+ #[inline]
+ pub unsafe fn anotherMethod(&mut self, c: AnotherInt) {
+ C_anotherMethod(&mut *self, c)
+ }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct D {
+ pub _base: C,
+ pub ptr: *mut C_MyInt,
+}
+#[test]
+fn bindgen_test_layout_D() {
+ assert_eq!(::std::mem::size_of::<D>() , 80usize);
+ assert_eq!(::std::mem::align_of::<D>() , 8usize);
+}
+impl Clone for D {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/complex.rs b/tests/expectations/tests/complex.rs
new file mode 100644
index 00000000..f2a97952
--- /dev/null
+++ b/tests/expectations/tests/complex.rs
@@ -0,0 +1,64 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[derive(PartialEq, Copy, Clone, Hash, Debug, Default)]
+#[repr(C)]
+pub struct __BindgenComplex<T> {
+ pub re: T,
+ pub im: T,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct TestDouble {
+ pub mMember: __BindgenComplex<f64>,
+}
+#[test]
+fn bindgen_test_layout_TestDouble() {
+ assert_eq!(::std::mem::size_of::<TestDouble>() , 16usize);
+ assert_eq!(::std::mem::align_of::<TestDouble>() , 8usize);
+}
+impl Clone for TestDouble {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct TestDoublePtr {
+ pub mMember: *mut __BindgenComplex<f64>,
+}
+#[test]
+fn bindgen_test_layout_TestDoublePtr() {
+ assert_eq!(::std::mem::size_of::<TestDoublePtr>() , 8usize);
+ assert_eq!(::std::mem::align_of::<TestDoublePtr>() , 8usize);
+}
+impl Clone for TestDoublePtr {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct TestFloat {
+ pub mMember: __BindgenComplex<f32>,
+}
+#[test]
+fn bindgen_test_layout_TestFloat() {
+ assert_eq!(::std::mem::size_of::<TestFloat>() , 8usize);
+ assert_eq!(::std::mem::align_of::<TestFloat>() , 4usize);
+}
+impl Clone for TestFloat {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct TestFloatPtr {
+ pub mMember: *mut __BindgenComplex<f32>,
+}
+#[test]
+fn bindgen_test_layout_TestFloatPtr() {
+ assert_eq!(::std::mem::size_of::<TestFloatPtr>() , 8usize);
+ assert_eq!(::std::mem::align_of::<TestFloatPtr>() , 8usize);
+}
+impl Clone for TestFloatPtr {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/complex_global.rs b/tests/expectations/tests/complex_global.rs
new file mode 100644
index 00000000..badc4d1f
--- /dev/null
+++ b/tests/expectations/tests/complex_global.rs
@@ -0,0 +1,24 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[derive(PartialEq, Copy, Clone, Hash, Debug, Default)]
+#[repr(C)]
+pub struct __BindgenComplex<T> {
+ pub re: T,
+ pub im: T,
+}
+extern "C" {
+ #[link_name = "globalValueFloat"]
+ pub static mut globalValueFloat: __BindgenComplex<f32>;
+}
+extern "C" {
+ #[link_name = "globalValueDouble"]
+ pub static mut globalValueDouble: __BindgenComplex<f64>;
+}
+extern "C" {
+ #[link_name = "globalValueLongDouble"]
+ pub static mut globalValueLongDouble: __BindgenComplex<f64>;
+}
diff --git a/tests/expectations/tests/const_bool.rs b/tests/expectations/tests/const_bool.rs
new file mode 100644
index 00000000..8a50a094
--- /dev/null
+++ b/tests/expectations/tests/const_bool.rs
@@ -0,0 +1,23 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub const k: bool = true;
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct A {
+ pub _address: u8,
+}
+pub const A_k: bool = false;
+#[test]
+fn bindgen_test_layout_A() {
+ assert_eq!(::std::mem::size_of::<A>() , 1usize);
+ assert_eq!(::std::mem::align_of::<A>() , 1usize);
+}
+impl Clone for A {
+ fn clone(&self) -> Self { *self }
+}
+pub type foo = bool;
+pub const k2: foo = true;
diff --git a/tests/expectations/tests/const_enum_unnamed.rs b/tests/expectations/tests/const_enum_unnamed.rs
new file mode 100644
index 00000000..0bd3987a
--- /dev/null
+++ b/tests/expectations/tests/const_enum_unnamed.rs
@@ -0,0 +1,28 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub const FOO_BAR: _bindgen_ty_1 = _bindgen_ty_1::FOO_BAR;
+pub const FOO_BAZ: _bindgen_ty_1 = _bindgen_ty_1::FOO_BAZ;
+#[repr(u32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum _bindgen_ty_1 { FOO_BAR = 0, FOO_BAZ = 1, }
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Foo {
+ pub _address: u8,
+}
+pub const Foo_FOO_BAR: Foo__bindgen_ty_1 = Foo__bindgen_ty_1::FOO_BAR;
+#[repr(u32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum Foo__bindgen_ty_1 { FOO_BAR = 10, }
+#[test]
+fn bindgen_test_layout_Foo() {
+ assert_eq!(::std::mem::size_of::<Foo>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Foo>() , 1usize);
+}
+impl Clone for Foo {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/const_ptr.rs b/tests/expectations/tests/const_ptr.rs
new file mode 100644
index 00000000..89400df1
--- /dev/null
+++ b/tests/expectations/tests/const_ptr.rs
@@ -0,0 +1,9 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+extern "C" {
+ pub fn foo(bar: *const ::std::os::raw::c_void);
+}
diff --git a/tests/expectations/tests/const_resolved_ty.rs b/tests/expectations/tests/const_resolved_ty.rs
new file mode 100644
index 00000000..77d8f438
--- /dev/null
+++ b/tests/expectations/tests/const_resolved_ty.rs
@@ -0,0 +1,9 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+extern "C" {
+ pub fn foo(foo: *const u8);
+}
diff --git a/tests/expectations/tests/const_tparam.rs b/tests/expectations/tests/const_tparam.rs
new file mode 100644
index 00000000..3ed10d28
--- /dev/null
+++ b/tests/expectations/tests/const_tparam.rs
@@ -0,0 +1,12 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct C<T> {
+ pub foo: *const T,
+ pub bar: *mut T,
+}
diff --git a/tests/expectations/tests/constant-evaluate.rs b/tests/expectations/tests/constant-evaluate.rs
new file mode 100644
index 00000000..cdf097a2
--- /dev/null
+++ b/tests/expectations/tests/constant-evaluate.rs
@@ -0,0 +1,20 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub const foo: _bindgen_ty_1 = _bindgen_ty_1::foo;
+pub const bar: _bindgen_ty_1 = _bindgen_ty_1::bar;
+#[repr(u32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum _bindgen_ty_1 { foo = 4, bar = 8, }
+pub type EasyToOverflow = ::std::os::raw::c_ulonglong;
+pub const k: EasyToOverflow = 2147483648;
+pub const k_expr: EasyToOverflow = 0;
+pub const BAZ: ::std::os::raw::c_longlong = 24;
+pub const fuzz: f64 = 51.;
+pub const BAZZ: ::std::os::raw::c_char = 53;
+pub const WAT: ::std::os::raw::c_char = 0;
+pub const bytestring: &'static [u8; 4usize] = b"Foo\x00";
+pub const NOT_UTF8: [u8; 5usize] = [240, 40, 140, 40, 0];
diff --git a/tests/expectations/tests/constify-enum.rs b/tests/expectations/tests/constify-enum.rs
new file mode 100644
index 00000000..989c5197
--- /dev/null
+++ b/tests/expectations/tests/constify-enum.rs
@@ -0,0 +1,20 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub const nsCSSPropertyID_eCSSProperty_COUNT_unexistingVariantValue:
+ nsCSSPropertyID =
+ nsCSSPropertyID::eCSSProperty_COUNT_unexistingVariantValue;
+pub const nsCSSPropertyID_eCSSProperty_COUNT: nsCSSPropertyID =
+ nsCSSPropertyID::eCSSPropertyAlias_aa;
+#[repr(u32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum nsCSSPropertyID {
+ eCSSProperty_a = 0,
+ eCSSProperty_b = 1,
+ eCSSPropertyAlias_aa = 2,
+ eCSSPropertyAlias_bb = 3,
+ eCSSProperty_COUNT_unexistingVariantValue = 4,
+}
diff --git a/tests/expectations/tests/constructor-tp.rs b/tests/expectations/tests/constructor-tp.rs
new file mode 100644
index 00000000..50220489
--- /dev/null
+++ b/tests/expectations/tests/constructor-tp.rs
@@ -0,0 +1,37 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Foo<T> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Bar {
+ pub _address: u8,
+}
+#[test]
+fn bindgen_test_layout_Bar() {
+ assert_eq!(::std::mem::size_of::<Bar>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Bar>() , 1usize);
+}
+extern "C" {
+ #[link_name = "_ZN3BarC1Ev"]
+ pub fn Bar_Bar(this: *mut Bar);
+}
+impl Clone for Bar {
+ fn clone(&self) -> Self { *self }
+}
+impl Bar {
+ #[inline]
+ pub unsafe fn new() -> Self {
+ let mut __bindgen_tmp = ::std::mem::uninitialized();
+ Bar_Bar(&mut __bindgen_tmp);
+ __bindgen_tmp
+ }
+}
diff --git a/tests/expectations/tests/constructors.rs b/tests/expectations/tests/constructors.rs
new file mode 100644
index 00000000..95afb82d
--- /dev/null
+++ b/tests/expectations/tests/constructors.rs
@@ -0,0 +1,67 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct TestOverload {
+ pub _address: u8,
+}
+#[test]
+fn bindgen_test_layout_TestOverload() {
+ assert_eq!(::std::mem::size_of::<TestOverload>() , 1usize);
+ assert_eq!(::std::mem::align_of::<TestOverload>() , 1usize);
+}
+extern "C" {
+ #[link_name = "_ZN12TestOverloadC1Ei"]
+ pub fn TestOverload_TestOverload(this: *mut TestOverload,
+ arg1: ::std::os::raw::c_int);
+}
+extern "C" {
+ #[link_name = "_ZN12TestOverloadC1Ed"]
+ pub fn TestOverload_TestOverload1(this: *mut TestOverload, arg1: f64);
+}
+impl Clone for TestOverload {
+ fn clone(&self) -> Self { *self }
+}
+impl TestOverload {
+ #[inline]
+ pub unsafe fn new(arg1: ::std::os::raw::c_int) -> Self {
+ let mut __bindgen_tmp = ::std::mem::uninitialized();
+ TestOverload_TestOverload(&mut __bindgen_tmp, arg1);
+ __bindgen_tmp
+ }
+ #[inline]
+ pub unsafe fn new1(arg1: f64) -> Self {
+ let mut __bindgen_tmp = ::std::mem::uninitialized();
+ TestOverload_TestOverload1(&mut __bindgen_tmp, arg1);
+ __bindgen_tmp
+ }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct TestPublicNoArgs {
+ pub _address: u8,
+}
+#[test]
+fn bindgen_test_layout_TestPublicNoArgs() {
+ assert_eq!(::std::mem::size_of::<TestPublicNoArgs>() , 1usize);
+ assert_eq!(::std::mem::align_of::<TestPublicNoArgs>() , 1usize);
+}
+extern "C" {
+ #[link_name = "_ZN16TestPublicNoArgsC1Ev"]
+ pub fn TestPublicNoArgs_TestPublicNoArgs(this: *mut TestPublicNoArgs);
+}
+impl Clone for TestPublicNoArgs {
+ fn clone(&self) -> Self { *self }
+}
+impl TestPublicNoArgs {
+ #[inline]
+ pub unsafe fn new() -> Self {
+ let mut __bindgen_tmp = ::std::mem::uninitialized();
+ TestPublicNoArgs_TestPublicNoArgs(&mut __bindgen_tmp);
+ __bindgen_tmp
+ }
+}
diff --git a/tests/expectations/tests/convert-floats.rs b/tests/expectations/tests/convert-floats.rs
new file mode 100644
index 00000000..5cd38c13
--- /dev/null
+++ b/tests/expectations/tests/convert-floats.rs
@@ -0,0 +1,30 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[derive(PartialEq, Copy, Clone, Hash, Debug, Default)]
+#[repr(C)]
+pub struct __BindgenComplex<T> {
+ pub re: T,
+ pub im: T,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo {
+ pub bar: ::std::os::raw::c_float,
+ pub baz: ::std::os::raw::c_float,
+ pub bazz: ::std::os::raw::c_double,
+ pub bazzz: *mut ::std::os::raw::c_double,
+ pub complexFloat: __BindgenComplex<::std::os::raw::c_float>,
+ pub complexDouble: __BindgenComplex<::std::os::raw::c_double>,
+}
+#[test]
+fn bindgen_test_layout_foo() {
+ assert_eq!(::std::mem::size_of::<foo>() , 48usize);
+ assert_eq!(::std::mem::align_of::<foo>() , 8usize);
+}
+impl Clone for foo {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/crtp.rs b/tests/expectations/tests/crtp.rs
new file mode 100644
index 00000000..cc488fd6
--- /dev/null
+++ b/tests/expectations/tests/crtp.rs
@@ -0,0 +1,55 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Base<T> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Derived {
+ pub _address: u8,
+}
+#[test]
+fn bindgen_test_layout_Derived() {
+ assert_eq!(::std::mem::size_of::<Derived>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Derived>() , 1usize);
+}
+impl Clone for Derived {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug)]
+pub struct BaseWithDestructor<T> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+#[repr(C)]
+#[derive(Debug)]
+pub struct DerivedFromBaseWithDestructor {
+ pub _address: u8,
+}
+#[test]
+fn bindgen_test_layout_DerivedFromBaseWithDestructor() {
+ assert_eq!(::std::mem::size_of::<DerivedFromBaseWithDestructor>() ,
+ 1usize);
+ assert_eq!(::std::mem::align_of::<DerivedFromBaseWithDestructor>() ,
+ 1usize);
+}
+#[test]
+fn __bindgen_test_layout_template_1() {
+ assert_eq!(::std::mem::size_of::<Base<Derived>>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Base<Derived>>() , 1usize);
+}
+#[test]
+fn __bindgen_test_layout_template_2() {
+ assert_eq!(::std::mem::size_of::<BaseWithDestructor<DerivedFromBaseWithDestructor>>()
+ , 1usize);
+ assert_eq!(::std::mem::align_of::<BaseWithDestructor<DerivedFromBaseWithDestructor>>()
+ , 1usize);
+}
diff --git a/tests/expectations/tests/dash_language.rs b/tests/expectations/tests/dash_language.rs
new file mode 100644
index 00000000..148f9c32
--- /dev/null
+++ b/tests/expectations/tests/dash_language.rs
@@ -0,0 +1,12 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Foo<T> {
+ pub bar: ::std::os::raw::c_int,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
diff --git a/tests/expectations/tests/decl_extern_int_twice.rs b/tests/expectations/tests/decl_extern_int_twice.rs
new file mode 100644
index 00000000..603a51b1
--- /dev/null
+++ b/tests/expectations/tests/decl_extern_int_twice.rs
@@ -0,0 +1,10 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+extern "C" {
+ #[link_name = "foo"]
+ pub static mut foo: ::std::os::raw::c_int;
+}
diff --git a/tests/expectations/tests/decl_ptr_to_array.rs b/tests/expectations/tests/decl_ptr_to_array.rs
new file mode 100644
index 00000000..b8abedb5
--- /dev/null
+++ b/tests/expectations/tests/decl_ptr_to_array.rs
@@ -0,0 +1,10 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+extern "C" {
+ #[link_name = "foo"]
+ pub static mut foo: *mut [::std::os::raw::c_int; 1usize];
+}
diff --git a/tests/expectations/tests/disable-namespacing.rs b/tests/expectations/tests/disable-namespacing.rs
new file mode 100644
index 00000000..5c166946
--- /dev/null
+++ b/tests/expectations/tests/disable-namespacing.rs
@@ -0,0 +1,7 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub type Baz = ::std::os::raw::c_int;
diff --git a/tests/expectations/tests/duplicated-namespaces-definitions.rs b/tests/expectations/tests/duplicated-namespaces-definitions.rs
new file mode 100644
index 00000000..da06a2a9
--- /dev/null
+++ b/tests/expectations/tests/duplicated-namespaces-definitions.rs
@@ -0,0 +1,45 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub mod root {
+ #[allow(unused_imports)]
+ use self::super::root;
+ pub mod foo {
+ #[allow(unused_imports)]
+ use self::super::super::root;
+ #[repr(C)]
+ #[derive(Debug, Copy)]
+ pub struct Bar {
+ pub foo: ::std::os::raw::c_int,
+ pub baz: bool,
+ }
+ #[test]
+ fn bindgen_test_layout_Bar() {
+ assert_eq!(::std::mem::size_of::<Bar>() , 8usize);
+ assert_eq!(::std::mem::align_of::<Bar>() , 4usize);
+ }
+ impl Clone for Bar {
+ fn clone(&self) -> Self { *self }
+ }
+ }
+ pub mod bar {
+ #[allow(unused_imports)]
+ use self::super::super::root;
+ #[repr(C)]
+ #[derive(Debug, Copy)]
+ pub struct Foo {
+ pub ptr: *mut root::foo::Bar,
+ }
+ #[test]
+ fn bindgen_test_layout_Foo() {
+ assert_eq!(::std::mem::size_of::<Foo>() , 8usize);
+ assert_eq!(::std::mem::align_of::<Foo>() , 8usize);
+ }
+ impl Clone for Foo {
+ fn clone(&self) -> Self { *self }
+ }
+ }
+}
diff --git a/tests/expectations/tests/duplicated-namespaces.rs b/tests/expectations/tests/duplicated-namespaces.rs
new file mode 100644
index 00000000..42976657
--- /dev/null
+++ b/tests/expectations/tests/duplicated-namespaces.rs
@@ -0,0 +1,10 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub mod root {
+ #[allow(unused_imports)]
+ use self::super::root;
+}
diff --git a/tests/expectations/tests/duplicated_constants_in_ns.rs b/tests/expectations/tests/duplicated_constants_in_ns.rs
new file mode 100644
index 00000000..3721740c
--- /dev/null
+++ b/tests/expectations/tests/duplicated_constants_in_ns.rs
@@ -0,0 +1,20 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub mod root {
+ #[allow(unused_imports)]
+ use self::super::root;
+ pub mod foo {
+ #[allow(unused_imports)]
+ use self::super::super::root;
+ pub const FOO: ::std::os::raw::c_int = 4;
+ }
+ pub mod bar {
+ #[allow(unused_imports)]
+ use self::super::super::root;
+ pub const FOO: ::std::os::raw::c_int = 5;
+ }
+}
diff --git a/tests/expectations/tests/elaborated.rs b/tests/expectations/tests/elaborated.rs
new file mode 100644
index 00000000..0e8f4ee5
--- /dev/null
+++ b/tests/expectations/tests/elaborated.rs
@@ -0,0 +1,11 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub type whatever_whatever_t = ::std::os::raw::c_int;
+extern "C" {
+ #[link_name = "_Z9somethingPKi"]
+ pub fn something(wat: *const whatever_whatever_t);
+}
diff --git a/tests/expectations/tests/empty_template_param_name.rs b/tests/expectations/tests/empty_template_param_name.rs
new file mode 100644
index 00000000..e10b56db
--- /dev/null
+++ b/tests/expectations/tests/empty_template_param_name.rs
@@ -0,0 +1,13 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub type __void_t = ::std::os::raw::c_void;
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct __iterator_traits<_Iterator> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<_Iterator>,
+}
diff --git a/tests/expectations/tests/enum.rs b/tests/expectations/tests/enum.rs
new file mode 100644
index 00000000..8138d697
--- /dev/null
+++ b/tests/expectations/tests/enum.rs
@@ -0,0 +1,12 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(u32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum Foo { Bar = 0, Qux = 1, }
+#[repr(i32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum Neg { MinusOne = -1, One = 1, }
diff --git a/tests/expectations/tests/enum_alias.rs b/tests/expectations/tests/enum_alias.rs
new file mode 100644
index 00000000..7ea85598
--- /dev/null
+++ b/tests/expectations/tests/enum_alias.rs
@@ -0,0 +1,9 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(u8)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum Bar { VAL = 0, }
diff --git a/tests/expectations/tests/enum_and_vtable_mangling.rs b/tests/expectations/tests/enum_and_vtable_mangling.rs
new file mode 100644
index 00000000..a55c344e
--- /dev/null
+++ b/tests/expectations/tests/enum_and_vtable_mangling.rs
@@ -0,0 +1,28 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub const match_: _bindgen_ty_1 = _bindgen_ty_1::match_;
+pub const whatever_else: _bindgen_ty_1 = _bindgen_ty_1::whatever_else;
+#[repr(u32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum _bindgen_ty_1 { match_ = 0, whatever_else = 1, }
+#[repr(C)]
+pub struct C__bindgen_vtable {
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct C {
+ pub vtable_: *const C__bindgen_vtable,
+ pub i: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_C() {
+ assert_eq!(::std::mem::size_of::<C>() , 16usize);
+ assert_eq!(::std::mem::align_of::<C>() , 8usize);
+}
+impl Clone for C {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/enum_dupe.rs b/tests/expectations/tests/enum_dupe.rs
new file mode 100644
index 00000000..322b89fc
--- /dev/null
+++ b/tests/expectations/tests/enum_dupe.rs
@@ -0,0 +1,10 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub const Foo_Dupe: Foo = Foo::Bar;
+#[repr(u32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum Foo { Bar = 1, }
diff --git a/tests/expectations/tests/enum_explicit_type.rs b/tests/expectations/tests/enum_explicit_type.rs
new file mode 100644
index 00000000..4e555d3a
--- /dev/null
+++ b/tests/expectations/tests/enum_explicit_type.rs
@@ -0,0 +1,24 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(u8)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum Foo { Bar = 0, Qux = 1, }
+#[repr(i8)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum Neg { MinusOne = -1, One = 1, }
+#[repr(u16)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum Bigger { Much = 255, Larger = 256, }
+#[repr(i64)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum MuchLong { MuchLow = -4294967296, }
+#[repr(i64)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum MuchLongLong { I64_MIN = -9223372036854775808, }
+#[repr(u64)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum MuchULongLong { MuchHigh = 4294967296, }
diff --git a/tests/expectations/tests/enum_in_template_with_typedef.rs b/tests/expectations/tests/enum_in_template_with_typedef.rs
new file mode 100644
index 00000000..66a304aa
--- /dev/null
+++ b/tests/expectations/tests/enum_in_template_with_typedef.rs
@@ -0,0 +1,18 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct std_fbstring_core<Char> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<Char>,
+}
+pub type std_fbstring_core_category_type = u8;
+pub const std_fbstring_core_Category_Bar: std_fbstring_core_Category =
+ std_fbstring_core_Category::Foo;
+#[repr(u8)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum std_fbstring_core_Category { Foo = 0, }
diff --git a/tests/expectations/tests/enum_negative.rs b/tests/expectations/tests/enum_negative.rs
new file mode 100644
index 00000000..74cf4f16
--- /dev/null
+++ b/tests/expectations/tests/enum_negative.rs
@@ -0,0 +1,9 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(i32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum Foo { Bar = -2, Qux = 1, }
diff --git a/tests/expectations/tests/enum_packed.rs b/tests/expectations/tests/enum_packed.rs
new file mode 100644
index 00000000..963763e1
--- /dev/null
+++ b/tests/expectations/tests/enum_packed.rs
@@ -0,0 +1,15 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(u8)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum Foo { Bar = 0, Qux = 1, }
+#[repr(i8)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum Neg { MinusOne = -1, One = 1, }
+#[repr(u16)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum Bigger { Much = 255, Larger = 256, }
diff --git a/tests/expectations/tests/eval-variadic-template-parameter.rs b/tests/expectations/tests/eval-variadic-template-parameter.rs
new file mode 100644
index 00000000..f8c937e2
--- /dev/null
+++ b/tests/expectations/tests/eval-variadic-template-parameter.rs
@@ -0,0 +1,12 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct B<T> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
diff --git a/tests/expectations/tests/extern.rs b/tests/expectations/tests/extern.rs
new file mode 100644
index 00000000..e7ac7504
--- /dev/null
+++ b/tests/expectations/tests/extern.rs
@@ -0,0 +1,9 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub type foo =
+ ::std::option::Option<unsafe extern "C" fn(bar: ::std::os::raw::c_int)
+ -> ::std::os::raw::c_int>;
diff --git a/tests/expectations/tests/float128.rs b/tests/expectations/tests/float128.rs
new file mode 100644
index 00000000..b4b7b2bc
--- /dev/null
+++ b/tests/expectations/tests/float128.rs
@@ -0,0 +1,7 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+
diff --git a/tests/expectations/tests/forward-inherit-struct-with-fields.rs b/tests/expectations/tests/forward-inherit-struct-with-fields.rs
new file mode 100644
index 00000000..e377b3ad
--- /dev/null
+++ b/tests/expectations/tests/forward-inherit-struct-with-fields.rs
@@ -0,0 +1,17 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Rooted<T> {
+ pub _base: js_RootedBase<T>,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct js_RootedBase<T> {
+ pub foo: *mut T,
+ pub next: *mut Rooted<T>,
+}
diff --git a/tests/expectations/tests/forward-inherit-struct.rs b/tests/expectations/tests/forward-inherit-struct.rs
new file mode 100644
index 00000000..5de70fa9
--- /dev/null
+++ b/tests/expectations/tests/forward-inherit-struct.rs
@@ -0,0 +1,18 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Rooted<T> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct js_RootedBase<T> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
diff --git a/tests/expectations/tests/forward_declared_struct.rs b/tests/expectations/tests/forward_declared_struct.rs
new file mode 100644
index 00000000..5c2764e1
--- /dev/null
+++ b/tests/expectations/tests/forward_declared_struct.rs
@@ -0,0 +1,32 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct a {
+ pub b: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_a() {
+ assert_eq!(::std::mem::size_of::<a>() , 4usize);
+ assert_eq!(::std::mem::align_of::<a>() , 4usize);
+}
+impl Clone for a {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct c {
+ pub d: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_c() {
+ assert_eq!(::std::mem::size_of::<c>() , 4usize);
+ assert_eq!(::std::mem::align_of::<c>() , 4usize);
+}
+impl Clone for c {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/func_proto.rs b/tests/expectations/tests/func_proto.rs
new file mode 100644
index 00000000..e7ac7504
--- /dev/null
+++ b/tests/expectations/tests/func_proto.rs
@@ -0,0 +1,9 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub type foo =
+ ::std::option::Option<unsafe extern "C" fn(bar: ::std::os::raw::c_int)
+ -> ::std::os::raw::c_int>;
diff --git a/tests/expectations/tests/func_ptr.rs b/tests/expectations/tests/func_ptr.rs
new file mode 100644
index 00000000..87ec3e3d
--- /dev/null
+++ b/tests/expectations/tests/func_ptr.rs
@@ -0,0 +1,15 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+extern "C" {
+ #[link_name = "foo"]
+ pub static mut foo:
+ ::std::option::Option<unsafe extern "C" fn(x:
+ ::std::os::raw::c_int,
+ y:
+ ::std::os::raw::c_int)
+ -> ::std::os::raw::c_int>;
+}
diff --git a/tests/expectations/tests/func_ptr_in_struct.rs b/tests/expectations/tests/func_ptr_in_struct.rs
new file mode 100644
index 00000000..dcae771b
--- /dev/null
+++ b/tests/expectations/tests/func_ptr_in_struct.rs
@@ -0,0 +1,25 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum baz { }
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Foo {
+ pub bar: ::std::option::Option<unsafe extern "C" fn(x:
+ ::std::os::raw::c_int,
+ y:
+ ::std::os::raw::c_int)
+ -> baz>,
+}
+#[test]
+fn bindgen_test_layout_Foo() {
+ assert_eq!(::std::mem::size_of::<Foo>() , 8usize);
+ assert_eq!(::std::mem::align_of::<Foo>() , 8usize);
+}
+impl Clone for Foo {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/func_with_array_arg.rs b/tests/expectations/tests/func_with_array_arg.rs
new file mode 100644
index 00000000..1528e0ba
--- /dev/null
+++ b/tests/expectations/tests/func_with_array_arg.rs
@@ -0,0 +1,9 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+extern "C" {
+ pub fn f(x: *mut ::std::os::raw::c_int);
+}
diff --git a/tests/expectations/tests/func_with_func_ptr_arg.rs b/tests/expectations/tests/func_with_func_ptr_arg.rs
new file mode 100644
index 00000000..4ac25286
--- /dev/null
+++ b/tests/expectations/tests/func_with_func_ptr_arg.rs
@@ -0,0 +1,9 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+extern "C" {
+ pub fn foo(bar: ::std::option::Option<unsafe extern "C" fn()>);
+}
diff --git a/tests/expectations/tests/in_class_typedef.rs b/tests/expectations/tests/in_class_typedef.rs
new file mode 100644
index 00000000..4e95ca8c
--- /dev/null
+++ b/tests/expectations/tests/in_class_typedef.rs
@@ -0,0 +1,21 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Foo<T> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+pub type Foo_elem_type<T> = T;
+pub type Foo_ptr_type<T> = *mut T;
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Foo_Bar<T> {
+ pub x: ::std::os::raw::c_int,
+ pub y: ::std::os::raw::c_int,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
diff --git a/tests/expectations/tests/inherit-namespaced.rs b/tests/expectations/tests/inherit-namespaced.rs
new file mode 100644
index 00000000..c0d2e5a6
--- /dev/null
+++ b/tests/expectations/tests/inherit-namespaced.rs
@@ -0,0 +1,18 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct js_RootedBase<T> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Rooted<T> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
diff --git a/tests/expectations/tests/inherit_named.rs b/tests/expectations/tests/inherit_named.rs
new file mode 100644
index 00000000..8081c649
--- /dev/null
+++ b/tests/expectations/tests/inherit_named.rs
@@ -0,0 +1,17 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Wohoo<T> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Weeee<T> {
+ pub _base: T,
+}
diff --git a/tests/expectations/tests/inherit_typedef.rs b/tests/expectations/tests/inherit_typedef.rs
new file mode 100644
index 00000000..2b974223
--- /dev/null
+++ b/tests/expectations/tests/inherit_typedef.rs
@@ -0,0 +1,33 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Foo {
+ pub _address: u8,
+}
+#[test]
+fn bindgen_test_layout_Foo() {
+ assert_eq!(::std::mem::size_of::<Foo>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Foo>() , 1usize);
+}
+impl Clone for Foo {
+ fn clone(&self) -> Self { *self }
+}
+pub use self::Foo as TypedefedFoo;
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Bar {
+ pub _address: u8,
+}
+#[test]
+fn bindgen_test_layout_Bar() {
+ assert_eq!(::std::mem::size_of::<Bar>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Bar>() , 1usize);
+}
+impl Clone for Bar {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/inline-function.rs b/tests/expectations/tests/inline-function.rs
new file mode 100644
index 00000000..b4b7b2bc
--- /dev/null
+++ b/tests/expectations/tests/inline-function.rs
@@ -0,0 +1,7 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+
diff --git a/tests/expectations/tests/inline_namespace.rs b/tests/expectations/tests/inline_namespace.rs
new file mode 100644
index 00000000..5f6776b7
--- /dev/null
+++ b/tests/expectations/tests/inline_namespace.rs
@@ -0,0 +1,28 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub mod root {
+ #[allow(unused_imports)]
+ use self::super::root;
+ pub mod foo {
+ #[allow(unused_imports)]
+ use self::super::super::root;
+ pub type Ty = ::std::os::raw::c_int;
+ }
+ #[repr(C)]
+ #[derive(Debug, Copy)]
+ pub struct Bar {
+ pub baz: root::foo::Ty,
+ }
+ #[test]
+ fn bindgen_test_layout_Bar() {
+ assert_eq!(::std::mem::size_of::<Bar>() , 4usize);
+ assert_eq!(::std::mem::align_of::<Bar>() , 4usize);
+ }
+ impl Clone for Bar {
+ fn clone(&self) -> Self { *self }
+ }
+}
diff --git a/tests/expectations/tests/inline_namespace_conservative.rs b/tests/expectations/tests/inline_namespace_conservative.rs
new file mode 100644
index 00000000..d759a882
--- /dev/null
+++ b/tests/expectations/tests/inline_namespace_conservative.rs
@@ -0,0 +1,33 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub mod root {
+ #[allow(unused_imports)]
+ use self::super::root;
+ pub mod foo {
+ #[allow(unused_imports)]
+ use self::super::super::root;
+ pub mod bar {
+ #[allow(unused_imports)]
+ use self::super::super::super::root;
+ pub type Ty = ::std::os::raw::c_int;
+ }
+ pub type Ty = ::std::os::raw::c_longlong;
+ }
+ #[repr(C)]
+ #[derive(Debug, Copy)]
+ pub struct Bar {
+ pub baz: root::foo::bar::Ty,
+ }
+ #[test]
+ fn bindgen_test_layout_Bar() {
+ assert_eq!(::std::mem::size_of::<Bar>() , 4usize);
+ assert_eq!(::std::mem::align_of::<Bar>() , 4usize);
+ }
+ impl Clone for Bar {
+ fn clone(&self) -> Self { *self }
+ }
+}
diff --git a/tests/expectations/tests/inline_namespace_whitelist.rs b/tests/expectations/tests/inline_namespace_whitelist.rs
new file mode 100644
index 00000000..9b8f87a5
--- /dev/null
+++ b/tests/expectations/tests/inline_namespace_whitelist.rs
@@ -0,0 +1,15 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub mod root {
+ #[allow(unused_imports)]
+ use self::super::root;
+ pub mod std {
+ #[allow(unused_imports)]
+ use self::super::super::root;
+ pub type string = *const ::std::os::raw::c_char;
+ }
+}
diff --git a/tests/expectations/tests/inner_const.rs b/tests/expectations/tests/inner_const.rs
new file mode 100644
index 00000000..666b8ce2
--- /dev/null
+++ b/tests/expectations/tests/inner_const.rs
@@ -0,0 +1,27 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Foo {
+ pub bar: ::std::os::raw::c_int,
+}
+extern "C" {
+ #[link_name = "_ZN3Foo3BOOE"]
+ pub static mut Foo_BOO: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "_ZN3Foo8whateverE"]
+ pub static mut Foo_whatever: Foo;
+}
+#[test]
+fn bindgen_test_layout_Foo() {
+ assert_eq!(::std::mem::size_of::<Foo>() , 4usize);
+ assert_eq!(::std::mem::align_of::<Foo>() , 4usize);
+}
+impl Clone for Foo {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/inner_template_self.rs b/tests/expectations/tests/inner_template_self.rs
new file mode 100644
index 00000000..b965b92d
--- /dev/null
+++ b/tests/expectations/tests/inner_template_self.rs
@@ -0,0 +1,25 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct LinkedList<T> {
+ pub next: *mut LinkedList<T>,
+ pub prev: *mut LinkedList<T>,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct InstantiateIt {
+ pub m_list: LinkedList<::std::os::raw::c_int>,
+}
+#[test]
+fn bindgen_test_layout_InstantiateIt() {
+ assert_eq!(::std::mem::size_of::<InstantiateIt>() , 16usize);
+ assert_eq!(::std::mem::align_of::<InstantiateIt>() , 8usize);
+}
+impl Clone for InstantiateIt {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/int128_t.rs b/tests/expectations/tests/int128_t.rs
new file mode 100644
index 00000000..b4b7b2bc
--- /dev/null
+++ b/tests/expectations/tests/int128_t.rs
@@ -0,0 +1,7 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+
diff --git a/tests/expectations/tests/issue-358.rs b/tests/expectations/tests/issue-358.rs
new file mode 100644
index 00000000..1b933d34
--- /dev/null
+++ b/tests/expectations/tests/issue-358.rs
@@ -0,0 +1,20 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct JS_PersistentRooted<c> {
+ pub _base: a,
+ pub _phantom_0: ::std::marker::PhantomData<c>,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct a {
+ pub b: *mut a,
+}
+impl Clone for a {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/issue-372.rs b/tests/expectations/tests/issue-372.rs
new file mode 100644
index 00000000..c6d9209e
--- /dev/null
+++ b/tests/expectations/tests/issue-372.rs
@@ -0,0 +1,63 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub mod root {
+ #[allow(unused_imports)]
+ use self::super::root;
+ #[repr(C)]
+ #[derive(Debug, Copy)]
+ pub struct d {
+ pub m: root::i,
+ }
+ #[test]
+ fn bindgen_test_layout_d() {
+ assert_eq!(::std::mem::size_of::<d>() , 24usize);
+ assert_eq!(::std::mem::align_of::<d>() , 8usize);
+ }
+ impl Clone for d {
+ fn clone(&self) -> Self { *self }
+ }
+ #[repr(C)]
+ #[derive(Debug, Copy)]
+ pub struct i {
+ pub j: *mut root::i,
+ pub k: *mut root::i,
+ pub l: bool,
+ }
+ #[test]
+ fn bindgen_test_layout_i() {
+ assert_eq!(::std::mem::size_of::<i>() , 24usize);
+ assert_eq!(::std::mem::align_of::<i>() , 8usize);
+ }
+ impl Clone for i {
+ fn clone(&self) -> Self { *self }
+ }
+ #[repr(u32)]
+ #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+ pub enum n {
+ o = 0,
+ p = 1,
+ q = 2,
+ r = 3,
+ s = 4,
+ t = 5,
+ b = 6,
+ ae = 7,
+ e = 8,
+ ag = 9,
+ ah = 10,
+ ai = 11,
+ }
+ #[repr(C)]
+ pub struct F {
+ pub w: [u64; 33usize],
+ }
+ #[test]
+ fn bindgen_test_layout_F() {
+ assert_eq!(::std::mem::size_of::<F>() , 264usize);
+ assert_eq!(::std::mem::align_of::<F>() , 8usize);
+ }
+}
diff --git a/tests/expectations/tests/issue_311.rs b/tests/expectations/tests/issue_311.rs
new file mode 100644
index 00000000..f01a9d93
--- /dev/null
+++ b/tests/expectations/tests/issue_311.rs
@@ -0,0 +1,38 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub mod root {
+ #[allow(unused_imports)]
+ use self::super::root;
+ #[repr(C)]
+ #[derive(Debug, Copy)]
+ pub struct jsval_layout {
+ pub __bindgen_anon_1: root::jsval_layout__bindgen_ty_1,
+ }
+ #[repr(C)]
+ #[derive(Debug, Copy)]
+ pub struct jsval_layout__bindgen_ty_1 {
+ pub _address: u8,
+ }
+ #[test]
+ fn bindgen_test_layout_jsval_layout__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_1>() ,
+ 1usize);
+ assert_eq!(::std::mem::align_of::<jsval_layout__bindgen_ty_1>() ,
+ 1usize);
+ }
+ impl Clone for jsval_layout__bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+ }
+ #[test]
+ fn bindgen_test_layout_jsval_layout() {
+ assert_eq!(::std::mem::size_of::<jsval_layout>() , 1usize);
+ assert_eq!(::std::mem::align_of::<jsval_layout>() , 1usize);
+ }
+ impl Clone for jsval_layout {
+ fn clone(&self) -> Self { *self }
+ }
+}
diff --git a/tests/expectations/tests/issue_315.rs b/tests/expectations/tests/issue_315.rs
new file mode 100644
index 00000000..a5ab63fc
--- /dev/null
+++ b/tests/expectations/tests/issue_315.rs
@@ -0,0 +1,8 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+/// <div rustbindgen replaces="c"></div>
+pub type c<a> = a;
diff --git a/tests/expectations/tests/jsval_layout_opaque.rs b/tests/expectations/tests/jsval_layout_opaque.rs
new file mode 100644
index 00000000..530fdb22
--- /dev/null
+++ b/tests/expectations/tests/jsval_layout_opaque.rs
@@ -0,0 +1,200 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[inline]
+ pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
+ #[inline]
+ pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
+ #[inline]
+ pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
+}
+impl <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+pub const JSVAL_TAG_SHIFT: ::std::os::raw::c_uint = 47;
+pub const JSVAL_PAYLOAD_MASK: ::std::os::raw::c_ulonglong = 140737488355327;
+pub const JSVAL_TAG_MASK: ::std::os::raw::c_longlong = -140737488355328;
+#[repr(u8)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum JSValueType {
+ JSVAL_TYPE_DOUBLE = 0,
+ JSVAL_TYPE_INT32 = 1,
+ JSVAL_TYPE_UNDEFINED = 2,
+ JSVAL_TYPE_BOOLEAN = 3,
+ JSVAL_TYPE_MAGIC = 4,
+ JSVAL_TYPE_STRING = 5,
+ JSVAL_TYPE_SYMBOL = 6,
+ JSVAL_TYPE_NULL = 7,
+ JSVAL_TYPE_OBJECT = 8,
+ JSVAL_TYPE_UNKNOWN = 32,
+ JSVAL_TYPE_MISSING = 33,
+}
+#[repr(u32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum JSValueTag {
+ JSVAL_TAG_MAX_DOUBLE = 131056,
+ JSVAL_TAG_INT32 = 131057,
+ JSVAL_TAG_UNDEFINED = 131058,
+ JSVAL_TAG_STRING = 131061,
+ JSVAL_TAG_SYMBOL = 131062,
+ JSVAL_TAG_BOOLEAN = 131059,
+ JSVAL_TAG_MAGIC = 131060,
+ JSVAL_TAG_NULL = 131063,
+ JSVAL_TAG_OBJECT = 131064,
+}
+#[repr(u64)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum JSValueShiftedTag {
+ JSVAL_SHIFTED_TAG_MAX_DOUBLE = 18444492278190833663,
+ JSVAL_SHIFTED_TAG_INT32 = 18444633011384221696,
+ JSVAL_SHIFTED_TAG_UNDEFINED = 18444773748872577024,
+ JSVAL_SHIFTED_TAG_STRING = 18445195961337643008,
+ JSVAL_SHIFTED_TAG_SYMBOL = 18445336698825998336,
+ JSVAL_SHIFTED_TAG_BOOLEAN = 18444914486360932352,
+ JSVAL_SHIFTED_TAG_MAGIC = 18445055223849287680,
+ JSVAL_SHIFTED_TAG_NULL = 18445477436314353664,
+ JSVAL_SHIFTED_TAG_OBJECT = 18445618173802708992,
+}
+#[repr(u32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum JSWhyMagic {
+ JS_ELEMENTS_HOLE = 0,
+ JS_NO_ITER_VALUE = 1,
+ JS_GENERATOR_CLOSING = 2,
+ JS_NO_CONSTANT = 3,
+ JS_THIS_POISON = 4,
+ JS_ARG_POISON = 5,
+ JS_SERIALIZE_NO_NODE = 6,
+ JS_LAZY_ARGUMENTS = 7,
+ JS_OPTIMIZED_ARGUMENTS = 8,
+ JS_IS_CONSTRUCTING = 9,
+ JS_OVERWRITTEN_CALLEE = 10,
+ JS_BLOCK_NEEDS_CLONE = 11,
+ JS_HASH_KEY_EMPTY = 12,
+ JS_ION_ERROR = 13,
+ JS_ION_BAILOUT = 14,
+ JS_OPTIMIZED_OUT = 15,
+ JS_UNINITIALIZED_LEXICAL = 16,
+ JS_GENERIC_MAGIC = 17,
+ JS_WHY_MAGIC_COUNT = 18,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct jsval_layout {
+ pub asBits: __BindgenUnionField<u64>,
+ pub debugView: __BindgenUnionField<jsval_layout__bindgen_ty_1>,
+ pub s: __BindgenUnionField<jsval_layout__bindgen_ty_2>,
+ pub asDouble: __BindgenUnionField<f64>,
+ pub asPtr: __BindgenUnionField<*mut ::std::os::raw::c_void>,
+ pub asWord: __BindgenUnionField<usize>,
+ pub asUIntPtr: __BindgenUnionField<usize>,
+ pub bindgen_union_field: u64,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct jsval_layout__bindgen_ty_1 {
+ pub _bitfield_1: u64,
+}
+#[test]
+fn bindgen_test_layout_jsval_layout__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_1>() , 8usize);
+ assert_eq!(::std::mem::align_of::<jsval_layout__bindgen_ty_1>() , 8usize);
+}
+impl Clone for jsval_layout__bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+}
+impl jsval_layout__bindgen_ty_1 {
+ #[inline]
+ pub fn payload47(&self) -> u64 {
+ unsafe {
+ ::std::mem::transmute(((self._bitfield_1 &
+ (140737488355327usize as u64)) >>
+ 0u32) as u64)
+ }
+ }
+ #[inline]
+ pub fn set_payload47(&mut self, val: u64) {
+ self._bitfield_1 &= !(140737488355327usize as u64);
+ self._bitfield_1 |=
+ ((val as u64 as u64) << 0u32) & (140737488355327usize as u64);
+ }
+ #[inline]
+ pub fn tag(&self) -> JSValueTag {
+ unsafe {
+ ::std::mem::transmute(((self._bitfield_1 &
+ (18446603336221196288usize as u64)) >>
+ 47u32) as u32)
+ }
+ }
+ #[inline]
+ pub fn set_tag(&mut self, val: JSValueTag) {
+ self._bitfield_1 &= !(18446603336221196288usize as u64);
+ self._bitfield_1 |=
+ ((val as u32 as u64) << 47u32) &
+ (18446603336221196288usize as u64);
+ }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct jsval_layout__bindgen_ty_2 {
+ pub payload: jsval_layout__bindgen_ty_2__bindgen_ty_1,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct jsval_layout__bindgen_ty_2__bindgen_ty_1 {
+ pub i32: __BindgenUnionField<i32>,
+ pub u32: __BindgenUnionField<u32>,
+ pub why: __BindgenUnionField<JSWhyMagic>,
+ pub bindgen_union_field: u32,
+}
+#[test]
+fn bindgen_test_layout_jsval_layout__bindgen_ty_2__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_2__bindgen_ty_1>()
+ , 4usize);
+ assert_eq!(::std::mem::align_of::<jsval_layout__bindgen_ty_2__bindgen_ty_1>()
+ , 4usize);
+}
+impl Clone for jsval_layout__bindgen_ty_2__bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn bindgen_test_layout_jsval_layout__bindgen_ty_2() {
+ assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_2>() , 4usize);
+ assert_eq!(::std::mem::align_of::<jsval_layout__bindgen_ty_2>() , 4usize);
+}
+impl Clone for jsval_layout__bindgen_ty_2 {
+ fn clone(&self) -> Self { *self }
+}
+impl Clone for jsval_layout {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Value {
+ pub data: jsval_layout,
+}
+#[test]
+fn bindgen_test_layout_Value() {
+ assert_eq!(::std::mem::size_of::<Value>() , 8usize);
+ assert_eq!(::std::mem::align_of::<Value>() , 8usize);
+}
+impl Clone for Value {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/keywords.rs b/tests/expectations/tests/keywords.rs
new file mode 100644
index 00000000..5b75389e
--- /dev/null
+++ b/tests/expectations/tests/keywords.rs
@@ -0,0 +1,202 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+extern "C" {
+ #[link_name = "u8"]
+ pub static mut u8: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "u16"]
+ pub static mut u16: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "u32"]
+ pub static mut u32: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "u64"]
+ pub static mut u64: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "i8"]
+ pub static mut i8: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "i16"]
+ pub static mut i16: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "i32"]
+ pub static mut i32: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "i64"]
+ pub static mut i64: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "f32"]
+ pub static mut f32: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "f64"]
+ pub static mut f64: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "usize"]
+ pub static mut usize: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "isize"]
+ pub static mut isize: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "as"]
+ pub static mut as_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "box"]
+ pub static mut box_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "crate"]
+ pub static mut crate_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "false"]
+ pub static mut false_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "fn"]
+ pub static mut fn_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "impl"]
+ pub static mut impl_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "in"]
+ pub static mut in_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "let"]
+ pub static mut let_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "loop"]
+ pub static mut loop_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "match"]
+ pub static mut match_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "mod"]
+ pub static mut mod_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "move"]
+ pub static mut move_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "mut"]
+ pub static mut mut_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "pub"]
+ pub static mut pub_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "ref"]
+ pub static mut ref_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "self"]
+ pub static mut self_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "Self"]
+ pub static mut Self_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "super"]
+ pub static mut super_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "trait"]
+ pub static mut trait_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "true"]
+ pub static mut true_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "type"]
+ pub static mut type_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "unsafe"]
+ pub static mut unsafe_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "use"]
+ pub static mut use_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "where"]
+ pub static mut where_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "abstract"]
+ pub static mut abstract_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "alignof"]
+ pub static mut alignof_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "become"]
+ pub static mut become_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "final"]
+ pub static mut final_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "macro"]
+ pub static mut macro_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "offsetof"]
+ pub static mut offsetof_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "override"]
+ pub static mut override_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "priv"]
+ pub static mut priv_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "proc"]
+ pub static mut proc_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "pure"]
+ pub static mut pure_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "unsized"]
+ pub static mut unsized_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "virtual"]
+ pub static mut virtual_: ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "yield"]
+ pub static mut yield_: ::std::os::raw::c_int;
+}
diff --git a/tests/expectations/tests/macro-expr-basic.rs b/tests/expectations/tests/macro-expr-basic.rs
new file mode 100644
index 00000000..355294e7
--- /dev/null
+++ b/tests/expectations/tests/macro-expr-basic.rs
@@ -0,0 +1,15 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub const FOO: ::std::os::raw::c_uint = 1;
+pub const BAR: ::std::os::raw::c_uint = 4;
+pub const BAZ: ::std::os::raw::c_uint = 5;
+pub const MIN: ::std::os::raw::c_longlong = -9223372036854775808;
+pub const BARR: ::std::os::raw::c_uint = 1;
+pub const BAZZ: ::std::os::raw::c_uint = 7;
+pub const I_RAN_OUT_OF_DUMB_NAMES: ::std::os::raw::c_uint = 7;
+pub const HAZ_A_COMMENT: ::std::os::raw::c_uint = 1;
+pub const HAZ_A_COMMENT_INSIDE: ::std::os::raw::c_uint = 2;
diff --git a/tests/expectations/tests/macro-redef.rs b/tests/expectations/tests/macro-redef.rs
new file mode 100644
index 00000000..881a44ae
--- /dev/null
+++ b/tests/expectations/tests/macro-redef.rs
@@ -0,0 +1,9 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub const FOO: ::std::os::raw::c_uint = 4;
+pub const BAR: ::std::os::raw::c_uint = 5;
+pub const BAZ: ::std::os::raw::c_uint = 6;
diff --git a/tests/expectations/tests/macro_const.rs b/tests/expectations/tests/macro_const.rs
new file mode 100644
index 00000000..9e7eb420
--- /dev/null
+++ b/tests/expectations/tests/macro_const.rs
@@ -0,0 +1,12 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub const foo: &'static [u8; 4usize] = b"bar\x00";
+pub const CHAR: u8 = b'b';
+pub const CHARR: u8 = b'\x00';
+pub const FLOAT: f32 = 5.09;
+pub const FLOAT_EXPR: f32 = 0.005;
+pub const INVALID_UTF8: [u8; 5usize] = [240, 40, 140, 40, 0];
diff --git a/tests/expectations/tests/maddness-is-avoidable.rs b/tests/expectations/tests/maddness-is-avoidable.rs
new file mode 100644
index 00000000..d31345ba
--- /dev/null
+++ b/tests/expectations/tests/maddness-is-avoidable.rs
@@ -0,0 +1,20 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct RefPtr<T> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct RefPtr_Proxy<T, R, Args> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+ pub _phantom_1: ::std::marker::PhantomData<R>,
+ pub _phantom_2: ::std::marker::PhantomData<Args>,
+}
diff --git a/tests/expectations/tests/method-mangling.rs b/tests/expectations/tests/method-mangling.rs
new file mode 100644
index 00000000..3b5107a8
--- /dev/null
+++ b/tests/expectations/tests/method-mangling.rs
@@ -0,0 +1,29 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Foo {
+ pub _address: u8,
+}
+#[test]
+fn bindgen_test_layout_Foo() {
+ assert_eq!(::std::mem::size_of::<Foo>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Foo>() , 1usize);
+}
+extern "C" {
+ #[link_name = "_ZN3Foo4typeEv"]
+ pub fn Foo_type(this: *mut Foo) -> ::std::os::raw::c_int;
+}
+impl Clone for Foo {
+ fn clone(&self) -> Self { *self }
+}
+impl Foo {
+ #[inline]
+ pub unsafe fn type_(&mut self) -> ::std::os::raw::c_int {
+ Foo_type(&mut *self)
+ }
+}
diff --git a/tests/expectations/tests/module-whitelisted.rs b/tests/expectations/tests/module-whitelisted.rs
new file mode 100644
index 00000000..6f88c54b
--- /dev/null
+++ b/tests/expectations/tests/module-whitelisted.rs
@@ -0,0 +1,23 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub mod root {
+ #[allow(unused_imports)]
+ use self::super::root;
+ #[repr(C)]
+ #[derive(Debug, Copy)]
+ pub struct Test {
+ pub _address: u8,
+ }
+ #[test]
+ fn bindgen_test_layout_Test() {
+ assert_eq!(::std::mem::size_of::<Test>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Test>() , 1usize);
+ }
+ impl Clone for Test {
+ fn clone(&self) -> Self { *self }
+ }
+}
diff --git a/tests/expectations/tests/msvc-no-usr.rs b/tests/expectations/tests/msvc-no-usr.rs
new file mode 100644
index 00000000..8cab8cdc
--- /dev/null
+++ b/tests/expectations/tests/msvc-no-usr.rs
@@ -0,0 +1,19 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct A {
+ pub foo: usize,
+}
+#[test]
+fn bindgen_test_layout_A() {
+ assert_eq!(::std::mem::size_of::<A>() , 8usize);
+ assert_eq!(::std::mem::align_of::<A>() , 8usize);
+}
+impl Clone for A {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/multiple-inherit-empty-correct-layout.rs b/tests/expectations/tests/multiple-inherit-empty-correct-layout.rs
new file mode 100644
index 00000000..5e9cf522
--- /dev/null
+++ b/tests/expectations/tests/multiple-inherit-empty-correct-layout.rs
@@ -0,0 +1,45 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Foo {
+ pub _address: u8,
+}
+#[test]
+fn bindgen_test_layout_Foo() {
+ assert_eq!(::std::mem::size_of::<Foo>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Foo>() , 1usize);
+}
+impl Clone for Foo {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Bar {
+ pub _address: u8,
+}
+#[test]
+fn bindgen_test_layout_Bar() {
+ assert_eq!(::std::mem::size_of::<Bar>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Bar>() , 1usize);
+}
+impl Clone for Bar {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Baz {
+ pub _address: u8,
+}
+#[test]
+fn bindgen_test_layout_Baz() {
+ assert_eq!(::std::mem::size_of::<Baz>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Baz>() , 1usize);
+}
+impl Clone for Baz {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/mutable.rs b/tests/expectations/tests/mutable.rs
new file mode 100644
index 00000000..0d0d6ea3
--- /dev/null
+++ b/tests/expectations/tests/mutable.rs
@@ -0,0 +1,42 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct C {
+ pub m_member: ::std::os::raw::c_int,
+ pub m_other: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_C() {
+ assert_eq!(::std::mem::size_of::<C>() , 8usize);
+ assert_eq!(::std::mem::align_of::<C>() , 4usize);
+}
+impl Clone for C {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug)]
+pub struct NonCopiable {
+ pub m_member: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_NonCopiable() {
+ assert_eq!(::std::mem::size_of::<NonCopiable>() , 4usize);
+ assert_eq!(::std::mem::align_of::<NonCopiable>() , 4usize);
+}
+#[repr(C)]
+#[derive(Debug)]
+pub struct NonCopiableWithNonCopiableMutableMember {
+ pub m_member: NonCopiable,
+}
+#[test]
+fn bindgen_test_layout_NonCopiableWithNonCopiableMutableMember() {
+ assert_eq!(::std::mem::size_of::<NonCopiableWithNonCopiableMutableMember>()
+ , 4usize);
+ assert_eq!(::std::mem::align_of::<NonCopiableWithNonCopiableMutableMember>()
+ , 4usize);
+}
diff --git a/tests/expectations/tests/namespace.rs b/tests/expectations/tests/namespace.rs
new file mode 100644
index 00000000..ece4e341
--- /dev/null
+++ b/tests/expectations/tests/namespace.rs
@@ -0,0 +1,87 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub mod root {
+ #[allow(unused_imports)]
+ use self::super::root;
+ extern "C" {
+ #[link_name = "_Z9top_levelv"]
+ pub fn top_level();
+ }
+ pub mod whatever {
+ #[allow(unused_imports)]
+ use self::super::super::root;
+ pub type whatever_int_t = ::std::os::raw::c_int;
+ extern "C" {
+ #[link_name = "_ZN8whatever11in_whateverEv"]
+ pub fn in_whatever();
+ }
+ }
+ pub mod _bindgen_mod_id_13 {
+ #[allow(unused_imports)]
+ use self::super::super::root;
+ extern "C" {
+ #[link_name = "_ZN12_GLOBAL__N_13fooEv"]
+ pub fn foo();
+ }
+ #[repr(C)]
+ #[derive(Debug, Copy)]
+ pub struct A {
+ pub b: root::whatever::whatever_int_t,
+ }
+ #[test]
+ fn bindgen_test_layout_A() {
+ assert_eq!(::std::mem::size_of::<A>() , 4usize);
+ assert_eq!(::std::mem::align_of::<A>() , 4usize);
+ }
+ extern "C" {
+ #[link_name = "_ZN12_GLOBAL__N_11A20lets_hope_this_worksEv"]
+ pub fn A_lets_hope_this_works(this:
+ *mut root::_bindgen_mod_id_13::A)
+ -> ::std::os::raw::c_int;
+ }
+ impl Clone for A {
+ fn clone(&self) -> Self { *self }
+ }
+ impl A {
+ #[inline]
+ pub unsafe fn lets_hope_this_works(&mut self)
+ -> ::std::os::raw::c_int {
+ A_lets_hope_this_works(&mut *self)
+ }
+ }
+ }
+ #[repr(C)]
+ #[derive(Debug)]
+ pub struct C<T> {
+ pub _base: root::_bindgen_mod_id_13::A,
+ pub m_c: T,
+ pub m_c_ptr: *mut T,
+ pub m_c_arr: [T; 10usize],
+ }
+ pub mod w {
+ #[allow(unused_imports)]
+ use self::super::super::root;
+ pub type whatever_int_t = ::std::os::raw::c_uint;
+ #[repr(C)]
+ #[derive(Debug)]
+ pub struct D<T> {
+ pub m_c: root::C<T>,
+ }
+ extern "C" {
+ #[link_name = "_ZN1w3hehEv"]
+ pub fn heh() -> root::w::whatever_int_t;
+ }
+ extern "C" {
+ #[link_name = "_ZN1w3fooEv"]
+ pub fn foo() -> root::C<::std::os::raw::c_int>;
+ }
+ extern "C" {
+ #[link_name = "_ZN1w4barrEv"]
+ pub fn barr() -> root::C<f32>;
+ }
+ }
+}
diff --git a/tests/expectations/tests/nested.rs b/tests/expectations/tests/nested.rs
new file mode 100644
index 00000000..fdd435aa
--- /dev/null
+++ b/tests/expectations/tests/nested.rs
@@ -0,0 +1,59 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Calc {
+ pub w: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_Calc() {
+ assert_eq!(::std::mem::size_of::<Calc>() , 4usize);
+ assert_eq!(::std::mem::align_of::<Calc>() , 4usize);
+}
+impl Clone for Calc {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Test {
+ pub _address: u8,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Test_Size {
+ pub mWidth: Test_Size_Dimension,
+ pub mHeight: Test_Size_Dimension,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Test_Size_Dimension {
+ pub _base: Calc,
+}
+#[test]
+fn bindgen_test_layout_Test_Size_Dimension() {
+ assert_eq!(::std::mem::size_of::<Test_Size_Dimension>() , 4usize);
+ assert_eq!(::std::mem::align_of::<Test_Size_Dimension>() , 4usize);
+}
+impl Clone for Test_Size_Dimension {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn bindgen_test_layout_Test_Size() {
+ assert_eq!(::std::mem::size_of::<Test_Size>() , 8usize);
+ assert_eq!(::std::mem::align_of::<Test_Size>() , 4usize);
+}
+impl Clone for Test_Size {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn bindgen_test_layout_Test() {
+ assert_eq!(::std::mem::size_of::<Test>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Test>() , 1usize);
+}
+impl Clone for Test {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/nested_vtable.rs b/tests/expectations/tests/nested_vtable.rs
new file mode 100644
index 00000000..d74ad55f
--- /dev/null
+++ b/tests/expectations/tests/nested_vtable.rs
@@ -0,0 +1,48 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+pub struct nsISupports__bindgen_vtable {
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct nsISupports {
+ pub vtable_: *const nsISupports__bindgen_vtable,
+}
+#[test]
+fn bindgen_test_layout_nsISupports() {
+ assert_eq!(::std::mem::size_of::<nsISupports>() , 8usize);
+ assert_eq!(::std::mem::align_of::<nsISupports>() , 8usize);
+}
+impl Clone for nsISupports {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct nsIRunnable {
+ pub _base: nsISupports,
+}
+#[test]
+fn bindgen_test_layout_nsIRunnable() {
+ assert_eq!(::std::mem::size_of::<nsIRunnable>() , 8usize);
+ assert_eq!(::std::mem::align_of::<nsIRunnable>() , 8usize);
+}
+impl Clone for nsIRunnable {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Runnable {
+ pub _base: nsIRunnable,
+}
+#[test]
+fn bindgen_test_layout_Runnable() {
+ assert_eq!(::std::mem::size_of::<Runnable>() , 8usize);
+ assert_eq!(::std::mem::align_of::<Runnable>() , 8usize);
+}
+impl Clone for Runnable {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/nested_within_namespace.rs b/tests/expectations/tests/nested_within_namespace.rs
new file mode 100644
index 00000000..0c9c31ef
--- /dev/null
+++ b/tests/expectations/tests/nested_within_namespace.rs
@@ -0,0 +1,53 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub mod root {
+ #[allow(unused_imports)]
+ use self::super::root;
+ pub mod foo {
+ #[allow(unused_imports)]
+ use self::super::super::root;
+ #[repr(C)]
+ #[derive(Debug, Copy)]
+ pub struct Bar {
+ pub foo: ::std::os::raw::c_int,
+ }
+ #[repr(C)]
+ #[derive(Debug, Copy)]
+ pub struct Bar_Baz {
+ pub foo: ::std::os::raw::c_int,
+ }
+ #[test]
+ fn bindgen_test_layout_Bar_Baz() {
+ assert_eq!(::std::mem::size_of::<Bar_Baz>() , 4usize);
+ assert_eq!(::std::mem::align_of::<Bar_Baz>() , 4usize);
+ }
+ impl Clone for Bar_Baz {
+ fn clone(&self) -> Self { *self }
+ }
+ #[test]
+ fn bindgen_test_layout_Bar() {
+ assert_eq!(::std::mem::size_of::<Bar>() , 4usize);
+ assert_eq!(::std::mem::align_of::<Bar>() , 4usize);
+ }
+ impl Clone for Bar {
+ fn clone(&self) -> Self { *self }
+ }
+ #[repr(C)]
+ #[derive(Debug, Copy)]
+ pub struct Baz {
+ pub baz: ::std::os::raw::c_int,
+ }
+ #[test]
+ fn bindgen_test_layout_Baz() {
+ assert_eq!(::std::mem::size_of::<Baz>() , 4usize);
+ assert_eq!(::std::mem::align_of::<Baz>() , 4usize);
+ }
+ impl Clone for Baz {
+ fn clone(&self) -> Self { *self }
+ }
+ }
+}
diff --git a/tests/expectations/tests/no-std.rs b/tests/expectations/tests/no-std.rs
new file mode 100644
index 00000000..f50a889d
--- /dev/null
+++ b/tests/expectations/tests/no-std.rs
@@ -0,0 +1,23 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+#![no_std]
+mod libc { pub type c_int = i32; pub enum c_void {} }
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo {
+ pub a: libc::c_int,
+ pub b: libc::c_int,
+ pub bar: *mut libc::c_void,
+}
+#[test]
+fn bindgen_test_layout_foo() {
+ assert_eq!(::core::mem::size_of::<foo>() , 16usize);
+ assert_eq!(::core::mem::align_of::<foo>() , 8usize);
+}
+impl Clone for foo {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/no_copy.rs b/tests/expectations/tests/no_copy.rs
new file mode 100644
index 00000000..53ab9677
--- /dev/null
+++ b/tests/expectations/tests/no_copy.rs
@@ -0,0 +1,13 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+/** <div rustbindgen nocopy></div> */
+#[repr(C)]
+#[derive(Debug)]
+pub struct CopiableButWait<T> {
+ pub whatever: ::std::os::raw::c_int,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
diff --git a/tests/expectations/tests/nsStyleAutoArray.rs b/tests/expectations/tests/nsStyleAutoArray.rs
new file mode 100644
index 00000000..c150ec46
--- /dev/null
+++ b/tests/expectations/tests/nsStyleAutoArray.rs
@@ -0,0 +1,22 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct nsTArray<T> {
+ pub mBuff: *mut T,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct nsStyleAutoArray<T> {
+ pub mFirstElement: T,
+ pub mOtherElements: nsTArray<T>,
+}
+#[repr(i32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum nsStyleAutoArray_WithSingleInitialElement {
+ WITH_SINGLE_INITIAL_ELEMENT = 0,
+}
diff --git a/tests/expectations/tests/only_bitfields.rs b/tests/expectations/tests/only_bitfields.rs
new file mode 100644
index 00000000..68968826
--- /dev/null
+++ b/tests/expectations/tests/only_bitfields.rs
@@ -0,0 +1,45 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct C {
+ pub _bitfield_1: u8,
+}
+#[test]
+fn bindgen_test_layout_C() {
+ assert_eq!(::std::mem::size_of::<C>() , 1usize);
+ assert_eq!(::std::mem::align_of::<C>() , 1usize);
+}
+impl Clone for C {
+ fn clone(&self) -> Self { *self }
+}
+impl C {
+ #[inline]
+ pub fn a(&self) -> bool {
+ unsafe {
+ ::std::mem::transmute(((self._bitfield_1 & (1usize as u8)) >>
+ 0u32) as u8)
+ }
+ }
+ #[inline]
+ pub fn set_a(&mut self, val: bool) {
+ self._bitfield_1 &= !(1usize as u8);
+ self._bitfield_1 |= ((val as u8 as u8) << 0u32) & (1usize as u8);
+ }
+ #[inline]
+ pub fn b(&self) -> bool {
+ unsafe {
+ ::std::mem::transmute(((self._bitfield_1 & (254usize as u8)) >>
+ 1u32) as u8)
+ }
+ }
+ #[inline]
+ pub fn set_b(&mut self, val: bool) {
+ self._bitfield_1 &= !(254usize as u8);
+ self._bitfield_1 |= ((val as u8 as u8) << 1u32) & (254usize as u8);
+ }
+}
diff --git a/tests/expectations/tests/opaque-tracing.rs b/tests/expectations/tests/opaque-tracing.rs
new file mode 100644
index 00000000..7dcc4eef
--- /dev/null
+++ b/tests/expectations/tests/opaque-tracing.rs
@@ -0,0 +1,23 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Container {
+ pub _bindgen_opaque_blob: [u32; 2usize],
+}
+#[test]
+fn bindgen_test_layout_Container() {
+ assert_eq!(::std::mem::size_of::<Container>() , 8usize);
+ assert_eq!(::std::mem::align_of::<Container>() , 4usize);
+}
+impl Clone for Container {
+ fn clone(&self) -> Self { *self }
+}
+extern "C" {
+ #[link_name = "_Z3fooP9Container"]
+ pub fn foo(c: *mut Container);
+}
diff --git a/tests/expectations/tests/opaque_in_struct.rs b/tests/expectations/tests/opaque_in_struct.rs
new file mode 100644
index 00000000..c94caa1f
--- /dev/null
+++ b/tests/expectations/tests/opaque_in_struct.rs
@@ -0,0 +1,33 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+/** <div rustbindgen opaque> */
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct opaque {
+ pub _bindgen_opaque_blob: u32,
+}
+#[test]
+fn bindgen_test_layout_opaque() {
+ assert_eq!(::std::mem::size_of::<opaque>() , 4usize);
+ assert_eq!(::std::mem::align_of::<opaque>() , 4usize);
+}
+impl Clone for opaque {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct container {
+ pub contained: opaque,
+}
+#[test]
+fn bindgen_test_layout_container() {
+ assert_eq!(::std::mem::size_of::<container>() , 4usize);
+ assert_eq!(::std::mem::align_of::<container>() , 4usize);
+}
+impl Clone for container {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/opaque_pointer.rs b/tests/expectations/tests/opaque_pointer.rs
new file mode 100644
index 00000000..118a1782
--- /dev/null
+++ b/tests/expectations/tests/opaque_pointer.rs
@@ -0,0 +1,45 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+/**
+ * <div rustbindgen opaque></div>
+ */
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct OtherOpaque {
+ pub _bindgen_opaque_blob: u32,
+}
+#[test]
+fn bindgen_test_layout_OtherOpaque() {
+ assert_eq!(::std::mem::size_of::<OtherOpaque>() , 4usize);
+ assert_eq!(::std::mem::align_of::<OtherOpaque>() , 4usize);
+}
+impl Clone for OtherOpaque {
+ fn clone(&self) -> Self { *self }
+}
+/**
+ * <div rustbindgen opaque></div>
+ */
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Opaque<T> {
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct WithOpaquePtr {
+ pub whatever: *mut Opaque<::std::os::raw::c_int>,
+ pub other: u32,
+ pub t: OtherOpaque,
+}
+#[test]
+fn bindgen_test_layout_WithOpaquePtr() {
+ assert_eq!(::std::mem::size_of::<WithOpaquePtr>() , 16usize);
+ assert_eq!(::std::mem::align_of::<WithOpaquePtr>() , 8usize);
+}
+impl Clone for WithOpaquePtr {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/opaque_typedef.rs b/tests/expectations/tests/opaque_typedef.rs
new file mode 100644
index 00000000..c45cbc6f
--- /dev/null
+++ b/tests/expectations/tests/opaque_typedef.rs
@@ -0,0 +1,15 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct RandomTemplate<T> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+/** <div rustbindgen opaque></div> */
+pub type ShouldBeOpaque = [u8; 0usize];
+pub type ShouldNotBeOpaque = RandomTemplate<f32>;
diff --git a/tests/expectations/tests/overflowed_enum.rs b/tests/expectations/tests/overflowed_enum.rs
new file mode 100644
index 00000000..9e1f8a7f
--- /dev/null
+++ b/tests/expectations/tests/overflowed_enum.rs
@@ -0,0 +1,16 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(u32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum Foo {
+ BAP_ARM = 9698489,
+ BAP_X86 = 11960045,
+ BAP_X86_64 = 3128633167,
+}
+#[repr(u16)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum Bar { One = 1, Big = 2, }
diff --git a/tests/expectations/tests/overloading.rs b/tests/expectations/tests/overloading.rs
new file mode 100644
index 00000000..71002e23
--- /dev/null
+++ b/tests/expectations/tests/overloading.rs
@@ -0,0 +1,23 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+extern "C" {
+ #[link_name = "_Z8Evaluatec"]
+ pub fn Evaluate(r: ::std::os::raw::c_char) -> bool;
+}
+extern "C" {
+ #[link_name = "_Z8Evaluateii"]
+ pub fn Evaluate1(x: ::std::os::raw::c_int, y: ::std::os::raw::c_int)
+ -> bool;
+}
+extern "C" {
+ #[link_name = "_ZN3foo10MyFunctionEv"]
+ pub fn foo_MyFunction();
+}
+extern "C" {
+ #[link_name = "_ZN3bar10MyFunctionEv"]
+ pub fn bar_MyFunction();
+}
diff --git a/tests/expectations/tests/private.rs b/tests/expectations/tests/private.rs
new file mode 100644
index 00000000..c4ac37d1
--- /dev/null
+++ b/tests/expectations/tests/private.rs
@@ -0,0 +1,52 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct HasPrivate {
+ pub mNotPrivate: ::std::os::raw::c_int,
+ /** <div rustbindgen private></div> */
+ mIsPrivate: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_HasPrivate() {
+ assert_eq!(::std::mem::size_of::<HasPrivate>() , 8usize);
+ assert_eq!(::std::mem::align_of::<HasPrivate>() , 4usize);
+}
+impl Clone for HasPrivate {
+ fn clone(&self) -> Self { *self }
+}
+/** <div rustbindgen private></div> */
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct VeryPrivate {
+ mIsPrivate: ::std::os::raw::c_int,
+ mIsAlsoPrivate: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_VeryPrivate() {
+ assert_eq!(::std::mem::size_of::<VeryPrivate>() , 8usize);
+ assert_eq!(::std::mem::align_of::<VeryPrivate>() , 4usize);
+}
+impl Clone for VeryPrivate {
+ fn clone(&self) -> Self { *self }
+}
+/** <div rustbindgen private></div> */
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct ContradictPrivate {
+ /** <div rustbindgen private="false"></div> */
+ pub mNotPrivate: ::std::os::raw::c_int,
+ mIsPrivate: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_ContradictPrivate() {
+ assert_eq!(::std::mem::size_of::<ContradictPrivate>() , 8usize);
+ assert_eq!(::std::mem::align_of::<ContradictPrivate>() , 4usize);
+}
+impl Clone for ContradictPrivate {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/public-dtor.rs b/tests/expectations/tests/public-dtor.rs
new file mode 100644
index 00000000..851857ee
--- /dev/null
+++ b/tests/expectations/tests/public-dtor.rs
@@ -0,0 +1,16 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug)]
+pub struct cv_String {
+ pub _address: u8,
+}
+#[test]
+fn bindgen_test_layout_cv_String() {
+ assert_eq!(::std::mem::size_of::<cv_String>() , 1usize);
+ assert_eq!(::std::mem::align_of::<cv_String>() , 1usize);
+}
diff --git a/tests/expectations/tests/redeclaration.rs b/tests/expectations/tests/redeclaration.rs
new file mode 100644
index 00000000..0d7e585c
--- /dev/null
+++ b/tests/expectations/tests/redeclaration.rs
@@ -0,0 +1,9 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+extern "C" {
+ pub fn foo();
+}
diff --git a/tests/expectations/tests/ref_argument_array.rs b/tests/expectations/tests/ref_argument_array.rs
new file mode 100644
index 00000000..c88492d7
--- /dev/null
+++ b/tests/expectations/tests/ref_argument_array.rs
@@ -0,0 +1,23 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub const NSID_LENGTH: ::std::os::raw::c_uint = 10;
+#[repr(C)]
+pub struct nsID__bindgen_vtable {
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct nsID {
+ pub vtable_: *const nsID__bindgen_vtable,
+}
+#[test]
+fn bindgen_test_layout_nsID() {
+ assert_eq!(::std::mem::size_of::<nsID>() , 8usize);
+ assert_eq!(::std::mem::align_of::<nsID>() , 8usize);
+}
+impl Clone for nsID {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/reparented_replacement.rs b/tests/expectations/tests/reparented_replacement.rs
new file mode 100644
index 00000000..e8ccc931
--- /dev/null
+++ b/tests/expectations/tests/reparented_replacement.rs
@@ -0,0 +1,29 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub mod root {
+ #[allow(unused_imports)]
+ use self::super::root;
+ pub mod foo {
+ #[allow(unused_imports)]
+ use self::super::super::root;
+ /// <div rustbindgen replaces="foo::Bar"></div>
+ #[repr(C)]
+ #[derive(Debug, Copy)]
+ pub struct Bar {
+ pub bazz: ::std::os::raw::c_int,
+ }
+ #[test]
+ fn bindgen_test_layout_Bar() {
+ assert_eq!(::std::mem::size_of::<Bar>() , 4usize);
+ assert_eq!(::std::mem::align_of::<Bar>() , 4usize);
+ }
+ impl Clone for Bar {
+ fn clone(&self) -> Self { *self }
+ }
+ }
+ pub use root::foo::Bar as ReferencesBar;
+}
diff --git a/tests/expectations/tests/replace_template_alias.rs b/tests/expectations/tests/replace_template_alias.rs
new file mode 100644
index 00000000..f922ac77
--- /dev/null
+++ b/tests/expectations/tests/replace_template_alias.rs
@@ -0,0 +1,15 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+/// But the replacement type does use T!
+///
+/// <div rustbindgen replaces="JS::detail::MaybeWrapped" />
+pub type JS_detail_MaybeWrapped<T> = T;
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct JS_Rooted<T> {
+ pub ptr: JS_detail_MaybeWrapped<T>,
+}
diff --git a/tests/expectations/tests/replace_use.rs b/tests/expectations/tests/replace_use.rs
new file mode 100644
index 00000000..f4fee442
--- /dev/null
+++ b/tests/expectations/tests/replace_use.rs
@@ -0,0 +1,28 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+/**
+ * <div rustbindgen replaces="nsTArray"></div>
+ */
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct nsTArray<T> {
+ pub y: ::std::os::raw::c_uint,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Test {
+ pub a: nsTArray<::std::os::raw::c_long>,
+}
+#[test]
+fn bindgen_test_layout_Test() {
+ assert_eq!(::std::mem::size_of::<Test>() , 4usize);
+ assert_eq!(::std::mem::align_of::<Test>() , 4usize);
+}
+impl Clone for Test {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/replaces_double.rs b/tests/expectations/tests/replaces_double.rs
new file mode 100644
index 00000000..50dafd42
--- /dev/null
+++ b/tests/expectations/tests/replaces_double.rs
@@ -0,0 +1,15 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Rooted<T> {
+ pub ptr: Rooted_MaybeWrapped<T>,
+}
+/**
+ * <div rustbindgen replaces="Rooted_MaybeWrapped"></div>
+ */
+pub type Rooted_MaybeWrapped<T> = T;
diff --git a/tests/expectations/tests/resolved_type_def_function.rs b/tests/expectations/tests/resolved_type_def_function.rs
new file mode 100644
index 00000000..83f07dd0
--- /dev/null
+++ b/tests/expectations/tests/resolved_type_def_function.rs
@@ -0,0 +1,10 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub type FuncType = ::std::option::Option<unsafe extern "C" fn()>;
+extern "C" {
+ pub fn Func();
+}
diff --git a/tests/expectations/tests/same_struct_name_in_different_namespaces.rs b/tests/expectations/tests/same_struct_name_in_different_namespaces.rs
new file mode 100644
index 00000000..8e7c177b
--- /dev/null
+++ b/tests/expectations/tests/same_struct_name_in_different_namespaces.rs
@@ -0,0 +1,28 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct JS_Zone {
+ pub _address: u8,
+}
+impl Clone for JS_Zone {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct JS_shadow_Zone {
+ pub x: ::std::os::raw::c_int,
+ pub y: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_JS_shadow_Zone() {
+ assert_eq!(::std::mem::size_of::<JS_shadow_Zone>() , 8usize);
+ assert_eq!(::std::mem::align_of::<JS_shadow_Zone>() , 4usize);
+}
+impl Clone for JS_shadow_Zone {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/size_t_template.rs b/tests/expectations/tests/size_t_template.rs
new file mode 100644
index 00000000..78351ecc
--- /dev/null
+++ b/tests/expectations/tests/size_t_template.rs
@@ -0,0 +1,19 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct C {
+ pub arr: [u32; 3usize],
+}
+#[test]
+fn bindgen_test_layout_C() {
+ assert_eq!(::std::mem::size_of::<C>() , 12usize);
+ assert_eq!(::std::mem::align_of::<C>() , 4usize);
+}
+impl Clone for C {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/struct_containing_forward_declared_struct.rs b/tests/expectations/tests/struct_containing_forward_declared_struct.rs
new file mode 100644
index 00000000..388cc595
--- /dev/null
+++ b/tests/expectations/tests/struct_containing_forward_declared_struct.rs
@@ -0,0 +1,32 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct a {
+ pub val_a: *mut a_b,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct a_b {
+ pub val_b: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_a_b() {
+ assert_eq!(::std::mem::size_of::<a_b>() , 4usize);
+ assert_eq!(::std::mem::align_of::<a_b>() , 4usize);
+}
+impl Clone for a_b {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn bindgen_test_layout_a() {
+ assert_eq!(::std::mem::size_of::<a>() , 8usize);
+ assert_eq!(::std::mem::align_of::<a>() , 8usize);
+}
+impl Clone for a {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/struct_with_anon_struct.rs b/tests/expectations/tests/struct_with_anon_struct.rs
new file mode 100644
index 00000000..1c49675d
--- /dev/null
+++ b/tests/expectations/tests/struct_with_anon_struct.rs
@@ -0,0 +1,33 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo {
+ pub bar: foo__bindgen_ty_1,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo__bindgen_ty_1 {
+ pub a: ::std::os::raw::c_int,
+ pub b: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_foo__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 8usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize);
+}
+impl Clone for foo__bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn bindgen_test_layout_foo() {
+ assert_eq!(::std::mem::size_of::<foo>() , 8usize);
+ assert_eq!(::std::mem::align_of::<foo>() , 4usize);
+}
+impl Clone for foo {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/struct_with_anon_struct_array.rs b/tests/expectations/tests/struct_with_anon_struct_array.rs
new file mode 100644
index 00000000..6e1c0315
--- /dev/null
+++ b/tests/expectations/tests/struct_with_anon_struct_array.rs
@@ -0,0 +1,48 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo {
+ pub bar: [foo__bindgen_ty_1; 2usize],
+ pub baz: [[[foo__bindgen_ty_2; 4usize]; 3usize]; 2usize],
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo__bindgen_ty_1 {
+ pub a: ::std::os::raw::c_int,
+ pub b: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_foo__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 8usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize);
+}
+impl Clone for foo__bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo__bindgen_ty_2 {
+ pub a: ::std::os::raw::c_int,
+ pub b: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_foo__bindgen_ty_2() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_2>() , 8usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_2>() , 4usize);
+}
+impl Clone for foo__bindgen_ty_2 {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn bindgen_test_layout_foo() {
+ assert_eq!(::std::mem::size_of::<foo>() , 208usize);
+ assert_eq!(::std::mem::align_of::<foo>() , 4usize);
+}
+impl Clone for foo {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/struct_with_anon_struct_pointer.rs b/tests/expectations/tests/struct_with_anon_struct_pointer.rs
new file mode 100644
index 00000000..aa77d4b6
--- /dev/null
+++ b/tests/expectations/tests/struct_with_anon_struct_pointer.rs
@@ -0,0 +1,33 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo {
+ pub bar: *mut foo__bindgen_ty_1,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo__bindgen_ty_1 {
+ pub a: ::std::os::raw::c_int,
+ pub b: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_foo__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 8usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize);
+}
+impl Clone for foo__bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn bindgen_test_layout_foo() {
+ assert_eq!(::std::mem::size_of::<foo>() , 8usize);
+ assert_eq!(::std::mem::align_of::<foo>() , 8usize);
+}
+impl Clone for foo {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/struct_with_anon_union.rs b/tests/expectations/tests/struct_with_anon_union.rs
new file mode 100644
index 00000000..0d2e937a
--- /dev/null
+++ b/tests/expectations/tests/struct_with_anon_union.rs
@@ -0,0 +1,58 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[inline]
+ pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
+ #[inline]
+ pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
+ #[inline]
+ pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
+}
+impl <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo {
+ pub bar: foo__bindgen_ty_1,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo__bindgen_ty_1 {
+ pub a: __BindgenUnionField<::std::os::raw::c_uint>,
+ pub b: __BindgenUnionField<::std::os::raw::c_ushort>,
+ pub bindgen_union_field: u32,
+}
+#[test]
+fn bindgen_test_layout_foo__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 4usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize);
+}
+impl Clone for foo__bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn bindgen_test_layout_foo() {
+ assert_eq!(::std::mem::size_of::<foo>() , 4usize);
+ assert_eq!(::std::mem::align_of::<foo>() , 4usize);
+}
+impl Clone for foo {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/struct_with_anon_unnamed_struct.rs b/tests/expectations/tests/struct_with_anon_unnamed_struct.rs
new file mode 100644
index 00000000..1b77fccc
--- /dev/null
+++ b/tests/expectations/tests/struct_with_anon_unnamed_struct.rs
@@ -0,0 +1,33 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo {
+ pub __bindgen_anon_1: foo__bindgen_ty_1,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo__bindgen_ty_1 {
+ pub a: ::std::os::raw::c_uint,
+ pub b: ::std::os::raw::c_uint,
+}
+#[test]
+fn bindgen_test_layout_foo__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 8usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize);
+}
+impl Clone for foo__bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn bindgen_test_layout_foo() {
+ assert_eq!(::std::mem::size_of::<foo>() , 8usize);
+ assert_eq!(::std::mem::align_of::<foo>() , 4usize);
+}
+impl Clone for foo {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/struct_with_anon_unnamed_union.rs b/tests/expectations/tests/struct_with_anon_unnamed_union.rs
new file mode 100644
index 00000000..2914eb41
--- /dev/null
+++ b/tests/expectations/tests/struct_with_anon_unnamed_union.rs
@@ -0,0 +1,58 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[inline]
+ pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
+ #[inline]
+ pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
+ #[inline]
+ pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
+}
+impl <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo {
+ pub __bindgen_anon_1: foo__bindgen_ty_1,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo__bindgen_ty_1 {
+ pub a: __BindgenUnionField<::std::os::raw::c_uint>,
+ pub b: __BindgenUnionField<::std::os::raw::c_ushort>,
+ pub bindgen_union_field: u32,
+}
+#[test]
+fn bindgen_test_layout_foo__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 4usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize);
+}
+impl Clone for foo__bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn bindgen_test_layout_foo() {
+ assert_eq!(::std::mem::size_of::<foo>() , 4usize);
+ assert_eq!(::std::mem::align_of::<foo>() , 4usize);
+}
+impl Clone for foo {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/struct_with_bitfields.rs b/tests/expectations/tests/struct_with_bitfields.rs
new file mode 100644
index 00000000..3fb83a47
--- /dev/null
+++ b/tests/expectations/tests/struct_with_bitfields.rs
@@ -0,0 +1,122 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct bitfield {
+ pub _bitfield_1: u8,
+ pub e: ::std::os::raw::c_int,
+ pub _bitfield_2: u8,
+ pub _bitfield_3: u32,
+}
+#[test]
+fn bindgen_test_layout_bitfield() {
+ assert_eq!(::std::mem::size_of::<bitfield>() , 16usize);
+ assert_eq!(::std::mem::align_of::<bitfield>() , 4usize);
+}
+impl Clone for bitfield {
+ fn clone(&self) -> Self { *self }
+}
+impl bitfield {
+ #[inline]
+ pub fn a(&self) -> ::std::os::raw::c_ushort {
+ unsafe {
+ ::std::mem::transmute(((self._bitfield_1 & (1usize as u8)) >>
+ 0u32) as u16)
+ }
+ }
+ #[inline]
+ pub fn set_a(&mut self, val: ::std::os::raw::c_ushort) {
+ self._bitfield_1 &= !(1usize as u8);
+ self._bitfield_1 |= ((val as u16 as u8) << 0u32) & (1usize as u8);
+ }
+ #[inline]
+ pub fn b(&self) -> ::std::os::raw::c_ushort {
+ unsafe {
+ ::std::mem::transmute(((self._bitfield_1 & (2usize as u8)) >>
+ 1u32) as u16)
+ }
+ }
+ #[inline]
+ pub fn set_b(&mut self, val: ::std::os::raw::c_ushort) {
+ self._bitfield_1 &= !(2usize as u8);
+ self._bitfield_1 |= ((val as u16 as u8) << 1u32) & (2usize as u8);
+ }
+ #[inline]
+ pub fn c(&self) -> ::std::os::raw::c_ushort {
+ unsafe {
+ ::std::mem::transmute(((self._bitfield_1 & (4usize as u8)) >>
+ 2u32) as u16)
+ }
+ }
+ #[inline]
+ pub fn set_c(&mut self, val: ::std::os::raw::c_ushort) {
+ self._bitfield_1 &= !(4usize as u8);
+ self._bitfield_1 |= ((val as u16 as u8) << 2u32) & (4usize as u8);
+ }
+ #[inline]
+ pub fn at_offset_3(&self) -> ::std::os::raw::c_ushort {
+ unsafe {
+ ::std::mem::transmute(((self._bitfield_1 & (8usize as u8)) >>
+ 3u32) as u16)
+ }
+ }
+ #[inline]
+ pub fn set_at_offset_3(&mut self, val: ::std::os::raw::c_ushort) {
+ self._bitfield_1 &= !(8usize as u8);
+ self._bitfield_1 |= ((val as u16 as u8) << 3u32) & (8usize as u8);
+ }
+ #[inline]
+ pub fn at_offset_4(&self) -> ::std::os::raw::c_ushort {
+ unsafe {
+ ::std::mem::transmute(((self._bitfield_1 & (48usize as u8)) >>
+ 4u32) as u16)
+ }
+ }
+ #[inline]
+ pub fn set_at_offset_4(&mut self, val: ::std::os::raw::c_ushort) {
+ self._bitfield_1 &= !(48usize as u8);
+ self._bitfield_1 |= ((val as u16 as u8) << 4u32) & (48usize as u8);
+ }
+ #[inline]
+ pub fn d(&self) -> ::std::os::raw::c_ushort {
+ unsafe {
+ ::std::mem::transmute(((self._bitfield_1 & (192usize as u8)) >>
+ 6u32) as u16)
+ }
+ }
+ #[inline]
+ pub fn set_d(&mut self, val: ::std::os::raw::c_ushort) {
+ self._bitfield_1 &= !(192usize as u8);
+ self._bitfield_1 |= ((val as u16 as u8) << 6u32) & (192usize as u8);
+ }
+ #[inline]
+ pub fn f(&self) -> ::std::os::raw::c_uint {
+ unsafe {
+ ::std::mem::transmute(((self._bitfield_2 & (3usize as u8)) >>
+ 0u32) as u32)
+ }
+ }
+ #[inline]
+ pub fn set_f(&mut self, val: ::std::os::raw::c_uint) {
+ self._bitfield_2 &= !(3usize as u8);
+ self._bitfield_2 |= ((val as u32 as u8) << 0u32) & (3usize as u8);
+ }
+ #[inline]
+ pub fn g(&self) -> ::std::os::raw::c_uint {
+ unsafe {
+ ::std::mem::transmute(((self._bitfield_3 &
+ (4294967295usize as u32)) >> 0u32) as
+ u32)
+ }
+ }
+ #[inline]
+ pub fn set_g(&mut self, val: ::std::os::raw::c_uint) {
+ self._bitfield_3 &= !(4294967295usize as u32);
+ self._bitfield_3 |=
+ ((val as u32 as u32) << 0u32) & (4294967295usize as u32);
+ }
+}
diff --git a/tests/expectations/tests/struct_with_derive_debug.rs b/tests/expectations/tests/struct_with_derive_debug.rs
new file mode 100644
index 00000000..52906a81
--- /dev/null
+++ b/tests/expectations/tests/struct_with_derive_debug.rs
@@ -0,0 +1,50 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct LittleArray {
+ pub a: [::std::os::raw::c_int; 32usize],
+}
+#[test]
+fn bindgen_test_layout_LittleArray() {
+ assert_eq!(::std::mem::size_of::<LittleArray>() , 128usize);
+ assert_eq!(::std::mem::align_of::<LittleArray>() , 4usize);
+}
+impl Clone for LittleArray {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+pub struct BigArray {
+ pub a: [::std::os::raw::c_int; 33usize],
+}
+#[test]
+fn bindgen_test_layout_BigArray() {
+ assert_eq!(::std::mem::size_of::<BigArray>() , 132usize);
+ assert_eq!(::std::mem::align_of::<BigArray>() , 4usize);
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct WithLittleArray {
+ pub a: LittleArray,
+}
+#[test]
+fn bindgen_test_layout_WithLittleArray() {
+ assert_eq!(::std::mem::size_of::<WithLittleArray>() , 128usize);
+ assert_eq!(::std::mem::align_of::<WithLittleArray>() , 4usize);
+}
+impl Clone for WithLittleArray {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+pub struct WithBigArray {
+ pub a: BigArray,
+}
+#[test]
+fn bindgen_test_layout_WithBigArray() {
+ assert_eq!(::std::mem::size_of::<WithBigArray>() , 132usize);
+ assert_eq!(::std::mem::align_of::<WithBigArray>() , 4usize);
+}
diff --git a/tests/expectations/tests/struct_with_nesting.rs b/tests/expectations/tests/struct_with_nesting.rs
new file mode 100644
index 00000000..b3e0a5ca
--- /dev/null
+++ b/tests/expectations/tests/struct_with_nesting.rs
@@ -0,0 +1,94 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[inline]
+ pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
+ #[inline]
+ pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
+ #[inline]
+ pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
+}
+impl <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo {
+ pub a: ::std::os::raw::c_uint,
+ pub __bindgen_anon_1: foo__bindgen_ty_1,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo__bindgen_ty_1 {
+ pub b: __BindgenUnionField<::std::os::raw::c_uint>,
+ pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1__bindgen_ty_1>,
+ pub __bindgen_anon_2: __BindgenUnionField<foo__bindgen_ty_1__bindgen_ty_2>,
+ pub bindgen_union_field: u32,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo__bindgen_ty_1__bindgen_ty_1 {
+ pub c1: ::std::os::raw::c_ushort,
+ pub c2: ::std::os::raw::c_ushort,
+}
+#[test]
+fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1__bindgen_ty_1>() ,
+ 4usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1__bindgen_ty_1>() ,
+ 2usize);
+}
+impl Clone for foo__bindgen_ty_1__bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo__bindgen_ty_1__bindgen_ty_2 {
+ pub d1: ::std::os::raw::c_uchar,
+ pub d2: ::std::os::raw::c_uchar,
+ pub d3: ::std::os::raw::c_uchar,
+ pub d4: ::std::os::raw::c_uchar,
+}
+#[test]
+fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1__bindgen_ty_2>() ,
+ 4usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1__bindgen_ty_2>() ,
+ 1usize);
+}
+impl Clone for foo__bindgen_ty_1__bindgen_ty_2 {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn bindgen_test_layout_foo__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 4usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize);
+}
+impl Clone for foo__bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn bindgen_test_layout_foo() {
+ assert_eq!(::std::mem::size_of::<foo>() , 8usize);
+ assert_eq!(::std::mem::align_of::<foo>() , 4usize);
+}
+impl Clone for foo {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/struct_with_packing.rs b/tests/expectations/tests/struct_with_packing.rs
new file mode 100644
index 00000000..93fc3f11
--- /dev/null
+++ b/tests/expectations/tests/struct_with_packing.rs
@@ -0,0 +1,20 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C, packed)]
+#[derive(Debug, Copy)]
+pub struct a {
+ pub b: ::std::os::raw::c_char,
+ pub c: ::std::os::raw::c_short,
+}
+#[test]
+fn bindgen_test_layout_a() {
+ assert_eq!(::std::mem::size_of::<a>() , 3usize);
+ assert_eq!(::std::mem::align_of::<a>() , 1usize);
+}
+impl Clone for a {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/struct_with_struct.rs b/tests/expectations/tests/struct_with_struct.rs
new file mode 100644
index 00000000..c8cdc927
--- /dev/null
+++ b/tests/expectations/tests/struct_with_struct.rs
@@ -0,0 +1,33 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo {
+ pub bar: foo__bindgen_ty_1,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo__bindgen_ty_1 {
+ pub x: ::std::os::raw::c_uint,
+ pub y: ::std::os::raw::c_uint,
+}
+#[test]
+fn bindgen_test_layout_foo__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 8usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize);
+}
+impl Clone for foo__bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn bindgen_test_layout_foo() {
+ assert_eq!(::std::mem::size_of::<foo>() , 8usize);
+ assert_eq!(::std::mem::align_of::<foo>() , 4usize);
+}
+impl Clone for foo {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/struct_with_typedef_template_arg.rs b/tests/expectations/tests/struct_with_typedef_template_arg.rs
new file mode 100644
index 00000000..6f8d71f1
--- /dev/null
+++ b/tests/expectations/tests/struct_with_typedef_template_arg.rs
@@ -0,0 +1,15 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Proxy<T, Args> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+ pub _phantom_1: ::std::marker::PhantomData<Args>,
+}
+pub type Proxy_foo<T> =
+ ::std::option::Option<unsafe extern "C" fn(bar: *mut T)>;
diff --git a/tests/expectations/tests/template.rs b/tests/expectations/tests/template.rs
new file mode 100644
index 00000000..5864ac73
--- /dev/null
+++ b/tests/expectations/tests/template.rs
@@ -0,0 +1,184 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug)]
+pub struct Foo<T, U> {
+ pub m_member: T,
+ pub m_member_ptr: *mut T,
+ pub m_member_arr: [T; 1usize],
+ pub _phantom_1: ::std::marker::PhantomData<U>,
+}
+#[test]
+fn __bindgen_test_layout_template_1() {
+ assert_eq!(::std::mem::size_of::<Foo<::std::os::raw::c_int, ::std::os::raw::c_int>>()
+ , 24usize);
+ assert_eq!(::std::mem::align_of::<Foo<::std::os::raw::c_int, ::std::os::raw::c_int>>()
+ , 8usize);
+}
+extern "C" {
+ #[link_name = "_Z3bar3FooIiiE"]
+ pub fn bar(foo: Foo<::std::os::raw::c_int, ::std::os::raw::c_int>);
+}
+#[repr(C)]
+#[derive(Debug)]
+pub struct D<T> {
+ pub m_foo: D_MyFoo,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+pub type D_MyFoo = Foo<::std::os::raw::c_int, ::std::os::raw::c_int>;
+#[repr(C)]
+#[derive(Debug)]
+pub struct D_U<T, Z> {
+ pub m_nested_foo: D_MyFoo,
+ pub m_baz: Z,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Rooted<T> {
+ pub prev: *mut T,
+ pub next: *mut Rooted<*mut ::std::os::raw::c_void>,
+ pub ptr: T,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct RootedContainer {
+ pub root: Rooted<*mut ::std::os::raw::c_void>,
+}
+#[test]
+fn bindgen_test_layout_RootedContainer() {
+ assert_eq!(::std::mem::size_of::<RootedContainer>() , 24usize);
+ assert_eq!(::std::mem::align_of::<RootedContainer>() , 8usize);
+}
+impl Clone for RootedContainer {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug)]
+pub struct WithDtor<T> {
+ pub member: T,
+}
+pub type WithDtorIntFwd = WithDtor<::std::os::raw::c_int>;
+#[repr(C)]
+#[derive(Debug)]
+pub struct PODButContainsDtor {
+ pub member: WithDtorIntFwd,
+}
+#[test]
+fn bindgen_test_layout_PODButContainsDtor() {
+ assert_eq!(::std::mem::size_of::<PODButContainsDtor>() , 4usize);
+ assert_eq!(::std::mem::align_of::<PODButContainsDtor>() , 4usize);
+}
+/** <div rustbindgen opaque> */
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Opaque<T> {
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct POD {
+ pub opaque_member: u32,
+}
+#[test]
+fn bindgen_test_layout_POD() {
+ assert_eq!(::std::mem::size_of::<POD>() , 4usize);
+ assert_eq!(::std::mem::align_of::<POD>() , 4usize);
+}
+impl Clone for POD {
+ fn clone(&self) -> Self { *self }
+}
+/**
+ * <div rustbindgen replaces="NestedReplaced"></div>
+ */
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct NestedReplaced<T> {
+ pub buff: *mut T,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct NestedBase<T, U> {
+ pub buff: *mut T,
+ pub _phantom_1: ::std::marker::PhantomData<U>,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Incomplete<T> {
+ pub d: T,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct NestedContainer<T> {
+ pub c: T,
+ pub nested: NestedReplaced<T>,
+ pub inc: Incomplete<T>,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Untemplated {
+ pub _address: u8,
+}
+#[test]
+fn bindgen_test_layout_Untemplated() {
+ assert_eq!(::std::mem::size_of::<Untemplated>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Untemplated>() , 1usize);
+}
+impl Clone for Untemplated {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Templated<T> {
+ pub m_untemplated: Untemplated,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+/**
+ * If the replacement doesn't happen at the parse level the container would be
+ * copy and the replacement wouldn't, so this wouldn't compile.
+ *
+ * <div rustbindgen replaces="ReplacedWithoutDestructor"></div>
+ */
+#[repr(C)]
+#[derive(Debug)]
+pub struct ReplacedWithoutDestructor<T> {
+ pub buff: *mut T,
+}
+#[repr(C)]
+#[derive(Debug)]
+pub struct ShouldNotBeCopiable<T> {
+ pub m_member: ReplacedWithoutDestructor<T>,
+}
+#[repr(C)]
+#[derive(Debug)]
+pub struct ShouldNotBeCopiableAsWell<U> {
+ pub m_member: ReplacedWithoutDestructorFwd<U>,
+}
+/**
+ * If the replacement doesn't happen at the parse level the container would be
+ * copy and the replacement wouldn't, so this wouldn't compile.
+ *
+ * <div rustbindgen replaces="ReplacedWithoutDestructorFwd"></div>
+ */
+#[repr(C)]
+#[derive(Debug)]
+pub struct ReplacedWithoutDestructorFwd<T> {
+ pub buff: *mut T,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct TemplateWithVar<T> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+#[test]
+fn __bindgen_test_layout_template_2() {
+ assert_eq!(::std::mem::size_of::<WithDtor<::std::os::raw::c_int>>() ,
+ 4usize);
+ assert_eq!(::std::mem::align_of::<WithDtor<::std::os::raw::c_int>>() ,
+ 4usize);
+}
diff --git a/tests/expectations/tests/template_alias.rs b/tests/expectations/tests/template_alias.rs
new file mode 100644
index 00000000..d301a11c
--- /dev/null
+++ b/tests/expectations/tests/template_alias.rs
@@ -0,0 +1,12 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub type JS_detail_Wrapped<T> = T;
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct JS_Rooted<T> {
+ pub ptr: JS_detail_Wrapped<T>,
+}
diff --git a/tests/expectations/tests/template_alias_basic.rs b/tests/expectations/tests/template_alias_basic.rs
new file mode 100644
index 00000000..656fff33
--- /dev/null
+++ b/tests/expectations/tests/template_alias_basic.rs
@@ -0,0 +1,7 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub type Wrapped<T> = T;
diff --git a/tests/expectations/tests/template_alias_namespace.rs b/tests/expectations/tests/template_alias_namespace.rs
new file mode 100644
index 00000000..cf4a079c
--- /dev/null
+++ b/tests/expectations/tests/template_alias_namespace.rs
@@ -0,0 +1,24 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub mod root {
+ #[allow(unused_imports)]
+ use self::super::root;
+ pub mod JS {
+ #[allow(unused_imports)]
+ use self::super::super::root;
+ pub mod detail {
+ #[allow(unused_imports)]
+ use self::super::super::super::root;
+ pub type Wrapped<T> = T;
+ }
+ #[repr(C)]
+ #[derive(Debug, Copy, Clone)]
+ pub struct Rooted<T> {
+ pub ptr: root::JS::detail::Wrapped<T>,
+ }
+ }
+}
diff --git a/tests/expectations/tests/template_typedef_transitive_param.rs b/tests/expectations/tests/template_typedef_transitive_param.rs
new file mode 100644
index 00000000..166ddc3c
--- /dev/null
+++ b/tests/expectations/tests/template_typedef_transitive_param.rs
@@ -0,0 +1,18 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Wrapper<T> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Wrapper_Wrapped<T> {
+ pub t: T,
+}
+pub type Wrapper_Type<T> = Wrapper_Wrapped<T>;
diff --git a/tests/expectations/tests/template_typedefs.rs b/tests/expectations/tests/template_typedefs.rs
new file mode 100644
index 00000000..5f0d80b9
--- /dev/null
+++ b/tests/expectations/tests/template_typedefs.rs
@@ -0,0 +1,22 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub type foo =
+ ::std::option::Option<unsafe extern "C" fn(arg1: ::std::os::raw::c_int)>;
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Foo<T, U> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+ pub _phantom_1: ::std::marker::PhantomData<U>,
+}
+pub type Foo_Char<T> = T;
+pub type Foo_FooPtrTypedef<T> = *mut Foo_Char<T>;
+pub type Foo_nsCOMArrayEnumFunc<T> =
+ ::std::option::Option<unsafe extern "C" fn(aElement: *mut T,
+ aData:
+ *mut ::std::os::raw::c_void)
+ -> bool>;
diff --git a/tests/expectations/tests/templateref_opaque.rs b/tests/expectations/tests/templateref_opaque.rs
new file mode 100644
index 00000000..d69254c8
--- /dev/null
+++ b/tests/expectations/tests/templateref_opaque.rs
@@ -0,0 +1,20 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct detail_PointerType<T> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+pub type detail_PointerType_Type<T> = *mut T;
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct UniquePtr<T> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+pub type UniquePtr_Pointer<T> = detail_PointerType<T>;
diff --git a/tests/expectations/tests/type-referenced-by-whitelisted-function.rs b/tests/expectations/tests/type-referenced-by-whitelisted-function.rs
new file mode 100644
index 00000000..c9686501
--- /dev/null
+++ b/tests/expectations/tests/type-referenced-by-whitelisted-function.rs
@@ -0,0 +1,22 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct dl_phdr_info {
+ pub x: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_dl_phdr_info() {
+ assert_eq!(::std::mem::size_of::<dl_phdr_info>() , 4usize);
+ assert_eq!(::std::mem::align_of::<dl_phdr_info>() , 4usize);
+}
+impl Clone for dl_phdr_info {
+ fn clone(&self) -> Self { *self }
+}
+extern "C" {
+ pub fn dl_iterate_phdr(arg1: *mut dl_phdr_info) -> ::std::os::raw::c_int;
+}
diff --git a/tests/expectations/tests/type_alias_empty.rs b/tests/expectations/tests/type_alias_empty.rs
new file mode 100644
index 00000000..47e36006
--- /dev/null
+++ b/tests/expectations/tests/type_alias_empty.rs
@@ -0,0 +1,7 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub type bool_constant = ();
diff --git a/tests/expectations/tests/type_alias_partial_template_especialization.rs b/tests/expectations/tests/type_alias_partial_template_especialization.rs
new file mode 100644
index 00000000..70b5f66c
--- /dev/null
+++ b/tests/expectations/tests/type_alias_partial_template_especialization.rs
@@ -0,0 +1,12 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub type MaybeWrapped<A> = A;
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Rooted<T> {
+ pub ptr: MaybeWrapped<T>,
+}
diff --git a/tests/expectations/tests/type_alias_template_specialized.rs b/tests/expectations/tests/type_alias_template_specialized.rs
new file mode 100644
index 00000000..11813bc6
--- /dev/null
+++ b/tests/expectations/tests/type_alias_template_specialized.rs
@@ -0,0 +1,21 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Rooted {
+ pub ptr: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_Rooted() {
+ assert_eq!(::std::mem::size_of::<Rooted>() , 4usize);
+ assert_eq!(::std::mem::align_of::<Rooted>() , 4usize);
+}
+impl Clone for Rooted {
+ fn clone(&self) -> Self { *self }
+}
+/// <div rustbindgen replaces="MaybeWrapped"></div>
+pub type MaybeWrapped<a> = a;
diff --git a/tests/expectations/tests/typedefd-array-as-function-arg.rs b/tests/expectations/tests/typedefd-array-as-function-arg.rs
new file mode 100644
index 00000000..56074f75
--- /dev/null
+++ b/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/tests/expectations/tests/typeref.rs b/tests/expectations/tests/typeref.rs
new file mode 100644
index 00000000..1188393d
--- /dev/null
+++ b/tests/expectations/tests/typeref.rs
@@ -0,0 +1,96 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[inline]
+ pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
+ #[inline]
+ pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
+ #[inline]
+ pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
+}
+impl <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct nsFoo {
+ pub mBar: mozilla_StyleShapeSource<::std::os::raw::c_int>,
+}
+#[test]
+fn bindgen_test_layout_nsFoo() {
+ assert_eq!(::std::mem::size_of::<nsFoo>() , 8usize);
+ assert_eq!(::std::mem::align_of::<nsFoo>() , 8usize);
+}
+impl Clone for nsFoo {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct mozilla_FragmentOrURL {
+ pub mIsLocalRef: bool,
+}
+#[test]
+fn bindgen_test_layout_mozilla_FragmentOrURL() {
+ assert_eq!(::std::mem::size_of::<mozilla_FragmentOrURL>() , 1usize);
+ assert_eq!(::std::mem::align_of::<mozilla_FragmentOrURL>() , 1usize);
+}
+impl Clone for mozilla_FragmentOrURL {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct mozilla_Position {
+ pub _address: u8,
+}
+#[test]
+fn bindgen_test_layout_mozilla_Position() {
+ assert_eq!(::std::mem::size_of::<mozilla_Position>() , 1usize);
+ assert_eq!(::std::mem::align_of::<mozilla_Position>() , 1usize);
+}
+impl Clone for mozilla_Position {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct mozilla_StyleShapeSource<ReferenceBox> {
+ pub __bindgen_anon_1: mozilla_StyleShapeSource__bindgen_ty_1<ReferenceBox>,
+ pub _phantom_0: ::std::marker::PhantomData<ReferenceBox>,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct mozilla_StyleShapeSource__bindgen_ty_1<ReferenceBox> {
+ pub mPosition: __BindgenUnionField<*mut mozilla_Position>,
+ pub mFragmentOrURL: __BindgenUnionField<*mut mozilla_FragmentOrURL>,
+ pub bindgen_union_field: u64,
+ pub _phantom_0: ::std::marker::PhantomData<ReferenceBox>,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Bar {
+ pub mFoo: *mut nsFoo,
+}
+#[test]
+fn bindgen_test_layout_Bar() {
+ assert_eq!(::std::mem::size_of::<Bar>() , 8usize);
+ assert_eq!(::std::mem::align_of::<Bar>() , 8usize);
+}
+impl Clone for Bar {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/union-in-ns.rs b/tests/expectations/tests/union-in-ns.rs
new file mode 100644
index 00000000..fa511e51
--- /dev/null
+++ b/tests/expectations/tests/union-in-ns.rs
@@ -0,0 +1,52 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub mod root {
+ #[repr(C)]
+ pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+ impl <T> __BindgenUnionField<T> {
+ #[inline]
+ pub fn new() -> Self {
+ __BindgenUnionField(::std::marker::PhantomData)
+ }
+ #[inline]
+ pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
+ #[inline]
+ pub unsafe fn as_mut(&mut self) -> &mut T {
+ ::std::mem::transmute(self)
+ }
+ }
+ impl <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+ }
+ impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+ }
+ impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+ }
+ #[allow(unused_imports)]
+ use self::super::root;
+ #[repr(C)]
+ #[derive(Debug, Copy)]
+ pub struct bar {
+ pub baz: root::__BindgenUnionField<::std::os::raw::c_int>,
+ pub bindgen_union_field: u32,
+ }
+ #[test]
+ fn bindgen_test_layout_bar() {
+ assert_eq!(::std::mem::size_of::<bar>() , 4usize);
+ assert_eq!(::std::mem::align_of::<bar>() , 4usize);
+ }
+ impl Clone for bar {
+ fn clone(&self) -> Self { *self }
+ }
+}
diff --git a/tests/expectations/tests/union_dtor.rs b/tests/expectations/tests/union_dtor.rs
new file mode 100644
index 00000000..9be626ff
--- /dev/null
+++ b/tests/expectations/tests/union_dtor.rs
@@ -0,0 +1,42 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[inline]
+ pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
+ #[inline]
+ pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
+ #[inline]
+ pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
+}
+impl <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug)]
+pub struct UnionWithDtor {
+ pub mFoo: __BindgenUnionField<::std::os::raw::c_int>,
+ pub mBar: __BindgenUnionField<*mut ::std::os::raw::c_void>,
+ pub bindgen_union_field: u64,
+}
+#[test]
+fn bindgen_test_layout_UnionWithDtor() {
+ assert_eq!(::std::mem::size_of::<UnionWithDtor>() , 8usize);
+ assert_eq!(::std::mem::align_of::<UnionWithDtor>() , 8usize);
+}
diff --git a/tests/expectations/tests/union_fields.rs b/tests/expectations/tests/union_fields.rs
new file mode 100644
index 00000000..21d87919
--- /dev/null
+++ b/tests/expectations/tests/union_fields.rs
@@ -0,0 +1,47 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[inline]
+ pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
+ #[inline]
+ pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
+ #[inline]
+ pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
+}
+impl <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct _bindgen_ty_1 {
+ pub mInt: __BindgenUnionField<::std::os::raw::c_int>,
+ pub mFloat: __BindgenUnionField<f32>,
+ pub mPointer: __BindgenUnionField<*mut ::std::os::raw::c_void>,
+ pub bindgen_union_field: u64,
+}
+#[test]
+fn bindgen_test_layout__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<_bindgen_ty_1>() , 8usize);
+ assert_eq!(::std::mem::align_of::<_bindgen_ty_1>() , 8usize);
+}
+impl Clone for _bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+}
+pub use self::_bindgen_ty_1 as nsStyleUnion;
diff --git a/tests/expectations/tests/union_template.rs b/tests/expectations/tests/union_template.rs
new file mode 100644
index 00000000..fc92afb8
--- /dev/null
+++ b/tests/expectations/tests/union_template.rs
@@ -0,0 +1,62 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[inline]
+ pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
+ #[inline]
+ pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
+ #[inline]
+ pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
+}
+impl <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct NastyStruct<T> {
+ pub mIsSome: bool,
+ pub mStorage: NastyStruct__bindgen_ty_1<T>,
+ pub __bindgen_anon_1: NastyStruct__bindgen_ty_2<T>,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct NastyStruct__bindgen_ty_1<T> {
+ pub mFoo: __BindgenUnionField<*mut ::std::os::raw::c_void>,
+ pub mDummy: __BindgenUnionField<::std::os::raw::c_ulong>,
+ pub bindgen_union_field: u64,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct NastyStruct__bindgen_ty_2<T> {
+ pub wat: __BindgenUnionField<::std::os::raw::c_short>,
+ pub wut: __BindgenUnionField<*mut ::std::os::raw::c_int>,
+ pub bindgen_union_field: u64,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Whatever<T> {
+ pub mTPtr: __BindgenUnionField<*mut ::std::os::raw::c_void>,
+ pub mInt: __BindgenUnionField<::std::os::raw::c_int>,
+ pub bindgen_union_field: u64,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
diff --git a/tests/expectations/tests/union_with_anon_struct.rs b/tests/expectations/tests/union_with_anon_struct.rs
new file mode 100644
index 00000000..f0a21512
--- /dev/null
+++ b/tests/expectations/tests/union_with_anon_struct.rs
@@ -0,0 +1,58 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[inline]
+ pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
+ #[inline]
+ pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
+ #[inline]
+ pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
+}
+impl <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo {
+ pub bar: __BindgenUnionField<foo__bindgen_ty_1>,
+ pub bindgen_union_field: [u32; 2usize],
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo__bindgen_ty_1 {
+ pub a: ::std::os::raw::c_uint,
+ pub b: ::std::os::raw::c_uint,
+}
+#[test]
+fn bindgen_test_layout_foo__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 8usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize);
+}
+impl Clone for foo__bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn bindgen_test_layout_foo() {
+ assert_eq!(::std::mem::size_of::<foo>() , 8usize);
+ assert_eq!(::std::mem::align_of::<foo>() , 4usize);
+}
+impl Clone for foo {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/union_with_anon_struct_bitfield.rs b/tests/expectations/tests/union_with_anon_struct_bitfield.rs
new file mode 100644
index 00000000..548b0dc4
--- /dev/null
+++ b/tests/expectations/tests/union_with_anon_struct_bitfield.rs
@@ -0,0 +1,86 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[inline]
+ pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
+ #[inline]
+ pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
+ #[inline]
+ pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
+}
+impl <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo {
+ pub a: __BindgenUnionField<::std::os::raw::c_int>,
+ pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1>,
+ pub bindgen_union_field: u32,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo__bindgen_ty_1 {
+ pub _bitfield_1: u32,
+}
+#[test]
+fn bindgen_test_layout_foo__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 4usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize);
+}
+impl Clone for foo__bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+}
+impl foo__bindgen_ty_1 {
+ #[inline]
+ pub fn b(&self) -> ::std::os::raw::c_int {
+ unsafe {
+ ::std::mem::transmute(((self._bitfield_1 & (127usize as u32)) >>
+ 0u32) as u32)
+ }
+ }
+ #[inline]
+ pub fn set_b(&mut self, val: ::std::os::raw::c_int) {
+ self._bitfield_1 &= !(127usize as u32);
+ self._bitfield_1 |= ((val as u32 as u32) << 0u32) & (127usize as u32);
+ }
+ #[inline]
+ pub fn c(&self) -> ::std::os::raw::c_int {
+ unsafe {
+ ::std::mem::transmute(((self._bitfield_1 &
+ (4294967168usize as u32)) >> 7u32) as
+ u32)
+ }
+ }
+ #[inline]
+ pub fn set_c(&mut self, val: ::std::os::raw::c_int) {
+ self._bitfield_1 &= !(4294967168usize as u32);
+ self._bitfield_1 |=
+ ((val as u32 as u32) << 7u32) & (4294967168usize as u32);
+ }
+}
+#[test]
+fn bindgen_test_layout_foo() {
+ assert_eq!(::std::mem::size_of::<foo>() , 4usize);
+ assert_eq!(::std::mem::align_of::<foo>() , 4usize);
+}
+impl Clone for foo {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/union_with_anon_union.rs b/tests/expectations/tests/union_with_anon_union.rs
new file mode 100644
index 00000000..95278556
--- /dev/null
+++ b/tests/expectations/tests/union_with_anon_union.rs
@@ -0,0 +1,59 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[inline]
+ pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
+ #[inline]
+ pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
+ #[inline]
+ pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
+}
+impl <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo {
+ pub bar: __BindgenUnionField<foo__bindgen_ty_1>,
+ pub bindgen_union_field: u32,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo__bindgen_ty_1 {
+ pub a: __BindgenUnionField<::std::os::raw::c_uint>,
+ pub b: __BindgenUnionField<::std::os::raw::c_ushort>,
+ pub bindgen_union_field: u32,
+}
+#[test]
+fn bindgen_test_layout_foo__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 4usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize);
+}
+impl Clone for foo__bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn bindgen_test_layout_foo() {
+ assert_eq!(::std::mem::size_of::<foo>() , 4usize);
+ assert_eq!(::std::mem::align_of::<foo>() , 4usize);
+}
+impl Clone for foo {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/union_with_anon_unnamed_struct.rs b/tests/expectations/tests/union_with_anon_unnamed_struct.rs
new file mode 100644
index 00000000..2d6fab97
--- /dev/null
+++ b/tests/expectations/tests/union_with_anon_unnamed_struct.rs
@@ -0,0 +1,61 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[inline]
+ pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
+ #[inline]
+ pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
+ #[inline]
+ pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
+}
+impl <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct pixel {
+ pub rgba: __BindgenUnionField<::std::os::raw::c_uint>,
+ pub __bindgen_anon_1: __BindgenUnionField<pixel__bindgen_ty_1>,
+ pub bindgen_union_field: u32,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct pixel__bindgen_ty_1 {
+ pub r: ::std::os::raw::c_uchar,
+ pub g: ::std::os::raw::c_uchar,
+ pub b: ::std::os::raw::c_uchar,
+ pub a: ::std::os::raw::c_uchar,
+}
+#[test]
+fn bindgen_test_layout_pixel__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<pixel__bindgen_ty_1>() , 4usize);
+ assert_eq!(::std::mem::align_of::<pixel__bindgen_ty_1>() , 1usize);
+}
+impl Clone for pixel__bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn bindgen_test_layout_pixel() {
+ assert_eq!(::std::mem::size_of::<pixel>() , 4usize);
+ assert_eq!(::std::mem::align_of::<pixel>() , 4usize);
+}
+impl Clone for pixel {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/union_with_anon_unnamed_union.rs b/tests/expectations/tests/union_with_anon_unnamed_union.rs
new file mode 100644
index 00000000..eb214017
--- /dev/null
+++ b/tests/expectations/tests/union_with_anon_unnamed_union.rs
@@ -0,0 +1,60 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[inline]
+ pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
+ #[inline]
+ pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
+ #[inline]
+ pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
+}
+impl <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo {
+ pub a: __BindgenUnionField<::std::os::raw::c_uint>,
+ pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1>,
+ pub bindgen_union_field: u32,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo__bindgen_ty_1 {
+ pub b: __BindgenUnionField<::std::os::raw::c_ushort>,
+ pub c: __BindgenUnionField<::std::os::raw::c_uchar>,
+ pub bindgen_union_field: u16,
+}
+#[test]
+fn bindgen_test_layout_foo__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 2usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 2usize);
+}
+impl Clone for foo__bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn bindgen_test_layout_foo() {
+ assert_eq!(::std::mem::size_of::<foo>() , 4usize);
+ assert_eq!(::std::mem::align_of::<foo>() , 4usize);
+}
+impl Clone for foo {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/union_with_big_member.rs b/tests/expectations/tests/union_with_big_member.rs
new file mode 100644
index 00000000..b921f33c
--- /dev/null
+++ b/tests/expectations/tests/union_with_big_member.rs
@@ -0,0 +1,75 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[inline]
+ pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
+ #[inline]
+ pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
+ #[inline]
+ pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
+}
+impl <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Copy)]
+pub struct WithBigArray {
+ pub a: __BindgenUnionField<::std::os::raw::c_int>,
+ pub b: __BindgenUnionField<[::std::os::raw::c_int; 33usize]>,
+ pub bindgen_union_field: [u32; 33usize],
+}
+#[test]
+fn bindgen_test_layout_WithBigArray() {
+ assert_eq!(::std::mem::size_of::<WithBigArray>() , 132usize);
+ assert_eq!(::std::mem::align_of::<WithBigArray>() , 4usize);
+}
+impl Clone for WithBigArray {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct WithBigArray2 {
+ pub a: __BindgenUnionField<::std::os::raw::c_int>,
+ pub b: __BindgenUnionField<[::std::os::raw::c_char; 33usize]>,
+ pub bindgen_union_field: [u32; 9usize],
+}
+#[test]
+fn bindgen_test_layout_WithBigArray2() {
+ assert_eq!(::std::mem::size_of::<WithBigArray2>() , 36usize);
+ assert_eq!(::std::mem::align_of::<WithBigArray2>() , 4usize);
+}
+impl Clone for WithBigArray2 {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Copy)]
+pub struct WithBigMember {
+ pub a: __BindgenUnionField<::std::os::raw::c_int>,
+ pub b: __BindgenUnionField<WithBigArray>,
+ pub bindgen_union_field: [u32; 33usize],
+}
+#[test]
+fn bindgen_test_layout_WithBigMember() {
+ assert_eq!(::std::mem::size_of::<WithBigMember>() , 132usize);
+ assert_eq!(::std::mem::align_of::<WithBigMember>() , 4usize);
+}
+impl Clone for WithBigMember {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/union_with_nesting.rs b/tests/expectations/tests/union_with_nesting.rs
new file mode 100644
index 00000000..af9e442d
--- /dev/null
+++ b/tests/expectations/tests/union_with_nesting.rs
@@ -0,0 +1,93 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[inline]
+ pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
+ #[inline]
+ pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
+ #[inline]
+ pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
+}
+impl <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo {
+ pub a: __BindgenUnionField<::std::os::raw::c_uint>,
+ pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1>,
+ pub bindgen_union_field: u32,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo__bindgen_ty_1 {
+ pub __bindgen_anon_1: foo__bindgen_ty_1__bindgen_ty_1,
+ pub __bindgen_anon_2: foo__bindgen_ty_1__bindgen_ty_2,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo__bindgen_ty_1__bindgen_ty_1 {
+ pub b1: __BindgenUnionField<::std::os::raw::c_ushort>,
+ pub b2: __BindgenUnionField<::std::os::raw::c_ushort>,
+ pub bindgen_union_field: u16,
+}
+#[test]
+fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1__bindgen_ty_1>() ,
+ 2usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1__bindgen_ty_1>() ,
+ 2usize);
+}
+impl Clone for foo__bindgen_ty_1__bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo__bindgen_ty_1__bindgen_ty_2 {
+ pub c1: __BindgenUnionField<::std::os::raw::c_ushort>,
+ pub c2: __BindgenUnionField<::std::os::raw::c_ushort>,
+ pub bindgen_union_field: u16,
+}
+#[test]
+fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1__bindgen_ty_2>() ,
+ 2usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1__bindgen_ty_2>() ,
+ 2usize);
+}
+impl Clone for foo__bindgen_ty_1__bindgen_ty_2 {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn bindgen_test_layout_foo__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 4usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 2usize);
+}
+impl Clone for foo__bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn bindgen_test_layout_foo() {
+ assert_eq!(::std::mem::size_of::<foo>() , 4usize);
+ assert_eq!(::std::mem::align_of::<foo>() , 4usize);
+}
+impl Clone for foo {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/unknown_attr.rs b/tests/expectations/tests/unknown_attr.rs
new file mode 100644
index 00000000..541bee5d
--- /dev/null
+++ b/tests/expectations/tests/unknown_attr.rs
@@ -0,0 +1,16 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct _bindgen_ty_1 {
+ pub __clang_max_align_nonce1: ::std::os::raw::c_longlong,
+ pub __clang_max_align_nonce2: f64,
+}
+impl Clone for _bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+}
+pub use self::_bindgen_ty_1 as max_align_t;
diff --git a/tests/expectations/tests/use-core.rs b/tests/expectations/tests/use-core.rs
new file mode 100644
index 00000000..b0900f5f
--- /dev/null
+++ b/tests/expectations/tests/use-core.rs
@@ -0,0 +1,24 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+extern crate core;
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo {
+ pub a: ::std::os::raw::c_int,
+ pub b: ::std::os::raw::c_int,
+ pub bar: *mut ::std::os::raw::c_void,
+}
+#[test]
+fn bindgen_test_layout_foo() {
+ assert_eq!(::core::mem::size_of::<foo>() , 16usize);
+ assert_eq!(::core::mem::align_of::<foo>() , 8usize);
+}
+impl Clone for foo {
+ fn clone(&self) -> Self { *self }
+}
+pub type fooFunction =
+ ::core::option::Option<unsafe extern "C" fn(bar: ::std::os::raw::c_int)>;
diff --git a/tests/expectations/tests/using.rs b/tests/expectations/tests/using.rs
new file mode 100644
index 00000000..dbb6c84f
--- /dev/null
+++ b/tests/expectations/tests/using.rs
@@ -0,0 +1,14 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Point<T> {
+ pub x: T,
+ pub y: T,
+}
+pub type IntPoint2D = Point<::std::os::raw::c_int>;
+pub type IntVec2D = Point<::std::os::raw::c_int>;
diff --git a/tests/expectations/tests/var-tracing.rs b/tests/expectations/tests/var-tracing.rs
new file mode 100644
index 00000000..75c5ebe3
--- /dev/null
+++ b/tests/expectations/tests/var-tracing.rs
@@ -0,0 +1,48 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Bar {
+ pub m_baz: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_Bar() {
+ assert_eq!(::std::mem::size_of::<Bar>() , 4usize);
+ assert_eq!(::std::mem::align_of::<Bar>() , 4usize);
+}
+extern "C" {
+ #[link_name = "_ZN3BarC1Ei"]
+ pub fn Bar_Bar(this: *mut Bar, baz: ::std::os::raw::c_int);
+}
+impl Clone for Bar {
+ fn clone(&self) -> Self { *self }
+}
+impl Bar {
+ #[inline]
+ pub unsafe fn new(baz: ::std::os::raw::c_int) -> Self {
+ let mut __bindgen_tmp = ::std::mem::uninitialized();
+ Bar_Bar(&mut __bindgen_tmp, baz);
+ __bindgen_tmp
+ }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Baz {
+ pub _address: u8,
+}
+extern "C" {
+ #[link_name = "_ZN3Baz3FOOE"]
+ pub static mut Baz_FOO: *const Bar;
+}
+#[test]
+fn bindgen_test_layout_Baz() {
+ assert_eq!(::std::mem::size_of::<Baz>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Baz>() , 1usize);
+}
+impl Clone for Baz {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/variadic-method.rs b/tests/expectations/tests/variadic-method.rs
new file mode 100644
index 00000000..34301069
--- /dev/null
+++ b/tests/expectations/tests/variadic-method.rs
@@ -0,0 +1,27 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+extern "C" {
+ #[link_name = "_Z3fooPKcz"]
+ pub fn foo(fmt: *const ::std::os::raw::c_char, ...);
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Bar {
+ pub _address: u8,
+}
+#[test]
+fn bindgen_test_layout_Bar() {
+ assert_eq!(::std::mem::size_of::<Bar>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Bar>() , 1usize);
+}
+extern "C" {
+ #[link_name = "_ZN3Bar3fooEPKcz"]
+ pub fn Bar_foo(this: *mut Bar, fmt: *const ::std::os::raw::c_char, ...);
+}
+impl Clone for Bar {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/variadic_template_function.rs b/tests/expectations/tests/variadic_template_function.rs
new file mode 100644
index 00000000..cd99df96
--- /dev/null
+++ b/tests/expectations/tests/variadic_template_function.rs
@@ -0,0 +1,12 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct VariadicFunctionObject<T> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
diff --git a/tests/expectations/tests/vector.rs b/tests/expectations/tests/vector.rs
new file mode 100644
index 00000000..b8ca5735
--- /dev/null
+++ b/tests/expectations/tests/vector.rs
@@ -0,0 +1,19 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo {
+ pub mMember: [::std::os::raw::c_longlong; 1usize],
+}
+#[test]
+fn bindgen_test_layout_foo() {
+ assert_eq!(::std::mem::size_of::<foo>() , 8usize);
+ assert_eq!(::std::mem::align_of::<foo>() , 8usize);
+}
+impl Clone for foo {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/virtual_dtor.rs b/tests/expectations/tests/virtual_dtor.rs
new file mode 100644
index 00000000..9571f084
--- /dev/null
+++ b/tests/expectations/tests/virtual_dtor.rs
@@ -0,0 +1,19 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+pub struct nsSlots__bindgen_vtable {
+}
+#[repr(C)]
+#[derive(Debug)]
+pub struct nsSlots {
+ pub vtable_: *const nsSlots__bindgen_vtable,
+}
+#[test]
+fn bindgen_test_layout_nsSlots() {
+ assert_eq!(::std::mem::size_of::<nsSlots>() , 8usize);
+ assert_eq!(::std::mem::align_of::<nsSlots>() , 8usize);
+}
diff --git a/tests/expectations/tests/virtual_inheritance.rs b/tests/expectations/tests/virtual_inheritance.rs
new file mode 100644
index 00000000..f271223f
--- /dev/null
+++ b/tests/expectations/tests/virtual_inheritance.rs
@@ -0,0 +1,68 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct A {
+ pub foo: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_A() {
+ assert_eq!(::std::mem::size_of::<A>() , 4usize);
+ assert_eq!(::std::mem::align_of::<A>() , 4usize);
+}
+impl Clone for A {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+pub struct B__bindgen_vtable {
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct B {
+ pub vtable_: *const B__bindgen_vtable,
+ pub bar: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_B() {
+ assert_eq!(::std::mem::size_of::<B>() , 16usize);
+ assert_eq!(::std::mem::align_of::<B>() , 8usize);
+}
+impl Clone for B {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+pub struct C__bindgen_vtable {
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct C {
+ pub vtable_: *const C__bindgen_vtable,
+ pub baz: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_C() {
+ assert_eq!(::std::mem::size_of::<C>() , 16usize);
+ assert_eq!(::std::mem::align_of::<C>() , 8usize);
+}
+impl Clone for C {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct D {
+ pub _base: C,
+ pub _base_1: B,
+ pub bazz: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_D() {
+ assert_eq!(::std::mem::size_of::<D>() , 40usize);
+ assert_eq!(::std::mem::align_of::<D>() , 8usize);
+}
+impl Clone for D {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/virtual_overloaded.rs b/tests/expectations/tests/virtual_overloaded.rs
new file mode 100644
index 00000000..7833cdbf
--- /dev/null
+++ b/tests/expectations/tests/virtual_overloaded.rs
@@ -0,0 +1,22 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+pub struct C__bindgen_vtable {
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct C {
+ pub vtable_: *const C__bindgen_vtable,
+}
+#[test]
+fn bindgen_test_layout_C() {
+ assert_eq!(::std::mem::size_of::<C>() , 8usize);
+ assert_eq!(::std::mem::align_of::<C>() , 8usize);
+}
+impl Clone for C {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/vtable_recursive_sig.rs b/tests/expectations/tests/vtable_recursive_sig.rs
new file mode 100644
index 00000000..ce62eeb0
--- /dev/null
+++ b/tests/expectations/tests/vtable_recursive_sig.rs
@@ -0,0 +1,35 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Derived {
+ pub _base: Base,
+}
+#[test]
+fn bindgen_test_layout_Derived() {
+ assert_eq!(::std::mem::size_of::<Derived>() , 8usize);
+ assert_eq!(::std::mem::align_of::<Derived>() , 8usize);
+}
+impl Clone for Derived {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+pub struct Base__bindgen_vtable {
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Base {
+ pub vtable_: *const Base__bindgen_vtable,
+}
+#[test]
+fn bindgen_test_layout_Base() {
+ assert_eq!(::std::mem::size_of::<Base>() , 8usize);
+ assert_eq!(::std::mem::align_of::<Base>() , 8usize);
+}
+impl Clone for Base {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/weird_bitfields.rs b/tests/expectations/tests/weird_bitfields.rs
new file mode 100644
index 00000000..56ee76a5
--- /dev/null
+++ b/tests/expectations/tests/weird_bitfields.rs
@@ -0,0 +1,128 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(u32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum nsStyleSVGOpacitySource {
+ eStyleSVGOpacitySource_Normal = 0,
+ eStyleSVGOpacitySource_ContextFillOpacity = 1,
+ eStyleSVGOpacitySource_ContextStrokeOpacity = 2,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Weird {
+ pub mStrokeDasharrayLength: ::std::os::raw::c_uint,
+ pub _bitfield_1: u32,
+ pub mClipRule: ::std::os::raw::c_uchar,
+ pub mColorInterpolation: ::std::os::raw::c_uchar,
+ pub mColorInterpolationFilters: ::std::os::raw::c_uchar,
+ pub mFillRule: ::std::os::raw::c_uchar,
+ pub mImageRendering: ::std::os::raw::c_uchar,
+ pub mPaintOrder: ::std::os::raw::c_uchar,
+ pub mShapeRendering: ::std::os::raw::c_uchar,
+ pub mStrokeLinecap: ::std::os::raw::c_uchar,
+ pub mStrokeLinejoin: ::std::os::raw::c_uchar,
+ pub mTextAnchor: ::std::os::raw::c_uchar,
+ pub mTextRendering: ::std::os::raw::c_uchar,
+ pub _bitfield_2: u16,
+}
+#[test]
+fn bindgen_test_layout_Weird() {
+ assert_eq!(::std::mem::size_of::<Weird>() , 24usize);
+ assert_eq!(::std::mem::align_of::<Weird>() , 4usize);
+}
+impl Clone for Weird {
+ fn clone(&self) -> Self { *self }
+}
+impl Weird {
+ #[inline]
+ pub fn bitTest(&self) -> ::std::os::raw::c_uint {
+ unsafe {
+ ::std::mem::transmute(((self._bitfield_1 & (65535usize as u32)) >>
+ 0u32) as u32)
+ }
+ }
+ #[inline]
+ pub fn set_bitTest(&mut self, val: ::std::os::raw::c_uint) {
+ self._bitfield_1 &= !(65535usize as u32);
+ self._bitfield_1 |=
+ ((val as u32 as u32) << 0u32) & (65535usize as u32);
+ }
+ #[inline]
+ pub fn bitTest2(&self) -> ::std::os::raw::c_uint {
+ unsafe {
+ ::std::mem::transmute(((self._bitfield_1 &
+ (2147418112usize as u32)) >> 16u32) as
+ u32)
+ }
+ }
+ #[inline]
+ pub fn set_bitTest2(&mut self, val: ::std::os::raw::c_uint) {
+ self._bitfield_1 &= !(2147418112usize as u32);
+ self._bitfield_1 |=
+ ((val as u32 as u32) << 16u32) & (2147418112usize as u32);
+ }
+ #[inline]
+ pub fn mFillOpacitySource(&self) -> nsStyleSVGOpacitySource {
+ unsafe {
+ ::std::mem::transmute(((self._bitfield_2 & (7usize as u16)) >>
+ 0u32) as u32)
+ }
+ }
+ #[inline]
+ pub fn set_mFillOpacitySource(&mut self, val: nsStyleSVGOpacitySource) {
+ self._bitfield_2 &= !(7usize as u16);
+ self._bitfield_2 |= ((val as u32 as u16) << 0u32) & (7usize as u16);
+ }
+ #[inline]
+ pub fn mStrokeOpacitySource(&self) -> nsStyleSVGOpacitySource {
+ unsafe {
+ ::std::mem::transmute(((self._bitfield_2 & (56usize as u16)) >>
+ 3u32) as u32)
+ }
+ }
+ #[inline]
+ pub fn set_mStrokeOpacitySource(&mut self, val: nsStyleSVGOpacitySource) {
+ self._bitfield_2 &= !(56usize as u16);
+ self._bitfield_2 |= ((val as u32 as u16) << 3u32) & (56usize as u16);
+ }
+ #[inline]
+ pub fn mStrokeDasharrayFromObject(&self) -> bool {
+ unsafe {
+ ::std::mem::transmute(((self._bitfield_2 & (64usize as u16)) >>
+ 6u32) as u8)
+ }
+ }
+ #[inline]
+ pub fn set_mStrokeDasharrayFromObject(&mut self, val: bool) {
+ self._bitfield_2 &= !(64usize as u16);
+ self._bitfield_2 |= ((val as u8 as u16) << 6u32) & (64usize as u16);
+ }
+ #[inline]
+ pub fn mStrokeDashoffsetFromObject(&self) -> bool {
+ unsafe {
+ ::std::mem::transmute(((self._bitfield_2 & (128usize as u16)) >>
+ 7u32) as u8)
+ }
+ }
+ #[inline]
+ pub fn set_mStrokeDashoffsetFromObject(&mut self, val: bool) {
+ self._bitfield_2 &= !(128usize as u16);
+ self._bitfield_2 |= ((val as u8 as u16) << 7u32) & (128usize as u16);
+ }
+ #[inline]
+ pub fn mStrokeWidthFromObject(&self) -> bool {
+ unsafe {
+ ::std::mem::transmute(((self._bitfield_2 & (256usize as u16)) >>
+ 8u32) as u8)
+ }
+ }
+ #[inline]
+ pub fn set_mStrokeWidthFromObject(&mut self, val: bool) {
+ self._bitfield_2 &= !(256usize as u16);
+ self._bitfield_2 |= ((val as u8 as u16) << 8u32) & (256usize as u16);
+ }
+}
diff --git a/tests/expectations/tests/what_is_going_on.rs b/tests/expectations/tests/what_is_going_on.rs
new file mode 100644
index 00000000..6f1998d1
--- /dev/null
+++ b/tests/expectations/tests/what_is_going_on.rs
@@ -0,0 +1,28 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct UnknownUnits {
+ pub _address: u8,
+}
+#[test]
+fn bindgen_test_layout_UnknownUnits() {
+ assert_eq!(::std::mem::size_of::<UnknownUnits>() , 1usize);
+ assert_eq!(::std::mem::align_of::<UnknownUnits>() , 1usize);
+}
+impl Clone for UnknownUnits {
+ fn clone(&self) -> Self { *self }
+}
+pub type Float = f32;
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct PointTyped<units, F> {
+ pub x: F,
+ pub y: F,
+ pub _phantom_0: ::std::marker::PhantomData<units>,
+}
+pub type IntPoint = PointTyped<UnknownUnits, f32>;
diff --git a/tests/expectations/tests/whitelist-namespaces-basic.rs b/tests/expectations/tests/whitelist-namespaces-basic.rs
new file mode 100644
index 00000000..cbb12f6b
--- /dev/null
+++ b/tests/expectations/tests/whitelist-namespaces-basic.rs
@@ -0,0 +1,31 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub mod root {
+ #[allow(unused_imports)]
+ use self::super::root;
+ pub mod outer {
+ #[allow(unused_imports)]
+ use self::super::super::root;
+ pub mod inner {
+ #[allow(unused_imports)]
+ use self::super::super::super::root;
+ #[repr(C)]
+ #[derive(Debug, Copy)]
+ pub struct Helper {
+ pub _address: u8,
+ }
+ #[test]
+ fn bindgen_test_layout_Helper() {
+ assert_eq!(::std::mem::size_of::<Helper>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Helper>() , 1usize);
+ }
+ impl Clone for Helper {
+ fn clone(&self) -> Self { *self }
+ }
+ }
+ }
+}
diff --git a/tests/expectations/tests/whitelist-namespaces.rs b/tests/expectations/tests/whitelist-namespaces.rs
new file mode 100644
index 00000000..bc257af6
--- /dev/null
+++ b/tests/expectations/tests/whitelist-namespaces.rs
@@ -0,0 +1,44 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub mod root {
+ #[allow(unused_imports)]
+ use self::super::root;
+ pub mod outer {
+ #[allow(unused_imports)]
+ use self::super::super::root;
+ pub mod inner {
+ #[allow(unused_imports)]
+ use self::super::super::super::root;
+ #[repr(C)]
+ #[derive(Debug, Copy)]
+ pub struct Helper {
+ pub _address: u8,
+ }
+ #[test]
+ fn bindgen_test_layout_Helper() {
+ assert_eq!(::std::mem::size_of::<Helper>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Helper>() , 1usize);
+ }
+ impl Clone for Helper {
+ fn clone(&self) -> Self { *self }
+ }
+ }
+ #[repr(C)]
+ #[derive(Debug, Copy)]
+ pub struct Test {
+ pub helper: root::outer::inner::Helper,
+ }
+ #[test]
+ fn bindgen_test_layout_Test() {
+ assert_eq!(::std::mem::size_of::<Test>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Test>() , 1usize);
+ }
+ impl Clone for Test {
+ fn clone(&self) -> Self { *self }
+ }
+ }
+}
diff --git a/tests/expectations/tests/whitelist_basic.rs b/tests/expectations/tests/whitelist_basic.rs
new file mode 100644
index 00000000..0104f049
--- /dev/null
+++ b/tests/expectations/tests/whitelist_basic.rs
@@ -0,0 +1,18 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct WhitelistMe<T> {
+ pub foo: ::std::os::raw::c_int,
+ pub bar: WhitelistMe_Inner<T>,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct WhitelistMe_Inner<T> {
+ pub bar: T,
+}
diff --git a/tests/expectations/tests/whitelist_fix.rs b/tests/expectations/tests/whitelist_fix.rs
new file mode 100644
index 00000000..9e26e1be
--- /dev/null
+++ b/tests/expectations/tests/whitelist_fix.rs
@@ -0,0 +1,10 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+pub enum Test {}
+
+extern "C" {
+ pub fn Servo_Test(a: *mut Test);
+}
diff --git a/tests/expectations/tests/whitelist_vars.rs b/tests/expectations/tests/whitelist_vars.rs
new file mode 100644
index 00000000..f7af24b2
--- /dev/null
+++ b/tests/expectations/tests/whitelist_vars.rs
@@ -0,0 +1,10 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub const NONE: ::std::os::raw::c_uint = 0;
+pub const FOO: ::std::os::raw::c_uint = 5;
+pub const FOOB: ::std::os::raw::c_int = -2;
+pub const FOOBAR: ::std::os::raw::c_int = -10;
diff --git a/tests/headers/accessors.hpp b/tests/headers/accessors.hpp
new file mode 100644
index 00000000..4c23e35d
--- /dev/null
+++ b/tests/headers/accessors.hpp
@@ -0,0 +1,46 @@
+struct SomeAccessors {
+ int mNoAccessor;
+ /** <div rustbindgen accessor></div> */
+ int mBothAccessors;
+ /** <div rustbindgen accessor="unsafe"></div> */
+ int mUnsafeAccessors;
+ /** <div rustbindgen accessor="immutable"></div> */
+ int mImmutableAccessor;
+};
+
+/** <div rustbindgen accessor></div> */
+struct AllAccessors {
+ int mBothAccessors;
+ int mAlsoBothAccessors;
+};
+
+/** <div rustbindgen accessor="unsafe"></div> */
+struct AllUnsafeAccessors {
+ int mBothAccessors;
+ int mAlsoBothAccessors;
+};
+
+/** <div rustbindgen accessor></div> */
+struct ContradictAccessors {
+ int mBothAccessors;
+ /** <div rustbindgen accessor="false"></div> */
+ int mNoAccessors;
+ /** <div rustbindgen accessor="unsafe"></div> */
+ int mUnsafeAccessors;
+ /** <div rustbindgen accessor="immutable"></div> */
+ int mImmutableAccessor;
+};
+
+/** <div rustbindgen accessor replaces="Replaced"></div> */
+struct Replacing {
+ int mAccessor;
+};
+
+struct Replaced {
+ int noOp;
+};
+
+/** <div rustbindgen accessor></div> */
+struct Wrapper {
+ Replaced mReplaced;
+};
diff --git a/tests/headers/annotation_hide.hpp b/tests/headers/annotation_hide.hpp
new file mode 100644
index 00000000..3c82c9a2
--- /dev/null
+++ b/tests/headers/annotation_hide.hpp
@@ -0,0 +1,16 @@
+
+/**
+ * <div rustbindgen="true" hide="true"></div>
+ */
+struct C;
+
+/**
+ * <div rustbindgen opaque></div>
+ */
+struct D {
+ int a;
+};
+
+struct NotAnnotated {
+ int f;
+};
diff --git a/tests/headers/anon_enum.hpp b/tests/headers/anon_enum.hpp
new file mode 100644
index 00000000..1961fe6c
--- /dev/null
+++ b/tests/headers/anon_enum.hpp
@@ -0,0 +1,10 @@
+struct Test {
+ int foo;
+ float bar;
+ enum { T_NONE };
+};
+
+typedef enum {
+ Foo,
+ Bar,
+} Baz;
diff --git a/tests/headers/anon_enum_trait.hpp b/tests/headers/anon_enum_trait.hpp
new file mode 100644
index 00000000..e1ec394c
--- /dev/null
+++ b/tests/headers/anon_enum_trait.hpp
@@ -0,0 +1,22 @@
+
+template<typename _Tp>
+class DataType {
+public:
+ typedef _Tp value_type;
+ typedef value_type work_type;
+ typedef value_type channel_type;
+ typedef value_type vec_type;
+ enum { generic_type = 1,
+ depth = -1,
+ channels = 1,
+ fmt = 0,
+ type = -1,
+ };
+};
+
+struct Foo {
+ enum {
+ Bar = 0,
+ Baz = 0,
+ };
+};
diff --git a/tests/headers/anon_enum_whitelist.h b/tests/headers/anon_enum_whitelist.h
new file mode 100644
index 00000000..15cda6b1
--- /dev/null
+++ b/tests/headers/anon_enum_whitelist.h
@@ -0,0 +1,6 @@
+// bindgen-flags: --whitelist-var NODE_.*
+
+enum {
+ NODE_FLAG_FOO,
+ NODE_FLAG_BAR,
+};
diff --git a/tests/headers/anon_union.hpp b/tests/headers/anon_union.hpp
new file mode 100644
index 00000000..126f6a6e
--- /dev/null
+++ b/tests/headers/anon_union.hpp
@@ -0,0 +1,20 @@
+template<typename T>
+struct TErrorResult {
+ enum UnionState {
+ HasMessage,
+ HasException,
+ };
+ int mResult;
+ struct Message;
+ struct DOMExceptionInfo;
+ union {
+ Message* mMessage;
+ DOMExceptionInfo* mDOMExceptionInfo;
+ };
+
+ bool mMightHaveUnreported;
+ UnionState mUnionState;
+};
+
+struct ErrorResult : public TErrorResult<int> {
+};
diff --git a/tests/headers/arg_keyword.hpp b/tests/headers/arg_keyword.hpp
new file mode 100644
index 00000000..9f0af850
--- /dev/null
+++ b/tests/headers/arg_keyword.hpp
@@ -0,0 +1 @@
+void foo(const char* type);
diff --git a/tests/headers/auto.hpp b/tests/headers/auto.hpp
new file mode 100644
index 00000000..b5f6d5f3
--- /dev/null
+++ b/tests/headers/auto.hpp
@@ -0,0 +1,19 @@
+// bindgen-flags: -- -std=c++14
+// bindgen-unstable
+
+class Foo {
+ static constexpr auto kFoo = 2 == 2;
+};
+
+template<typename T>
+class Bar {
+ static const constexpr auto kBar = T(1);
+};
+
+template<typename T> auto Test1() {
+ return T(1);
+}
+
+auto Test2() {
+ return Test1<unsigned int>();
+}
diff --git a/tests/headers/bad-namespace-parenthood-inheritance.hpp b/tests/headers/bad-namespace-parenthood-inheritance.hpp
new file mode 100644
index 00000000..ce21a401
--- /dev/null
+++ b/tests/headers/bad-namespace-parenthood-inheritance.hpp
@@ -0,0 +1,15 @@
+namespace std
+{
+ template < typename > struct char_traits;
+}
+namespace __gnu_cxx
+{
+ template < typename > struct char_traits;
+}
+namespace std
+{
+ template < class _CharT > struct char_traits:__gnu_cxx::char_traits <
+ _CharT >
+ {
+ };
+}
diff --git a/tests/headers/base-to-derived.hpp b/tests/headers/base-to-derived.hpp
new file mode 100644
index 00000000..ea31e0f2
--- /dev/null
+++ b/tests/headers/base-to-derived.hpp
@@ -0,0 +1,19 @@
+// bindgen-flags: -- -std=c++11
+
+struct false_type {};
+
+template<typename _From, typename _To, bool>
+struct __is_base_to_derived_ref;
+
+template<typename _From, typename _To>
+struct __is_base_to_derived_ref<_From, _To, true>
+{
+ typedef _To type;
+
+ static constexpr bool value = type::value;
+};
+
+template<typename _From, typename _To>
+struct __is_base_to_derived_ref<_From, _To, false>
+: public false_type
+{ };
diff --git a/tests/headers/bitfield-enum-basic.hpp b/tests/headers/bitfield-enum-basic.hpp
new file mode 100644
index 00000000..364bebf2
--- /dev/null
+++ b/tests/headers/bitfield-enum-basic.hpp
@@ -0,0 +1,27 @@
+// bindgen-flags: --bitfield-enum "Foo|Buz|NS_.*|DUMMY_.*" -- -std=c++11
+
+enum Foo {
+ Bar = 1 << 1,
+ Baz = 1 << 2,
+ Duplicated = 1 << 2,
+ Negative = -3,
+};
+
+enum class Buz : signed char {
+ Bar = 1 << 1,
+ Baz = 1 << 2,
+ Duplicated = 1 << 2,
+ Negative = -3,
+};
+
+enum {
+ NS_FOO = 1 << 0,
+ NS_BAR = 1 << 1,
+};
+
+class Dummy {
+ enum {
+ DUMMY_FOO = 1 << 0,
+ DUMMY_BAR = 1 << 1,
+ };
+};
diff --git a/tests/headers/bitfield_method_mangling.h b/tests/headers/bitfield_method_mangling.h
new file mode 100644
index 00000000..257648ee
--- /dev/null
+++ b/tests/headers/bitfield_method_mangling.h
@@ -0,0 +1,5 @@
+typedef struct
+{
+ unsigned int pad3: 24;
+ unsigned int type: 8;
+} mach_msg_type_descriptor_t;
diff --git a/tests/headers/blocks.h b/tests/headers/blocks.h
new file mode 100644
index 00000000..80420e6e
--- /dev/null
+++ b/tests/headers/blocks.h
@@ -0,0 +1,3 @@
+// bindgen-flags: -- -fblocks
+
+void atexit_b(void (^)(void));
diff --git a/tests/headers/canonical_path_without_namespacing.hpp b/tests/headers/canonical_path_without_namespacing.hpp
new file mode 100644
index 00000000..92e85842
--- /dev/null
+++ b/tests/headers/canonical_path_without_namespacing.hpp
@@ -0,0 +1,7 @@
+// bindgen-flags: --disable-name-namespacing
+
+namespace foo {
+ struct Bar {};
+}
+
+void baz(foo::Bar*);
diff --git a/tests/headers/class.hpp b/tests/headers/class.hpp
new file mode 100644
index 00000000..e753f186
--- /dev/null
+++ b/tests/headers/class.hpp
@@ -0,0 +1,29 @@
+class C {
+ int a;
+ // More than rust limits (32)
+ char big_array[33];
+};
+
+class WithDtor {
+ int b;
+
+ ~WithDtor() {}
+};
+
+union Union {
+ float d;
+ int i;
+};
+
+class WithUnion {
+ Union data;
+};
+
+class RealAbstractionWithTonsOfMethods {
+ void foo();
+public:
+ void bar() const;
+ void bar();
+ void bar(int foo);
+ static void sta();
+};
diff --git a/tests/headers/class_nested.hpp b/tests/headers/class_nested.hpp
new file mode 100644
index 00000000..ab38d500
--- /dev/null
+++ b/tests/headers/class_nested.hpp
@@ -0,0 +1,24 @@
+class A {
+public:
+ int member_a;
+ class B {
+ int member_b;
+ };
+};
+
+A::B var;
+
+class D {
+ A::B member;
+};
+
+template<typename T>
+class Templated {
+ T member;
+
+ class Templated_inner {
+ public:
+ T* member_ptr;
+ void get() {}
+ };
+};
diff --git a/tests/headers/class_no_members.hpp b/tests/headers/class_no_members.hpp
new file mode 100644
index 00000000..a4483558
--- /dev/null
+++ b/tests/headers/class_no_members.hpp
@@ -0,0 +1,16 @@
+// bindgen-flags: -- -std=c++11
+
+class whatever {
+};
+
+class whatever_child: public whatever {
+};
+
+class whatever_child_with_member: public whatever {
+public:
+ int m_member;
+};
+
+static_assert(sizeof(whatever) == 1, "Testing!");
+static_assert(sizeof(whatever_child) == 1, "Testing!");
+static_assert(sizeof(whatever_child_with_member) == 4, "Testing!");
diff --git a/tests/headers/class_static.hpp b/tests/headers/class_static.hpp
new file mode 100644
index 00000000..21ab2321
--- /dev/null
+++ b/tests/headers/class_static.hpp
@@ -0,0 +1,7 @@
+class MyClass {
+public:
+ static const int* example;
+ static const int* example_check_no_collision;
+};
+
+static const int* example_check_no_collision;
diff --git a/tests/headers/class_static_const.hpp b/tests/headers/class_static_const.hpp
new file mode 100644
index 00000000..150afe8b
--- /dev/null
+++ b/tests/headers/class_static_const.hpp
@@ -0,0 +1,8 @@
+using int32_t = int;
+typedef unsigned int uint32_t;
+
+class A {
+ static const int a = 0;
+ static const int32_t b = 077;
+ static const uint32_t c = 0xff;
+};
diff --git a/tests/headers/class_use_as.hpp b/tests/headers/class_use_as.hpp
new file mode 100644
index 00000000..a4e36ded
--- /dev/null
+++ b/tests/headers/class_use_as.hpp
@@ -0,0 +1,15 @@
+
+/**
+ * <div rustbindgen="true" replaces="whatever"></div>
+ */
+struct whatever_replacement {
+ int replacement;
+};
+
+struct whatever {
+ int b;
+};
+
+struct container {
+ whatever c;
+};
diff --git a/tests/headers/class_with_dtor.hpp b/tests/headers/class_with_dtor.hpp
new file mode 100644
index 00000000..b9bf74e1
--- /dev/null
+++ b/tests/headers/class_with_dtor.hpp
@@ -0,0 +1,13 @@
+
+
+template <typename T>
+class HandleWithDtor {
+ T* ptr;
+ ~HandleWithDtor() {}
+};
+
+typedef HandleWithDtor<int> HandleValue;
+
+class WithoutDtor {
+ HandleValue shouldBeWithDtor;
+};
diff --git a/tests/headers/class_with_inner_struct.hpp b/tests/headers/class_with_inner_struct.hpp
new file mode 100644
index 00000000..ec729fe6
--- /dev/null
+++ b/tests/headers/class_with_inner_struct.hpp
@@ -0,0 +1,43 @@
+// bindgen-flags: -- -std=c++11
+
+class A {
+ unsigned c;
+ struct Segment { int begin, end; };
+ union {
+ int f;
+ } named_union;
+ union {
+ int d;
+ };
+};
+
+class B {
+ unsigned d;
+ struct Segment { int begin, end; };
+};
+
+
+enum class StepSyntax {
+ Keyword, // step-start and step-end
+ FunctionalWithoutKeyword, // steps(...)
+ FunctionalWithStartKeyword, // steps(..., start)
+ FunctionalWithEndKeyword, // steps(..., end)
+};
+
+class C {
+ unsigned d;
+ union {
+ struct {
+ float mX1;
+ float mY1;
+ float mX2;
+ float mY2;
+ } mFunc;
+ struct {
+ StepSyntax mStepSyntax;
+ unsigned int mSteps;
+ };
+ };
+ // To ensure it doesn't collide
+ struct Segment { int begin, end; };
+};
diff --git a/tests/headers/class_with_typedef.hpp b/tests/headers/class_with_typedef.hpp
new file mode 100644
index 00000000..8707cffe
--- /dev/null
+++ b/tests/headers/class_with_typedef.hpp
@@ -0,0 +1,22 @@
+typedef int AnotherInt;
+
+class C {
+public:
+ typedef int MyInt;
+ typedef const char* Lookup;
+ MyInt c;
+ MyInt* ptr;
+ MyInt arr[10];
+ AnotherInt d;
+ AnotherInt* other_ptr;
+
+ void method(MyInt c);
+ void methodRef(MyInt& c);
+ void complexMethodRef(Lookup& c);
+ void anotherMethod(AnotherInt c);
+};
+
+class D: public C {
+public:
+ MyInt* ptr;
+};
diff --git a/tests/headers/complex.h b/tests/headers/complex.h
new file mode 100644
index 00000000..04877a4e
--- /dev/null
+++ b/tests/headers/complex.h
@@ -0,0 +1,16 @@
+
+#define COMPLEX_TEST(ty_, name_) \
+ struct Test##name_ { \
+ ty_ _Complex mMember; \
+ \
+ }; \
+ struct Test##name_##Ptr { \
+ ty_ _Complex* mMember; \
+ };
+
+COMPLEX_TEST(double, Double)
+COMPLEX_TEST(float, Float)
+
+// FIXME: 128-byte-aligned in some machines
+// which we can't support right now in Rust.
+// COMPLEX_TEST(long double, LongDouble)
diff --git a/tests/headers/complex_global.h b/tests/headers/complex_global.h
new file mode 100644
index 00000000..d9f9fb01
--- /dev/null
+++ b/tests/headers/complex_global.h
@@ -0,0 +1,3 @@
+float _Complex globalValueFloat;
+double _Complex globalValueDouble;
+long double _Complex globalValueLongDouble;
diff --git a/tests/headers/const_bool.hpp b/tests/headers/const_bool.hpp
new file mode 100644
index 00000000..633a7c90
--- /dev/null
+++ b/tests/headers/const_bool.hpp
@@ -0,0 +1,9 @@
+// bindgen-unstable
+
+const bool k = true;
+struct A {
+ static const bool k = false;
+};
+
+typedef bool foo;
+const foo k2 = true;
diff --git a/tests/headers/const_enum_unnamed.hpp b/tests/headers/const_enum_unnamed.hpp
new file mode 100644
index 00000000..eb139434
--- /dev/null
+++ b/tests/headers/const_enum_unnamed.hpp
@@ -0,0 +1,9 @@
+
+enum {
+ FOO_BAR,
+ FOO_BAZ,
+};
+
+class Foo {
+ enum { FOO_BAR = 10 };
+};
diff --git a/tests/headers/const_ptr.hpp b/tests/headers/const_ptr.hpp
new file mode 100644
index 00000000..66744f8b
--- /dev/null
+++ b/tests/headers/const_ptr.hpp
@@ -0,0 +1,3 @@
+extern "C" {
+ void foo(const void* bar);
+}
diff --git a/tests/headers/const_resolved_ty.h b/tests/headers/const_resolved_ty.h
new file mode 100644
index 00000000..2521e61c
--- /dev/null
+++ b/tests/headers/const_resolved_ty.h
@@ -0,0 +1,3 @@
+typedef unsigned char uint8_t;
+
+void foo(const uint8_t* foo);
diff --git a/tests/headers/const_tparam.hpp b/tests/headers/const_tparam.hpp
new file mode 100644
index 00000000..05f26e4a
--- /dev/null
+++ b/tests/headers/const_tparam.hpp
@@ -0,0 +1,5 @@
+template<typename T>
+class C {
+ const T* const foo;
+ const T* bar;
+};
diff --git a/tests/headers/constant-evaluate.h b/tests/headers/constant-evaluate.h
new file mode 100644
index 00000000..f9f1fa66
--- /dev/null
+++ b/tests/headers/constant-evaluate.h
@@ -0,0 +1,19 @@
+// bindgen-unstable
+
+enum {
+ foo = 4,
+ bar = 8,
+};
+
+typedef unsigned long long EasyToOverflow;
+const EasyToOverflow k = 0x80000000;
+
+const EasyToOverflow k_expr = 1ULL << 60;
+
+const long long BAZ = (1 << foo) | bar;
+const double fuzz = (1 + 50.0f);
+const char BAZZ = '5';
+const char WAT = '\0';
+
+const char* bytestring = "Foo";
+const char* NOT_UTF8 = "\xf0\x28\x8c\x28";
diff --git a/tests/headers/constify-enum.h b/tests/headers/constify-enum.h
new file mode 100644
index 00000000..a5b4052c
--- /dev/null
+++ b/tests/headers/constify-enum.h
@@ -0,0 +1,13 @@
+
+enum nsCSSPropertyID {
+ eCSSProperty_a,
+ eCSSProperty_b,
+
+ eCSSProperty_COUNT, /**< <div rustbindgen constant></div> */
+ eCSSProperty_COUNT_DUMMY2 = eCSSProperty_COUNT - 1, /**< <div rustbindgen hide></div> */
+
+ eCSSPropertyAlias_aa,
+ eCSSPropertyAlias_bb,
+
+ eCSSProperty_COUNT_unexistingVariantValue, /**< <div rustbindgen constant></div> */
+};
diff --git a/tests/headers/constructor-tp.hpp b/tests/headers/constructor-tp.hpp
new file mode 100644
index 00000000..6e55ea78
--- /dev/null
+++ b/tests/headers/constructor-tp.hpp
@@ -0,0 +1,26 @@
+
+template<typename T>
+class Foo {
+public:
+ Foo();
+
+ void doBaz();
+};
+
+template<typename T>
+inline void
+Foo<T>::doBaz() {
+}
+
+class Bar {
+public:
+ Bar();
+};
+
+template<typename T>
+Foo<T>::Foo() {
+}
+
+inline
+Bar::Bar() {
+}
diff --git a/tests/headers/constructors.hpp b/tests/headers/constructors.hpp
new file mode 100644
index 00000000..d4174889
--- /dev/null
+++ b/tests/headers/constructors.hpp
@@ -0,0 +1,13 @@
+
+class TestOverload {
+ // This one shouldnt' be generated.
+ TestOverload();
+public:
+ TestOverload(int);
+ TestOverload(double);
+};
+
+class TestPublicNoArgs {
+public:
+ TestPublicNoArgs();
+};
diff --git a/tests/headers/convert-floats.h b/tests/headers/convert-floats.h
new file mode 100644
index 00000000..08d9fe0b
--- /dev/null
+++ b/tests/headers/convert-floats.h
@@ -0,0 +1,9 @@
+// bindgen-flags: --no-convert-floats
+
+struct foo {
+ float bar, baz;
+ double bazz;
+ long double* bazzz;
+ float _Complex complexFloat;
+ double _Complex complexDouble;
+};
diff --git a/tests/headers/crtp.hpp b/tests/headers/crtp.hpp
new file mode 100644
index 00000000..a5477c54
--- /dev/null
+++ b/tests/headers/crtp.hpp
@@ -0,0 +1,12 @@
+template<class T>
+class Base {};
+
+class Derived : public Base<Derived> {};
+
+template<class T>
+class BaseWithDestructor {
+ ~BaseWithDestructor();
+};
+
+class DerivedFromBaseWithDestructor :
+ public BaseWithDestructor<DerivedFromBaseWithDestructor> {};
diff --git a/tests/headers/dash_language.h b/tests/headers/dash_language.h
new file mode 100644
index 00000000..4c8bb58d
--- /dev/null
+++ b/tests/headers/dash_language.h
@@ -0,0 +1,6 @@
+// bindgen-flags: -- -x c++ --std=c++11
+
+template<typename T>
+struct Foo {
+ int bar;
+};
diff --git a/tests/headers/decl_extern_int_twice.h b/tests/headers/decl_extern_int_twice.h
new file mode 100644
index 00000000..06f80e87
--- /dev/null
+++ b/tests/headers/decl_extern_int_twice.h
@@ -0,0 +1,2 @@
+extern int foo;
+extern int foo;
diff --git a/tests/headers/decl_ptr_to_array.h b/tests/headers/decl_ptr_to_array.h
new file mode 100644
index 00000000..3222cbd4
--- /dev/null
+++ b/tests/headers/decl_ptr_to_array.h
@@ -0,0 +1 @@
+int (*foo)[1];
diff --git a/tests/headers/disable-namespacing.hpp b/tests/headers/disable-namespacing.hpp
new file mode 100644
index 00000000..11191361
--- /dev/null
+++ b/tests/headers/disable-namespacing.hpp
@@ -0,0 +1,9 @@
+// bindgen-flags: --disable-name-namespacing
+
+namespace foo {
+namespace bar {
+
+typedef int Baz;
+
+}
+}
diff --git a/tests/headers/duplicated-namespaces-definitions.hpp b/tests/headers/duplicated-namespaces-definitions.hpp
new file mode 100644
index 00000000..7c8888de
--- /dev/null
+++ b/tests/headers/duplicated-namespaces-definitions.hpp
@@ -0,0 +1,18 @@
+// bindgen-flags: --enable-cxx-namespaces
+
+namespace foo {
+ class Bar;
+}
+
+namespace bar {
+ struct Foo {
+ foo::Bar* ptr;
+ };
+};
+
+namespace foo {
+ class Bar {
+ int foo;
+ bool baz;
+ };
+}
diff --git a/tests/headers/duplicated-namespaces.hpp b/tests/headers/duplicated-namespaces.hpp
new file mode 100644
index 00000000..10e1933f
--- /dev/null
+++ b/tests/headers/duplicated-namespaces.hpp
@@ -0,0 +1,4 @@
+// bindgen-flags: --enable-cxx-namespaces
+
+namespace std {}
+namespace std {}
diff --git a/tests/headers/duplicated_constants_in_ns.hpp b/tests/headers/duplicated_constants_in_ns.hpp
new file mode 100644
index 00000000..bb343641
--- /dev/null
+++ b/tests/headers/duplicated_constants_in_ns.hpp
@@ -0,0 +1,7 @@
+// bindgen-flags: --enable-cxx-namespaces
+namespace foo {
+ const int FOO = 4;
+}
+namespace bar {
+ const int FOO = 5;
+}
diff --git a/tests/headers/elaborated.hpp b/tests/headers/elaborated.hpp
new file mode 100644
index 00000000..4bfbff23
--- /dev/null
+++ b/tests/headers/elaborated.hpp
@@ -0,0 +1,5 @@
+namespace whatever {
+ typedef int whatever_t;
+}
+
+void something(const whatever::whatever_t *wat);
diff --git a/tests/headers/empty_template_param_name.hpp b/tests/headers/empty_template_param_name.hpp
new file mode 100644
index 00000000..0e9f3c34
--- /dev/null
+++ b/tests/headers/empty_template_param_name.hpp
@@ -0,0 +1,6 @@
+// bindgen-flags: -- -std=c++11
+
+template<typename...> using __void_t = void;
+
+template<typename _Iterator, typename = __void_t<>>
+ struct __iterator_traits { };
diff --git a/tests/headers/enum.h b/tests/headers/enum.h
new file mode 100644
index 00000000..f2d301e7
--- /dev/null
+++ b/tests/headers/enum.h
@@ -0,0 +1,9 @@
+enum Foo {
+ Bar = 0,
+ Qux
+};
+
+enum Neg {
+ MinusOne = -1,
+ One = 1,
+};
diff --git a/tests/headers/enum_alias.hpp b/tests/headers/enum_alias.hpp
new file mode 100644
index 00000000..658f8fde
--- /dev/null
+++ b/tests/headers/enum_alias.hpp
@@ -0,0 +1,7 @@
+// bindgen-flags: -- -std=c++11
+
+typedef unsigned char uint8_t;
+
+enum Bar : uint8_t {
+ VAL
+};
diff --git a/tests/headers/enum_and_vtable_mangling.hpp b/tests/headers/enum_and_vtable_mangling.hpp
new file mode 100644
index 00000000..3abd6a29
--- /dev/null
+++ b/tests/headers/enum_and_vtable_mangling.hpp
@@ -0,0 +1,11 @@
+
+enum {
+ match,
+ whatever_else,
+};
+
+class C {
+ int i;
+public:
+ virtual void match() { };
+};
diff --git a/tests/headers/enum_dupe.h b/tests/headers/enum_dupe.h
new file mode 100644
index 00000000..6d3591d5
--- /dev/null
+++ b/tests/headers/enum_dupe.h
@@ -0,0 +1,4 @@
+enum Foo {
+ Bar = 1,
+ Dupe = 1
+};
diff --git a/tests/headers/enum_explicit_type.hpp b/tests/headers/enum_explicit_type.hpp
new file mode 100644
index 00000000..78eadd40
--- /dev/null
+++ b/tests/headers/enum_explicit_type.hpp
@@ -0,0 +1,28 @@
+// bindgen-flags: -- -std=c++11
+
+enum Foo: unsigned char {
+ Bar = 0,
+ Qux
+};
+
+enum Neg: char {
+ MinusOne = -1,
+ One = 1,
+};
+
+enum Bigger: unsigned short {
+ Much = 255,
+ Larger
+};
+
+enum MuchLong: long {
+ MuchLow = -4294967296,
+};
+
+enum MuchLongLong: long long {
+ I64_MIN = 1ll << 63,
+};
+
+enum MuchULongLong: unsigned long long {
+ MuchHigh = 4294967296,
+};
diff --git a/tests/headers/enum_in_template_with_typedef.hpp b/tests/headers/enum_in_template_with_typedef.hpp
new file mode 100644
index 00000000..ac19b781
--- /dev/null
+++ b/tests/headers/enum_in_template_with_typedef.hpp
@@ -0,0 +1,16 @@
+// bindgen-flags: -- -std=c++11
+
+namespace std {
+ template <typename Char> class fbstring_core;
+}
+
+typedef unsigned char uint8_t;
+namespace std {
+ template <typename Char> class fbstring_core {
+ typedef uint8_t category_type;
+ enum Category : category_type {
+ Foo = 1,
+ Bar = 4,
+ };
+ };
+}
diff --git a/tests/headers/enum_negative.h b/tests/headers/enum_negative.h
new file mode 100644
index 00000000..6cbdfe04
--- /dev/null
+++ b/tests/headers/enum_negative.h
@@ -0,0 +1,4 @@
+enum Foo {
+ Bar = -2,
+ Qux = 1,
+};
diff --git a/tests/headers/enum_packed.h b/tests/headers/enum_packed.h
new file mode 100644
index 00000000..8654d110
--- /dev/null
+++ b/tests/headers/enum_packed.h
@@ -0,0 +1,14 @@
+enum __attribute__((packed)) Foo {
+ Bar = 0,
+ Qux
+};
+
+enum __attribute__((packed)) Neg {
+ MinusOne = -1,
+ One = 1,
+};
+
+enum __attribute__((packed)) Bigger {
+ Much = 255,
+ Larger
+};
diff --git a/tests/headers/eval-variadic-template-parameter.hpp b/tests/headers/eval-variadic-template-parameter.hpp
new file mode 100644
index 00000000..0a9e51c1
--- /dev/null
+++ b/tests/headers/eval-variadic-template-parameter.hpp
@@ -0,0 +1,8 @@
+// bindgen-flags: -- -std=c++11
+
+template <typename... T>
+struct B {
+ // Can't generate anything meaningful in Rust for this, but we shouldn't
+ // trigger an assertion inside Clang.
+ static const long c = sizeof...(T);
+};
diff --git a/tests/headers/extern.hpp b/tests/headers/extern.hpp
new file mode 100644
index 00000000..0779e038
--- /dev/null
+++ b/tests/headers/extern.hpp
@@ -0,0 +1,3 @@
+extern "C" {
+#include "func_proto.h"
+}
diff --git a/tests/headers/float128.hpp b/tests/headers/float128.hpp
new file mode 100644
index 00000000..f554e88e
--- /dev/null
+++ b/tests/headers/float128.hpp
@@ -0,0 +1,13 @@
+// FIXME: libclang < 3.9 does not expose `__float128` in its interface, so this
+// test will fail. Once we remove support for `--features llvm_stable` and
+// require libclang >= 3.9, we can reenable this test.
+//
+// static __float128 global = 1.0;
+
+// FIXME: We have no way to get 128 bit aligned structs in Rust at the moment,
+// and therefore the generated layout tests for this struct will fail. When we
+// can enforce 128 bit alignment, we can re-enable this test.
+//
+// struct A {
+// __float128 f;
+// };
diff --git a/tests/headers/forward-inherit-struct-with-fields.hpp b/tests/headers/forward-inherit-struct-with-fields.hpp
new file mode 100644
index 00000000..437fff5d
--- /dev/null
+++ b/tests/headers/forward-inherit-struct-with-fields.hpp
@@ -0,0 +1,8 @@
+template <typename> class Rooted;
+namespace js {
+ template <typename T> class RootedBase {
+ T* foo;
+ Rooted<T>* next;
+ };
+}
+template <typename T> class Rooted : js::RootedBase<T> {};
diff --git a/tests/headers/forward-inherit-struct.hpp b/tests/headers/forward-inherit-struct.hpp
new file mode 100644
index 00000000..ac7aef5e
--- /dev/null
+++ b/tests/headers/forward-inherit-struct.hpp
@@ -0,0 +1,5 @@
+template <typename> class Rooted;
+namespace js {
+ template <typename T> class RootedBase {};
+}
+template <typename T> class Rooted : js::RootedBase<T> {};
diff --git a/tests/headers/forward_declared_struct.h b/tests/headers/forward_declared_struct.h
new file mode 100644
index 00000000..2a69450c
--- /dev/null
+++ b/tests/headers/forward_declared_struct.h
@@ -0,0 +1,11 @@
+struct a;
+
+struct a {
+ int b;
+};
+
+struct c {
+ int d;
+};
+
+struct c; \ No newline at end of file
diff --git a/tests/headers/func_proto.h b/tests/headers/func_proto.h
new file mode 100644
index 00000000..51139ca9
--- /dev/null
+++ b/tests/headers/func_proto.h
@@ -0,0 +1 @@
+typedef int foo(int bar);
diff --git a/tests/headers/func_ptr.h b/tests/headers/func_ptr.h
new file mode 100644
index 00000000..a4662f3d
--- /dev/null
+++ b/tests/headers/func_ptr.h
@@ -0,0 +1 @@
+int (*foo) (int x, int y);
diff --git a/tests/headers/func_ptr_in_struct.h b/tests/headers/func_ptr_in_struct.h
new file mode 100644
index 00000000..988db5b3
--- /dev/null
+++ b/tests/headers/func_ptr_in_struct.h
@@ -0,0 +1,6 @@
+
+enum baz;
+
+struct Foo {
+ enum baz (*bar) (int x, int y);
+};
diff --git a/tests/headers/func_with_array_arg.h b/tests/headers/func_with_array_arg.h
new file mode 100644
index 00000000..1b81702b
--- /dev/null
+++ b/tests/headers/func_with_array_arg.h
@@ -0,0 +1 @@
+void f(int x[2]);
diff --git a/tests/headers/func_with_func_ptr_arg.h b/tests/headers/func_with_func_ptr_arg.h
new file mode 100644
index 00000000..629c84ab
--- /dev/null
+++ b/tests/headers/func_with_func_ptr_arg.h
@@ -0,0 +1 @@
+void foo(void (*bar)());
diff --git a/tests/headers/in_class_typedef.hpp b/tests/headers/in_class_typedef.hpp
new file mode 100644
index 00000000..dda7472d
--- /dev/null
+++ b/tests/headers/in_class_typedef.hpp
@@ -0,0 +1,10 @@
+
+template<typename T>
+class Foo {
+ typedef T elem_type;
+ typedef T* ptr_type;
+
+ typedef struct Bar {
+ int x, y;
+ } Bar;
+};
diff --git a/tests/headers/inherit-namespaced.hpp b/tests/headers/inherit-namespaced.hpp
new file mode 100644
index 00000000..61eafd5a
--- /dev/null
+++ b/tests/headers/inherit-namespaced.hpp
@@ -0,0 +1,4 @@
+namespace js {
+ template <typename T> class RootedBase {};
+}
+template <typename T> class Rooted : js::RootedBase<T> {};
diff --git a/tests/headers/inherit_named.hpp b/tests/headers/inherit_named.hpp
new file mode 100644
index 00000000..9881d1b6
--- /dev/null
+++ b/tests/headers/inherit_named.hpp
@@ -0,0 +1,5 @@
+template<typename T>
+class Wohoo {};
+
+template<typename T>
+class Weeee : public T {};
diff --git a/tests/headers/inherit_typedef.hpp b/tests/headers/inherit_typedef.hpp
new file mode 100644
index 00000000..8d699e82
--- /dev/null
+++ b/tests/headers/inherit_typedef.hpp
@@ -0,0 +1,5 @@
+struct Foo {};
+
+typedef Foo TypedefedFoo;
+
+struct Bar: public TypedefedFoo {};
diff --git a/tests/headers/inline-function.h b/tests/headers/inline-function.h
new file mode 100644
index 00000000..02cb7c08
--- /dev/null
+++ b/tests/headers/inline-function.h
@@ -0,0 +1,6 @@
+// bindgen-unstable
+
+/** The point of this test is to _not_ generate these functions. */
+
+inline static int myadd(const int x, const int y) { return x + y; }
+static int mysub(const int x, const int y) { return x - y; }
diff --git a/tests/headers/inline_namespace.hpp b/tests/headers/inline_namespace.hpp
new file mode 100644
index 00000000..2ccf8ab0
--- /dev/null
+++ b/tests/headers/inline_namespace.hpp
@@ -0,0 +1,11 @@
+// bindgen-flags: --enable-cxx-namespaces -- -std=c++11
+
+namespace foo {
+ inline namespace bar {
+ using Ty = int;
+ };
+};
+
+class Bar {
+ foo::Ty baz;
+};
diff --git a/tests/headers/inline_namespace_conservative.hpp b/tests/headers/inline_namespace_conservative.hpp
new file mode 100644
index 00000000..50068a2e
--- /dev/null
+++ b/tests/headers/inline_namespace_conservative.hpp
@@ -0,0 +1,12 @@
+// bindgen-flags: --enable-cxx-namespaces --conservative-inline-namespaces -- -std=c++11
+
+namespace foo {
+ inline namespace bar {
+ using Ty = int;
+ };
+ using Ty = long long;
+};
+
+class Bar {
+ foo::bar::Ty baz;
+};
diff --git a/tests/headers/inline_namespace_whitelist.hpp b/tests/headers/inline_namespace_whitelist.hpp
new file mode 100644
index 00000000..30047bbe
--- /dev/null
+++ b/tests/headers/inline_namespace_whitelist.hpp
@@ -0,0 +1,7 @@
+// bindgen-flags: --enable-cxx-namespaces --whitelist-type=std::string -- -std=c++11
+
+namespace std {
+ inline namespace bar {
+ using string = const char*;
+ };
+};
diff --git a/tests/headers/inner_const.hpp b/tests/headers/inner_const.hpp
new file mode 100644
index 00000000..25c2e603
--- /dev/null
+++ b/tests/headers/inner_const.hpp
@@ -0,0 +1,6 @@
+
+class Foo {
+ static int BOO;
+ static Foo whatever;
+ int bar;
+};
diff --git a/tests/headers/inner_template_self.hpp b/tests/headers/inner_template_self.hpp
new file mode 100644
index 00000000..1ae5af06
--- /dev/null
+++ b/tests/headers/inner_template_self.hpp
@@ -0,0 +1,10 @@
+
+template <typename T>
+class LinkedList {
+ LinkedList<T>* next;
+ LinkedList* prev;
+};
+
+class InstantiateIt {
+ LinkedList<int> m_list;
+};
diff --git a/tests/headers/int128_t.h b/tests/headers/int128_t.h
new file mode 100644
index 00000000..eece252c
--- /dev/null
+++ b/tests/headers/int128_t.h
@@ -0,0 +1,7 @@
+/**
+ * FIXME: Uncomment this once we can generate the proper alignment for the type,
+ * i.e., when we use u128/i128.
+struct Foo {
+ __int128 foo;
+};
+ */
diff --git a/tests/headers/issue-358.hpp b/tests/headers/issue-358.hpp
new file mode 100644
index 00000000..b14521b7
--- /dev/null
+++ b/tests/headers/issue-358.hpp
@@ -0,0 +1,8 @@
+// bindgen-flags: -- -std=c++11
+namespace JS {
+template <typename> class PersistentRooted;
+}
+template <typename> class a { a *b; };
+namespace JS {
+template <typename c> class PersistentRooted : a<PersistentRooted<c>> {};
+}
diff --git a/tests/headers/issue-372.hpp b/tests/headers/issue-372.hpp
new file mode 100644
index 00000000..a072f061
--- /dev/null
+++ b/tests/headers/issue-372.hpp
@@ -0,0 +1,16 @@
+// bindgen-flags: --enable-cxx-namespaces
+template <typename a, int b> class c { a e[b]; };
+class d;
+template <typename g, g f> class C { c<d, f> h; };
+class i {
+ i *j;
+ i *k;
+ bool l;
+};
+class d {
+ i m;
+};
+enum n { o, p, q, r, s, t, b, ae, e, ag, ah, ai };
+class F {
+ C<n, ai> w;
+};
diff --git a/tests/headers/issue_311.hpp b/tests/headers/issue_311.hpp
new file mode 100644
index 00000000..a8d7fd99
--- /dev/null
+++ b/tests/headers/issue_311.hpp
@@ -0,0 +1,5 @@
+// bindgen-flags: --enable-cxx-namespaces
+
+struct jsval_layout {
+ struct {};
+};
diff --git a/tests/headers/issue_315.hpp b/tests/headers/issue_315.hpp
new file mode 100644
index 00000000..e58cb5e3
--- /dev/null
+++ b/tests/headers/issue_315.hpp
@@ -0,0 +1,2 @@
+/// <div rustbindgen replaces="c"></div>
+template <typename a> using b = a;
diff --git a/tests/headers/jsval_layout_opaque.hpp b/tests/headers/jsval_layout_opaque.hpp
new file mode 100644
index 00000000..85c5be63
--- /dev/null
+++ b/tests/headers/jsval_layout_opaque.hpp
@@ -0,0 +1,424 @@
+// bindgen-flags: --no-unstable-rust -- -std=c++11
+
+/**
+ * These typedefs are hacky, but keep our tests consistent across 64-bit
+ * platforms, otherwise the id's change and our CI is unhappy.
+ */
+typedef unsigned char uint8_t;
+typedef int int32_t;
+typedef unsigned int uint32_t;
+typedef unsigned long long uint64_t;
+typedef unsigned long long size_t;
+typedef unsigned long long uintptr_t;
+
+
+#define JS_PUNBOX64
+#define IS_LITTLE_ENDIAN
+
+/*
+ * Try to get jsvals 64-bit aligned. We could almost assert that all values are
+ * aligned, but MSVC and GCC occasionally break alignment.
+ */
+#if defined(__GNUC__) || defined(__xlc__) || defined(__xlC__)
+# define JSVAL_ALIGNMENT __attribute__((aligned (8)))
+#elif defined(_MSC_VER)
+ /*
+ * Structs can be aligned with MSVC, but not if they are used as parameters,
+ * so we just don't try to align.
+ */
+# define JSVAL_ALIGNMENT
+#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+# define JSVAL_ALIGNMENT
+#elif defined(__HP_cc) || defined(__HP_aCC)
+# define JSVAL_ALIGNMENT
+#endif
+
+#if defined(JS_PUNBOX64)
+# define JSVAL_TAG_SHIFT 47
+#endif
+
+/*
+ * We try to use enums so that printing a jsval_layout in the debugger shows
+ * nice symbolic type tags, however we can only do this when we can force the
+ * underlying type of the enum to be the desired size.
+ */
+#if !defined(__SUNPRO_CC) && !defined(__xlC__)
+
+#if defined(_MSC_VER)
+# define JS_ENUM_HEADER(id, type) enum id : type
+# define JS_ENUM_FOOTER(id)
+#else
+# define JS_ENUM_HEADER(id, type) enum id
+# define JS_ENUM_FOOTER(id) __attribute__((packed))
+#endif
+
+/* Remember to propagate changes to the C defines below. */
+JS_ENUM_HEADER(JSValueType, uint8_t)
+{
+ JSVAL_TYPE_DOUBLE = 0x00,
+ JSVAL_TYPE_INT32 = 0x01,
+ JSVAL_TYPE_UNDEFINED = 0x02,
+ JSVAL_TYPE_BOOLEAN = 0x03,
+ JSVAL_TYPE_MAGIC = 0x04,
+ JSVAL_TYPE_STRING = 0x05,
+ JSVAL_TYPE_SYMBOL = 0x06,
+ JSVAL_TYPE_NULL = 0x07,
+ JSVAL_TYPE_OBJECT = 0x08,
+
+ /* These never appear in a jsval; they are only provided as an out-of-band value. */
+ JSVAL_TYPE_UNKNOWN = 0x20,
+ JSVAL_TYPE_MISSING = 0x21
+} JS_ENUM_FOOTER(JSValueType);
+
+static_assert(sizeof(JSValueType) == 1,
+ "compiler typed enum support is apparently buggy");
+
+#if defined(JS_NUNBOX32)
+
+/* Remember to propagate changes to the C defines below. */
+JS_ENUM_HEADER(JSValueTag, uint32_t)
+{
+ JSVAL_TAG_CLEAR = 0xFFFFFF80,
+ JSVAL_TAG_INT32 = JSVAL_TAG_CLEAR | JSVAL_TYPE_INT32,
+ JSVAL_TAG_UNDEFINED = JSVAL_TAG_CLEAR | JSVAL_TYPE_UNDEFINED,
+ JSVAL_TAG_STRING = JSVAL_TAG_CLEAR | JSVAL_TYPE_STRING,
+ JSVAL_TAG_SYMBOL = JSVAL_TAG_CLEAR | JSVAL_TYPE_SYMBOL,
+ JSVAL_TAG_BOOLEAN = JSVAL_TAG_CLEAR | JSVAL_TYPE_BOOLEAN,
+ JSVAL_TAG_MAGIC = JSVAL_TAG_CLEAR | JSVAL_TYPE_MAGIC,
+ JSVAL_TAG_NULL = JSVAL_TAG_CLEAR | JSVAL_TYPE_NULL,
+ JSVAL_TAG_OBJECT = JSVAL_TAG_CLEAR | JSVAL_TYPE_OBJECT
+} JS_ENUM_FOOTER(JSValueTag);
+
+static_assert(sizeof(JSValueTag) == sizeof(uint32_t),
+ "compiler typed enum support is apparently buggy");
+
+#elif defined(JS_PUNBOX64)
+
+/* Remember to propagate changes to the C defines below. */
+JS_ENUM_HEADER(JSValueTag, uint32_t)
+{
+ JSVAL_TAG_MAX_DOUBLE = 0x1FFF0,
+ JSVAL_TAG_INT32 = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_INT32,
+ JSVAL_TAG_UNDEFINED = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_UNDEFINED,
+ JSVAL_TAG_STRING = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_STRING,
+ JSVAL_TAG_SYMBOL = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_SYMBOL,
+ JSVAL_TAG_BOOLEAN = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_BOOLEAN,
+ JSVAL_TAG_MAGIC = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_MAGIC,
+ JSVAL_TAG_NULL = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_NULL,
+ JSVAL_TAG_OBJECT = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_OBJECT
+} JS_ENUM_FOOTER(JSValueTag);
+
+static_assert(sizeof(JSValueTag) == sizeof(uint32_t),
+ "compiler typed enum support is apparently buggy");
+
+JS_ENUM_HEADER(JSValueShiftedTag, uint64_t)
+{
+ JSVAL_SHIFTED_TAG_MAX_DOUBLE = ((((uint64_t)JSVAL_TAG_MAX_DOUBLE) << JSVAL_TAG_SHIFT) | 0xFFFFFFFF),
+ JSVAL_SHIFTED_TAG_INT32 = (((uint64_t)JSVAL_TAG_INT32) << JSVAL_TAG_SHIFT),
+ JSVAL_SHIFTED_TAG_UNDEFINED = (((uint64_t)JSVAL_TAG_UNDEFINED) << JSVAL_TAG_SHIFT),
+ JSVAL_SHIFTED_TAG_STRING = (((uint64_t)JSVAL_TAG_STRING) << JSVAL_TAG_SHIFT),
+ JSVAL_SHIFTED_TAG_SYMBOL = (((uint64_t)JSVAL_TAG_SYMBOL) << JSVAL_TAG_SHIFT),
+ JSVAL_SHIFTED_TAG_BOOLEAN = (((uint64_t)JSVAL_TAG_BOOLEAN) << JSVAL_TAG_SHIFT),
+ JSVAL_SHIFTED_TAG_MAGIC = (((uint64_t)JSVAL_TAG_MAGIC) << JSVAL_TAG_SHIFT),
+ JSVAL_SHIFTED_TAG_NULL = (((uint64_t)JSVAL_TAG_NULL) << JSVAL_TAG_SHIFT),
+ JSVAL_SHIFTED_TAG_OBJECT = (((uint64_t)JSVAL_TAG_OBJECT) << JSVAL_TAG_SHIFT)
+} JS_ENUM_FOOTER(JSValueShiftedTag);
+
+static_assert(sizeof(JSValueShiftedTag) == sizeof(uint64_t),
+ "compiler typed enum support is apparently buggy");
+
+#endif
+
+/*
+ * All our supported compilers implement C++11 |enum Foo : T| syntax, so don't
+ * expose these macros. (This macro exists *only* because gcc bug 51242
+ * <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51242> makes bit-fields of
+ * typed enums trigger a warning that can't be turned off. Don't expose it
+ * beyond this file!)
+ */
+#undef JS_ENUM_HEADER
+#undef JS_ENUM_FOOTER
+
+#else /* !defined(__SUNPRO_CC) && !defined(__xlC__) */
+
+typedef uint8_t JSValueType;
+#define JSVAL_TYPE_DOUBLE ((uint8_t)0x00)
+#define JSVAL_TYPE_INT32 ((uint8_t)0x01)
+#define JSVAL_TYPE_UNDEFINED ((uint8_t)0x02)
+#define JSVAL_TYPE_BOOLEAN ((uint8_t)0x03)
+#define JSVAL_TYPE_MAGIC ((uint8_t)0x04)
+#define JSVAL_TYPE_STRING ((uint8_t)0x05)
+#define JSVAL_TYPE_SYMBOL ((uint8_t)0x06)
+#define JSVAL_TYPE_NULL ((uint8_t)0x07)
+#define JSVAL_TYPE_OBJECT ((uint8_t)0x08)
+#define JSVAL_TYPE_UNKNOWN ((uint8_t)0x20)
+
+#if defined(JS_NUNBOX32)
+
+typedef uint32_t JSValueTag;
+#define JSVAL_TAG_CLEAR ((uint32_t)(0xFFFFFF80))
+#define JSVAL_TAG_INT32 ((uint32_t)(JSVAL_TAG_CLEAR | JSVAL_TYPE_INT32))
+#define JSVAL_TAG_UNDEFINED ((uint32_t)(JSVAL_TAG_CLEAR | JSVAL_TYPE_UNDEFINED))
+#define JSVAL_TAG_STRING ((uint32_t)(JSVAL_TAG_CLEAR | JSVAL_TYPE_STRING))
+#define JSVAL_TAG_SYMBOL ((uint32_t)(JSVAL_TAG_CLEAR | JSVAL_TYPE_SYMBOL))
+#define JSVAL_TAG_BOOLEAN ((uint32_t)(JSVAL_TAG_CLEAR | JSVAL_TYPE_BOOLEAN))
+#define JSVAL_TAG_MAGIC ((uint32_t)(JSVAL_TAG_CLEAR | JSVAL_TYPE_MAGIC))
+#define JSVAL_TAG_NULL ((uint32_t)(JSVAL_TAG_CLEAR | JSVAL_TYPE_NULL))
+#define JSVAL_TAG_OBJECT ((uint32_t)(JSVAL_TAG_CLEAR | JSVAL_TYPE_OBJECT))
+
+#elif defined(JS_PUNBOX64)
+
+typedef uint32_t JSValueTag;
+#define JSVAL_TAG_MAX_DOUBLE ((uint32_t)(0x1FFF0))
+#define JSVAL_TAG_INT32 (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_INT32)
+#define JSVAL_TAG_UNDEFINED (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_UNDEFINED)
+#define JSVAL_TAG_STRING (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_STRING)
+#define JSVAL_TAG_SYMBOL (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_SYMBOL)
+#define JSVAL_TAG_BOOLEAN (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_BOOLEAN)
+#define JSVAL_TAG_MAGIC (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_MAGIC)
+#define JSVAL_TAG_NULL (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_NULL)
+#define JSVAL_TAG_OBJECT (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_OBJECT)
+
+typedef uint64_t JSValueShiftedTag;
+#define JSVAL_SHIFTED_TAG_MAX_DOUBLE ((((uint64_t)JSVAL_TAG_MAX_DOUBLE) << JSVAL_TAG_SHIFT) | 0xFFFFFFFF)
+#define JSVAL_SHIFTED_TAG_INT32 (((uint64_t)JSVAL_TAG_INT32) << JSVAL_TAG_SHIFT)
+#define JSVAL_SHIFTED_TAG_UNDEFINED (((uint64_t)JSVAL_TAG_UNDEFINED) << JSVAL_TAG_SHIFT)
+#define JSVAL_SHIFTED_TAG_STRING (((uint64_t)JSVAL_TAG_STRING) << JSVAL_TAG_SHIFT)
+#define JSVAL_SHIFTED_TAG_SYMBOL (((uint64_t)JSVAL_TAG_SYMBOL) << JSVAL_TAG_SHIFT)
+#define JSVAL_SHIFTED_TAG_BOOLEAN (((uint64_t)JSVAL_TAG_BOOLEAN) << JSVAL_TAG_SHIFT)
+#define JSVAL_SHIFTED_TAG_MAGIC (((uint64_t)JSVAL_TAG_MAGIC) << JSVAL_TAG_SHIFT)
+#define JSVAL_SHIFTED_TAG_NULL (((uint64_t)JSVAL_TAG_NULL) << JSVAL_TAG_SHIFT)
+#define JSVAL_SHIFTED_TAG_OBJECT (((uint64_t)JSVAL_TAG_OBJECT) << JSVAL_TAG_SHIFT)
+
+#endif /* JS_PUNBOX64 */
+#endif /* !defined(__SUNPRO_CC) && !defined(__xlC__) */
+
+#if defined(JS_NUNBOX32)
+
+#define JSVAL_TYPE_TO_TAG(type) ((JSValueTag)(JSVAL_TAG_CLEAR | (type)))
+
+#define JSVAL_LOWER_INCL_TAG_OF_OBJ_OR_NULL_SET JSVAL_TAG_NULL
+#define JSVAL_UPPER_EXCL_TAG_OF_PRIMITIVE_SET JSVAL_TAG_OBJECT
+#define JSVAL_UPPER_INCL_TAG_OF_NUMBER_SET JSVAL_TAG_INT32
+#define JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET JSVAL_TAG_STRING
+
+#elif defined(JS_PUNBOX64)
+
+#define JSVAL_PAYLOAD_MASK 0x00007FFFFFFFFFFFLL
+#define JSVAL_TAG_MASK 0xFFFF800000000000LL
+#define JSVAL_TYPE_TO_TAG(type) ((JSValueTag)(JSVAL_TAG_MAX_DOUBLE | (type)))
+#define JSVAL_TYPE_TO_SHIFTED_TAG(type) (((uint64_t)JSVAL_TYPE_TO_TAG(type)) << JSVAL_TAG_SHIFT)
+
+#define JSVAL_LOWER_INCL_TAG_OF_OBJ_OR_NULL_SET JSVAL_TAG_NULL
+#define JSVAL_UPPER_EXCL_TAG_OF_PRIMITIVE_SET JSVAL_TAG_OBJECT
+#define JSVAL_UPPER_INCL_TAG_OF_NUMBER_SET JSVAL_TAG_INT32
+#define JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET JSVAL_TAG_STRING
+
+#define JSVAL_LOWER_INCL_SHIFTED_TAG_OF_OBJ_OR_NULL_SET JSVAL_SHIFTED_TAG_NULL
+#define JSVAL_UPPER_EXCL_SHIFTED_TAG_OF_PRIMITIVE_SET JSVAL_SHIFTED_TAG_OBJECT
+#define JSVAL_UPPER_EXCL_SHIFTED_TAG_OF_NUMBER_SET JSVAL_SHIFTED_TAG_UNDEFINED
+#define JSVAL_LOWER_INCL_SHIFTED_TAG_OF_GCTHING_SET JSVAL_SHIFTED_TAG_STRING
+
+#endif /* JS_PUNBOX64 */
+
+typedef enum JSWhyMagic
+{
+ /** a hole in a native object's elements */
+ JS_ELEMENTS_HOLE,
+
+ /** there is not a pending iterator value */
+ JS_NO_ITER_VALUE,
+
+ /** exception value thrown when closing a generator */
+ JS_GENERATOR_CLOSING,
+
+ /** compiler sentinel value */
+ JS_NO_CONSTANT,
+
+ /** used in debug builds to catch tracing errors */
+ JS_THIS_POISON,
+
+ /** used in debug builds to catch tracing errors */
+ JS_ARG_POISON,
+
+ /** an empty subnode in the AST serializer */
+ JS_SERIALIZE_NO_NODE,
+
+ /** lazy arguments value on the stack */
+ JS_LAZY_ARGUMENTS,
+
+ /** optimized-away 'arguments' value */
+ JS_OPTIMIZED_ARGUMENTS,
+
+ /** magic value passed to natives to indicate construction */
+ JS_IS_CONSTRUCTING,
+
+ /** arguments.callee has been overwritten */
+ JS_OVERWRITTEN_CALLEE,
+
+ /** value of static block object slot */
+ JS_BLOCK_NEEDS_CLONE,
+
+ /** see class js::HashableValue */
+ JS_HASH_KEY_EMPTY,
+
+ /** error while running Ion code */
+ JS_ION_ERROR,
+
+ /** missing recover instruction result */
+ JS_ION_BAILOUT,
+
+ /** optimized out slot */
+ JS_OPTIMIZED_OUT,
+
+ /** uninitialized lexical bindings that produce ReferenceError on touch. */
+ JS_UNINITIALIZED_LEXICAL,
+
+ /** for local use */
+ JS_GENERIC_MAGIC,
+
+ JS_WHY_MAGIC_COUNT
+} JSWhyMagic;
+
+#if defined(IS_LITTLE_ENDIAN)
+# if defined(JS_NUNBOX32)
+typedef union jsval_layout
+{
+ uint64_t asBits;
+ struct {
+ union {
+ int32_t i32;
+ uint32_t u32;
+ uint32_t boo; // Don't use |bool| -- it must be four bytes.
+ JSString* str;
+ JS::Symbol* sym;
+ JSObject* obj;
+ js::gc::Cell* cell;
+ void* ptr;
+ JSWhyMagic why;
+ size_t word;
+ uintptr_t uintptr;
+ } payload;
+ JSValueTag tag;
+ } s;
+ double asDouble;
+ void* asPtr;
+} JSVAL_ALIGNMENT jsval_layout;
+# elif defined(JS_PUNBOX64)
+typedef union jsval_layout
+{
+ uint64_t asBits;
+#if !defined(_WIN64)
+ /* MSVC does not pack these correctly :-( */
+ struct {
+ uint64_t payload47 : 47;
+ JSValueTag tag : 17;
+ } debugView;
+#endif
+ struct {
+ union {
+ int32_t i32;
+ uint32_t u32;
+ JSWhyMagic why;
+ } payload;
+ } s;
+ double asDouble;
+ void* asPtr;
+ size_t asWord;
+ uintptr_t asUIntPtr;
+} JSVAL_ALIGNMENT jsval_layout;
+# endif /* JS_PUNBOX64 */
+#else /* defined(IS_LITTLE_ENDIAN) */
+# if defined(JS_NUNBOX32)
+typedef union jsval_layout
+{
+ uint64_t asBits;
+ struct {
+ JSValueTag tag;
+ union {
+ int32_t i32;
+ uint32_t u32;
+ uint32_t boo; // Don't use |bool| -- it must be four bytes.
+ JSString* str;
+ JS::Symbol* sym;
+ JSObject* obj;
+ js::gc::Cell* cell;
+ void* ptr;
+ JSWhyMagic why;
+ size_t word;
+ uintptr_t uintptr;
+ } payload;
+ } s;
+ double asDouble;
+ void* asPtr;
+} JSVAL_ALIGNMENT jsval_layout;
+# elif defined(JS_PUNBOX64)
+typedef union jsval_layout
+{
+ uint64_t asBits;
+ struct {
+ JSValueTag tag : 17;
+ uint64_t payload47 : 47;
+ } debugView;
+ struct {
+ uint32_t padding;
+ union {
+ int32_t i32;
+ uint32_t u32;
+ JSWhyMagic why;
+ } payload;
+ } s;
+ double asDouble;
+ void* asPtr;
+ size_t asWord;
+ uintptr_t asUIntPtr;
+} JSVAL_ALIGNMENT jsval_layout;
+# endif /* JS_PUNBOX64 */
+#endif /* defined(IS_LITTLE_ENDIAN) */
+
+/*
+ * For codesize purposes on some platforms, it's important that the
+ * compiler know that JS::Values constructed from constant values can be
+ * folded to constant bit patterns at compile time, rather than
+ * constructed at runtime. Doing this requires a fair amount of C++11
+ * features, which are not supported on all of our compilers. Set up
+ * some defines and helper macros in an attempt to confine the ugliness
+ * here, rather than scattering it all about the file. The important
+ * features are:
+ *
+ * - constexpr;
+ * - defaulted functions;
+ * - C99-style designated initializers.
+ */
+#if defined(__clang__)
+# if __has_feature(cxx_constexpr) && __has_feature(cxx_defaulted_functions)
+# define JS_VALUE_IS_CONSTEXPR
+# endif
+#elif defined(__GNUC__)
+/*
+ * We need 4.5 for defaulted functions, 4.6 for constexpr, 4.7 because 4.6
+ * doesn't understand |(X) { .field = ... }| syntax, and 4.7.3 because
+ * versions prior to that have bugs in the C++ front-end that cause crashes.
+ */
+# if MOZ_GCC_VERSION_AT_LEAST(4, 7, 3)
+# define JS_VALUE_IS_CONSTEXPR
+# endif
+#endif
+
+#if defined(JS_VALUE_IS_CONSTEXPR)
+# define JS_RETURN_LAYOUT_FROM_BITS(BITS) \
+ return (jsval_layout) { .asBits = (BITS) }
+# define JS_VALUE_CONSTEXPR MOZ_CONSTEXPR
+# define JS_VALUE_CONSTEXPR_VAR MOZ_CONSTEXPR_VAR
+#else
+# define JS_RETURN_LAYOUT_FROM_BITS(BITS) \
+ jsval_layout l; \
+ l.asBits = (BITS); \
+ return l;
+# define JS_VALUE_CONSTEXPR
+# define JS_VALUE_CONSTEXPR_VAR const
+#endif
+
+struct Value {
+ jsval_layout data;
+};
diff --git a/tests/headers/keywords.h b/tests/headers/keywords.h
new file mode 100644
index 00000000..8699ce5f
--- /dev/null
+++ b/tests/headers/keywords.h
@@ -0,0 +1,49 @@
+int u8;
+int u16;
+int u32;
+int u64;
+int i8;
+int i16;
+int i32;
+int i64;
+int f32;
+int f64;
+int usize;
+int isize;
+int as;
+int box;
+int crate;
+int false;
+int fn;
+int impl;
+int in;
+int let;
+int loop;
+int match;
+int mod;
+int move;
+int mut;
+int pub;
+int ref;
+int self;
+int Self;
+int super;
+int trait;
+int true;
+int type;
+int unsafe;
+int use;
+int where;
+int abstract;
+int alignof;
+int become;
+int final;
+int macro;
+int offsetof;
+int override;
+int priv;
+int proc;
+int pure;
+int unsized;
+int virtual;
+int yield;
diff --git a/tests/headers/macro-expr-basic.h b/tests/headers/macro-expr-basic.h
new file mode 100644
index 00000000..d2de7fdf
--- /dev/null
+++ b/tests/headers/macro-expr-basic.h
@@ -0,0 +1,14 @@
+#define FOO 1
+#define BAR 4
+#define BAZ (FOO + BAR)
+
+#define MIN (1 << 63)
+
+#define BARR (1 << 0)
+#define BAZZ ((1 << 1) + BAZ)
+#define I_RAN_OUT_OF_DUMB_NAMES (BARR | BAZZ)
+
+/* I haz a comment */
+#define HAZ_A_COMMENT BARR
+
+#define HAZ_A_COMMENT_INSIDE (/* comment for real */ BARR + FOO)
diff --git a/tests/headers/macro-redef.h b/tests/headers/macro-redef.h
new file mode 100644
index 00000000..0180d2ab
--- /dev/null
+++ b/tests/headers/macro-redef.h
@@ -0,0 +1,5 @@
+#define FOO 4
+#define BAR (1 + FOO)
+#undef FOO
+#define FOO 5
+#define BAZ (1 + FOO)
diff --git a/tests/headers/macro_const.h b/tests/headers/macro_const.h
new file mode 100644
index 00000000..c28a3f6b
--- /dev/null
+++ b/tests/headers/macro_const.h
@@ -0,0 +1,7 @@
+#define foo "bar"
+#define CHAR 'b'
+#define CHARR '\0'
+#define FLOAT 5.09f
+#define FLOAT_EXPR (5 / 1000.0f)
+
+#define INVALID_UTF8 "\xf0\x28\x8c\x28"
diff --git a/tests/headers/maddness-is-avoidable.hpp b/tests/headers/maddness-is-avoidable.hpp
new file mode 100644
index 00000000..46d7495e
--- /dev/null
+++ b/tests/headers/maddness-is-avoidable.hpp
@@ -0,0 +1,9 @@
+// bindgen-flags: --blacklist-type RefPtr_Proxy_member_function
+
+template<typename T>
+class RefPtr {
+ template<typename R, typename... Args>
+ class Proxy {
+ typedef R (T::*member_function)(Args...);
+ };
+};
diff --git a/tests/headers/method-mangling.hpp b/tests/headers/method-mangling.hpp
new file mode 100644
index 00000000..0dac4975
--- /dev/null
+++ b/tests/headers/method-mangling.hpp
@@ -0,0 +1,5 @@
+
+class Foo {
+public:
+ int type();
+};
diff --git a/tests/headers/module-whitelisted.hpp b/tests/headers/module-whitelisted.hpp
new file mode 100644
index 00000000..f41e874e
--- /dev/null
+++ b/tests/headers/module-whitelisted.hpp
@@ -0,0 +1,2 @@
+// bindgen-flags: --enable-cxx-namespaces
+struct Test {};
diff --git a/tests/headers/msvc-no-usr.hpp b/tests/headers/msvc-no-usr.hpp
new file mode 100644
index 00000000..b15e49f5
--- /dev/null
+++ b/tests/headers/msvc-no-usr.hpp
@@ -0,0 +1,8 @@
+
+typedef unsigned long long size_t;
+
+class A {
+ const size_t foo;
+
+ A() : foo(5) {}
+};
diff --git a/tests/headers/multiple-inherit-empty-correct-layout.hpp b/tests/headers/multiple-inherit-empty-correct-layout.hpp
new file mode 100644
index 00000000..1e2b133a
--- /dev/null
+++ b/tests/headers/multiple-inherit-empty-correct-layout.hpp
@@ -0,0 +1,3 @@
+struct Foo {};
+struct Bar {};
+struct Baz : public Foo, public Bar {};
diff --git a/tests/headers/mutable.hpp b/tests/headers/mutable.hpp
new file mode 100644
index 00000000..b61a1031
--- /dev/null
+++ b/tests/headers/mutable.hpp
@@ -0,0 +1,14 @@
+class C {
+ mutable int m_member;
+ int m_other;
+};
+
+class NonCopiable {
+ mutable int m_member;
+
+ ~NonCopiable() {};
+};
+
+class NonCopiableWithNonCopiableMutableMember {
+ mutable NonCopiable m_member;
+};
diff --git a/tests/headers/namespace.hpp b/tests/headers/namespace.hpp
new file mode 100644
index 00000000..65788539
--- /dev/null
+++ b/tests/headers/namespace.hpp
@@ -0,0 +1,47 @@
+// bindgen-flags: --enable-cxx-namespaces
+
+void top_level();
+
+namespace whatever {
+ typedef int whatever_int_t;
+
+ void in_whatever();
+}
+
+namespace {
+ namespace empty {}
+
+ void foo();
+ struct A {
+ whatever::whatever_int_t b;
+ public:
+ int lets_hope_this_works();
+ };
+}
+
+template<typename T>
+class C: public A {
+ T m_c;
+ T* m_c_ptr;
+ T m_c_arr[10];
+};
+
+
+template<>
+class C<int>;
+
+
+namespace w {
+ typedef unsigned int whatever_int_t;
+
+ template<typename T>
+ class D {
+ C<T> m_c;
+ };
+
+ whatever_int_t heh(); // this should return w::whatever_int_t, and not whatever::whatever_int_t
+
+ C<int> foo();
+
+ C<float> barr(); // <- This is the problematic one
+}
diff --git a/tests/headers/nested.hpp b/tests/headers/nested.hpp
new file mode 100644
index 00000000..299e1768
--- /dev/null
+++ b/tests/headers/nested.hpp
@@ -0,0 +1,15 @@
+
+class Calc {
+ int w;
+};
+
+class Test {
+public:
+ struct Size;
+ friend struct Size;
+ struct Size {
+ struct Dimension : public Calc {
+ };
+ Dimension mWidth, mHeight;
+ };
+};
diff --git a/tests/headers/nested_vtable.hpp b/tests/headers/nested_vtable.hpp
new file mode 100644
index 00000000..87d6ce1f
--- /dev/null
+++ b/tests/headers/nested_vtable.hpp
@@ -0,0 +1,8 @@
+class nsISupports {
+public:
+ virtual nsISupports* QueryInterface();
+};
+
+class nsIRunnable : public nsISupports {};
+
+class Runnable : public nsIRunnable {};
diff --git a/tests/headers/nested_within_namespace.hpp b/tests/headers/nested_within_namespace.hpp
new file mode 100644
index 00000000..a9b7c1ec
--- /dev/null
+++ b/tests/headers/nested_within_namespace.hpp
@@ -0,0 +1,15 @@
+// bindgen-flags: --enable-cxx-namespaces
+
+namespace foo {
+ class Bar {
+ int foo;
+
+ class Baz {
+ int foo;
+ };
+ };
+
+ class Baz {
+ int baz;
+ };
+}
diff --git a/tests/headers/no-std.h b/tests/headers/no-std.h
new file mode 100644
index 00000000..7bee9657
--- /dev/null
+++ b/tests/headers/no-std.h
@@ -0,0 +1,5 @@
+// bindgen-flags: --ctypes-prefix "libc" --use-core --raw-line "#![no_std]" --raw-line "mod libc { pub type c_int = i32; pub enum c_void {} }"
+struct foo {
+ int a, b;
+ void* bar;
+};
diff --git a/tests/headers/no_copy.hpp b/tests/headers/no_copy.hpp
new file mode 100644
index 00000000..349e428e
--- /dev/null
+++ b/tests/headers/no_copy.hpp
@@ -0,0 +1,6 @@
+
+/** <div rustbindgen nocopy></div> */
+template<typename T>
+class CopiableButWait {
+ int whatever;
+};
diff --git a/tests/headers/nsStyleAutoArray.hpp b/tests/headers/nsStyleAutoArray.hpp
new file mode 100644
index 00000000..950152c0
--- /dev/null
+++ b/tests/headers/nsStyleAutoArray.hpp
@@ -0,0 +1,57 @@
+
+template<typename T>
+class nsTArray {
+ T* mBuff;
+};
+
+template<typename T>
+class nsStyleAutoArray
+{
+public:
+ // This constructor places a single element in mFirstElement.
+ enum WithSingleInitialElement { WITH_SINGLE_INITIAL_ELEMENT };
+ explicit nsStyleAutoArray(WithSingleInitialElement) {}
+ nsStyleAutoArray(const nsStyleAutoArray& aOther) { *this = aOther; }
+ nsStyleAutoArray& operator=(const nsStyleAutoArray& aOther) {
+ mFirstElement = aOther.mFirstElement;
+ mOtherElements = aOther.mOtherElements;
+ return *this;
+ }
+
+ bool operator==(const nsStyleAutoArray& aOther) const {
+ return Length() == aOther.Length() &&
+ mFirstElement == aOther.mFirstElement &&
+ mOtherElements == aOther.mOtherElements;
+ }
+ bool operator!=(const nsStyleAutoArray& aOther) const {
+ return !(*this == aOther);
+ }
+
+ unsigned long Length() const {
+ return mOtherElements.Length() + 1;
+ }
+ const T& operator[](unsigned long aIndex) const {
+ return aIndex == 0 ? mFirstElement : mOtherElements[aIndex - 1];
+ }
+ T& operator[](unsigned long aIndex) {
+ return aIndex == 0 ? mFirstElement : mOtherElements[aIndex - 1];
+ }
+
+ void EnsureLengthAtLeast(unsigned long aMinLen) {
+ if (aMinLen > 0) {
+ mOtherElements.EnsureLengthAtLeast(aMinLen - 1);
+ }
+ }
+
+ void SetLengthNonZero(unsigned long aNewLen) {
+ mOtherElements.SetLength(aNewLen - 1);
+ }
+
+ void TruncateLengthNonZero(unsigned long aNewLen) {
+ mOtherElements.TruncateLength(aNewLen - 1);
+ }
+
+private:
+ T mFirstElement;
+ nsTArray<T> mOtherElements;
+};
diff --git a/tests/headers/only_bitfields.hpp b/tests/headers/only_bitfields.hpp
new file mode 100644
index 00000000..84db0586
--- /dev/null
+++ b/tests/headers/only_bitfields.hpp
@@ -0,0 +1,5 @@
+// bindgen-flags: --no-unstable-rust
+class C {
+ bool a: 1;
+ bool b: 7;
+};
diff --git a/tests/headers/opaque-tracing.hpp b/tests/headers/opaque-tracing.hpp
new file mode 100644
index 00000000..7356245e
--- /dev/null
+++ b/tests/headers/opaque-tracing.hpp
@@ -0,0 +1,21 @@
+// bindgen-flags: --opaque-type=.* --whitelist-function=foo
+
+class Container;
+
+// The whitelist tracing should reach the Container type, even though it's
+// marked as opaque.
+void foo(Container* c);
+
+template<typename T>
+class Wat {
+ T foo;
+};
+
+class OtherOpaque {
+ int bar;
+};
+
+class Container {
+ Wat<int> bar;
+ OtherOpaque baz;
+};
diff --git a/tests/headers/opaque_in_struct.hpp b/tests/headers/opaque_in_struct.hpp
new file mode 100644
index 00000000..3cffeb20
--- /dev/null
+++ b/tests/headers/opaque_in_struct.hpp
@@ -0,0 +1,10 @@
+
+
+/** <div rustbindgen opaque> */
+typedef struct opaque {
+ int waht;
+} opaque;
+
+struct container {
+ opaque contained;
+};
diff --git a/tests/headers/opaque_pointer.hpp b/tests/headers/opaque_pointer.hpp
new file mode 100644
index 00000000..53f8ce1f
--- /dev/null
+++ b/tests/headers/opaque_pointer.hpp
@@ -0,0 +1,22 @@
+
+/**
+ * <div rustbindgen opaque></div>
+ */
+struct OtherOpaque {
+ int c;
+};
+
+/**
+ * <div rustbindgen opaque></div>
+ */
+template <typename T>
+struct Opaque {
+ T whatever;
+};
+
+struct WithOpaquePtr {
+ Opaque<int>* whatever;
+ Opaque<float> other;
+ OtherOpaque t;
+};
+
diff --git a/tests/headers/opaque_typedef.hpp b/tests/headers/opaque_typedef.hpp
new file mode 100644
index 00000000..25640738
--- /dev/null
+++ b/tests/headers/opaque_typedef.hpp
@@ -0,0 +1,17 @@
+// bindgen-flags: -- -std=c++11
+template<typename T>
+class RandomTemplate;
+
+template<int i>
+class Wat;
+
+template<int i>
+class Wat3;
+
+template<>
+class Wat3<3>;
+
+/** <div rustbindgen opaque></div> */
+typedef RandomTemplate<int> ShouldBeOpaque;
+
+typedef RandomTemplate<float> ShouldNotBeOpaque;
diff --git a/tests/headers/overflowed_enum.hpp b/tests/headers/overflowed_enum.hpp
new file mode 100644
index 00000000..1f2075a5
--- /dev/null
+++ b/tests/headers/overflowed_enum.hpp
@@ -0,0 +1,12 @@
+// bindgen-flags: -- -std=c++11 -Wno-narrowing
+
+enum Foo {
+ BAP_ARM = 0x93fcb9,
+ BAP_X86 = 0xb67eed,
+ BAP_X86_64 = 0xba7b274f,
+};
+
+enum Bar: unsigned short {
+ One = 1,
+ Big = 65538,
+};
diff --git a/tests/headers/overloading.hpp b/tests/headers/overloading.hpp
new file mode 100644
index 00000000..3c2b0487
--- /dev/null
+++ b/tests/headers/overloading.hpp
@@ -0,0 +1,9 @@
+extern bool Evaluate(char r);
+extern bool Evaluate(int x, int y);
+
+namespace foo {
+ extern void MyFunction();
+}
+namespace bar {
+ extern void MyFunction();
+}
diff --git a/tests/headers/private.hpp b/tests/headers/private.hpp
new file mode 100644
index 00000000..c0f3ce7f
--- /dev/null
+++ b/tests/headers/private.hpp
@@ -0,0 +1,21 @@
+
+struct HasPrivate {
+ int mNotPrivate;
+ /** <div rustbindgen private></div> */
+ int mIsPrivate;
+};
+
+
+/** <div rustbindgen private></div> */
+struct VeryPrivate {
+ int mIsPrivate;
+ int mIsAlsoPrivate;
+};
+
+
+/** <div rustbindgen private></div> */
+struct ContradictPrivate {
+ /** <div rustbindgen private="false"></div> */
+ int mNotPrivate;
+ int mIsPrivate;
+};
diff --git a/tests/headers/public-dtor.hpp b/tests/headers/public-dtor.hpp
new file mode 100644
index 00000000..5d4fb592
--- /dev/null
+++ b/tests/headers/public-dtor.hpp
@@ -0,0 +1,15 @@
+
+
+namespace cv {
+class String {
+public:
+ ~String();
+};
+
+
+inline
+String::~String()
+{
+}
+
+}
diff --git a/tests/headers/redeclaration.hpp b/tests/headers/redeclaration.hpp
new file mode 100644
index 00000000..d536b158
--- /dev/null
+++ b/tests/headers/redeclaration.hpp
@@ -0,0 +1,7 @@
+extern "C" {
+ void foo();
+}
+
+extern "C" {
+ void foo();
+}
diff --git a/tests/headers/ref_argument_array.hpp b/tests/headers/ref_argument_array.hpp
new file mode 100644
index 00000000..dc73fd62
--- /dev/null
+++ b/tests/headers/ref_argument_array.hpp
@@ -0,0 +1,6 @@
+
+#define NSID_LENGTH 10
+class nsID {
+public:
+ virtual void ToProvidedString(char (&aDest)[NSID_LENGTH]) = 0;
+};
diff --git a/tests/headers/reparented_replacement.hpp b/tests/headers/reparented_replacement.hpp
new file mode 100644
index 00000000..4ac2bf03
--- /dev/null
+++ b/tests/headers/reparented_replacement.hpp
@@ -0,0 +1,16 @@
+// bindgen-flags: --enable-cxx-namespaces
+
+namespace foo {
+ struct Bar {
+ int baz;
+ };
+}
+
+namespace bar {
+ /// <div rustbindgen replaces="foo::Bar"></div>
+ struct Bar_Replacement {
+ int bazz;
+ };
+};
+
+typedef foo::Bar ReferencesBar;
diff --git a/tests/headers/replace_template_alias.hpp b/tests/headers/replace_template_alias.hpp
new file mode 100644
index 00000000..c325b5a3
--- /dev/null
+++ b/tests/headers/replace_template_alias.hpp
@@ -0,0 +1,23 @@
+// bindgen-flags: -- --std=c++14
+
+namespace JS {
+namespace detail {
+
+/// Notice how this doesn't use T.
+template <typename T>
+using MaybeWrapped = int;
+
+}
+
+template <typename T>
+class Rooted {
+ detail::MaybeWrapped<T> ptr;
+};
+
+}
+
+/// But the replacement type does use T!
+///
+/// <div rustbindgen replaces="JS::detail::MaybeWrapped" />
+template <typename T>
+using replaces_MaybeWrapped = T;
diff --git a/tests/headers/replace_use.hpp b/tests/headers/replace_use.hpp
new file mode 100644
index 00000000..de44eb19
--- /dev/null
+++ b/tests/headers/replace_use.hpp
@@ -0,0 +1,15 @@
+template<typename T>
+struct nsTArray {
+ int x;
+};
+/**
+ * <div rustbindgen replaces="nsTArray"></div>
+ */
+template<typename T>
+struct nsTArray_Simple {
+ unsigned int y;
+};
+
+struct Test {
+ nsTArray<long> a;
+};
diff --git a/tests/headers/replaces_double.hpp b/tests/headers/replaces_double.hpp
new file mode 100644
index 00000000..1a78b0d9
--- /dev/null
+++ b/tests/headers/replaces_double.hpp
@@ -0,0 +1,20 @@
+// bindgen-flags: --blacklist-type Wrapper -- --std=c++11
+
+template<typename T>
+struct Wrapper {
+ struct Wrapped {
+ T t;
+ };
+ using Type = Wrapped;
+};
+
+template<typename T>
+class Rooted {
+ using MaybeWrapped = typename Wrapper<T>::Type;
+ MaybeWrapped ptr;
+
+ /**
+ * <div rustbindgen replaces="Rooted_MaybeWrapped"></div>
+ */
+ using MaybeWrapped_simple = T;
+};
diff --git a/tests/headers/resolved_type_def_function.h b/tests/headers/resolved_type_def_function.h
new file mode 100644
index 00000000..139b8c3e
--- /dev/null
+++ b/tests/headers/resolved_type_def_function.h
@@ -0,0 +1,2 @@
+typedef void (FuncType) ();
+extern FuncType Func; \ No newline at end of file
diff --git a/tests/headers/same_struct_name_in_different_namespaces.hpp b/tests/headers/same_struct_name_in_different_namespaces.hpp
new file mode 100644
index 00000000..fe685845
--- /dev/null
+++ b/tests/headers/same_struct_name_in_different_namespaces.hpp
@@ -0,0 +1,12 @@
+namespace JS {
+
+ struct Zone;
+
+ namespace shadow {
+
+ struct Zone {
+ int x;
+ int y;
+ };
+ }
+}
diff --git a/tests/headers/size_t_template.hpp b/tests/headers/size_t_template.hpp
new file mode 100644
index 00000000..6045c698
--- /dev/null
+++ b/tests/headers/size_t_template.hpp
@@ -0,0 +1,8 @@
+template<typename T, unsigned long N>
+class Array {
+ T inner[N];
+};
+
+class C {
+ Array<int, 3> arr;
+};
diff --git a/tests/headers/struct_containing_forward_declared_struct.h b/tests/headers/struct_containing_forward_declared_struct.h
new file mode 100644
index 00000000..d38aca2f
--- /dev/null
+++ b/tests/headers/struct_containing_forward_declared_struct.h
@@ -0,0 +1,7 @@
+struct a {
+ struct b* val_a;
+};
+
+struct b {
+ int val_b;
+};
diff --git a/tests/headers/struct_with_anon_struct.h b/tests/headers/struct_with_anon_struct.h
new file mode 100644
index 00000000..1617d7a8
--- /dev/null
+++ b/tests/headers/struct_with_anon_struct.h
@@ -0,0 +1,6 @@
+struct foo {
+ struct {
+ int a;
+ int b;
+ } bar;
+};
diff --git a/tests/headers/struct_with_anon_struct_array.h b/tests/headers/struct_with_anon_struct_array.h
new file mode 100644
index 00000000..9ea977e8
--- /dev/null
+++ b/tests/headers/struct_with_anon_struct_array.h
@@ -0,0 +1,10 @@
+struct foo {
+ struct {
+ int a;
+ int b;
+ } bar[2];
+ struct {
+ int a;
+ int b;
+ } baz[2][3][4];
+};
diff --git a/tests/headers/struct_with_anon_struct_pointer.h b/tests/headers/struct_with_anon_struct_pointer.h
new file mode 100644
index 00000000..0c486d84
--- /dev/null
+++ b/tests/headers/struct_with_anon_struct_pointer.h
@@ -0,0 +1,6 @@
+struct foo {
+ struct {
+ int a;
+ int b;
+ } *bar;
+};
diff --git a/tests/headers/struct_with_anon_union.h b/tests/headers/struct_with_anon_union.h
new file mode 100644
index 00000000..3a92b940
--- /dev/null
+++ b/tests/headers/struct_with_anon_union.h
@@ -0,0 +1,6 @@
+struct foo {
+ union {
+ unsigned int a;
+ unsigned short b;
+ } bar;
+};
diff --git a/tests/headers/struct_with_anon_unnamed_struct.h b/tests/headers/struct_with_anon_unnamed_struct.h
new file mode 100644
index 00000000..f8ac4225
--- /dev/null
+++ b/tests/headers/struct_with_anon_unnamed_struct.h
@@ -0,0 +1,6 @@
+struct foo {
+ struct {
+ unsigned int a;
+ unsigned int b;
+ };
+};
diff --git a/tests/headers/struct_with_anon_unnamed_union.h b/tests/headers/struct_with_anon_unnamed_union.h
new file mode 100644
index 00000000..7158e727
--- /dev/null
+++ b/tests/headers/struct_with_anon_unnamed_union.h
@@ -0,0 +1,6 @@
+struct foo {
+ union {
+ unsigned int a;
+ unsigned short b;
+ };
+};
diff --git a/tests/headers/struct_with_bitfields.h b/tests/headers/struct_with_bitfields.h
new file mode 100644
index 00000000..107fb136
--- /dev/null
+++ b/tests/headers/struct_with_bitfields.h
@@ -0,0 +1,13 @@
+// bindgen-flags: --no-unstable-rust
+struct bitfield {
+ unsigned short
+ a :1,
+ b :1,
+ c :1,
+ :1,
+ :2,
+ d :2;
+ int e;
+ unsigned int f : 2;
+ unsigned int g : 32;
+};
diff --git a/tests/headers/struct_with_derive_debug.h b/tests/headers/struct_with_derive_debug.h
new file mode 100644
index 00000000..98ba1b3d
--- /dev/null
+++ b/tests/headers/struct_with_derive_debug.h
@@ -0,0 +1,15 @@
+struct LittleArray {
+ int a[32];
+};
+
+struct BigArray{
+ int a[33];
+};
+
+struct WithLittleArray {
+ struct LittleArray a;
+};
+
+struct WithBigArray {
+ struct BigArray a;
+};
diff --git a/tests/headers/struct_with_nesting.h b/tests/headers/struct_with_nesting.h
new file mode 100644
index 00000000..9d7fa176
--- /dev/null
+++ b/tests/headers/struct_with_nesting.h
@@ -0,0 +1,17 @@
+struct foo {
+ unsigned int a;
+ union {
+ unsigned int b;
+ struct {
+ unsigned short c1;
+ unsigned short c2;
+ };
+
+ struct {
+ unsigned char d1;
+ unsigned char d2;
+ unsigned char d3;
+ unsigned char d4;
+ };
+ };
+};
diff --git a/tests/headers/struct_with_packing.h b/tests/headers/struct_with_packing.h
new file mode 100644
index 00000000..1b9fe131
--- /dev/null
+++ b/tests/headers/struct_with_packing.h
@@ -0,0 +1,4 @@
+struct a {
+ char b;
+ short c;
+} __attribute__((packed));
diff --git a/tests/headers/struct_with_struct.h b/tests/headers/struct_with_struct.h
new file mode 100644
index 00000000..78b1cc81
--- /dev/null
+++ b/tests/headers/struct_with_struct.h
@@ -0,0 +1,6 @@
+struct foo {
+ struct {
+ unsigned int x;
+ unsigned int y;
+ } bar;
+};
diff --git a/tests/headers/struct_with_typedef_template_arg.hpp b/tests/headers/struct_with_typedef_template_arg.hpp
new file mode 100644
index 00000000..7fed21ab
--- /dev/null
+++ b/tests/headers/struct_with_typedef_template_arg.hpp
@@ -0,0 +1,4 @@
+template<typename T, typename ...Args>
+struct Proxy {
+ typedef void (*foo)(T* bar);
+};
diff --git a/tests/headers/template.hpp b/tests/headers/template.hpp
new file mode 100644
index 00000000..c13643c3
--- /dev/null
+++ b/tests/headers/template.hpp
@@ -0,0 +1,144 @@
+template<typename T, typename U> class Foo {
+ T m_member;
+ T* m_member_ptr;
+ T m_member_arr[1];
+};
+
+void bar(Foo<int, int> foo);
+
+template<typename T>
+class D {
+ typedef Foo<int, int> MyFoo;
+
+ MyFoo m_foo;
+
+ template<typename Z>
+ class U {
+ MyFoo m_nested_foo;
+ Z m_baz;
+ };
+};
+
+template<typename T>
+class Rooted {
+ T* prev;
+ Rooted<void*>* next;
+ T ptr;
+};
+
+class RootedContainer {
+ Rooted<void*> root;
+};
+
+template<typename T>
+class WithDtor;
+
+typedef WithDtor<int> WithDtorIntFwd;
+
+template<typename T>
+class WithDtor {
+ T member;
+ ~WithDtor() {}
+};
+
+class PODButContainsDtor {
+ WithDtorIntFwd member;
+};
+
+
+/** <div rustbindgen opaque> */
+template<typename T>
+class Opaque {
+ T member;
+};
+
+class POD {
+ Opaque<int> opaque_member;
+};
+
+/**
+ * <div rustbindgen replaces="NestedReplaced"></div>
+ */
+template<typename T>
+class Nested {
+ T* buff;
+};
+
+template<typename T, typename U>
+class NestedBase {
+ T* buff;
+};
+
+template<typename T>
+class NestedReplaced: public NestedBase<T, int> {
+};
+
+template<typename T>
+class Incomplete;
+
+template<typename T>
+class NestedContainer {
+ T c;
+private:
+ NestedReplaced<T> nested;
+ Incomplete<T> inc;
+};
+
+template<typename T>
+class Incomplete {
+ T d;
+};
+
+class Untemplated {};
+
+template<typename T>
+class Templated {
+ Untemplated m_untemplated;
+};
+
+/**
+ * If the replacement doesn't happen at the parse level the container would be
+ * copy and the replacement wouldn't, so this wouldn't compile.
+ *
+ * <div rustbindgen replaces="ReplacedWithoutDestructor"></div>
+ */
+template<typename T>
+class ReplacedWithDestructor {
+ T* buff;
+ ~ReplacedWithDestructor() {};
+};
+
+template<typename T>
+class ReplacedWithoutDestructor {
+ T* buff;
+};
+
+template<typename T>
+class ReplacedWithoutDestructorFwd;
+
+template<typename T>
+class ShouldNotBeCopiable {
+ ReplacedWithoutDestructor<T> m_member;
+};
+
+template<typename U>
+class ShouldNotBeCopiableAsWell {
+ ReplacedWithoutDestructorFwd<U> m_member;
+};
+
+/**
+ * If the replacement doesn't happen at the parse level the container would be
+ * copy and the replacement wouldn't, so this wouldn't compile.
+ *
+ * <div rustbindgen replaces="ReplacedWithoutDestructorFwd"></div>
+ */
+template<typename T>
+class ReplacedWithDestructorDeclaredAfter {
+ T* buff;
+ ~ReplacedWithDestructorDeclaredAfter() {};
+};
+
+template<typename T>
+class TemplateWithVar {
+ static T var = 0;
+};
diff --git a/tests/headers/template_alias.hpp b/tests/headers/template_alias.hpp
new file mode 100644
index 00000000..646d9f40
--- /dev/null
+++ b/tests/headers/template_alias.hpp
@@ -0,0 +1,13 @@
+// bindgen-flags: -- -std=c++14
+
+namespace JS {
+namespace detail {
+ template <typename T>
+ using Wrapped = T;
+}
+
+template <typename T>
+struct Rooted {
+ detail::Wrapped<T> ptr;
+};
+}
diff --git a/tests/headers/template_alias_basic.hpp b/tests/headers/template_alias_basic.hpp
new file mode 100644
index 00000000..964f6e27
--- /dev/null
+++ b/tests/headers/template_alias_basic.hpp
@@ -0,0 +1,4 @@
+// bindgen-flags: -- -std=c++11
+
+template<typename T>
+using Wrapped = T;
diff --git a/tests/headers/template_alias_namespace.hpp b/tests/headers/template_alias_namespace.hpp
new file mode 100644
index 00000000..bd637166
--- /dev/null
+++ b/tests/headers/template_alias_namespace.hpp
@@ -0,0 +1,13 @@
+// bindgen-flags: --enable-cxx-namespaces -- -std=c++14
+
+namespace JS {
+namespace detail {
+ template <typename T>
+ using Wrapped = T;
+}
+
+template <typename T>
+struct Rooted {
+ detail::Wrapped<T> ptr;
+};
+}
diff --git a/tests/headers/template_typedef_transitive_param.hpp b/tests/headers/template_typedef_transitive_param.hpp
new file mode 100644
index 00000000..2269ac36
--- /dev/null
+++ b/tests/headers/template_typedef_transitive_param.hpp
@@ -0,0 +1,7 @@
+template<typename T>
+struct Wrapper {
+ struct Wrapped {
+ T t;
+ };
+ using Type = Wrapped;
+};
diff --git a/tests/headers/template_typedefs.hpp b/tests/headers/template_typedefs.hpp
new file mode 100644
index 00000000..5e13dcd8
--- /dev/null
+++ b/tests/headers/template_typedefs.hpp
@@ -0,0 +1,8 @@
+typedef void (*foo)(int);
+
+template<typename T, typename U>
+class Foo {
+ typedef T Char;
+ typedef Char* FooPtrTypedef;
+ typedef bool (*nsCOMArrayEnumFunc)(T* aElement, void* aData);
+};
diff --git a/tests/headers/templateref_opaque.hpp b/tests/headers/templateref_opaque.hpp
new file mode 100644
index 00000000..ca154c34
--- /dev/null
+++ b/tests/headers/templateref_opaque.hpp
@@ -0,0 +1,11 @@
+
+namespace detail {
+template<typename T>
+struct PointerType {
+ typedef T* Type;
+};
+}
+template<typename T>
+class UniquePtr {
+ typedef typename detail::PointerType<T> Pointer;
+};
diff --git a/tests/headers/type-referenced-by-whitelisted-function.h b/tests/headers/type-referenced-by-whitelisted-function.h
new file mode 100644
index 00000000..86b00303
--- /dev/null
+++ b/tests/headers/type-referenced-by-whitelisted-function.h
@@ -0,0 +1,7 @@
+// bindgen-flags: --whitelist-function dl_iterate_phdr
+
+struct dl_phdr_info {
+ int x;
+};
+
+int dl_iterate_phdr(struct dl_phdr_info *);
diff --git a/tests/headers/type_alias_empty.hpp b/tests/headers/type_alias_empty.hpp
new file mode 100644
index 00000000..f0760c8f
--- /dev/null
+++ b/tests/headers/type_alias_empty.hpp
@@ -0,0 +1,10 @@
+// bindgen-flags: --whitelist-type bool_constant -- -std=c++11
+
+// NB: The --whitelist-type is done to trigger the traversal of the types on
+// codegen in order to trigger #67.
+
+template<typename T, T Val>
+struct integral_constant {};
+
+template<bool B>
+using bool_constant = integral_constant<bool, B>;
diff --git a/tests/headers/type_alias_partial_template_especialization.hpp b/tests/headers/type_alias_partial_template_especialization.hpp
new file mode 100644
index 00000000..dfc36786
--- /dev/null
+++ b/tests/headers/type_alias_partial_template_especialization.hpp
@@ -0,0 +1,7 @@
+// bindgen-flags: -- -std=c++14
+template <typename A> using MaybeWrapped = A;
+
+template<class T>
+class Rooted {
+ MaybeWrapped<T> ptr;
+};
diff --git a/tests/headers/type_alias_template_specialized.hpp b/tests/headers/type_alias_template_specialized.hpp
new file mode 100644
index 00000000..a2d32b56
--- /dev/null
+++ b/tests/headers/type_alias_template_specialized.hpp
@@ -0,0 +1,9 @@
+// bindgen-flags: --whitelist-type Rooted -- -std=c++14
+
+template <typename a> using MaybeWrapped = a;
+class Rooted {
+ MaybeWrapped<int> ptr;
+};
+
+/// <div rustbindgen replaces="MaybeWrapped"></div>
+template <typename a> using replaces_MaybeWrapped = a;
diff --git a/tests/headers/typedefd-array-as-function-arg.h b/tests/headers/typedefd-array-as-function-arg.h
new file mode 100644
index 00000000..93790591
--- /dev/null
+++ b/tests/headers/typedefd-array-as-function-arg.h
@@ -0,0 +1,3 @@
+// foo.h
+typedef float myVector3[3];
+void modifyVectorFunc(myVector3 v);
diff --git a/tests/headers/typeref.hpp b/tests/headers/typeref.hpp
new file mode 100644
index 00000000..b94c98ef
--- /dev/null
+++ b/tests/headers/typeref.hpp
@@ -0,0 +1,28 @@
+struct nsFoo;
+
+namespace mozilla {
+
+struct FragmentOrURL { bool mIsLocalRef; };
+struct Position { };
+
+} // namespace mozilla
+
+class Bar {
+ nsFoo* mFoo;
+};
+
+namespace mozilla {
+
+template<typename ReferenceBox>
+struct StyleShapeSource {
+ union {
+ Position* mPosition;
+ FragmentOrURL* mFragmentOrURL;
+ };
+};
+
+} // namespace mozilla
+
+struct nsFoo {
+ mozilla::StyleShapeSource<int> mBar;
+};
diff --git a/tests/headers/union-in-ns.hpp b/tests/headers/union-in-ns.hpp
new file mode 100644
index 00000000..68b8f72d
--- /dev/null
+++ b/tests/headers/union-in-ns.hpp
@@ -0,0 +1,5 @@
+// bindgen-flags: --enable-cxx-namespaces
+
+union bar {
+ int baz;
+};
diff --git a/tests/headers/union_dtor.hpp b/tests/headers/union_dtor.hpp
new file mode 100644
index 00000000..399dc89d
--- /dev/null
+++ b/tests/headers/union_dtor.hpp
@@ -0,0 +1,5 @@
+union UnionWithDtor {
+ ~UnionWithDtor();
+ int mFoo;
+ void* mBar;
+};
diff --git a/tests/headers/union_fields.hpp b/tests/headers/union_fields.hpp
new file mode 100644
index 00000000..aec3a7fd
--- /dev/null
+++ b/tests/headers/union_fields.hpp
@@ -0,0 +1,5 @@
+typedef union {
+ int mInt;
+ float mFloat;
+ void* mPointer;
+} nsStyleUnion;
diff --git a/tests/headers/union_template.hpp b/tests/headers/union_template.hpp
new file mode 100644
index 00000000..0d0a9bb3
--- /dev/null
+++ b/tests/headers/union_template.hpp
@@ -0,0 +1,19 @@
+template<typename T>
+struct NastyStruct {
+ bool mIsSome;
+ union {
+ void* mFoo;
+ unsigned long mDummy;
+ } mStorage;
+
+ union {
+ short wat;
+ int* wut;
+ };
+};
+
+template<typename T>
+union Whatever {
+ void* mTPtr;
+ int mInt;
+};
diff --git a/tests/headers/union_with_anon_struct.h b/tests/headers/union_with_anon_struct.h
new file mode 100644
index 00000000..7f8dec95
--- /dev/null
+++ b/tests/headers/union_with_anon_struct.h
@@ -0,0 +1,6 @@
+union foo {
+ struct {
+ unsigned int a;
+ unsigned int b;
+ } bar;
+};
diff --git a/tests/headers/union_with_anon_struct_bitfield.h b/tests/headers/union_with_anon_struct_bitfield.h
new file mode 100644
index 00000000..24c7dce8
--- /dev/null
+++ b/tests/headers/union_with_anon_struct_bitfield.h
@@ -0,0 +1,8 @@
+// bindgen-flags: --no-unstable-rust
+union foo {
+ int a;
+ struct {
+ int b : 7;
+ int c : 25;
+ };
+};
diff --git a/tests/headers/union_with_anon_union.h b/tests/headers/union_with_anon_union.h
new file mode 100644
index 00000000..212431b8
--- /dev/null
+++ b/tests/headers/union_with_anon_union.h
@@ -0,0 +1,6 @@
+union foo {
+ union {
+ unsigned int a;
+ unsigned short b;
+ } bar;
+};
diff --git a/tests/headers/union_with_anon_unnamed_struct.h b/tests/headers/union_with_anon_unnamed_struct.h
new file mode 100644
index 00000000..79558049
--- /dev/null
+++ b/tests/headers/union_with_anon_unnamed_struct.h
@@ -0,0 +1,9 @@
+union pixel {
+ unsigned int rgba;
+ struct {
+ unsigned char r;
+ unsigned char g;
+ unsigned char b;
+ unsigned char a;
+ };
+};
diff --git a/tests/headers/union_with_anon_unnamed_union.h b/tests/headers/union_with_anon_unnamed_union.h
new file mode 100644
index 00000000..7580771a
--- /dev/null
+++ b/tests/headers/union_with_anon_unnamed_union.h
@@ -0,0 +1,7 @@
+union foo {
+ unsigned int a;
+ union {
+ unsigned short b;
+ unsigned char c;
+ };
+};
diff --git a/tests/headers/union_with_big_member.h b/tests/headers/union_with_big_member.h
new file mode 100644
index 00000000..6347d6ca
--- /dev/null
+++ b/tests/headers/union_with_big_member.h
@@ -0,0 +1,14 @@
+union WithBigArray {
+ int a;
+ int b[33];
+};
+
+union WithBigArray2 {
+ int a;
+ char b[33];
+};
+
+union WithBigMember {
+ int a;
+ union WithBigArray b;
+};
diff --git a/tests/headers/union_with_nesting.h b/tests/headers/union_with_nesting.h
new file mode 100644
index 00000000..cd907d57
--- /dev/null
+++ b/tests/headers/union_with_nesting.h
@@ -0,0 +1,14 @@
+union foo {
+ unsigned int a;
+ struct {
+ union {
+ unsigned short b1;
+ unsigned short b2;
+ };
+
+ union {
+ unsigned short c1;
+ unsigned short c2;
+ };
+ };
+};
diff --git a/tests/headers/unknown_attr.h b/tests/headers/unknown_attr.h
new file mode 100644
index 00000000..f87e9f0b
--- /dev/null
+++ b/tests/headers/unknown_attr.h
@@ -0,0 +1,6 @@
+typedef struct {
+ long long __clang_max_align_nonce1
+ __attribute__((__aligned__(__alignof__(long long))));
+ long double __clang_max_align_nonce2
+ __attribute__((__aligned__(__alignof__(long double))));
+} max_align_t;
diff --git a/tests/headers/use-core.h b/tests/headers/use-core.h
new file mode 100644
index 00000000..42bb10d9
--- /dev/null
+++ b/tests/headers/use-core.h
@@ -0,0 +1,8 @@
+// bindgen-flags: --use-core --raw-line "extern crate core;"
+
+struct foo {
+ int a, b;
+ void* bar;
+};
+
+typedef void (*fooFunction)(int bar);
diff --git a/tests/headers/using.hpp b/tests/headers/using.hpp
new file mode 100644
index 00000000..ba07b9c8
--- /dev/null
+++ b/tests/headers/using.hpp
@@ -0,0 +1,11 @@
+// bindgen-flags: -- -std=c++11
+
+template<typename T>
+class Point {
+ T x;
+ T y;
+};
+
+typedef Point<int> IntPoint2D;
+
+using IntVec2D = Point<int>;
diff --git a/tests/headers/var-tracing.hpp b/tests/headers/var-tracing.hpp
new file mode 100644
index 00000000..0d0b0cca
--- /dev/null
+++ b/tests/headers/var-tracing.hpp
@@ -0,0 +1,10 @@
+// bindgen-flags: --whitelist-type Baz
+
+struct Bar {
+ const int m_baz;
+ Bar(int baz);
+};
+
+class Baz {
+ static const Bar FOO[];
+};
diff --git a/tests/headers/variadic-method.hpp b/tests/headers/variadic-method.hpp
new file mode 100644
index 00000000..78a8eb45
--- /dev/null
+++ b/tests/headers/variadic-method.hpp
@@ -0,0 +1,6 @@
+
+void foo(const char* fmt, ...);
+
+struct Bar {
+ void foo(const char* fmt, ...);
+};
diff --git a/tests/headers/variadic_template_function.hpp b/tests/headers/variadic_template_function.hpp
new file mode 100644
index 00000000..4942d8f0
--- /dev/null
+++ b/tests/headers/variadic_template_function.hpp
@@ -0,0 +1,6 @@
+
+template <typename T>
+class VariadicFunctionObject {
+public:
+ int add_em_up(T count,...);
+};
diff --git a/tests/headers/vector.hpp b/tests/headers/vector.hpp
new file mode 100644
index 00000000..4707f77f
--- /dev/null
+++ b/tests/headers/vector.hpp
@@ -0,0 +1,3 @@
+struct foo {
+ __attribute__((__vector_size__(1 * sizeof(long long)))) long long mMember;
+};
diff --git a/tests/headers/virtual_dtor.hpp b/tests/headers/virtual_dtor.hpp
new file mode 100644
index 00000000..c35dcab1
--- /dev/null
+++ b/tests/headers/virtual_dtor.hpp
@@ -0,0 +1,3 @@
+struct nsSlots {
+ virtual ~nsSlots();
+};
diff --git a/tests/headers/virtual_inheritance.hpp b/tests/headers/virtual_inheritance.hpp
new file mode 100644
index 00000000..5198c51e
--- /dev/null
+++ b/tests/headers/virtual_inheritance.hpp
@@ -0,0 +1,16 @@
+
+class A {
+ int foo;
+};
+
+class B: public virtual A {
+ int bar;
+};
+
+class C: public virtual A {
+ int baz;
+};
+
+class D: public C, public B {
+ int bazz;
+};
diff --git a/tests/headers/virtual_overloaded.hpp b/tests/headers/virtual_overloaded.hpp
new file mode 100644
index 00000000..8aea8a19
--- /dev/null
+++ b/tests/headers/virtual_overloaded.hpp
@@ -0,0 +1,5 @@
+class C {
+public:
+ virtual void do_thing(char) { };
+ virtual void do_thing(int) { };
+};
diff --git a/tests/headers/vtable_recursive_sig.hpp b/tests/headers/vtable_recursive_sig.hpp
new file mode 100644
index 00000000..8729be00
--- /dev/null
+++ b/tests/headers/vtable_recursive_sig.hpp
@@ -0,0 +1,11 @@
+// bindgen-flags: -- -std=c++11
+
+class Derived;
+class Base {
+public:
+ virtual Derived* AsDerived() { return nullptr; }
+};
+
+class Derived final : public Base {
+ virtual Derived* AsDerived() override { return this; }
+};
diff --git a/tests/headers/weird_bitfields.hpp b/tests/headers/weird_bitfields.hpp
new file mode 100644
index 00000000..755681c1
--- /dev/null
+++ b/tests/headers/weird_bitfields.hpp
@@ -0,0 +1,35 @@
+// bindgen-flags: --no-unstable-rust
+// You can guess where this is taken from...
+enum nsStyleSVGOpacitySource {
+ eStyleSVGOpacitySource_Normal,
+ eStyleSVGOpacitySource_ContextFillOpacity,
+ eStyleSVGOpacitySource_ContextStrokeOpacity
+};
+
+class Weird {
+ unsigned int mStrokeDasharrayLength;
+ unsigned int bitTest: 16;
+ unsigned int bitTest2: 15;
+ unsigned char mClipRule; // [inherited]
+ unsigned char mColorInterpolation; // [inherited] see nsStyleConsts.h
+ unsigned char mColorInterpolationFilters; // [inherited] see nsStyleConsts.h
+ unsigned char mFillRule; // [inherited] see nsStyleConsts.h
+ unsigned char mImageRendering; // [inherited] see nsStyleConsts.h
+ unsigned char mPaintOrder; // [inherited] see nsStyleConsts.h
+ unsigned char mShapeRendering; // [inherited] see nsStyleConsts.h
+ unsigned char mStrokeLinecap; // [inherited] see nsStyleConsts.h
+ unsigned char mStrokeLinejoin; // [inherited] see nsStyleConsts.h
+ unsigned char mTextAnchor; // [inherited] see nsStyleConsts.h
+ unsigned char mTextRendering; // [inherited] see nsStyleConsts.h
+
+ // In SVG glyphs, whether we inherit fill or stroke opacity from the outer
+ // text object.
+ // Use 3 bits to avoid signedness problems in MSVC.
+ nsStyleSVGOpacitySource mFillOpacitySource : 3;
+ nsStyleSVGOpacitySource mStrokeOpacitySource : 3;
+
+ // SVG glyph outer object inheritance for other properties
+ bool mStrokeDasharrayFromObject : 1;
+ bool mStrokeDashoffsetFromObject : 1;
+ bool mStrokeWidthFromObject : 1;
+};
diff --git a/tests/headers/what_is_going_on.hpp b/tests/headers/what_is_going_on.hpp
new file mode 100644
index 00000000..078c1ad5
--- /dev/null
+++ b/tests/headers/what_is_going_on.hpp
@@ -0,0 +1,19 @@
+
+struct UnknownUnits {};
+typedef float Float;
+
+template<class units, class F = Float>
+struct PointTyped {
+ F x;
+ F y;
+
+ static PointTyped<units, F> FromUnknownPoint(const PointTyped<UnknownUnits, F>& aPoint) {
+ return PointTyped<units, F>(aPoint.x, aPoint.y);
+ }
+
+ PointTyped<UnknownUnits, F> ToUnknownPoint() const {
+ return PointTyped<UnknownUnits, F>(this->x, this->y);
+ }
+};
+
+typedef PointTyped<UnknownUnits> IntPoint;
diff --git a/tests/headers/whitelist-namespaces-basic.hpp b/tests/headers/whitelist-namespaces-basic.hpp
new file mode 100644
index 00000000..2eaa8740
--- /dev/null
+++ b/tests/headers/whitelist-namespaces-basic.hpp
@@ -0,0 +1,10 @@
+// bindgen-flags: --enable-cxx-namespaces --whitelist-type outer::inner::Helper
+
+namespace outer {
+ namespace inner {
+ struct Helper {};
+ }
+ struct Test {
+ inner::Helper helper;
+ };
+}
diff --git a/tests/headers/whitelist-namespaces.hpp b/tests/headers/whitelist-namespaces.hpp
new file mode 100644
index 00000000..d34cbe94
--- /dev/null
+++ b/tests/headers/whitelist-namespaces.hpp
@@ -0,0 +1,10 @@
+// bindgen-flags: --enable-cxx-namespaces --whitelist-type '.*'
+
+namespace outer {
+ namespace inner {
+ struct Helper {};
+ }
+ struct Test {
+ inner::Helper helper;
+ };
+}
diff --git a/tests/headers/whitelist_basic.hpp b/tests/headers/whitelist_basic.hpp
new file mode 100644
index 00000000..8424f75a
--- /dev/null
+++ b/tests/headers/whitelist_basic.hpp
@@ -0,0 +1,16 @@
+// bindgen-flags: --whitelist-type WhitelistMe
+
+template<typename T>
+class WhitelistMe {
+ class Inner {
+ T bar;
+ };
+
+ int foo;
+ Inner bar;
+};
+
+struct DontWhitelistMe {
+ void* foo;
+ double _Complex noComplexGenerated;
+};
diff --git a/tests/headers/whitelist_fix.hpp b/tests/headers/whitelist_fix.hpp
new file mode 100644
index 00000000..d0abda54
--- /dev/null
+++ b/tests/headers/whitelist_fix.hpp
@@ -0,0 +1,4 @@
+// bindgen-flags: --whitelist-function 'Servo_.*' --blacklist-type Test --raw-line "pub enum Test {}"
+
+struct Test {};
+extern "C" void Servo_Test(Test* a);
diff --git a/tests/headers/whitelist_vars.h b/tests/headers/whitelist_vars.h
new file mode 100644
index 00000000..07fa2815
--- /dev/null
+++ b/tests/headers/whitelist_vars.h
@@ -0,0 +1,4 @@
+#define NONE 0
+#define FOO 5
+#define FOOB -2
+#define FOOBAR (-10)
diff --git a/tests/tests.rs b/tests/tests.rs
new file mode 100644
index 00000000..05c8ad2c
--- /dev/null
+++ b/tests/tests.rs
@@ -0,0 +1,140 @@
+extern crate clap;
+extern crate diff;
+extern crate bindgen;
+extern crate shlex;
+
+use bindgen::Builder;
+use std::fs;
+use std::io::{BufRead, BufReader, Error, ErrorKind, Read, Write};
+use std::path::PathBuf;
+
+#[path="../src/options.rs"]
+mod options;
+use options::builder_from_flags;
+
+fn compare_generated_header(header: &PathBuf,
+ builder: Builder)
+ -> Result<(), Error> {
+ let file_name = try!(header.file_name()
+ .ok_or(Error::new(ErrorKind::Other, "spawn_bindgen expects a file")));
+
+ let mut expected = PathBuf::from(header);
+ expected.pop();
+ expected.pop();
+ expected.push("expectations");
+ expected.push("tests");
+ expected.push(file_name);
+ expected.set_extension("rs");
+
+ // We skip the generate() error here so we get a full diff below
+ let output = match builder.generate() {
+ Ok(bindings) => bindings.to_string(),
+ Err(_) => "".to_string(),
+ };
+
+ let mut buffer = String::new();
+ {
+ if let Ok(expected_file) = fs::File::open(&expected) {
+ try!(BufReader::new(expected_file).read_to_string(&mut buffer));
+ }
+ }
+
+ if output == buffer {
+ if !output.is_empty() {
+ return Ok(());
+ }
+ return Err(Error::new(ErrorKind::Other,
+ "Something's gone really wrong!"));
+ }
+
+ println!("diff expected generated");
+ println!("--- expected: {:?}", expected);
+ println!("+++ generated from: {:?}", header);
+
+ for diff in diff::lines(&buffer, &output) {
+ match diff {
+ diff::Result::Left(l) => println!("-{}", l),
+ diff::Result::Both(l, _) => println!(" {}", l),
+ diff::Result::Right(r) => println!("+{}", r),
+ }
+ }
+
+ // Override the diff.
+ {
+ let mut expected_file = try!(fs::File::create(&expected));
+ try!(expected_file.write_all(output.as_bytes()));
+ }
+
+ Err(Error::new(ErrorKind::Other, "Header and binding differ!"))
+}
+
+fn create_bindgen_builder(header: &PathBuf)
+ -> Result<Option<Builder>, Error> {
+ let source = try!(fs::File::open(header));
+ let reader = BufReader::new(source);
+
+ // Scoop up bindgen-flags from test header
+ let mut flags = Vec::with_capacity(2);
+
+ for line in reader.lines().take(2) {
+ let line = try!(line);
+ if line.contains("bindgen-flags: ") {
+ let extra_flags = line.split("bindgen-flags: ")
+ .last()
+ .and_then(shlex::split)
+ .unwrap();
+ flags.extend(extra_flags.into_iter());
+ } else if line.contains("bindgen-unstable") &&
+ cfg!(feature = "llvm_stable") {
+ return Ok(None);
+ }
+ }
+
+ // Fool builder_from_flags() into believing it has real env::args_os...
+ // - add "bindgen" as executable name 0th element
+ // - add header filename as 1st element
+ // - prepend raw lines so they're in the right order for expected output
+ // - append the test header's bindgen flags
+ let header_str = try!(header.to_str()
+ .ok_or(Error::new(ErrorKind::Other, "Invalid header file name")));
+
+ let prepend = ["bindgen",
+ header_str,
+ "--raw-line",
+ "",
+ "--raw-line",
+ "#![allow(non_snake_case)]",
+ "--raw-line",
+ ""];
+
+ let args = prepend.into_iter()
+ .map(ToString::to_string)
+ .chain(flags.into_iter());
+
+ builder_from_flags(args)
+ .map(|(builder, _)| Some(builder.no_unstable_rust()))
+}
+
+macro_rules! test_header {
+ ($function:ident, $header:expr) => (
+ #[test]
+ fn $function() {
+ let header = PathBuf::from($header);
+ let result = create_bindgen_builder(&header)
+ .and_then(|builder| {
+ if let Some(builder) = builder {
+ compare_generated_header(&header, builder)
+ } else {
+ Ok(())
+ }
+ });
+
+ if let Err(err) = result {
+ panic!("{}", err);
+ }
+ }
+ )
+}
+
+// This file is generated by build.rs
+include!(concat!(env!("OUT_DIR"), "/tests.rs"));
diff --git a/tests/uses/.gitignore b/tests/uses/.gitignore
new file mode 100644
index 00000000..40d7cb4c
--- /dev/null
+++ b/tests/uses/.gitignore
@@ -0,0 +1,2 @@
+*.c
+*.cpp