├── .gitattributes ├── .github ├── ISSUE_TEMPLATE.md └── workflows │ ├── bindgen.yml │ ├── bump-version.yml │ ├── create-tag.yml │ ├── deploy-book.yml │ ├── publish.yml │ └── release.yml ├── .gitignore ├── CHANGELOG.md ├── CONTRIBUTING.md ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── README.md ├── appveyor.yml ├── bindgen-cli ├── Cargo.toml ├── LICENSE └── main.rs ├── bindgen-integration ├── .gitattributes ├── Cargo.toml ├── build.rs ├── cpp │ ├── Test.cc │ └── Test.h ├── include │ └── stub.h └── src │ └── lib.rs ├── bindgen-tests ├── Cargo.toml ├── build.rs ├── src │ └── lib.rs └── tests │ ├── .gitattributes │ ├── expectations │ ├── Cargo.toml │ ├── build.rs │ ├── lib.rs │ ├── rustfmt.toml │ ├── src │ │ └── lib.rs │ ├── struct_with_anon_struct_array_float.rs │ └── tests │ │ ├── .gitattributes │ │ ├── 16-byte-alignment.rs │ │ ├── 381-decltype-alias.rs │ │ ├── abi-override.rs │ │ ├── abi_variadic_function.rs │ │ ├── accessors.rs │ │ ├── alias_comments.rs │ │ ├── allowlist-file.rs │ │ ├── allowlist-namespaces-basic.rs │ │ ├── allowlist-namespaces.rs │ │ ├── allowlist_basic.rs │ │ ├── allowlist_fix.rs │ │ ├── allowlist_item.rs │ │ ├── allowlist_vars.rs │ │ ├── allowlist_warnings.rs │ │ ├── allowlisted-item-references-no-hash.rs │ │ ├── allowlisted-item-references-no-partialeq.rs │ │ ├── allowlisted_item_references_no_copy.rs │ │ ├── annotation_hide.rs │ │ ├── anon-fields-prefix.rs │ │ ├── anon_enum.rs │ │ ├── anon_enum_allowlist.rs │ │ ├── anon_enum_allowlist_item.rs │ │ ├── anon_enum_blocklist.rs │ │ ├── anon_enum_trait.rs │ │ ├── anon_struct_in_union.rs │ │ ├── anon_union.rs │ │ ├── anonymous-template-types.rs │ │ ├── arg_keyword.rs │ │ ├── array-of-zero-sized-types.rs │ │ ├── atomic-constant.rs │ │ ├── attribute-custom-cli.rs │ │ ├── attribute-custom.rs │ │ ├── attribute_warn_unused_result.rs │ │ ├── attribute_warn_unused_result_no_attribute_detection.rs │ │ ├── auto.rs │ │ ├── bad-namespace-parenthood-inheritance.rs │ │ ├── base-to-derived.rs │ │ ├── bindgen-union-inside-namespace.rs │ │ ├── bitfield-32bit-overflow.rs │ │ ├── bitfield-enum-basic.rs │ │ ├── bitfield-enum-repr-c.rs │ │ ├── bitfield-enum-repr-transparent.rs │ │ ├── bitfield-large.rs │ │ ├── bitfield-linux-32.rs │ │ ├── bitfield-method-same-name.rs │ │ ├── bitfield_align.rs │ │ ├── bitfield_align_2.rs │ │ ├── bitfield_large_overflow.rs │ │ ├── bitfield_method_mangling.rs │ │ ├── bitfield_pragma_packed.rs │ │ ├── block_return_type.rs │ │ ├── blocklist-and-impl-debug.rs │ │ ├── blocklist-file.rs │ │ ├── blocklist-function.rs │ │ ├── blocklist-item.rs │ │ ├── blocklist-methods.rs │ │ ├── blocklist-var.rs │ │ ├── blocklist_bitfield_unit.rs │ │ ├── blocks-signature.rs │ │ ├── blocks.rs │ │ ├── bug-1529681.rs │ │ ├── builtin-template.rs │ │ ├── c-empty-layout.rs │ │ ├── c-unwind-abi-override.rs │ │ ├── c_naming.rs │ │ ├── call-conv-field.rs │ │ ├── call-conv-typedef.rs │ │ ├── canonical-types.rs │ │ ├── canonical_path_without_namespacing.rs │ │ ├── char.rs │ │ ├── char16_t.rs │ │ ├── class.rs │ │ ├── class_nested.rs │ │ ├── class_no_members.rs │ │ ├── class_static.rs │ │ ├── class_static_const.rs │ │ ├── class_use_as.rs │ │ ├── class_with_dtor.rs │ │ ├── class_with_enum.rs │ │ ├── class_with_inner_struct.rs │ │ ├── class_with_typedef.rs │ │ ├── comment-indent.rs │ │ ├── complex.rs │ │ ├── complex_global.rs │ │ ├── const-const-mut-ptr.rs │ │ ├── const_array.rs │ │ ├── const_array_fn_arg.rs │ │ ├── const_array_typedef.rs │ │ ├── const_bool.rs │ │ ├── const_enum_unnamed.rs │ │ ├── const_multidim_array_fn_arg.rs │ │ ├── const_ptr.rs │ │ ├── const_resolved_ty.rs │ │ ├── const_tparam.rs │ │ ├── constant-evaluate.rs │ │ ├── constant-non-specialized-tp.rs │ │ ├── constified-enum-module-overflow.rs │ │ ├── constify-all-enums.rs │ │ ├── constify-enum.rs │ │ ├── constify-module-enums-basic.rs │ │ ├── constify-module-enums-namespace.rs │ │ ├── constify-module-enums-shadow-name.rs │ │ ├── constify-module-enums-simple-alias.rs │ │ ├── constify-module-enums-simple-nonamespace.rs │ │ ├── constify-module-enums-types.rs │ │ ├── constructor-tp.rs │ │ ├── constructors.rs │ │ ├── constructors_1_33.rs │ │ ├── contains-vs-inherits-zero-sized.rs │ │ ├── convert-cpp-comment-to-rust.rs │ │ ├── convert-floats.rs │ │ ├── core_ffi_c.rs │ │ ├── cpp-empty-layout.rs │ │ ├── crtp.rs │ │ ├── ctypes-prefix-path.rs │ │ ├── dash_language.rs │ │ ├── decl_extern_int_twice.rs │ │ ├── decl_ptr_to_array.rs │ │ ├── default-enum-style-constified-module.rs │ │ ├── default-macro-constant-type-signed.rs │ │ ├── default-macro-constant-type-unsigned.rs │ │ ├── default-macro-constant-type.rs │ │ ├── default-template-parameter.rs │ │ ├── default_visibility_crate.rs │ │ ├── default_visibility_private.rs │ │ ├── default_visibility_private_respects_cxx_access_spec.rs │ │ ├── deleted-function.rs │ │ ├── derive-bitfield-method-same-name.rs │ │ ├── derive-clone.rs │ │ ├── derive-custom-cli.rs │ │ ├── derive-custom.rs │ │ ├── derive-debug-bitfield-1-51.rs │ │ ├── derive-debug-bitfield-core.rs │ │ ├── derive-debug-bitfield.rs │ │ ├── derive-debug-function-pointer.rs │ │ ├── derive-debug-generic.rs │ │ ├── derive-debug-mangle-name.rs │ │ ├── derive-debug-opaque-template-instantiation.rs │ │ ├── derive-debug-opaque.rs │ │ ├── derive-default-and-blocklist.rs │ │ ├── derive-fn-ptr.rs │ │ ├── derive-hash-and-blocklist.rs │ │ ├── derive-hash-blocklisting.rs │ │ ├── derive-hash-struct-with-anon-struct-float.rs │ │ ├── derive-hash-struct-with-float-array.rs │ │ ├── derive-hash-struct-with-incomplete-array.rs │ │ ├── derive-hash-struct-with-pointer.rs │ │ ├── derive-hash-template-def-float.rs │ │ ├── derive-hash-template-inst-float.rs │ │ ├── derive-partialeq-and-blocklist.rs │ │ ├── derive-partialeq-anonfield.rs │ │ ├── derive-partialeq-base.rs │ │ ├── derive-partialeq-bitfield.rs │ │ ├── derive-partialeq-core.rs │ │ ├── derive-partialeq-pointer.rs │ │ ├── derive-partialeq-union.rs │ │ ├── disable-namespacing.rs │ │ ├── disable-nested-struct-naming.rs │ │ ├── disable-untagged-union.rs │ │ ├── divide-by-zero-in-struct-layout.rs │ │ ├── do-not-derive-copy.rs │ │ ├── doggo-or-null.rs │ │ ├── dupe-enum-variant-in-namespace.rs │ │ ├── duplicated-definition-count.rs │ │ ├── duplicated-namespaces-definitions.rs │ │ ├── duplicated-namespaces.rs │ │ ├── duplicated_constants_in_ns.rs │ │ ├── dynamic_loading_attributes.rs │ │ ├── dynamic_loading_required.rs │ │ ├── dynamic_loading_simple.rs │ │ ├── dynamic_loading_template.rs │ │ ├── dynamic_loading_variable_required.rs │ │ ├── dynamic_loading_variable_simple.rs │ │ ├── dynamic_loading_variable_with_allowlist.rs │ │ ├── dynamic_loading_with_allowlist.rs │ │ ├── dynamic_loading_with_blocklist.rs │ │ ├── dynamic_loading_with_class.rs │ │ ├── elaborated.rs │ │ ├── empty-enum.rs │ │ ├── empty-union.rs │ │ ├── empty_template_param_name.rs │ │ ├── enum-default-bitfield.rs │ │ ├── enum-default-consts.rs │ │ ├── enum-default-module.rs │ │ ├── enum-default-rust.d │ │ ├── enum-default-rust.rs │ │ ├── enum-doc-bitfield.rs │ │ ├── enum-doc-mod.rs │ │ ├── enum-doc-rusty.rs │ │ ├── enum-doc.rs │ │ ├── enum-no-debug-rust.rs │ │ ├── enum-translate-type.rs │ │ ├── enum-typedef.rs │ │ ├── enum-undefault.rs │ │ ├── enum-variant-replaces.rs │ │ ├── enum.rs │ │ ├── enum_alias.rs │ │ ├── enum_and_vtable_mangling.rs │ │ ├── enum_dupe.rs │ │ ├── enum_explicit_type.rs │ │ ├── enum_explicit_type_constants.rs │ │ ├── enum_in_template.rs │ │ ├── enum_in_template_with_typedef.rs │ │ ├── enum_negative.rs │ │ ├── enum_packed.rs │ │ ├── error-E0600-cannot-apply-unary-negation-to-u32.rs │ │ ├── eval-value-dependent.rs │ │ ├── eval-variadic-template-parameter.rs │ │ ├── explicit-padding.rs │ │ ├── extern-const-struct.rs │ │ ├── extern.rs │ │ ├── extern_blocks_post_1_82.rs │ │ ├── extern_blocks_pre_1_82.rs │ │ ├── field-visibility-callback.rs │ │ ├── field-visibility.rs │ │ ├── fit-macro-constant-types-signed.rs │ │ ├── fit-macro-constant-types.rs │ │ ├── flexarray.rs │ │ ├── float128.rs │ │ ├── float16.rs │ │ ├── forward-declaration-autoptr.rs │ │ ├── forward-enum-decl.rs │ │ ├── forward-inherit-struct-with-fields.rs │ │ ├── forward-inherit-struct.rs │ │ ├── forward_declared_complex_types.rs │ │ ├── forward_declared_opaque.rs │ │ ├── forward_declared_struct.rs │ │ ├── func_proto.rs │ │ ├── func_ptr.rs │ │ ├── func_ptr_in_struct.rs │ │ ├── func_ptr_return_type.rs │ │ ├── func_return_must_use.rs │ │ ├── func_with_array_arg.rs │ │ ├── func_with_func_ptr_arg.rs │ │ ├── function-typedef-stdcall.rs │ │ ├── gen-constructors-neg.rs │ │ ├── gen-constructors.rs │ │ ├── gen-destructors-neg.rs │ │ ├── gen-destructors.rs │ │ ├── generate-inline.rs │ │ ├── generated │ │ ├── README.md │ │ └── wrap_static_fns.c │ │ ├── i128.rs │ │ ├── in_class_typedef.rs │ │ ├── incomplete-array-padding.rs │ │ ├── infinite-macro.rs │ │ ├── inherit-from-template-instantiation-with-vtable.rs │ │ ├── inherit-namespaced.rs │ │ ├── inherit_multiple_interfaces.rs │ │ ├── inherit_named.rs │ │ ├── inherit_typedef.rs │ │ ├── inline-function.rs │ │ ├── inline_namespace.rs │ │ ├── inline_namespace_allowlist.rs │ │ ├── inline_namespace_conservative.rs │ │ ├── inline_namespace_macro.rs │ │ ├── inline_namespace_nested.rs │ │ ├── inline_namespace_no_ns_enabled.rs │ │ ├── inner-typedef-gh422.rs │ │ ├── inner_const.rs │ │ ├── inner_template_self.rs │ │ ├── int128_t.rs │ │ ├── issue-1025-unknown-enum-repr.rs │ │ ├── issue-1034.rs │ │ ├── issue-1040.rs │ │ ├── issue-1076-unnamed-bitfield-alignment.rs │ │ ├── issue-1113-template-references.rs │ │ ├── issue-1118-using-forward-decl.rs │ │ ├── issue-1197-pure-virtual-stuff.rs │ │ ├── issue-1198-alias-rust-bitfield-enum.rs │ │ ├── issue-1198-alias-rust-const-mod-bitfield-enum.rs │ │ ├── issue-1198-alias-rust-const-mod-enum.rs │ │ ├── issue-1198-alias-rust-enum.rs │ │ ├── issue-1216-variadic-member.rs │ │ ├── issue-1238-fwd-no-copy.rs │ │ ├── issue-1281.rs │ │ ├── issue-1285.rs │ │ ├── issue-1291.rs │ │ ├── issue-1350-attribute-overloadable.rs │ │ ├── issue-1375-prefixed-functions.rs │ │ ├── issue-1382-rust-primitive-types.rs │ │ ├── issue-1435.rs │ │ ├── issue-1443.rs │ │ ├── issue-1454.rs │ │ ├── issue-1464.rs │ │ ├── issue-1488-enum-new-type.rs │ │ ├── issue-1488-options.rs │ │ ├── issue-1488-template-alias-new-type.rs │ │ ├── issue-1498.rs │ │ ├── issue-1514.rs │ │ ├── issue-1554.rs │ │ ├── issue-1599-opaque-typedef-to-enum.rs │ │ ├── issue-1676-macro-namespace-prefix.rs │ │ ├── issue-1947.rs │ │ ├── issue-1977-larger-arrays.rs │ │ ├── issue-1995.rs │ │ ├── issue-2019.rs │ │ ├── issue-2239-template-dependent-bit-width.rs │ │ ├── issue-2556.rs │ │ ├── issue-2566-cstr.rs │ │ ├── issue-2566.rs │ │ ├── issue-2695.rs │ │ ├── issue-2966.rs │ │ ├── issue-3027.rs │ │ ├── issue-358.rs │ │ ├── issue-372.rs │ │ ├── issue-410.rs │ │ ├── issue-446.rs │ │ ├── issue-447.rs │ │ ├── issue-493.rs │ │ ├── issue-511.rs │ │ ├── issue-537-repr-packed-n.rs │ │ ├── issue-537.rs │ │ ├── issue-544-stylo-creduce-2.rs │ │ ├── issue-544-stylo-creduce.rs │ │ ├── issue-569-non-type-template-params-causing-layout-test-failures.rs │ │ ├── issue-573-layout-test-failures.rs │ │ ├── issue-574-assertion-failure-in-codegen.rs │ │ ├── issue-584-stylo-template-analysis-panic.rs │ │ ├── issue-638-stylo-cannot-find-T-in-this-scope.rs │ │ ├── issue-639-typedef-anon-field.rs │ │ ├── issue-643-inner-struct.rs │ │ ├── issue-645-cannot-find-type-T-in-this-scope.rs │ │ ├── issue-648-derive-debug-with-padding.rs │ │ ├── issue-654-struct-fn-collision.rs │ │ ├── issue-662-cannot-find-T-in-this-scope.rs │ │ ├── issue-662-part-2.rs │ │ ├── issue-674-1.rs │ │ ├── issue-674-2.rs │ │ ├── issue-674-3.rs │ │ ├── issue-677-nested-ns-specifier.rs │ │ ├── issue-691-template-parameter-virtual.rs │ │ ├── issue-710-must-use-type.rs │ │ ├── issue-739-pointer-wide-bitfield.rs │ │ ├── issue-753.rs │ │ ├── issue-769-bad-instantiation-test.rs │ │ ├── issue-801-opaque-sloppiness.rs │ │ ├── issue-807-opaque-types-methods-being-generated.rs │ │ ├── issue-816.rs │ │ ├── issue-820-unused-template-param-in-alias.rs │ │ ├── issue-826-generating-methods-when-asked-not-to.rs │ │ ├── issue-833-1.rs │ │ ├── issue-833-2.rs │ │ ├── issue-833.rs │ │ ├── issue-834.rs │ │ ├── issue-848-replacement-system-include.rs │ │ ├── issue-888-enum-var-decl-jump.rs │ │ ├── issue-944-derive-copy-and-blocklisting.rs │ │ ├── issue-946.rs │ │ ├── issue_311.rs │ │ ├── issue_315.rs │ │ ├── jsval_layout_opaque.rs │ │ ├── keywords.rs │ │ ├── layout.rs │ │ ├── layout_align.rs │ │ ├── layout_arp.rs │ │ ├── layout_array.rs │ │ ├── layout_array_too_long.rs │ │ ├── layout_cmdline_token.rs │ │ ├── layout_eth_conf.rs │ │ ├── layout_kni_mbuf.rs │ │ ├── layout_large_align_field.rs │ │ ├── layout_mbuf.rs │ │ ├── libclang-9 │ │ ├── atomic-constant.rs │ │ ├── constified-enum-module-overflow.rs │ │ ├── issue-544-stylo-creduce-2.rs │ │ ├── issue-753.rs │ │ ├── macro_fallback_non_system_dir.rs │ │ ├── ptr32-has-different-size.rs │ │ └── struct_typedef_ns.rs │ │ ├── libclang_version_specific_generated_tests.rs │ │ ├── long_double.rs │ │ ├── macro-expr-basic.rs │ │ ├── macro-expr-uncommon-token.rs │ │ ├── macro-redef.rs │ │ ├── macro_const.rs │ │ ├── maddness-is-avoidable.rs │ │ ├── mangling-ios.rs │ │ ├── mangling-linux32.rs │ │ ├── mangling-linux64.rs │ │ ├── mangling-macos.rs │ │ ├── mangling-win32.rs │ │ ├── mangling-win64.rs │ │ ├── merge_extern_blocks_post_1_82.rs │ │ ├── merge_extern_blocks_pre_1_82.rs │ │ ├── method-mangling.rs │ │ ├── module-allowlisted.rs │ │ ├── msvc-no-usr.rs │ │ ├── multiple-inherit-empty-correct-layout.rs │ │ ├── mutable.rs │ │ ├── namespace.rs │ │ ├── nested-template-typedef.rs │ │ ├── nested.rs │ │ ├── nested_vtable.rs │ │ ├── nested_within_namespace.rs │ │ ├── newtype-enum.rs │ │ ├── newtype-global-enum.rs │ │ ├── no-comments.rs │ │ ├── no-derive-debug.rs │ │ ├── no-derive-default.rs │ │ ├── no-hash-allowlisted.rs │ │ ├── no-hash-opaque.rs │ │ ├── no-partialeq-allowlisted.rs │ │ ├── no-partialeq-opaque.rs │ │ ├── no-recursive-allowlisting.rs │ │ ├── no-std.rs │ │ ├── no_copy.rs │ │ ├── no_copy_allowlisted.rs │ │ ├── no_copy_opaque.rs │ │ ├── no_debug.rs │ │ ├── no_debug_allowlisted.rs │ │ ├── no_debug_bypass_impl_debug.rs │ │ ├── no_debug_opaque.rs │ │ ├── no_default.rs │ │ ├── no_default_allowlisted.rs │ │ ├── no_default_bypass_derive_default.rs │ │ ├── no_default_opaque.rs │ │ ├── no_size_t_is_usize.rs │ │ ├── non-type-params.rs │ │ ├── noreturn.rs │ │ ├── nsBaseHashtable.rs │ │ ├── nsStyleAutoArray.rs │ │ ├── objc_allowlist.rs │ │ ├── objc_blocklist.rs │ │ ├── objc_category.rs │ │ ├── objc_class.rs │ │ ├── objc_class_method.rs │ │ ├── objc_escape.rs │ │ ├── objc_inheritance.rs │ │ ├── objc_interface.rs │ │ ├── objc_interface_type.rs │ │ ├── objc_method.rs │ │ ├── objc_method_clash.rs │ │ ├── objc_pointer_return_types.rs │ │ ├── objc_property_fnptr.rs │ │ ├── objc_protocol.rs │ │ ├── objc_protocol_inheritance.rs │ │ ├── objc_sel_and_id.rs │ │ ├── objc_template.rs │ │ ├── only_bitfields.rs │ │ ├── opaque-template-inst-member-2.rs │ │ ├── opaque-template-inst-member.rs │ │ ├── opaque-template-instantiation-namespaced.rs │ │ ├── opaque-template-instantiation.rs │ │ ├── opaque-tracing.rs │ │ ├── opaque_in_struct.rs │ │ ├── opaque_pointer.rs │ │ ├── opaque_typedef.rs │ │ ├── opencl_vector.rs │ │ ├── operator.rs │ │ ├── operator_equals.rs │ │ ├── ord-enum.rs │ │ ├── overflowed_enum.rs │ │ ├── overloading.rs │ │ ├── packed-bitfield.rs │ │ ├── packed-n-with-padding.rs │ │ ├── packed-vtable.rs │ │ ├── parm-union.rs │ │ ├── parsecb-anonymous-enum-variant-rename.rs │ │ ├── partial-specialization-and-inheritance.rs │ │ ├── pointer-attr.rs │ │ ├── prefix-link-name-c.rs │ │ ├── prefix-link-name-cpp.rs │ │ ├── prepend-enum-constified-variant.rs │ │ ├── prepend_enum_name.rs │ │ ├── private.rs │ │ ├── private_fields.rs │ │ ├── ptr32-has-different-size.rs │ │ ├── public-dtor.rs │ │ ├── qualified-dependent-types.rs │ │ ├── redeclaration.rs │ │ ├── redundant-packed-and-align.rs │ │ ├── ref_argument_array.rs │ │ ├── reparented_replacement.rs │ │ ├── replace_template_alias.rs │ │ ├── replace_use.rs │ │ ├── replaces_double.rs │ │ ├── repr-align.rs │ │ ├── resolved_type_def_function.rs │ │ ├── same_struct_name_in_different_namespaces.rs │ │ ├── sentry-defined-multiple-times.rs │ │ ├── short-enums.rs │ │ ├── size_t_template.rs │ │ ├── sort-items.rs │ │ ├── sorted_items.rs │ │ ├── special-members.rs │ │ ├── specific_receiver.rs │ │ ├── stdint_typedef.rs │ │ ├── strings_array.rs │ │ ├── strings_cstr.rs │ │ ├── strings_cstr2.rs │ │ ├── strings_cstr2_2018.rs │ │ ├── struct_containing_forward_declared_struct.rs │ │ ├── struct_typedef.rs │ │ ├── struct_typedef_ns.rs │ │ ├── struct_with_anon_struct.rs │ │ ├── struct_with_anon_struct_array.rs │ │ ├── struct_with_anon_struct_pointer.rs │ │ ├── struct_with_anon_union.rs │ │ ├── struct_with_anon_unnamed_struct.rs │ │ ├── struct_with_anon_unnamed_union.rs │ │ ├── struct_with_bitfields.rs │ │ ├── struct_with_derive_debug.rs │ │ ├── struct_with_large_array.rs │ │ ├── struct_with_nesting.rs │ │ ├── struct_with_packing.rs │ │ ├── struct_with_struct.rs │ │ ├── struct_with_typedef_template_arg.rs │ │ ├── template-fun-ty.rs │ │ ├── template-param-usage-0.rs │ │ ├── template-param-usage-1.rs │ │ ├── template-param-usage-10.rs │ │ ├── template-param-usage-11.rs │ │ ├── template-param-usage-12.rs │ │ ├── template-param-usage-13.rs │ │ ├── template-param-usage-14.rs │ │ ├── template-param-usage-15.rs │ │ ├── template-param-usage-2.rs │ │ ├── template-param-usage-3.rs │ │ ├── template-param-usage-4.rs │ │ ├── template-param-usage-5.rs │ │ ├── template-param-usage-6.rs │ │ ├── template-param-usage-7.rs │ │ ├── template-param-usage-8.rs │ │ ├── template-param-usage-9.rs │ │ ├── template-with-var.rs │ │ ├── template.rs │ │ ├── template_alias.rs │ │ ├── template_alias_basic.rs │ │ ├── template_alias_namespace.rs │ │ ├── template_fun.rs │ │ ├── template_instantiation_with_fn_local_type.rs │ │ ├── template_partial_specification.rs │ │ ├── template_typedef_transitive_param.rs │ │ ├── template_typedefs.rs │ │ ├── templateref_opaque.rs │ │ ├── templatized-bitfield.rs │ │ ├── test_macro_fallback_non_system_dir.rs │ │ ├── test_mixed_header_and_header_contents.rs │ │ ├── test_multiple_header_calls_in_builder.rs │ │ ├── timex.rs │ │ ├── transform-op.rs │ │ ├── type-referenced-by-allowlisted-function.rs │ │ ├── type_alias_empty.rs │ │ ├── type_alias_partial_template_especialization.rs │ │ ├── type_alias_template_specialized.rs │ │ ├── typedef-pointer-overlap.rs │ │ ├── typedefd-array-as-function-arg.rs │ │ ├── typeref.rs │ │ ├── uncallable_functions.rs │ │ ├── underscore.rs │ │ ├── union-align.rs │ │ ├── union-in-ns.rs │ │ ├── union_bitfield.rs │ │ ├── union_dtor.rs │ │ ├── union_fields.rs │ │ ├── union_template.rs │ │ ├── union_with_anon_struct.rs │ │ ├── union_with_anon_struct_bitfield.rs │ │ ├── union_with_anon_union.rs │ │ ├── union_with_anon_unnamed_struct.rs │ │ ├── union_with_anon_unnamed_union.rs │ │ ├── union_with_big_member.rs │ │ ├── union_with_nesting.rs │ │ ├── union_with_non_copy_member.rs │ │ ├── union_with_zero_sized_array.rs │ │ ├── unknown_attr.rs │ │ ├── unsorted-items.rs │ │ ├── use-core.rs │ │ ├── using.rs │ │ ├── va_list_aarch64_linux.rs │ │ ├── var-tracing.rs │ │ ├── variadic-method.rs │ │ ├── variadic_template_function.rs │ │ ├── vector.rs │ │ ├── virtual_dtor.rs │ │ ├── virtual_inheritance.rs │ │ ├── virtual_interface.rs │ │ ├── virtual_overloaded.rs │ │ ├── void_typedef.rs │ │ ├── vtable_recursive_sig.rs │ │ ├── wasm-constructor-returns.rs │ │ ├── wasm-import-module.rs │ │ ├── weird_bitfields.rs │ │ ├── what_is_going_on.rs │ │ ├── win32-dtors.rs │ │ ├── win32-thiscall.rs │ │ ├── win32-thiscall_1_73.rs │ │ ├── win32-thiscall_nightly.rs │ │ ├── win32-vectorcall-nightly.rs │ │ ├── win32-vectorcall.rs │ │ ├── with_array_pointers_arguments.rs │ │ ├── without_array_pointers_arguments.rs │ │ ├── wrap-static-fns.rs │ │ ├── wrap_unsafe_ops_anon_union.rs │ │ ├── wrap_unsafe_ops_class.rs │ │ ├── wrap_unsafe_ops_dynamic_loading_simple.rs │ │ ├── wrap_unsafe_ops_objc_class.rs │ │ ├── zero-size-array-align.rs │ │ └── zero-sized-array.rs │ ├── headers │ ├── 16-byte-alignment.h │ ├── 381-decltype-alias.hpp │ ├── abi-override.h │ ├── abi_variadic_function.hpp │ ├── accessors.hpp │ ├── alias_comments.h │ ├── allowlist-file.hpp │ ├── allowlist-namespaces-basic.hpp │ ├── allowlist-namespaces.hpp │ ├── allowlist_basic.hpp │ ├── allowlist_fix.hpp │ ├── allowlist_item.h │ ├── allowlist_vars.h │ ├── allowlist_warnings.h │ ├── allowlisted-item-references-no-hash.hpp │ ├── allowlisted-item-references-no-partialeq.hpp │ ├── allowlisted │ │ └── file.hpp │ ├── allowlisted_item_references_no_copy.hpp │ ├── annotation_hide.hpp │ ├── anon-fields-prefix.h │ ├── anon_enum.hpp │ ├── anon_enum_allowlist.h │ ├── anon_enum_allowlist_item.h │ ├── anon_enum_blocklist.h │ ├── anon_enum_trait.hpp │ ├── anon_struct_in_union.h │ ├── anon_union.hpp │ ├── anonymous-template-types.hpp │ ├── arg_keyword.hpp │ ├── array-of-zero-sized-types.hpp │ ├── atomic-constant.h │ ├── attribute-custom-cli.h │ ├── attribute-custom.h │ ├── attribute_warn_unused_result.hpp │ ├── attribute_warn_unused_result_no_attribute_detection.hpp │ ├── auto.hpp │ ├── bad-namespace-parenthood-inheritance.hpp │ ├── base-to-derived.hpp │ ├── bindgen-union-inside-namespace.hpp │ ├── bitfield-32bit-overflow.h │ ├── bitfield-enum-basic.hpp │ ├── bitfield-enum-repr-c.hpp │ ├── bitfield-enum-repr-transparent.hpp │ ├── bitfield-large.hpp │ ├── bitfield-linux-32.hpp │ ├── bitfield-method-same-name.hpp │ ├── bitfield_align.h │ ├── bitfield_align_2.h │ ├── bitfield_large_overflow.hpp │ ├── bitfield_method_mangling.h │ ├── bitfield_pragma_packed.h │ ├── block_return_type.h │ ├── blocklist-and-impl-debug.hpp │ ├── blocklist-file.hpp │ ├── blocklist-function.hpp │ ├── blocklist-item.hpp │ ├── blocklist-methods.hpp │ ├── blocklist-var.hpp │ ├── blocklist_bitfield_unit.h │ ├── blocklisted │ │ ├── fake-stdint.h │ │ └── file.hpp │ ├── blocks-signature.hpp │ ├── blocks.hpp │ ├── bug-1529681.hpp │ ├── builtin-template.hpp │ ├── c-empty-layout.h │ ├── c-unwind-abi-override.h │ ├── c_naming.h │ ├── call-conv-field.h │ ├── call-conv-typedef.h │ ├── canonical-types.hpp │ ├── canonical_path_without_namespacing.hpp │ ├── char.h │ ├── char16_t.hpp │ ├── class.hpp │ ├── class_nested.hpp │ ├── class_no_members.hpp │ ├── class_static.hpp │ ├── class_static_const.hpp │ ├── class_use_as.hpp │ ├── class_with_dtor.hpp │ ├── class_with_enum.hpp │ ├── class_with_inner_struct.hpp │ ├── class_with_typedef.hpp │ ├── comment-indent.hpp │ ├── complex.h │ ├── complex_global.h │ ├── const-const-mut-ptr.h │ ├── const_array.h │ ├── const_array_fn_arg.h │ ├── const_array_typedef.h │ ├── const_bool.hpp │ ├── const_enum_unnamed.hpp │ ├── const_multidim_array_fn_arg.h │ ├── const_ptr.hpp │ ├── const_resolved_ty.h │ ├── const_tparam.hpp │ ├── constant-evaluate.h │ ├── constant-non-specialized-tp.hpp │ ├── constified-enum-module-overflow.hpp │ ├── constify-all-enums.h │ ├── constify-enum.h │ ├── constify-module-enums-basic.h │ ├── constify-module-enums-namespace.hpp │ ├── constify-module-enums-shadow-name.h │ ├── constify-module-enums-simple-alias.hpp │ ├── constify-module-enums-simple-nonamespace.hpp │ ├── constify-module-enums-types.hpp │ ├── constructor-tp.hpp │ ├── constructors.hpp │ ├── constructors_1_33.hpp │ ├── contains-vs-inherits-zero-sized.hpp │ ├── convert-cpp-comment-to-rust.hpp │ ├── convert-floats.h │ ├── core_ffi_c.h │ ├── cpp-empty-layout.hpp │ ├── crtp.hpp │ ├── ctypes-prefix-path.h │ ├── dash_language.h │ ├── decl_extern_int_twice.h │ ├── decl_ptr_to_array.h │ ├── default-enum-style-constified-module.h │ ├── default-macro-constant-type-signed.h │ ├── default-macro-constant-type-unsigned.h │ ├── default-macro-constant-type.h │ ├── default-template-parameter.hpp │ ├── default_visibility_crate.h │ ├── default_visibility_private.h │ ├── default_visibility_private_respects_cxx_access_spec.h │ ├── deleted-function.hpp │ ├── derive-bitfield-method-same-name.hpp │ ├── derive-clone.h │ ├── derive-custom-cli.h │ ├── derive-custom.h │ ├── derive-debug-bitfield-1-51.hpp │ ├── derive-debug-bitfield-core.hpp │ ├── derive-debug-bitfield.hpp │ ├── derive-debug-function-pointer.hpp │ ├── derive-debug-generic.hpp │ ├── derive-debug-mangle-name.h │ ├── derive-debug-opaque-template-instantiation.hpp │ ├── derive-debug-opaque.hpp │ ├── derive-default-and-blocklist.hpp │ ├── derive-fn-ptr.h │ ├── derive-hash-and-blocklist.hpp │ ├── derive-hash-blocklisting.hpp │ ├── derive-hash-struct-with-anon-struct-float.h │ ├── derive-hash-struct-with-float-array.h │ ├── derive-hash-struct-with-incomplete-array.h │ ├── derive-hash-struct-with-pointer.h │ ├── derive-hash-template-def-float.hpp │ ├── derive-hash-template-inst-float.hpp │ ├── derive-partialeq-and-blocklist.hpp │ ├── derive-partialeq-anonfield.h │ ├── derive-partialeq-base.hpp │ ├── derive-partialeq-bitfield.hpp │ ├── derive-partialeq-core.h │ ├── derive-partialeq-pointer.hpp │ ├── derive-partialeq-union.hpp │ ├── disable-namespacing.hpp │ ├── disable-nested-struct-naming.h │ ├── disable-untagged-union.hpp │ ├── divide-by-zero-in-struct-layout.h │ ├── do-not-derive-copy.hpp │ ├── doggo-or-null.hpp │ ├── dupe-enum-variant-in-namespace.h │ ├── duplicated-definition-count.hpp │ ├── duplicated-namespaces-definitions.hpp │ ├── duplicated-namespaces.hpp │ ├── duplicated_constants_in_ns.hpp │ ├── dynamic_loading_attributes.h │ ├── dynamic_loading_required.h │ ├── dynamic_loading_simple.h │ ├── dynamic_loading_template.hpp │ ├── dynamic_loading_variable_required.h │ ├── dynamic_loading_variable_simple.h │ ├── dynamic_loading_variable_with_allowlist.hpp │ ├── dynamic_loading_with_allowlist.hpp │ ├── dynamic_loading_with_blocklist.hpp │ ├── dynamic_loading_with_class.hpp │ ├── elaborated.hpp │ ├── empty-enum.h │ ├── empty-union.hpp │ ├── empty_template_param_name.hpp │ ├── enum-default-bitfield.h │ ├── enum-default-consts.h │ ├── enum-default-module.h │ ├── enum-default-rust.h │ ├── enum-doc-bitfield.h │ ├── enum-doc-mod.h │ ├── enum-doc-rusty.h │ ├── enum-doc.h │ ├── enum-no-debug-rust.h │ ├── enum-translate-type.hpp │ ├── enum-typedef.h │ ├── enum-undefault.h │ ├── enum-variant-replaces.h │ ├── enum.h │ ├── enum_alias.hpp │ ├── enum_and_vtable_mangling.hpp │ ├── enum_dupe.h │ ├── enum_explicit_type.hpp │ ├── enum_explicit_type_constants.hpp │ ├── enum_in_template.hpp │ ├── enum_in_template_with_typedef.hpp │ ├── enum_negative.h │ ├── enum_packed.h │ ├── error-E0600-cannot-apply-unary-negation-to-u32.h │ ├── eval-value-dependent.hpp │ ├── eval-variadic-template-parameter.hpp │ ├── explicit-padding.h │ ├── extern-const-struct.h │ ├── extern.hpp │ ├── extern_blocks_post_1_82.h │ ├── extern_blocks_pre_1_82.h │ ├── field-visibility-callback.h │ ├── field-visibility.h │ ├── fit-macro-constant-types-signed.h │ ├── fit-macro-constant-types.h │ ├── flexarray.hpp │ ├── float128.hpp │ ├── float16.h │ ├── forward-declaration-autoptr.hpp │ ├── forward-enum-decl.hpp │ ├── forward-inherit-struct-with-fields.hpp │ ├── forward-inherit-struct.hpp │ ├── forward_declared_complex_types.hpp │ ├── forward_declared_opaque.h │ ├── forward_declared_struct.h │ ├── func_proto.h │ ├── func_ptr.h │ ├── func_ptr_in_struct.h │ ├── func_ptr_return_type.h │ ├── func_return_must_use.h │ ├── func_with_array_arg.h │ ├── func_with_func_ptr_arg.h │ ├── function-typedef-stdcall.h │ ├── gen-constructors-neg.hpp │ ├── gen-constructors.hpp │ ├── gen-destructors-neg.hpp │ ├── gen-destructors.hpp │ ├── generate-inline.hpp │ ├── i128.h │ ├── in_class_typedef.hpp │ ├── incomplete-array-padding.h │ ├── infinite-macro.h │ ├── inherit-from-template-instantiation-with-vtable.hpp │ ├── inherit-namespaced.hpp │ ├── inherit_multiple_interfaces.hpp │ ├── inherit_named.hpp │ ├── inherit_typedef.hpp │ ├── inline-function.h │ ├── inline_namespace.hpp │ ├── inline_namespace_allowlist.hpp │ ├── inline_namespace_conservative.hpp │ ├── inline_namespace_macro.hpp │ ├── inline_namespace_nested.hpp │ ├── inline_namespace_no_ns_enabled.hpp │ ├── inner-typedef-gh422.hpp │ ├── inner_const.hpp │ ├── inner_template_self.hpp │ ├── int128_t.h │ ├── issue-1025-unknown-enum-repr.hpp │ ├── issue-1034.h │ ├── issue-1040.h │ ├── issue-1076-unnamed-bitfield-alignment.h │ ├── issue-1113-template-references.hpp │ ├── issue-1118-using-forward-decl.hpp │ ├── issue-1197-pure-virtual-stuff.hpp │ ├── issue-1198-alias-rust-bitfield-enum.h │ ├── issue-1198-alias-rust-const-mod-bitfield-enum.h │ ├── issue-1198-alias-rust-const-mod-enum.h │ ├── issue-1198-alias-rust-enum.h │ ├── issue-1216-variadic-member.h │ ├── issue-1238-fwd-no-copy.h │ ├── issue-1281.h │ ├── issue-1285.h │ ├── issue-1291.hpp │ ├── issue-1350-attribute-overloadable.h │ ├── issue-1375-prefixed-functions.h │ ├── issue-1382-rust-primitive-types.h │ ├── issue-1435.hpp │ ├── issue-1443.hpp │ ├── issue-1454.h │ ├── issue-1464.hpp │ ├── issue-1488-enum-new-type.h │ ├── issue-1488-options.h │ ├── issue-1488-template-alias-new-type.hpp │ ├── issue-1498.h │ ├── issue-1514.hpp │ ├── issue-1554.h │ ├── issue-1599-opaque-typedef-to-enum.h │ ├── issue-1676-macro-namespace-prefix.hpp │ ├── issue-1947.h │ ├── issue-1977-larger-arrays.hpp │ ├── issue-1995.h │ ├── issue-2019.hpp │ ├── issue-2239-template-dependent-bit-width.hpp │ ├── issue-2556.h │ ├── issue-2556 │ │ ├── LayoutConstants.h │ │ ├── nsSize.h │ │ └── nsStyleStruct.h │ ├── issue-2566-cstr.h │ ├── issue-2566.h │ ├── issue-2695.h │ ├── issue-2966.h │ ├── issue-3027.hpp │ ├── issue-358.hpp │ ├── issue-372.hpp │ ├── issue-410.hpp │ ├── issue-446.hpp │ ├── issue-447.hpp │ ├── issue-493.hpp │ ├── issue-511.h │ ├── issue-537-repr-packed-n.h │ ├── issue-537.h │ ├── issue-544-stylo-creduce-2.hpp │ ├── issue-544-stylo-creduce.hpp │ ├── issue-569-non-type-template-params-causing-layout-test-failures.hpp │ ├── issue-573-layout-test-failures.hpp │ ├── issue-574-assertion-failure-in-codegen.hpp │ ├── issue-584-stylo-template-analysis-panic.hpp │ ├── issue-638-stylo-cannot-find-T-in-this-scope.hpp │ ├── issue-639-typedef-anon-field.hpp │ ├── issue-643-inner-struct.h │ ├── issue-645-cannot-find-type-T-in-this-scope.hpp │ ├── issue-648-derive-debug-with-padding.h │ ├── issue-654-struct-fn-collision.h │ ├── issue-662-cannot-find-T-in-this-scope.hpp │ ├── issue-662-part-2.hpp │ ├── issue-674-1.hpp │ ├── issue-674-2.hpp │ ├── issue-674-3.hpp │ ├── issue-677-nested-ns-specifier.hpp │ ├── issue-691-template-parameter-virtual.hpp │ ├── issue-710-must-use-type.h │ ├── issue-739-pointer-wide-bitfield.h │ ├── issue-753.h │ ├── issue-769-bad-instantiation-test.hpp │ ├── issue-801-opaque-sloppiness.hpp │ ├── issue-807-opaque-types-methods-being-generated.hpp │ ├── issue-816.h │ ├── issue-820-unused-template-param-in-alias.hpp │ ├── issue-826-generating-methods-when-asked-not-to.hpp │ ├── issue-833-1.hpp │ ├── issue-833-2.hpp │ ├── issue-833.hpp │ ├── issue-834.hpp │ ├── issue-848-replacement-system-include.hpp │ ├── issue-848 │ │ └── an-include.h │ ├── issue-888-enum-var-decl-jump.hpp │ ├── issue-944-derive-copy-and-blocklisting.hpp │ ├── issue-946.h │ ├── issue_311.hpp │ ├── issue_315.hpp │ ├── jsval_layout_opaque.hpp │ ├── keywords.h │ ├── layout.h │ ├── layout_align.h │ ├── layout_arp.h │ ├── layout_array.h │ ├── layout_array_too_long.h │ ├── layout_cmdline_token.h │ ├── layout_eth_conf.h │ ├── layout_kni_mbuf.h │ ├── layout_large_align_field.h │ ├── layout_mbuf.h │ ├── long_double.h │ ├── macro-expr-basic.h │ ├── macro-expr-uncommon-token.h │ ├── macro-redef.h │ ├── macro_const.h │ ├── maddness-is-avoidable.hpp │ ├── mangling-ios.h │ ├── mangling-linux32.hpp │ ├── mangling-linux64.hpp │ ├── mangling-macos.hpp │ ├── mangling-win32.hpp │ ├── mangling-win64.hpp │ ├── merge_extern_blocks_post_1_82.hpp │ ├── merge_extern_blocks_pre_1_82.hpp │ ├── method-mangling.hpp │ ├── module-allowlisted.hpp │ ├── msvc-no-usr.hpp │ ├── multiple-inherit-empty-correct-layout.hpp │ ├── mutable.hpp │ ├── namespace.hpp │ ├── namespace │ │ ├── nsbegin.h │ │ ├── nsdefine.h │ │ └── nsend.h │ ├── nested-template-typedef.hpp │ ├── nested.hpp │ ├── nested_vtable.hpp │ ├── nested_within_namespace.hpp │ ├── newtype-enum.hpp │ ├── newtype-global-enum.hpp │ ├── no-comments.h │ ├── no-derive-debug.h │ ├── no-derive-default.h │ ├── no-hash-allowlisted.hpp │ ├── no-hash-opaque.hpp │ ├── no-partialeq-allowlisted.hpp │ ├── no-partialeq-opaque.hpp │ ├── no-recursive-allowlisting.h │ ├── no-std.h │ ├── no_copy.hpp │ ├── no_copy_allowlisted.hpp │ ├── no_copy_opaque.hpp │ ├── no_debug.hpp │ ├── no_debug_allowlisted.hpp │ ├── no_debug_bypass_impl_debug.hpp │ ├── no_debug_opaque.hpp │ ├── no_default.hpp │ ├── no_default_allowlisted.hpp │ ├── no_default_bypass_derive_default.hpp │ ├── no_default_opaque.hpp │ ├── no_size_t_is_usize.h │ ├── non-type-params.hpp │ ├── noreturn.hpp │ ├── nsBaseHashtable.hpp │ ├── nsStyleAutoArray.hpp │ ├── objc_allowlist.h │ ├── objc_blocklist.h │ ├── objc_category.h │ ├── objc_class.h │ ├── objc_class_method.h │ ├── objc_escape.h │ ├── objc_inheritance.h │ ├── objc_interface.h │ ├── objc_interface_type.h │ ├── objc_method.h │ ├── objc_method_clash.h │ ├── objc_pointer_return_types.h │ ├── objc_property_fnptr.h │ ├── objc_protocol.h │ ├── objc_protocol_inheritance.h │ ├── objc_sel_and_id.h │ ├── objc_template.h │ ├── only_bitfields.hpp │ ├── opaque-template-inst-member-2.hpp │ ├── opaque-template-inst-member.hpp │ ├── opaque-template-instantiation-namespaced.hpp │ ├── opaque-template-instantiation.hpp │ ├── opaque-tracing.hpp │ ├── opaque_in_struct.hpp │ ├── opaque_pointer.hpp │ ├── opaque_typedef.hpp │ ├── opencl_vector.h │ ├── operator.hpp │ ├── operator_equals.hpp │ ├── ord-enum.h │ ├── overflowed_enum.hpp │ ├── overloading.hpp │ ├── packed-bitfield.h │ ├── packed-n-with-padding.h │ ├── packed-vtable.h │ ├── parm-union.hpp │ ├── parsecb-anonymous-enum-variant-rename.h │ ├── partial-specialization-and-inheritance.hpp │ ├── pointer-attr.h │ ├── prefix-link-name-c.h │ ├── prefix-link-name-cpp.hpp │ ├── prepend-enum-constified-variant.h │ ├── prepend_enum_name.hpp │ ├── private.hpp │ ├── private_fields.hpp │ ├── ptr32-has-different-size.h │ ├── public-dtor.hpp │ ├── qualified-dependent-types.hpp │ ├── redeclaration.hpp │ ├── redundant-packed-and-align.h │ ├── ref_argument_array.hpp │ ├── reparented_replacement.hpp │ ├── replace_template_alias.hpp │ ├── replace_use.hpp │ ├── replaces_double.hpp │ ├── repr-align.hpp │ ├── resolved_type_def_function.h │ ├── same_struct_name_in_different_namespaces.hpp │ ├── sentry-defined-multiple-times.hpp │ ├── short-enums.hpp │ ├── size_t_template.hpp │ ├── sorted_items.hpp │ ├── special-members.hpp │ ├── specific_receiver.hpp │ ├── stdint_typedef.h │ ├── strings_array.h │ ├── strings_cstr.h │ ├── strings_cstr2.h │ ├── strings_cstr2_2018.h │ ├── struct_containing_forward_declared_struct.h │ ├── struct_typedef.h │ ├── struct_typedef_ns.hpp │ ├── struct_with_anon_struct.h │ ├── struct_with_anon_struct_array.h │ ├── struct_with_anon_struct_pointer.h │ ├── struct_with_anon_union.h │ ├── struct_with_anon_unnamed_struct.h │ ├── struct_with_anon_unnamed_union.h │ ├── struct_with_bitfields.h │ ├── struct_with_derive_debug.h │ ├── struct_with_large_array.hpp │ ├── struct_with_nesting.h │ ├── struct_with_packing.h │ ├── struct_with_struct.h │ ├── struct_with_typedef_template_arg.hpp │ ├── template-fun-ty.hpp │ ├── template-param-usage-0.hpp │ ├── template-param-usage-1.hpp │ ├── template-param-usage-10.hpp │ ├── template-param-usage-11.hpp │ ├── template-param-usage-12.hpp │ ├── template-param-usage-13.hpp │ ├── template-param-usage-14.hpp │ ├── template-param-usage-15.hpp │ ├── template-param-usage-2.hpp │ ├── template-param-usage-3.hpp │ ├── template-param-usage-4.hpp │ ├── template-param-usage-5.hpp │ ├── template-param-usage-6.hpp │ ├── template-param-usage-7.hpp │ ├── template-param-usage-8.hpp │ ├── template-param-usage-9.hpp │ ├── template-with-var.hpp │ ├── template.hpp │ ├── template_alias.hpp │ ├── template_alias_basic.hpp │ ├── template_alias_namespace.hpp │ ├── template_fun.hpp │ ├── template_instantiation_with_fn_local_type.hpp │ ├── template_partial_specification.hpp │ ├── template_typedef_transitive_param.hpp │ ├── template_typedefs.hpp │ ├── templateref_opaque.hpp │ ├── templatized-bitfield.hpp │ ├── timex.h │ ├── transform-op.hpp │ ├── type-referenced-by-allowlisted-function.h │ ├── type_alias_empty.hpp │ ├── type_alias_partial_template_especialization.hpp │ ├── type_alias_template_specialized.hpp │ ├── typedef-pointer-overlap.h │ ├── typedefd-array-as-function-arg.h │ ├── typeref.hpp │ ├── uncallable_functions.hpp │ ├── underscore.hpp │ ├── union-align.h │ ├── union-in-ns.hpp │ ├── union_bitfield.h │ ├── union_dtor.hpp │ ├── union_fields.hpp │ ├── union_template.hpp │ ├── union_with_anon_struct.h │ ├── union_with_anon_struct_bitfield.h │ ├── union_with_anon_union.h │ ├── union_with_anon_unnamed_struct.h │ ├── union_with_anon_unnamed_union.h │ ├── union_with_big_member.h │ ├── union_with_nesting.h │ ├── union_with_non_copy_member.h │ ├── union_with_zero_sized_array.h │ ├── unknown_attr.h │ ├── unsorted-items.h │ ├── use-core.h │ ├── using.hpp │ ├── va_list_aarch64_linux.h │ ├── var-tracing.hpp │ ├── variadic-method.hpp │ ├── variadic_template_function.hpp │ ├── vector.hpp │ ├── virtual_dtor.hpp │ ├── virtual_inheritance.hpp │ ├── virtual_interface.hpp │ ├── virtual_overloaded.hpp │ ├── void_typedef.h │ ├── vtable_recursive_sig.hpp │ ├── wasm-constructor-returns.hpp │ ├── wasm-import-module.h │ ├── weird_bitfields.hpp │ ├── what_is_going_on.hpp │ ├── win32-dtors.hpp │ ├── win32-thiscall.hpp │ ├── win32-thiscall_1_73.hpp │ ├── win32-thiscall_nightly.hpp │ ├── win32-vectorcall-nightly.h │ ├── win32-vectorcall.h │ ├── with_array_pointers_arguments.h │ ├── without_array_pointers_arguments.h │ ├── wrap-static-fns.h │ ├── wrap_unsafe_ops_anon_union.hpp │ ├── wrap_unsafe_ops_class.hpp │ ├── wrap_unsafe_ops_dynamic_loading_simple.h │ ├── wrap_unsafe_ops_objc_class.h │ ├── zero-size-array-align.h │ └── zero-sized-array.hpp │ ├── macro_fallback_test_headers │ ├── another_header.h │ └── one_header.h │ ├── parse_callbacks │ ├── item_discovery_callback │ │ ├── header_item_discovery.h │ │ ├── header_item_discovery.hpp │ │ └── mod.rs │ └── mod.rs │ ├── quickchecking │ ├── .gitignore │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── bin.rs │ │ ├── fuzzers.rs │ │ └── lib.rs │ └── tests │ │ └── fuzzed-c-headers.rs │ ├── rustfmt.toml │ ├── stylo.hpp │ ├── stylo_sanity.rs │ ├── test-one.sh │ ├── tests.rs │ └── uses │ └── .gitignore ├── bindgen ├── Cargo.toml ├── LICENSE ├── build.rs ├── callbacks.rs ├── clang.rs ├── codegen │ ├── bitfield_unit.rs │ ├── bitfield_unit_raw_ref_macros.rs │ ├── bitfield_unit_tests.rs │ ├── dyngen.rs │ ├── error.rs │ ├── helpers.rs │ ├── impl_debug.rs │ ├── impl_partialeq.rs │ ├── mod.rs │ ├── postprocessing │ │ ├── merge_extern_blocks.rs │ │ ├── mod.rs │ │ └── sort_semantically.rs │ ├── serialize.rs │ └── struct_layout.rs ├── deps.rs ├── diagnostics.rs ├── extra_assertions.rs ├── features.rs ├── ir │ ├── analysis │ │ ├── derive.rs │ │ ├── has_destructor.rs │ │ ├── has_float.rs │ │ ├── has_type_param_in_array.rs │ │ ├── has_vtable.rs │ │ ├── mod.rs │ │ ├── sizedness.rs │ │ └── template_params.rs │ ├── annotations.rs │ ├── comment.rs │ ├── comp.rs │ ├── context.rs │ ├── derive.rs │ ├── dot.rs │ ├── enum_ty.rs │ ├── function.rs │ ├── int.rs │ ├── item.rs │ ├── item_kind.rs │ ├── layout.rs │ ├── mod.rs │ ├── module.rs │ ├── objc.rs │ ├── template.rs │ ├── traversal.rs │ ├── ty.rs │ └── var.rs ├── lib.rs ├── log_stubs.rs ├── options │ ├── as_args.rs │ ├── cli.rs │ ├── helpers.rs │ └── mod.rs ├── parse.rs ├── regex_set.rs └── time.rs ├── book ├── .gitignore ├── book.toml └── src │ ├── SUMMARY.md │ ├── allowlisting.md │ ├── blocklisting.md │ ├── code-formatting.md │ ├── command-line-usage.md │ ├── cpp.md │ ├── customizing-generated-bindings.md │ ├── faq.md │ ├── introduction.md │ ├── library-usage.md │ ├── must-use-types.md │ ├── nocopy.md │ ├── nodebug.md │ ├── nodefault.md │ ├── non-system-libraries.md │ ├── objc.md │ ├── opaque.md │ ├── replacing-types.md │ ├── requirements.md │ ├── tutorial-0.md │ ├── tutorial-1.md │ ├── tutorial-2.md │ ├── tutorial-3.md │ ├── tutorial-4.md │ ├── tutorial-5.md │ ├── tutorial-6.md │ ├── using-bitfields.md │ ├── using-fam.md │ ├── using-unions.md │ └── visibility.md ├── ci ├── assert-no-diff.bat ├── no-includes.sh ├── test.bat └── test.sh ├── clippy.toml ├── csmith-fuzzing ├── README.md ├── csmith.h ├── driver.py └── predicate.py ├── dist-workspace.toml ├── example-graphviz-ir.png ├── releases ├── friends.sh └── release-announcement-template.md ├── rustfmt.toml └── triagebot.toml /.gitattributes: -------------------------------------------------------------------------------- 1 | tests/stylo.hpp -diff 2 | tests/headers/* eol=lf 3 | tests/expectations/tests/* eol=lf -------------------------------------------------------------------------------- /bindgen-cli/LICENSE: -------------------------------------------------------------------------------- 1 | ../LICENSE -------------------------------------------------------------------------------- /bindgen-integration/.gitattributes: -------------------------------------------------------------------------------- 1 | # Tell Github Linguist to avoid counting these C and C++ test inputs toward 2 | # statistics. 3 | *.h -linguist-detectable 4 | *.cc -linguist-detectable 5 | -------------------------------------------------------------------------------- /bindgen-integration/cpp/Test.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rust-lang/rust-bindgen/763c8b956808c850660c521059d4588bf4be05df/bindgen-integration/cpp/Test.h -------------------------------------------------------------------------------- /bindgen-integration/include/stub.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rust-lang/rust-bindgen/763c8b956808c850660c521059d4588bf4be05df/bindgen-integration/include/stub.h -------------------------------------------------------------------------------- /bindgen-tests/src/lib.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /bindgen-tests/tests/.gitattributes: -------------------------------------------------------------------------------- 1 | # Tell Github Linguist to avoid counting these C and C++ test inputs toward 2 | # statistics. 3 | *.h -linguist-detectable 4 | *.hpp -linguist-detectable 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/lib.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rust-lang/rust-bindgen/763c8b956808c850660c521059d4588bf4be05df/bindgen-tests/tests/expectations/lib.rs -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/rustfmt.toml: -------------------------------------------------------------------------------- 1 | # disable rustfmt for this crate so running `cargo fmt` doesn't affect the expected binding files 2 | disable_all_formatting = true 3 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/src/lib.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/struct_with_anon_struct_array_float.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/.gitattributes: -------------------------------------------------------------------------------- 1 | # Prevent Github Linguist from counting generated files in statistics. 2 | *.rs linguist-generated 3 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/381-decltype-alias.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(C)] 3 | #[derive(Debug, Default, Copy, Clone)] 4 | pub struct std_allocator_traits { 5 | pub _address: u8, 6 | } 7 | pub type std_allocator_traits___size_type<_Alloc> = _Alloc; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/abi_variadic_function.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | unsafe extern "C" { 3 | #[link_name = "\u{1}_Z1bcz"] 4 | pub fn b(arg1: ::std::os::raw::c_char, ...) -> ::std::os::raw::c_char; 5 | } 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/allowlist_fix.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub enum Test {} 3 | unsafe extern "C" { 4 | pub fn Servo_Test(a: *mut Test); 5 | } 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/allowlist_vars.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub const NONE: u32 = 0; 3 | pub const FOO: u32 = 5; 4 | pub const FOOB: i32 = -2; 5 | pub const FOOBAR: i32 = -10; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/allowlist_warnings.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/anon_enum_allowlist_item.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub const NODE_FLAG_FOO: _bindgen_ty_1 = 0; 3 | pub const NODE_FLAG_BAR: _bindgen_ty_1 = 1; 4 | pub type _bindgen_ty_1 = ::std::os::raw::c_uint; 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/anon_enum_blocklist.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub const FLAG_Z: _bindgen_ty_2 = 0; 3 | pub const FLAG_W: _bindgen_ty_2 = 1; 4 | pub type _bindgen_ty_2 = ::std::os::raw::c_uint; 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/arg_keyword.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | unsafe extern "C" { 3 | #[link_name = "\u{1}_Z3fooPKc"] 4 | pub fn foo(type_: *const ::std::os::raw::c_char); 5 | } 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/atomic-constant.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | unsafe extern "C" { 3 | pub static mut a: ::std::os::raw::c_int; 4 | } 5 | unsafe extern "C" { 6 | pub static mut b: ::std::os::raw::c_int; 7 | } 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/block_return_type.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #![cfg(target_os = "macos")] 3 | extern crate block; 4 | unsafe extern "C" { 5 | pub fn func() -> _bindgen_ty_id_4; 6 | } 7 | pub type _bindgen_ty_id_4 = *const ::block::Block< 8 | (::std::os::raw::c_int, ::std::os::raw::c_int), 9 | ::std::os::raw::c_int, 10 | >; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/blocklist-var.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/builtin-template.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub type std_make_integer_sequence = u8; 3 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/c-unwind-abi-override.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | unsafe extern "C-unwind" { 3 | pub fn foo(); 4 | } 5 | unsafe extern "C-unwind" { 6 | pub fn bar(); 7 | } 8 | unsafe extern "C" { 9 | pub fn baz(); 10 | } 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/call-conv-typedef.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #![cfg(not(test))] 3 | pub type void_fn = ::std::option::Option; 4 | pub type fn_ = ::std::option::Option< 5 | unsafe extern "stdcall" fn(id: ::std::os::raw::c_int) -> void_fn, 6 | >; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/char16_t.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(transparent)] 3 | pub struct bindgen_cchar16_t(u16); 4 | unsafe extern "C" { 5 | #[link_name = "\u{1}_Z16receive_char16_tDs"] 6 | pub fn receive_char16_t(input: bindgen_cchar16_t); 7 | } 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/const_array.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | unsafe extern "C" { 3 | pub static foo: [::std::os::raw::c_int; 1usize]; 4 | } 5 | unsafe extern "C" { 6 | pub static mut bar: [::std::os::raw::c_int; 1usize]; 7 | } 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/const_array_fn_arg.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | unsafe extern "C" { 3 | pub fn f(a: *const ::std::os::raw::c_int); 4 | } 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/const_multidim_array_fn_arg.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | unsafe extern "C" { 3 | pub fn f(a: *const [::std::os::raw::c_int; 1usize]); 4 | } 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/const_ptr.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | unsafe extern "C" { 3 | pub fn foo(bar: *const ::std::os::raw::c_void); 4 | } 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/const_resolved_ty.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | unsafe extern "C" { 3 | pub fn foo(foo: *const u8); 4 | } 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/dash_language.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(C)] 3 | #[derive(Debug, Default, Copy, Clone)] 4 | pub struct Foo { 5 | pub bar: ::std::os::raw::c_int, 6 | } 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/decl_extern_int_twice.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | unsafe extern "C" { 3 | pub static mut foo: ::std::os::raw::c_int; 4 | } 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/decl_ptr_to_array.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | unsafe extern "C" { 3 | pub static mut foo: *mut [::std::os::raw::c_int; 1usize]; 4 | } 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/default-enum-style-constified-module.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub mod Foo { 3 | pub type Type = ::std::os::raw::c_uint; 4 | pub const bar: Type = 0; 5 | pub const baz: Type = 1; 6 | pub const blap: Type = 2; 7 | } 8 | unsafe extern "C" { 9 | pub fn func(x: Foo::Type); 10 | } 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/disable-namespacing.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub type Baz = ::std::os::raw::c_int; 3 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/duplicated-namespaces.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] 3 | pub mod root { 4 | #[allow(unused_imports)] 5 | use self::super::root; 6 | } 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/elaborated.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub type whatever_whatever_t = ::std::os::raw::c_int; 3 | unsafe extern "C" { 4 | #[link_name = "\u{1}_Z9somethingPKi"] 5 | pub fn something(wat: *const whatever_whatever_t); 6 | } 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/empty_template_param_name.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub type __void_t = ::std::os::raw::c_void; 3 | #[repr(C)] 4 | #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] 5 | pub struct __iterator_traits { 6 | pub _address: u8, 7 | } 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/enum-default-rust.d: -------------------------------------------------------------------------------- 1 | tests/expectations/tests/enum-default-rust.rs: tests/headers/enum-default-rust.h tests/headers/enum.h 2 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/enum-translate-type.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub const my_enum1_A: my_enum1 = 0; 3 | pub type my_enum1 = u32; 4 | pub const my_enum2_B: my_enum2 = -1; 5 | pub type my_enum2 = i32; 6 | pub const my_enum3_C: my_enum3 = 0; 7 | pub type my_enum3 = i16; 8 | pub const my_enum4_D: my_enum4 = 255; 9 | pub type my_enum4 = u8; 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/enum-typedef.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub const Enum_Variant: Enum = 0; 3 | pub type Enum = i16; 4 | pub type TypedefFirst = i16; 5 | pub const TypedefFirst_Variant2: TypedefFirst = 0; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/enum-undefault.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(u32)] 3 | #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] 4 | pub enum Foo { 5 | Bar = 0, 6 | Qux = 1, 7 | } 8 | pub const Neg_MinusOne: Neg = -1; 9 | pub const Neg_One: Neg = 1; 10 | pub type Neg = ::std::os::raw::c_int; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/enum_alias.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(u8)] 3 | #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] 4 | pub enum Bar { 5 | VAL = 0, 6 | } 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/enum_dupe.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | impl Foo { 3 | pub const Dupe: Foo = Foo::Bar; 4 | } 5 | #[repr(u32)] 6 | #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] 7 | pub enum Foo { 8 | Bar = 1, 9 | } 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/enum_in_template.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(C)] 3 | #[derive(Debug, Default, Copy, Clone)] 4 | pub struct Foo { 5 | pub _address: u8, 6 | } 7 | pub const Foo_Bar_A: Foo_Bar = 0; 8 | pub const Foo_Bar_B: Foo_Bar = 0; 9 | pub type Foo_Bar = i32; 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/enum_negative.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(i32)] 3 | #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] 4 | pub enum Foo { 5 | Bar = -2, 6 | Qux = 1, 7 | } 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/error-E0600-cannot-apply-unary-negation-to-u32.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #![allow(overflowing_literals)] 3 | pub const a: u32 = 4294967291; 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/eval-value-dependent.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(C)] 3 | #[derive(Debug, Default, Copy, Clone)] 4 | pub struct e { 5 | pub _address: u8, 6 | } 7 | pub type e_f = d; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/eval-variadic-template-parameter.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(C)] 3 | #[derive(Debug, Default, Copy, Clone)] 4 | pub struct B { 5 | pub _address: u8, 6 | } 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/extern.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub type foo = ::std::option::Option< 3 | unsafe extern "C" fn(bar: ::std::os::raw::c_int) -> ::std::os::raw::c_int, 4 | >; 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/extern_blocks_post_1_82.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | unsafe extern "C" { 3 | pub fn cool_function(i: ::std::os::raw::c_int, c: ::std::os::raw::c_char); 4 | } 5 | unsafe extern "C" { 6 | pub static mut cool_static: ::std::os::raw::c_int; 7 | } 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/extern_blocks_pre_1_82.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | extern "C" { 3 | pub fn cool_function(i: ::std::os::raw::c_int, c: ::std::os::raw::c_char); 4 | } 5 | extern "C" { 6 | pub static mut cool_static: ::std::os::raw::c_int; 7 | } 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/float128.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/forward-enum-decl.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(i32)] 3 | #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] 4 | pub enum CSSPseudoClassType { 5 | empty = 0, 6 | link = 1, 7 | } 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/forward_declared_opaque.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(C)] 3 | #[derive(Copy, Clone)] 4 | pub struct a { 5 | _unused: [u8; 0], 6 | } 7 | #[repr(C)] 8 | #[derive(Debug, Default, Copy, Clone)] 9 | pub struct b { 10 | _unused: [u8; 0], 11 | } 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/func_proto.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub type foo = ::std::option::Option< 3 | unsafe extern "C" fn(bar: ::std::os::raw::c_int) -> ::std::os::raw::c_int, 4 | >; 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/func_ptr.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | unsafe extern "C" { 3 | pub static mut foo: ::std::option::Option< 4 | unsafe extern "C" fn( 5 | x: ::std::os::raw::c_int, 6 | y: ::std::os::raw::c_int, 7 | ) -> ::std::os::raw::c_int, 8 | >; 9 | } 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/func_ptr_return_type.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | unsafe extern "C" { 3 | pub fn func() -> ::std::option::Option< 4 | unsafe extern "C" fn( 5 | arg1: ::std::os::raw::c_int, 6 | arg2: ::std::os::raw::c_int, 7 | ) -> ::std::os::raw::c_int, 8 | >; 9 | } 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/func_with_array_arg.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | unsafe extern "C" { 3 | pub fn f(x: *mut ::std::os::raw::c_int); 4 | } 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/generated/README.md: -------------------------------------------------------------------------------- 1 | # Generated C, C++, Header files 2 | 3 | This directory contains files for features where extra files are generated 4 | as a part of the feature. For example, `--wrap-static-fns`. 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/infinite-macro.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub const INFINITY: f64 = f64::INFINITY; 3 | pub const NAN: f64 = f64::NAN; 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/inline-function.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/int128_t.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/issue-1025-unknown-enum-repr.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(C)] 3 | #[derive(Debug, Default, Copy, Clone)] 4 | pub struct a { 5 | pub _address: u8, 6 | } 7 | pub type a__bindgen_ty_1 = i32; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/issue-1040.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub const g_107: ::std::os::raw::c_ulonglong = 18446744073709551615; 3 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/issue-1238-fwd-no-copy.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(C)] 3 | #[derive(Debug)] 4 | pub struct MyType { 5 | _unused: [u8; 0], 6 | } 7 | pub type MyTypeT = MyType; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/issue-1350-attribute-overloadable.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | unsafe extern "C" { 3 | #[link_name = "\u{1}_Z11my_functioni"] 4 | pub fn my_function(a: ::std::os::raw::c_int); 5 | } 6 | unsafe extern "C" { 7 | #[link_name = "\u{1}_Z11my_functionPKc"] 8 | pub fn my_function1(a: *const ::std::os::raw::c_char); 9 | } 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/issue-1464.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/issue-1488-template-alias-new-type.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(transparent)] 3 | #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] 4 | pub struct Wrapped(pub T); 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/issue-1554.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #![cfg(feature = "nightly")] 3 | #![feature(non_exhaustive)] 4 | #[repr(u32)] 5 | #[non_exhaustive] 6 | #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] 7 | pub enum Planet { 8 | earth = 0, 9 | mars = 1, 10 | } 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/issue-1599-opaque-typedef-to-enum.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub const a_b: a = 0; 3 | pub const a_c: a = 1; 4 | pub type a = ::std::os::raw::c_uint; 5 | pub type d = u32; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/issue-1676-macro-namespace-prefix.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/issue-2566-cstr.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub const FOO: &[u8; 4] = b"a\0b\0"; 3 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/issue-2566.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub const FOO: &[u8; 4] = b"a\0b\0"; 3 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/issue-544-stylo-creduce.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(C)] 3 | #[derive(Debug, Default, Copy, Clone)] 4 | pub struct a { 5 | pub _address: u8, 6 | } 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/issue-654-struct-fn-collision.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(C)] 3 | #[derive(Debug, Copy, Clone)] 4 | pub struct foo { 5 | _unused: [u8; 0], 6 | } 7 | unsafe extern "C" { 8 | pub fn foo() -> ::std::os::raw::c_int; 9 | } 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/issue-753.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub const CONST: u32 = 5; 3 | pub const OTHER_CONST: u32 = 6; 4 | pub const LARGE_CONST: u32 = 1536; 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/issue-820-unused-template-param-in-alias.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub type Foo_self_type = u8; 3 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/issue-833-1.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(C)] 3 | pub struct nsTArray { 4 | pub hdr: *const (), 5 | } 6 | unsafe extern "C" { 7 | pub fn func() -> *mut nsTArray; 8 | } 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/issue-833-2.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(C)] 3 | #[derive(Debug, Default, Copy, Clone)] 4 | pub struct nsTArray { 5 | pub _address: u8, 6 | } 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/issue-833.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(C)] 3 | pub struct nsTArray { 4 | pub hdr: *const T, 5 | } 6 | unsafe extern "C" { 7 | pub fn func() -> *mut nsTArray<::std::os::raw::c_int>; 8 | } 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/issue_315.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | ///
3 | pub type c = a; 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/layout.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/libclang-9/atomic-constant.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | unsafe extern "C" { 3 | pub static mut b: ::std::os::raw::c_int; 4 | } 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/libclang-9/issue-753.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/libclang-9/macro_fallback_non_system_dir.rs: -------------------------------------------------------------------------------- 1 | pub const NEGATIVE: i32 = -1; 2 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/libclang_version_specific_generated_tests.rs: -------------------------------------------------------------------------------- 1 | include!(concat!( 2 | env!("OUT_DIR"), 3 | "/libclang_version_specific_generated_tests.rs" 4 | )); 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/macro-expr-uncommon-token.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub const MODBUS_WOOT: u32 = 3; 3 | unsafe extern "C" { 4 | pub fn foo(); 5 | } 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/macro-redef.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub const FOO: u32 = 4; 3 | pub const BAR: u32 = 5; 4 | pub const BAZ: u32 = 6; 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/macro_const.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub const foo: &[u8; 4] = b"bar\0"; 3 | pub const CHAR: u8 = 98u8; 4 | pub const CHARR: u8 = 0u8; 5 | pub const FLOAT: f64 = 5.09; 6 | pub const FLOAT_EXPR: f64 = 0.005; 7 | pub const LONG: u32 = 3; 8 | pub const INVALID_UTF8: &[u8; 5] = b"\xF0(\x8C(\0"; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/maddness-is-avoidable.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(C)] 3 | #[derive(Debug, Default, Copy, Clone)] 4 | pub struct RefPtr { 5 | pub _address: u8, 6 | } 7 | #[repr(C)] 8 | #[derive(Debug, Default, Copy, Clone)] 9 | pub struct RefPtr_Proxy { 10 | pub _address: u8, 11 | } 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/mangling-ios.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | unsafe extern "C" { 3 | pub fn foo(); 4 | } 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/nested-template-typedef.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(C)] 3 | #[derive(Debug, Default, Copy, Clone)] 4 | pub struct Foo { 5 | pub _address: u8, 6 | } 7 | #[repr(C)] 8 | #[derive(Debug, Default, Copy, Clone)] 9 | pub struct Foo_Bar { 10 | pub _address: u8, 11 | } 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/newtype-global-enum.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub const Foo_Bar: Foo = Foo(2); 3 | pub const Foo_Baz: Foo = Foo(4); 4 | pub const Foo_Duplicated: Foo = Foo(4); 5 | pub const Foo_Negative: Foo = Foo(-3); 6 | #[repr(transparent)] 7 | #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] 8 | pub struct Foo(pub ::std::os::raw::c_int); 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/no_copy.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | ///
3 | #[repr(C)] 4 | #[derive(Debug, Default)] 5 | pub struct CopiableButWait { 6 | pub whatever: ::std::os::raw::c_int, 7 | } 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/no_debug.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | ///
3 | #[repr(C)] 4 | #[derive(Default, Copy, Clone)] 5 | pub struct DebugButWait { 6 | pub whatever: ::std::os::raw::c_int, 7 | } 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/opaque_typedef.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(C)] 3 | #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] 4 | pub struct RandomTemplate { 5 | pub _address: u8, 6 | } 7 | ///
8 | pub type ShouldBeOpaque = u8; 9 | pub type ShouldNotBeOpaque = RandomTemplate; 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/opencl_vector.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub type float4 = [f32; 4usize]; 3 | pub type float2 = [f32; 2usize]; 4 | unsafe extern "C" { 5 | pub fn foo(a: float2, b: float2) -> float4; 6 | } 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/operator.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | unsafe extern "C" { 3 | #[link_name = "\u{1}_Z20operator_informationv"] 4 | pub fn operator_information() -> ::std::os::raw::c_int; 5 | } 6 | #[repr(C)] 7 | #[derive(Debug, Copy, Clone)] 8 | pub struct Foo { 9 | _unused: [u8; 0], 10 | } 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/parsecb-anonymous-enum-variant-rename.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub const RENAMED_MyVal: _bindgen_ty_1 = 0; 3 | pub type _bindgen_ty_1 = ::std::os::raw::c_uint; 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/pointer-attr.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | unsafe extern "C" { 3 | pub fn a(arg1: *const ::std::os::raw::c_char); 4 | } 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/prefix-link-name-c.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | unsafe extern "C" { 3 | #[link_name = "\u{1}foo_bar"] 4 | pub fn bar() -> ::std::os::raw::c_int; 5 | } 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/prefix-link-name-cpp.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | unsafe extern "C" { 3 | #[link_name = "\u{1}foo_foo"] 4 | pub fn baz_foo() -> ::std::os::raw::c_int; 5 | } 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/prepend-enum-constified-variant.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | impl AVCodecID { 3 | pub const AV_CODEC_ID_TTF: AVCodecID = AVCodecID::AV_CODEC_ID_FIRST_UNKNOWN; 4 | } 5 | #[repr(u32)] 6 | #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] 7 | pub enum AVCodecID { 8 | AV_CODEC_ID_FIRST_UNKNOWN = 98304, 9 | } 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/prepend_enum_name.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub const FOO_BAR: foo = 0; 3 | pub const FOO_BAZ: foo = 1; 4 | pub type foo = ::std::os::raw::c_uint; 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/qualified-dependent-types.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(C)] 3 | #[derive(Debug, Default, Copy, Clone)] 4 | pub struct Foo { 5 | pub _address: u8, 6 | } 7 | #[repr(C)] 8 | #[derive(Debug, Default, Copy, Clone)] 9 | pub struct Bar { 10 | pub _address: u8, 11 | } 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/redeclaration.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | unsafe extern "C" { 3 | pub fn foo(); 4 | } 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/resolved_type_def_function.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub type FuncType = ::std::option::Option; 3 | unsafe extern "C" { 4 | pub fn Func(); 5 | } 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/strings_array.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub const MY_STRING_UTF8: &[u8; 14] = b"Hello, world!\0"; 3 | pub const MY_STRING_INTERIOR_NULL: &[u8; 7] = b"Hello,\0"; 4 | pub const MY_STRING_NON_UTF8: &[u8; 7] = b"ABCDE\xFF\0"; 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/strings_cstr2.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub const MY_STRING_UTF8: &::std::ffi::CStr = c"Hello, world!"; 3 | pub const MY_STRING_INTERIOR_NULL: &::std::ffi::CStr = c"Hello,"; 4 | pub const MY_STRING_NON_UTF8: &::std::ffi::CStr = c"ABCDE\xFF"; 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/struct_with_typedef_template_arg.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(C)] 3 | #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] 4 | pub struct Proxy { 5 | pub _address: u8, 6 | } 7 | pub type Proxy_foo = ::std::option::Option; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/template-param-usage-1.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(C)] 3 | #[derive(Debug, Default, Copy, Clone)] 4 | pub struct DoesNotUseTemplateParameter { 5 | pub x: ::std::os::raw::c_int, 6 | } 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/template-param-usage-11.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(C)] 3 | #[derive(Debug, Default, Copy, Clone)] 4 | pub struct DoesNotUseT { 5 | pub _address: u8, 6 | } 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/template-param-usage-6.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(C)] 3 | #[derive(Debug, Default, Copy, Clone)] 4 | pub struct DoesNotUseTemplateParameter { 5 | pub x: ::std::os::raw::c_int, 6 | } 7 | pub type DoesNotUseTemplateParameter_ButAliasDoesUseIt = T; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/template-with-var.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(C)] 3 | #[derive(Debug, Default, Copy, Clone)] 4 | pub struct TemplateWithVar { 5 | pub _address: u8, 6 | } 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/template_alias_basic.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub type Wrapped = T; 3 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/template_fun.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/template_partial_specification.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/test_macro_fallback_non_system_dir.rs: -------------------------------------------------------------------------------- 1 | pub const CONST: u32 = 5; 2 | pub const OTHER_CONST: u32 = 6; 3 | pub const LARGE_CONST: u32 = 1536; 4 | pub const THE_CONST: u32 = 28; 5 | pub const MY_CONST: u32 = 69; 6 | pub const NEGATIVE: i32 = -1; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/type_alias_empty.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub type bool_constant = u8; 3 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/typedefd-array-as-function-arg.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | pub type myVector3 = [f32; 3usize]; 3 | unsafe extern "C" { 4 | pub fn modifyVectorFunc(v: *mut f32); 5 | } 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/variadic_template_function.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[repr(C)] 3 | #[derive(Debug, Default, Copy, Clone)] 4 | pub struct VariadicFunctionObject { 5 | pub _address: u8, 6 | } 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/wasm-import-module.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | #[link(wasm_import_module = "test-module")] 3 | unsafe extern "C" { 4 | pub fn test_function(); 5 | } 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/expectations/tests/win32-vectorcall.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/381-decltype-alias.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++11 2 | 3 | namespace std { 4 | template struct allocator_traits { 5 | typedef decltype ( _S_size_type_helper ( ( _Alloc * ) 0 ) ) __size_type; 6 | }; 7 | } 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/abi-override.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --override-abi=foo=fastcall --override-abi=bar=stdcall --override-abi=boo=efiapi --override-abi=foobar=efiapi --override-abi qux=system --raw-line '#![cfg(target = "i686-pc-windows-msvc")]' 2 | 3 | void foo(); 4 | void bar(); 5 | void baz(); 6 | void qux(); 7 | 8 | typedef void (*boo)(); 9 | typedef void (*foobar)(boo boo); 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/abi_variadic_function.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++11 2 | 3 | char __attribute__((ms_abi)) a(char, ...); 4 | char b(char, ...); 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/allowlist-namespaces-basic.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-cxx-namespaces --allowlist-type outer::inner::Helper 2 | 3 | namespace outer { 4 | namespace inner { 5 | struct Helper {}; 6 | } 7 | struct Test { 8 | inner::Helper helper; 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/allowlist-namespaces.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-cxx-namespaces --allowlist-type '.*' 2 | 3 | namespace outer { 4 | namespace inner { 5 | struct Helper {}; 6 | } 7 | struct Test { 8 | inner::Helper helper; 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/allowlist_basic.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --allowlist-type AllowlistMe 2 | 3 | template 4 | class AllowlistMe { 5 | class Inner { 6 | T bar; 7 | }; 8 | 9 | int foo; 10 | Inner bar; 11 | }; 12 | 13 | struct DontAllowlistMe { 14 | void* foo; 15 | double _Complex noComplexGenerated; 16 | }; 17 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/allowlist_fix.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --allowlist-function 'Servo_.*' --blocklist-type Test --raw-line "pub enum Test {}" 2 | 3 | struct Test {}; 4 | extern "C" void Servo_Test(Test* a); 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/allowlist_item.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --allowlist-item 'Foo.*' 2 | 3 | struct Foo { 4 | int field; 5 | }; 6 | 7 | struct Foo FooNew(int value); 8 | 9 | #define FooDefault 0 10 | 11 | struct Bar { 12 | int field; 13 | }; 14 | 15 | struct Foo BarNew(int value); 16 | 17 | #define BarDefault 0 18 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/allowlist_vars.h: -------------------------------------------------------------------------------- 1 | #define NONE 0 2 | #define FOO 5 3 | #define FOOB -2 4 | #define FOOBAR (-10) 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/allowlist_warnings.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --allowlist-function "doesnt_match_anything" 2 | int non_matched_function(int arg); 3 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/allowlisted-item-references-no-hash.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --allowlist-type "AllowlistMe" --no-hash "NoHash" 2 | 3 | struct NoHash {}; 4 | 5 | class AllowlistMe { 6 | NoHash a; 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/allowlisted-item-references-no-partialeq.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-partialeq --allowlist-type "AllowlistMe" --no-partialeq "NoPartialEq" 2 | 3 | struct NoPartialEq {}; 4 | 5 | class AllowlistMe { 6 | NoPartialEq a; 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/allowlisted_item_references_no_copy.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --allowlist-type "AllowlistMe" --no-copy "NoCopy" 2 | 3 | struct NoCopy {}; 4 | 5 | class AllowlistMe { 6 | NoCopy a; 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/annotation_hide.hpp: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | *
4 | */ 5 | struct C; 6 | 7 | /** 8 | *
9 | */ 10 | struct D { 11 | int a; 12 | }; 13 | 14 | struct NotAnnotated { 15 | int f; 16 | }; 17 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/anon-fields-prefix.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --anon-fields-prefix "u" 2 | 3 | union color { 4 | struct { 5 | unsigned char r; 6 | unsigned char g; 7 | unsigned char b; 8 | }; 9 | struct { 10 | unsigned char y; 11 | unsigned char u; 12 | unsigned char v; 13 | }; 14 | unsigned char v3[3]; 15 | }; 16 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/anon_enum.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum ".*" 2 | struct Test { 3 | int foo; 4 | float bar; 5 | enum { T_NONE }; 6 | }; 7 | 8 | typedef enum { 9 | Foo, 10 | Bar, 11 | } Baz; 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/anon_enum_allowlist.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --allowlist-var "NODE_.*" --rustified-enum ".*" 2 | 3 | enum { 4 | NODE_FLAG_FOO, 5 | NODE_FLAG_BAR, 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/anon_enum_allowlist_item.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --allowlist-item "NODE_.*" 2 | 3 | enum { 4 | NODE_FLAG_FOO, 5 | NODE_FLAG_BAR, 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/anon_enum_blocklist.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --blocklist-type "_bindgen_ty_1" 2 | 3 | enum { 4 | FLAG_X, 5 | FLAG_Y, 6 | }; 7 | 8 | enum { 9 | FLAG_Z, 10 | FLAG_W, 11 | }; 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/anon_struct_in_union.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | struct s { 3 | union { 4 | struct inner { 5 | int b; 6 | } field; 7 | } u; 8 | }; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/arg_keyword.hpp: -------------------------------------------------------------------------------- 1 | // This comment exists to ensure that `--dump-preprocessed-input` doesn't strip 2 | // comments. 3 | void foo(const char* type); 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/array-of-zero-sized-types.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * This should get an `_address` byte. 3 | */ 4 | struct Empty {}; 5 | 6 | /** 7 | * This should not get an `_address` byte, since each `Empty` gets one, meaning 8 | * that this object is addressable. 9 | */ 10 | struct HasArrayOfEmpty { 11 | Empty empties[10]; 12 | }; 13 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/atomic-constant.h: -------------------------------------------------------------------------------- 1 | _Atomic(int) a; 2 | int b; 3 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/attribute_warn_unused_result.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: \-\-rust-target=1.33 --enable-function-attribute-detection 2 | 3 | class Foo { 4 | public: 5 | __attribute__((warn_unused_result)) 6 | int foo(int); 7 | }; 8 | 9 | __attribute__((warn_unused_result)) 10 | int foo(int); 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/attribute_warn_unused_result_no_attribute_detection.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: \-\-rust-target=1.33 2 | 3 | class Foo { 4 | public: 5 | __attribute__((warn_unused_result)) 6 | int foo(int); 7 | }; 8 | 9 | __attribute__((warn_unused_result)) 10 | int foo(int); 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/auto.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++14 2 | // bindgen-unstable 3 | 4 | class Foo { 5 | static constexpr auto kFoo = 2 == 2; 6 | }; 7 | 8 | template 9 | class Bar { 10 | static const constexpr auto kBar = T(1); 11 | }; 12 | 13 | template auto Test1() { 14 | return T(1); 15 | } 16 | 17 | auto Test2() { 18 | return Test1(); 19 | } 20 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/bad-namespace-parenthood-inheritance.hpp: -------------------------------------------------------------------------------- 1 | namespace std 2 | { 3 | template < typename > struct char_traits; 4 | } 5 | namespace __gnu_cxx 6 | { 7 | template < typename > struct char_traits; 8 | } 9 | namespace std 10 | { 11 | template < class _CharT > struct char_traits:__gnu_cxx::char_traits < 12 | _CharT > 13 | { 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/bindgen-union-inside-namespace.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: \-\-rust-target=1.33 --enable-cxx-namespaces 2 | 3 | namespace foo { 4 | union Bar { 5 | int foo; 6 | int bar; 7 | }; 8 | } 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/bitfield-enum-repr-c.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --bitfield-enum "Foo" \-\-rust-target=1.33 -- -std=c++11 2 | 3 | enum Foo { 4 | Bar = 1 << 1, 5 | Baz = 1 << 2, 6 | Duplicated = 1 << 2, 7 | Negative = -3, 8 | }; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/bitfield-enum-repr-transparent.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --bitfield-enum "Foo" \-\-rust-target=1.33 -- -std=c++11 2 | 3 | enum Foo { 4 | Bar = 1 << 1, 5 | Baz = 1 << 2, 6 | Duplicated = 1 << 2, 7 | Negative = -3, 8 | }; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/bitfield-large.hpp: -------------------------------------------------------------------------------- 1 | struct HasBigBitfield { 2 | __int128 x : 128; 3 | }; 4 | 5 | 6 | struct HasTwoBigBitfields { 7 | __int128 x : 80; 8 | __int128 y : 48; 9 | }; 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/bitfield-linux-32.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- --target=i586-unknown-linux 2 | 3 | typedef unsigned long long uint64_t; 4 | 5 | struct Test { 6 | uint64_t foo; 7 | uint64_t x : 56; 8 | uint64_t y : 8; 9 | }; 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/bitfield-method-same-name.hpp: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | char type_ : 3; 3 | char type(); 4 | void set_type_(char c); 5 | void set_type(char c); 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/bitfield_align_2.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --rustified-enum ".*" --raw-line '#![cfg(not(target_os="windows"))]' 2 | enum MyEnum { 3 | ONE, 4 | TWO, 5 | THREE, 6 | FOUR 7 | }; 8 | 9 | struct TaggedPtr { 10 | enum MyEnum tag : 2; 11 | long ptr : 62; 12 | }; 13 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/bitfield_large_overflow.hpp: -------------------------------------------------------------------------------- 1 | struct { 2 | unsigned : 632; 3 | } a; 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/bitfield_method_mangling.h: -------------------------------------------------------------------------------- 1 | typedef struct 2 | { 3 | unsigned int pad3: 24; 4 | unsigned int type: 8; 5 | } mach_msg_type_descriptor_t; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/block_return_type.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --generate-block --block-extern-crate -- -fblocks 2 | // bindgen-osx-only 3 | 4 | int (^func(void))(int, int); 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/blocklist-and-impl-debug.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --impl-debug --blocklist-type BlocklistMe --raw-line 'pub struct BlocklistMe(u8);' 2 | 3 | struct BlocklistMe {}; 4 | 5 | /** 6 | * Because this type contains a blocklisted type, it should not derive Debug. 7 | */ 8 | struct ShouldManuallyImplDebug { 9 | BlocklistMe a; 10 | }; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/blocklist-methods.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --blocklist-function="Foo_ba.*" 2 | 3 | class Foo { 4 | public: 5 | int foo(); 6 | int bar(); 7 | int baz(); 8 | }; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/blocklist-var.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --blocklist-var should_be_blocked 2 | 3 | extern int should_be_blocked; 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/blocklist_bitfield_unit.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --blocklist-type "__BindgenBitfieldUnit" --raw-line '#[path = "./struct_with_bitfields.rs"] mod bitfields;' --raw-line 'use bitfields::*;' 2 | struct C { 3 | unsigned char x; 4 | unsigned b1 : 1; 5 | unsigned b2 : 1; 6 | unsigned baz; 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/blocklisted/fake-stdint.h: -------------------------------------------------------------------------------- 1 | // -like types get special treatment even when blocklisted. 2 | typedef signed char int8_t; 3 | typedef unsigned char uint8_t; 4 | typedef signed short int16_t; 5 | typedef unsigned short uint16_t; 6 | typedef signed int int32_t; 7 | typedef unsigned int uint32_t; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/blocks-signature.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --generate-block --block-extern-crate -- -fblocks 2 | // bindgen-osx-only 3 | 4 | #include "blocks.hpp" 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/bug-1529681.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++14 2 | // 3 | // https://bugzilla.mozilla.org/show_bug.cgi?id=1529681 4 | // https://bugs.llvm.org/show_bug.cgi?id=40813 5 | 6 | class BrowsingContext { 7 | auto Tie(void* aUnused) const; 8 | }; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/builtin-template.hpp: -------------------------------------------------------------------------------- 1 | namespace std { 2 | template 3 | class integer_sequence; 4 | template 5 | using make_integer_sequence = __make_integer_seq; 6 | } 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/c-empty-layout.h: -------------------------------------------------------------------------------- 1 | struct Foo {}; 2 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/c-unwind-abi-override.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --override-abi="foo|bar=C-unwind" 2 | 3 | void foo(); 4 | void bar(); 5 | void baz(); 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/c_naming.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --c-naming 2 | 3 | typedef const struct a { 4 | int a; 5 | } *a; 6 | 7 | union b { 8 | int a; 9 | int b; 10 | }; 11 | typedef union b b; 12 | 13 | enum c { 14 | A, 15 | }; 16 | 17 | void takes_a(a arg) {} 18 | void takes_b(b arg) {} 19 | void takes_c(enum c arg) {} 20 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/call-conv-typedef.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --raw-line "#![cfg(not(test))]" -- --target=i686-pc-win32 2 | 3 | 4 | typedef void (__stdcall *void_fn)(); 5 | typedef void_fn (__stdcall *fn)(int id); 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/canonical_path_without_namespacing.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --disable-name-namespacing 2 | 3 | namespace foo { 4 | struct Bar {}; 5 | } 6 | 7 | void baz(foo::Bar*); 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/char16_t.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --use-distinct-char16-t --raw-line '#[repr(transparent)] pub struct bindgen_cchar16_t(u16);' -- -x c++ -std=c++14 2 | 3 | void receive_char16_t(char16_t input) { 4 | } 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/class_static.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | class MyClass { 3 | public: 4 | static const int* example; 5 | static const int* example_check_no_collision; 6 | }; 7 | 8 | static const int* example_check_no_collision; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/class_static_const.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | using int32_t = int; 3 | typedef unsigned int uint32_t; 4 | 5 | class A { 6 | static const int a = 0; 7 | static const int32_t b = 077; 8 | static const uint32_t c = 0xff; 9 | }; 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/class_use_as.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | 3 | /** 4 | *
5 | */ 6 | struct whatever_replacement { 7 | int replacement; 8 | }; 9 | 10 | struct whatever { 11 | int b; 12 | }; 13 | 14 | struct container { 15 | whatever c; 16 | }; 17 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/class_with_dtor.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | 3 | 4 | template 5 | class HandleWithDtor { 6 | T* ptr; 7 | ~HandleWithDtor() {} 8 | }; 9 | 10 | typedef HandleWithDtor HandleValue; 11 | 12 | class WithoutDtor { 13 | HandleValue shouldBeWithDtor; 14 | }; 15 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/class_with_enum.hpp: -------------------------------------------------------------------------------- 1 | class A { 2 | public: 3 | enum B { 4 | B1, 5 | B2, 6 | }; 7 | }; -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/complex_global.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | float _Complex globalValueFloat; 3 | double _Complex globalValueDouble; 4 | long double _Complex globalValueLongDouble; 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/const-const-mut-ptr.h: -------------------------------------------------------------------------------- 1 | struct foo { 2 | const int** const* const* bar; 3 | }; 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/const_array.h: -------------------------------------------------------------------------------- 1 | extern const int foo[1]; 2 | extern int bar[1]; 3 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/const_array_fn_arg.h: -------------------------------------------------------------------------------- 1 | void f(const int a[]); 2 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/const_array_typedef.h: -------------------------------------------------------------------------------- 1 | typedef struct { 2 | int field; 3 | } strct; 4 | 5 | typedef strct typ[1]; 6 | 7 | extern typ w; 8 | extern strct *x; 9 | 10 | extern const typ y; 11 | extern const strct *z; 12 | 13 | void function(const typ a, const strct *b); 14 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/const_bool.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-unstable 2 | 3 | const bool k = true; 4 | struct A { 5 | static const bool k = false; 6 | }; 7 | 8 | typedef bool foo; 9 | const foo k2 = true; 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/const_enum_unnamed.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --rustified-enum ".*" 2 | 3 | enum { 4 | FOO_BAR, 5 | FOO_BAZ, 6 | }; 7 | 8 | class Foo { 9 | enum { FOO_BAR = 10 }; 10 | }; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/const_multidim_array_fn_arg.h: -------------------------------------------------------------------------------- 1 | void f(const int a[1][1]); 2 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/const_ptr.hpp: -------------------------------------------------------------------------------- 1 | extern "C" { 2 | void foo(const void* bar); 3 | } 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/const_resolved_ty.h: -------------------------------------------------------------------------------- 1 | typedef unsigned char uint8_t; 2 | 3 | void foo(const uint8_t* foo); 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/const_tparam.hpp: -------------------------------------------------------------------------------- 1 | template 2 | class C { 3 | const T* const foo; 4 | const T* bar; 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/constant-non-specialized-tp.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++11 2 | 3 | // This test ensure we protect ourselves from an LLVM crash. 4 | 5 | template 6 | struct Test { 7 | static constexpr bool x[] = {Args::x...}; 8 | }; 9 | 10 | template 11 | struct Outer { 12 | struct Inner { 13 | static constexpr int value[] = { T::value... }; 14 | }; 15 | }; 16 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/constified-enum-module-overflow.hpp: -------------------------------------------------------------------------------- 1 | template class B{}; 2 | template class C { 3 | public: 4 | using U = B; 5 | }; 6 | class A : C
{ 7 | U u; 8 | }; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/constify-all-enums.h: -------------------------------------------------------------------------------- 1 | 2 | enum foo { 3 | THIS, 4 | SHOULD_BE, 5 | A_CONSTANT, 6 | }; 7 | 8 | struct bar { 9 | enum foo this_should_work; 10 | }; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/constify-module-enums-namespace.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-cxx-namespaces --constified-enum-module ns1::ns2::foo 2 | 3 | namespace ns1 { 4 | namespace ns2 { 5 | enum foo { 6 | THIS, 7 | SHOULD_BE, 8 | A_CONSTANT, 9 | }; 10 | } 11 | 12 | namespace ns3 { 13 | struct bar { 14 | enum ns2::foo this_should_work; 15 | }; 16 | } 17 | } -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/constify-module-enums-shadow-name.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --constified-enum-module foo 2 | 3 | enum foo { 4 | Type, 5 | Type_, 6 | Type1, 7 | Type__, 8 | }; 9 | 10 | struct bar { 11 | enum foo member; 12 | }; 13 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/constify-module-enums-simple-nonamespace.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --constified-enum-module one::Foo 2 | 3 | namespace one { 4 | enum class Foo { 5 | Variant1, Variant2, 6 | }; 7 | } 8 | 9 | class Bar { 10 | one::Foo baz1; 11 | one::Foo* baz2; 12 | }; 13 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/constructor-tp.hpp: -------------------------------------------------------------------------------- 1 | 2 | template 3 | class Foo { 4 | public: 5 | Foo(); 6 | 7 | void doBaz(); 8 | }; 9 | 10 | template 11 | void 12 | Foo::doBaz() { 13 | } 14 | 15 | class Bar { 16 | public: 17 | Bar(); 18 | }; 19 | 20 | template 21 | Foo::Foo() { 22 | } 23 | 24 | Bar::Bar() { 25 | } 26 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/constructors.hpp: -------------------------------------------------------------------------------- 1 | 2 | class TestOverload { 3 | // This one shouldn't be generated. 4 | TestOverload(); 5 | public: 6 | TestOverload(int); 7 | TestOverload(double); 8 | }; 9 | 10 | class TestPublicNoArgs { 11 | public: 12 | TestPublicNoArgs(); 13 | }; 14 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/convert-cpp-comment-to-rust.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --no-layout-tests 2 | typedef unsigned mbedtls_mpi_uint; 3 | 4 | /** 5 | * \brief MPI structure 6 | */ 7 | typedef struct 8 | { 9 | int s; /*!< integer sign */ 10 | unsigned long n; /*!< total # of limbs */ 11 | mbedtls_mpi_uint *p; /*!< pointer to limbs */ 12 | } 13 | mbedtls_mpi; 14 | 15 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/convert-floats.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --no-convert-floats 2 | 3 | struct foo { 4 | float bar, baz; 5 | double bazz; 6 | long double* bazzz; 7 | float _Complex complexFloat; 8 | double _Complex complexDouble; 9 | }; 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/cpp-empty-layout.hpp: -------------------------------------------------------------------------------- 1 | struct Foo {}; 2 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/crtp.hpp: -------------------------------------------------------------------------------- 1 | template 2 | class Base {}; 3 | 4 | class Derived : public Base {}; 5 | 6 | template 7 | class BaseWithDestructor { 8 | ~BaseWithDestructor(); 9 | }; 10 | 11 | class DerivedFromBaseWithDestructor : 12 | public BaseWithDestructor {}; 13 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/ctypes-prefix-path.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --ctypes-prefix "libc::foo" --use-core --raw-line "#![no_std]" --raw-line "mod libc { pub mod foo { pub type c_int = i32; pub enum c_void {} } }" --rustified-enum ".*" 2 | struct foo { 3 | int a, b; 4 | void* bar; 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/dash_language.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -x c++ --std=c++11 2 | 3 | template 4 | struct Foo { 5 | int bar; 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/decl_extern_int_twice.h: -------------------------------------------------------------------------------- 1 | extern int foo; 2 | extern int foo; 3 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/decl_ptr_to_array.h: -------------------------------------------------------------------------------- 1 | int (*foo)[1]; 2 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/default-enum-style-constified-module.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --default-enum-style moduleconsts 2 | 3 | typedef enum { bar, baz, blap } Foo; 4 | void func(Foo x); 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/default-macro-constant-type-signed.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --default-macro-constant-type signed 2 | // All values are i32 if they fit; otherwise i64. 3 | #include "default-macro-constant-type.h" 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/default-macro-constant-type-unsigned.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --default-macro-constant-type unsigned 2 | // Negative values are i32 or i64; others are u32 or u64. 3 | #include "default-macro-constant-type.h" 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/default-template-parameter.hpp: -------------------------------------------------------------------------------- 1 | template 2 | struct Foo { 3 | T t; 4 | U u; 5 | }; 6 | 7 | static Foo bar; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/default_visibility_crate.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --no-layout-tests --default-visibility=crate 2 | 3 | struct Point { 4 | int x; 5 | int y; 6 | }; 7 | 8 | struct Color { 9 | char r :1; 10 | char g :1; 11 | char b :1; 12 | }; 13 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/default_visibility_private.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --no-layout-tests --default-visibility=private 2 | 3 | struct Point { 4 | int x; 5 | int y; 6 | }; 7 | 8 | struct Color { 9 | char r :1; 10 | char g :1; 11 | char b :1; 12 | }; 13 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/default_visibility_private_respects_cxx_access_spec.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --respect-cxx-access-specs --no-layout-tests --default-visibility=private 2 | 3 | struct Point { 4 | int x; 5 | int y; 6 | }; 7 | 8 | struct Color { 9 | char r :1; 10 | char g :1; 11 | char b :1; 12 | }; 13 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/derive-clone.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --rust-target 1.40 2 | // 3 | 4 | /// This struct should derive `Clone`. 5 | struct ShouldDeriveClone { 6 | int large[33]; 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/derive-debug-bitfield-1-51.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --impl-debug --rust-target 1.51 2 | 3 | class C { 4 | bool a: 1; 5 | bool b: 7; 6 | int large_array[50]; 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/derive-debug-bitfield-core.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --impl-debug --use-core --raw-line "extern crate core;" --rust-target 1.40 2 | 3 | class C { 4 | bool a: 1; 5 | bool b: 7; 6 | int large_array[50]; 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/derive-debug-bitfield.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --impl-debug --rust-target 1.40 2 | 3 | class C { 4 | bool a: 1; 5 | bool b: 7; 6 | int large_array[50]; 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/derive-debug-function-pointer.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --impl-debug --rust-target 1.40 2 | 3 | class Nice { 4 | typedef void (*Function) (int data); 5 | Function pointer; 6 | int large_array[34]; 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/derive-debug-generic.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --impl-debug --rust-target 1.40 2 | 3 | template 4 | class Generic { 5 | T t[40]; 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/derive-debug-mangle-name.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --impl-debug 2 | struct perf_event_attr { 3 | 4 | /* 5 | * Major type: hardware/software/tracepoint/etc. 6 | */ 7 | unsigned int type; 8 | 9 | float a; 10 | union { 11 | int b; 12 | int c; 13 | }; 14 | }; 15 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/derive-debug-opaque-template-instantiation.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --impl-debug --rust-target 1.40 2 | 3 | // This type is opaque because the second template parameter 4 | // is a non-type template parameter 5 | template 6 | class Opaque { 7 | T array[N]; 8 | }; 9 | 10 | class Instance { 11 | Opaque val; 12 | }; 13 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/derive-debug-opaque.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --opaque-type "Opaque" --impl-debug --rust-target 1.40 2 | 3 | class Opaque { 4 | int i; 5 | int not_debug[40]; 6 | }; 7 | 8 | class OpaqueUser { 9 | Opaque opaque; 10 | }; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/derive-hash-and-blocklist.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --blocklist-type BlocklistMe --raw-line 'pub struct BlocklistMe(u8);' 2 | 3 | struct BlocklistMe {}; 4 | 5 | /** 6 | * Because this type contains a blocklisted type, it should not derive Hash. 7 | */ 8 | struct ShouldNotDeriveHash { 9 | BlocklistMe a; 10 | }; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/derive-hash-struct-with-anon-struct-float.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialord --with-derive-ord --with-derive-partialeq --with-derive-eq 2 | // 3 | /// A struct containing a struct containing a float that cannot derive Hash/Eq/Ord but can derive PartialEq/PartialOrd 4 | struct foo { 5 | struct { 6 | float a; 7 | float b; 8 | } bar; 9 | }; 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/derive-hash-struct-with-float-array.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialord --with-derive-ord --with-derive-partialeq --with-derive-eq 2 | // 3 | /// A struct containing an array of floats that cannot derive Hash/Eq/Ord but can derive PartialEq/PartialOrd 4 | struct foo { 5 | float bar[3]; 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/derive-hash-template-def-float.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialord --with-derive-ord --with-derive-partialeq --with-derive-eq 2 | // 3 | /// Template definition containing a float, which cannot derive Hash/Eq/Ord but can derive PartialEq/PartialOrd. 4 | template 5 | struct foo { 6 | T data; 7 | float b; 8 | }; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/derive-partialeq-and-blocklist.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-partialeq --blocklist-type BlocklistMe --raw-line 'pub struct BlocklistMe(u8);' 2 | 3 | struct BlocklistMe {}; 4 | 5 | /** 6 | * Because this type contains a blocklisted type, it should not derive 7 | * PartialEq. 8 | */ 9 | struct ShouldNotDerivePartialEq { 10 | BlocklistMe a; 11 | }; 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/derive-partialeq-anonfield.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --impl-partialeq 2 | 3 | struct rte_mbuf { 4 | union {}; 5 | } __attribute__((__aligned__(64))); 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/derive-partialeq-base.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-partialeq --impl-partialeq --rust-target 1.40 2 | 3 | class Base { 4 | int large[33]; 5 | }; 6 | 7 | class ShouldDerivePartialEq: Base { 8 | }; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/derive-partialeq-bitfield.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-partialeq --impl-partialeq --rust-target 1.40 2 | 3 | class C { 4 | bool a: 1; 5 | bool b: 7; 6 | int large_array[50]; 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/derive-partialeq-core.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-partialeq --impl-partialeq --use-core --raw-line "extern crate core;" --rust-target 1.40 2 | 3 | struct C { 4 | int large_array[420]; 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/derive-partialeq-pointer.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | 3 | struct a; 4 | class Bar { 5 | a *b; 6 | }; 7 | struct c { 8 | union {}; 9 | }; 10 | struct a { 11 | c d; 12 | }; 13 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/derive-partialeq-union.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-partialeq --impl-partialeq 2 | 3 | /// Deriving PartialEq for rust unions is not supported. 4 | union ShouldNotDerivePartialEq { 5 | char a; 6 | int b; 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/disable-namespacing.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --disable-name-namespacing 2 | 3 | namespace foo { 4 | namespace bar { 5 | 6 | typedef int Baz; 7 | 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/disable-untagged-union.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --disable-untagged-union 2 | 3 | union Foo { 4 | int bar; 5 | unsigned int baz; 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/do-not-derive-copy.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --no-derive-copy 2 | 3 | class WouldBeCopyButWeAreNotDerivingCopy { 4 | int x; 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/dupe-enum-variant-in-namespace.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --rustified-enum ".*" --enable-cxx-namespaces -- -x c++ -std=c++11 2 | 3 | namespace foo { 4 | enum class Bar : unsigned { 5 | Foo = 0, 6 | Foo1 = 0, 7 | Foo2, 8 | Foo3 = Foo2, 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/duplicated-definition-count.hpp: -------------------------------------------------------------------------------- 1 | class BitStream { 2 | public: 3 | void Write(const char *inputByteArray, unsigned int numberOfBytes); 4 | void Write(BitStream *bitStream, unsigned numberOfBits); 5 | void Write1(); 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/duplicated-namespaces-definitions.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-cxx-namespaces 2 | 3 | namespace foo { 4 | class Bar; 5 | } 6 | 7 | namespace bar { 8 | struct Foo { 9 | foo::Bar* ptr; 10 | }; 11 | }; 12 | 13 | namespace foo { 14 | class Bar { 15 | int foo; 16 | bool baz; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/duplicated-namespaces.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-cxx-namespaces 2 | 3 | namespace std {} 4 | namespace std {} 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/duplicated_constants_in_ns.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-cxx-namespaces 2 | namespace foo { 3 | const int FOO = 4; 4 | } 5 | namespace bar { 6 | const int FOO = 5; 7 | } 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/dynamic_loading_attributes.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --dynamic-loading TestLib --dynamic-link-require-all --enable-function-attribute-detection 2 | /** 3 | * @brief A function 4 | * 5 | * @param x 6 | * @param y 7 | * @return int 8 | */ 9 | __attribute__((warn_unused_result)) 10 | int foo(int x, int y); 11 | int baz() ; 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/dynamic_loading_required.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --dynamic-loading TestLib --dynamic-link-require-all 2 | 3 | int foo(int x, int y); 4 | int bar(void *x); 5 | int baz(); 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/dynamic_loading_simple.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --dynamic-loading TestLib 2 | 3 | int foo(int x, int y); 4 | int bar(void *x); 5 | int baz(); 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/dynamic_loading_template.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --dynamic-loading TestLib 2 | 3 | template 4 | T foo(T x); 5 | 6 | template<> 7 | int foo(int x); 8 | 9 | template<> 10 | float foo(float x); 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/dynamic_loading_variable_required.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --dynamic-loading TestLib --dynamic-link-require-all 2 | 3 | int foo; 4 | int *baz; -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/dynamic_loading_variable_simple.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --dynamic-loading TestLib 2 | 3 | int foo; 4 | int *baz; -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/dynamic_loading_variable_with_allowlist.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --dynamic-loading TestLib --allowlist-var foo --allowlist-var bar 2 | 3 | int foo; 4 | int bar; 5 | int baz; // should not be allowed -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/dynamic_loading_with_allowlist.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --dynamic-loading TestLib --allowlist-function baz --allowlist-function foo --allowlist-function bazz 2 | 3 | class X { 4 | int _x; 5 | 6 | public: 7 | X(int x); 8 | 9 | void some_function(); 10 | void some_other_function(); 11 | }; 12 | 13 | int foo(void *x); 14 | int bar(void *x); 15 | int baz(void *x); 16 | int bazz(int, ...); 17 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/dynamic_loading_with_blocklist.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --dynamic-loading TestLib --blocklist-function baz 2 | 3 | class X { 4 | int _x; 5 | 6 | public: 7 | X(int x); 8 | 9 | void some_function(); 10 | void some_other_function(); 11 | }; 12 | 13 | int foo(void *x); 14 | int bar(void *x); 15 | int baz(void *x); 16 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/dynamic_loading_with_class.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --dynamic-loading TestLib 2 | 3 | int foo(void *x); 4 | 5 | class A { 6 | int _x; 7 | 8 | public: 9 | A(int x); 10 | 11 | void some_function(); 12 | void some_other_function(); 13 | }; 14 | 15 | void bar(); 16 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/elaborated.hpp: -------------------------------------------------------------------------------- 1 | namespace whatever { 2 | typedef int whatever_t; 3 | } 4 | 5 | void something(const whatever::whatever_t *wat); 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/empty-union.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --opaque-type ".*" 2 | 3 | template class a { 4 | union {}; 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/empty_template_param_name.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | // bindgen-flags: -- -std=c++11 3 | 4 | template using __void_t = void; 5 | 6 | template> 7 | struct __iterator_traits { }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/enum-default-bitfield.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --default-enum-style=bitfield --constified-enum-module=Neg 2 | 3 | #include "enum.h" 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/enum-default-consts.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --default-enum-style=consts --constified-enum-module=Neg 2 | 3 | #include "enum.h" 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/enum-default-module.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --default-enum-style=moduleconsts --constified-enum-module=Neg 2 | 3 | #include "enum.h" 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/enum-default-rust.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --default-enum-style=rust --constified-enum-module=Neg 2 | 3 | #include "enum.h" 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/enum-doc-bitfield.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --bitfield-enum B 2 | 3 | #include "enum-doc.h" 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/enum-doc-mod.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --constified-enum-module B 2 | 3 | #include "enum-doc.h" 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/enum-doc-rusty.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --rustified-enum B 2 | 3 | #include "enum-doc.h" 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/enum-no-debug-rust.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --no-derive-debug --default-enum-style=rust --constified-enum-module=Neg 2 | 3 | #include "enum.h" 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/enum-translate-type.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --translate-enum-integer-types -- -std=c++11 -Wno-narrowing 2 | 3 | enum my_enum1 { 4 | A = 0, 5 | }; 6 | enum my_enum2 { 7 | B = -1, 8 | }; 9 | enum my_enum3: short { 10 | C = 0, 11 | }; 12 | enum my_enum4: unsigned char { 13 | D = -1, 14 | }; 15 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/enum-undefault.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --default-enum-style=rust --constified-enum=Neg 2 | 3 | enum Foo { 4 | Bar = 0, 5 | Qux 6 | }; 7 | 8 | enum Neg { 9 | MinusOne = -1, 10 | One = 1, 11 | }; 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/enum_alias.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --rustified-enum ".*" -- -std=c++11 2 | 3 | typedef unsigned char uint8_t; 4 | 5 | enum Bar : uint8_t { 6 | VAL 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/enum_and_vtable_mangling.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --rustified-enum ".*" 2 | 3 | enum { 4 | match, 5 | whatever_else, 6 | }; 7 | 8 | class C { 9 | int i; 10 | public: 11 | virtual void match(); 12 | }; 13 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/enum_dupe.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --rustified-enum ".*" 2 | 3 | enum Foo { 4 | Bar = 1, 5 | Dupe = 1 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/enum_explicit_type_constants.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --raw-line '#![cfg(not(target_os="windows"))]' -- -std=c++11 2 | // 3 | // This test is much like enum_explicit_type, but without --rustified-enum. 4 | 5 | #include "enum_explicit_type.hpp" 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/enum_in_template.hpp: -------------------------------------------------------------------------------- 1 | 2 | template 3 | class Foo 4 | { 5 | enum Bar 6 | { 7 | A, 8 | B 9 | }; 10 | }; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/enum_negative.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --rustified-enum ".*" 2 | 3 | enum Foo { 4 | Bar = -2, 5 | Qux = 1, 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/enum_packed.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --rustified-enum ".*" 2 | 3 | enum __attribute__((packed)) Foo { 4 | Bar = 0, 5 | Qux 6 | }; 7 | 8 | enum __attribute__((packed)) Neg { 9 | MinusOne = -1, 10 | One = 1, 11 | }; 12 | 13 | enum __attribute__((packed)) Bigger { 14 | Much = 255, 15 | Larger 16 | }; 17 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/error-E0600-cannot-apply-unary-negation-to-u32.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --raw-line "#![allow(overflowing_literals)]" 2 | 3 | typedef unsigned int uint32_t; 4 | 5 | uint32_t a = 18446744073709551611; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/eval-value-dependent.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++11 2 | 3 | template class e { 4 | using f = d; 5 | static const auto g = alignof(f); 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/eval-variadic-template-parameter.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++11 2 | 3 | template 4 | struct B { 5 | // Can't generate anything meaningful in Rust for this, but we shouldn't 6 | // trigger an assertion inside Clang. 7 | static const long c = sizeof...(T); 8 | }; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/extern-const-struct.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --rust-target 1.40 2 | 3 | struct nsFoo { 4 | float details[400]; 5 | }; 6 | 7 | extern const struct nsFoo gDetails; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/extern.hpp: -------------------------------------------------------------------------------- 1 | extern "C" { 2 | #include "func_proto.h" 3 | } 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/extern_blocks_post_1_82.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --no-layout-tests --rust-target=1.82 2 | 3 | void cool_function(int i, char c); 4 | 5 | static int cool_static; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/extern_blocks_pre_1_82.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --no-layout-tests --rust-target=1.81 2 | 3 | void cool_function(int i, char c); 4 | 5 | static int cool_static; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/field-visibility-callback.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --default-visibility private 2 | // bindgen-parse-callbacks: field-visibility-default-private 3 | 4 | struct my_struct { 5 | int a; 6 | int private_b; 7 | int c: 1; 8 | int private_d: 1; 9 | }; 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/field-visibility.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --default-visibility private --no-doc-comments 2 | 3 | struct my_struct1 { 4 | int a: 1; 5 | }; 6 | 7 | /**
*/ 8 | struct my_struct2 { 9 | int a: 1; 10 | }; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/fit-macro-constant-types-signed.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --default-macro-constant-type=signed --fit-macro-constant-types 2 | #include "default-macro-constant-type.h" 3 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/fit-macro-constant-types.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --fit-macro-constant-types 2 | // Test fitting macro constants into smaller integer types 3 | // Negative values are i8, i16, i32 or i64; others are u8, u16, u32 or u64. 4 | #include "default-macro-constant-type.h" -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/forward-declaration-autoptr.hpp: -------------------------------------------------------------------------------- 1 | class Foo; 2 | 3 | template 4 | struct RefPtr { 5 | T* m_inner; 6 | }; 7 | 8 | struct Bar { 9 | RefPtr m_member; 10 | }; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/forward-enum-decl.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --rustified-enum ".*" -- -std=c++11 2 | 3 | enum class CSSPseudoClassType : int; 4 | 5 | enum class CSSPseudoClassType : int { 6 | empty, 7 | link, 8 | }; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/forward-inherit-struct-with-fields.hpp: -------------------------------------------------------------------------------- 1 | template class Rooted; 2 | namespace js { 3 | template class RootedBase { 4 | T* foo; 5 | Rooted* next; 6 | }; 7 | } 8 | template class Rooted : js::RootedBase {}; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/forward-inherit-struct.hpp: -------------------------------------------------------------------------------- 1 | template class Rooted; 2 | namespace js { 3 | template class RootedBase {}; 4 | } 5 | template class Rooted : js::RootedBase {}; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/forward_declared_complex_types.hpp: -------------------------------------------------------------------------------- 1 | struct Foo_empty {}; 2 | struct Foo; 3 | 4 | struct Bar { 5 | Foo *f; 6 | }; 7 | 8 | void baz_struct(Foo* f); 9 | 10 | union Union; 11 | 12 | void baz_union(Union* u); 13 | 14 | class Quux; 15 | 16 | void baz_class(Quux* q); 17 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/forward_declared_opaque.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --opaque-type ".*" 2 | 3 | union a; 4 | struct b; 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/forward_declared_struct.h: -------------------------------------------------------------------------------- 1 | struct a; 2 | 3 | struct a { 4 | int b; 5 | }; 6 | 7 | struct c { 8 | int d; 9 | }; 10 | 11 | struct c; -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/func_proto.h: -------------------------------------------------------------------------------- 1 | typedef int foo(int bar); 2 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/func_ptr.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | // 3 | int (*foo) (int x, int y); 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/func_ptr_in_struct.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum ".*" 2 | // 3 | enum baz; 4 | 5 | struct Foo { 6 | enum baz (*bar) (int x, int y); 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/func_ptr_return_type.h: -------------------------------------------------------------------------------- 1 | int (*func(void))(int, int); 2 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/func_with_array_arg.h: -------------------------------------------------------------------------------- 1 | void f(int x[2]); 2 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/func_with_func_ptr_arg.h: -------------------------------------------------------------------------------- 1 | void foo(void (*bar)()); 2 | 3 | void bar(void (*one)(int a, int b), void (*two)(int c, int d)); 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/function-typedef-stdcall.h: -------------------------------------------------------------------------------- 1 | typedef 2 | void __stdcall 3 | EVT_VIGEM_X360_NOTIFICATION( 4 | void* Client, 5 | void* Target, 6 | unsigned char LargeMotor, 7 | unsigned char SmallMotor, 8 | unsigned char LedNumber, 9 | void* UserData 10 | ); 11 | 12 | typedef EVT_VIGEM_X360_NOTIFICATION *PFN_VIGEM_X360_NOTIFICATION; 13 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/gen-constructors-neg.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --generate types,functions 2 | 3 | class Foo { 4 | public: 5 | Foo(int a); 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/gen-constructors.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --generate types,constructors,functions 2 | 3 | class Foo { 4 | public: 5 | Foo(int a); 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/gen-destructors-neg.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --generate types,functions 2 | // 3 | // NB: This is intended to _not_ generate destructors. 4 | 5 | class Foo { 6 | int bar; 7 | public: 8 | ~Foo(); 9 | }; 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/gen-destructors.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --generate types,destructors,functions 2 | 3 | class Foo { 4 | int bar; 5 | public: 6 | ~Foo(); 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/generate-inline.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --generate-inline-functions 2 | 3 | class Foo { 4 | public: 5 | static inline int bar() { 6 | return 42; 7 | } 8 | }; 9 | 10 | inline int foo() { 11 | return 42; 12 | } 13 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/i128.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: \-\-rust-target=1.33 2 | 3 | struct foo { 4 | __int128 my_signed; 5 | unsigned __int128 my_unsigned; 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/in_class_typedef.hpp: -------------------------------------------------------------------------------- 1 | 2 | template 3 | class Foo { 4 | typedef T elem_type; 5 | typedef T* ptr_type; 6 | 7 | typedef struct Bar { 8 | int x, y; 9 | } Bar; 10 | }; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/incomplete-array-padding.h: -------------------------------------------------------------------------------- 1 | struct foo { 2 | char a : 1; 3 | void *b[]; 4 | }; 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/infinite-macro.h: -------------------------------------------------------------------------------- 1 | #define INFINITY (1.0f/0.0f) 2 | #define NAN (0.0f/0.0f) 3 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/inherit-namespaced.hpp: -------------------------------------------------------------------------------- 1 | namespace js { 2 | template class RootedBase {}; 3 | } 4 | template class Rooted : js::RootedBase {}; 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/inherit_multiple_interfaces.hpp: -------------------------------------------------------------------------------- 1 | class A { 2 | virtual void Foo(); 3 | 4 | int member; 5 | }; 6 | 7 | class B { 8 | virtual void Bar(); 9 | 10 | void* member2; 11 | }; 12 | 13 | class C : public A, public B { 14 | float member3; 15 | }; 16 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/inherit_named.hpp: -------------------------------------------------------------------------------- 1 | template 2 | class Wohoo {}; 3 | 4 | template 5 | class Weeee : public T {}; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/inherit_typedef.hpp: -------------------------------------------------------------------------------- 1 | struct Foo {}; 2 | 3 | typedef Foo TypedefedFoo; 4 | 5 | struct Bar: public TypedefedFoo {}; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/inline-function.h: -------------------------------------------------------------------------------- 1 | // bindgen-unstable 2 | 3 | /** The point of this test is to _not_ generate these functions. */ 4 | 5 | inline static int myadd(const int x, const int y) { return x + y; } 6 | static int mysub(const int x, const int y) { return x - y; } 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/inline_namespace.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-cxx-namespaces -- -std=c++11 2 | 3 | namespace foo { 4 | inline namespace bar { 5 | using Ty = int; 6 | }; 7 | }; 8 | 9 | class Bar { 10 | foo::Ty baz; 11 | }; 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/inline_namespace_allowlist.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-cxx-namespaces --allowlist-type=std::string -- -std=c++11 2 | 3 | namespace std { 4 | inline namespace bar { 5 | using string = const char*; 6 | }; 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/inline_namespace_conservative.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-cxx-namespaces --conservative-inline-namespaces -- -std=c++11 2 | 3 | namespace foo { 4 | inline namespace bar { 5 | using Ty = int; 6 | }; 7 | using Ty = long long; 8 | }; 9 | 10 | class Bar { 11 | foo::bar::Ty baz; 12 | }; 13 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/inline_namespace_macro.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-cxx-namespaces -- -std=c++11 2 | 3 | #include "namespace/nsdefine.h" 4 | 5 | BEGIN_NAMESPACE 6 | 7 | class duration {}; 8 | 9 | END_NAMESPACE 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/inline_namespace_nested.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-cxx-namespaces -- -std=c++2a 2 | 3 | namespace ranges::inline foo::bar { 4 | static int bar = 0; 5 | } 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/inline_namespace_no_ns_enabled.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++11 2 | 3 | namespace std { 4 | inline namespace __cxx11 { 5 | 6 | template 7 | class basic_string { 8 | struct Alloc_hider { 9 | void* storage; 10 | } hider; 11 | unsigned long length; 12 | struct { 13 | CharT inline_storage[4]; 14 | }; 15 | }; 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/inner-typedef-gh422.hpp: -------------------------------------------------------------------------------- 1 | template 2 | class Foo { 3 | public: 4 | class InnerType { 5 | T t; 6 | }; 7 | }; 8 | 9 | typedef Foo::InnerType Bar; 10 | 11 | Bar func(); -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/inner_const.hpp: -------------------------------------------------------------------------------- 1 | 2 | class Foo { 3 | static int BOO; 4 | static Foo whatever; 5 | int bar; 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/inner_template_self.hpp: -------------------------------------------------------------------------------- 1 | 2 | template 3 | class LinkedList { 4 | LinkedList* next; 5 | LinkedList* prev; 6 | }; 7 | 8 | class InstantiateIt { 9 | LinkedList m_list; 10 | }; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/int128_t.h: -------------------------------------------------------------------------------- 1 | /** 2 | * FIXME: Uncomment this once we can generate the proper alignment for the type, 3 | * i.e., when we use u128/i128. 4 | struct Foo { 5 | __int128 foo; 6 | }; 7 | */ 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1025-unknown-enum-repr.hpp: -------------------------------------------------------------------------------- 1 | 2 | template class a { 3 | enum {}; 4 | }; 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1034.h: -------------------------------------------------------------------------------- 1 | 2 | struct S2 { 3 | unsigned : 11 4 | }; 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1040.h: -------------------------------------------------------------------------------- 1 | unsigned long long g_107 = 18446744073709551615UL; 2 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1076-unnamed-bitfield-alignment.h: -------------------------------------------------------------------------------- 1 | struct S1 { 2 | signed : 15; 3 | unsigned : 6 4 | }; 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1113-template-references.hpp: -------------------------------------------------------------------------------- 1 | template 2 | class Entry : public K 3 | { 4 | V mData; 5 | }; 6 | 7 | template 8 | class nsBaseHashtable { 9 | typedef Entry EntryType; 10 | 11 | struct EntryPtr { 12 | private: 13 | EntryType& mEntry; 14 | bool mExistingEntry; 15 | }; 16 | }; 17 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1118-using-forward-decl.hpp: -------------------------------------------------------------------------------- 1 | template class nsTArray; 2 | template using c = nsTArray; 3 | class nsTArray_base { 4 | int *d; 5 | }; 6 | template class nsTArray : nsTArray_base {}; 7 | class nsIContent { 8 | nsTArray foo; 9 | }; 10 | nsTArray *Gecko_GetAnonymousContentForElement(); 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1197-pure-virtual-stuff.hpp: -------------------------------------------------------------------------------- 1 | class Foo 2 | { 3 | public: 4 | virtual void Bar() = 0; 5 | virtual ~Foo() = 0; 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1198-alias-rust-bitfield-enum.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --rustified-enum '.*' --bitfield-enum '.*' 2 | 3 | typedef enum MyDupeEnum { 4 | A = 0, 5 | A_alias = 0, 6 | B, 7 | } MyDupeEnum; 8 | 9 | enum MyOtherDupeEnum { 10 | C = 0, 11 | C_alias = 0, 12 | D, 13 | }; 14 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1198-alias-rust-const-mod-bitfield-enum.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --rustified-enum '.*' --constified-enum-module '.*' --bitfield-enum '.*' 2 | 3 | typedef enum MyDupeEnum { 4 | A = 0, 5 | A_alias = 0, 6 | B, 7 | } MyDupeEnum; 8 | 9 | enum MyOtherDupeEnum { 10 | C = 0, 11 | C_alias = 0, 12 | D, 13 | }; 14 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1198-alias-rust-const-mod-enum.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --rustified-enum '.*' --constified-enum-module '.*' 2 | 3 | typedef enum MyDupeEnum { 4 | A = 0, 5 | A_alias = 0, 6 | B, 7 | } MyDupeEnum; 8 | 9 | enum MyOtherDupeEnum { 10 | C = 0, 11 | C_alias = 0, 12 | D, 13 | }; -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1198-alias-rust-enum.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --rustified-enum '.*' 2 | 3 | 4 | typedef enum MyDupeEnum { 5 | A = 0, 6 | A_alias = 0, 7 | B, 8 | } MyDupeEnum; 9 | 10 | enum MyOtherDupeEnum { 11 | C = 0, 12 | C_alias = 0, 13 | D, 14 | }; -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1216-variadic-member.h: -------------------------------------------------------------------------------- 1 | void f(int a, ...); 2 | struct Foo { 3 | void (*f)(void *p, void *obj, int a, ...); 4 | }; 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1238-fwd-no-copy.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --no-copy MyType 2 | 3 | typedef struct MyType MyTypeT; 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1281.h: -------------------------------------------------------------------------------- 1 | struct foo; 2 | 3 | typedef struct bar { 4 | struct foo { 5 | int foo; 6 | } u; 7 | } bar_t; 8 | 9 | struct baz { 10 | struct foo f; 11 | }; 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1285.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --no-recursive-allowlist --allowlist-type "foo" 2 | 3 | struct foo { 4 | union { 5 | unsigned int a; 6 | unsigned short b; 7 | } bar; 8 | }; -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1350-attribute-overloadable.h: -------------------------------------------------------------------------------- 1 | void my_function(int a) __attribute__((overloadable)); 2 | void my_function(const char *a) __attribute__((overloadable)); 3 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1375-prefixed-functions.h: -------------------------------------------------------------------------------- 1 | // bindgen-parse-callbacks: remove-function-prefix-my_custom_prefix_ 2 | 3 | extern const int my_custom_prefix_var_const_name; 4 | 5 | extern int my_custom_prefix_var_mut_name; 6 | 7 | void my_custom_prefix_function_name(const int x); 8 | 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1435.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-cxx-namespaces 2 | 3 | namespace ns { 4 | enum class AB { A, B }; 5 | } 6 | using AB = ns::AB; 7 | static const AB kA = AB::A; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1443.hpp: -------------------------------------------------------------------------------- 1 | struct Foo; 2 | 3 | struct Bar { 4 | const Foo& f; 5 | unsigned m; 6 | }; 7 | 8 | struct Baz { 9 | Foo& f; 10 | unsigned m; 11 | }; 12 | 13 | struct Tar { 14 | const Foo&& f; 15 | unsigned m; 16 | }; 17 | 18 | struct Taz { 19 | Foo&& f; 20 | unsigned m; 21 | }; 22 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1454.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --no-recursive-allowlist --allowlist-type "local_type" --with-derive-hash --no-derive-copy --no-derive-default --raw-line "#[repr(C)] #[derive(Debug)] pub struct extern_type;" 2 | // bindgen-parse-callbacks: blocklisted-type-implements-trait 3 | 4 | struct extern_type {}; 5 | 6 | typedef struct 7 | { 8 | struct extern_type inner; 9 | } 10 | local_type; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1464.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Should not crash. 3 | template class Bar { 4 | public: 5 | Bar(); 6 | ~Bar(); 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1488-options.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --new-type-alias "SomePtr" --new-type-alias-deref "AnotherPtr" 2 | 3 | typedef int OSStatus; 4 | typedef void* SomePtr; 5 | typedef void* AnotherPtr; -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1488-template-alias-new-type.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --default-alias-style=new_type -- -std=c++14 2 | 3 | template 4 | using Wrapped = T; 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1514.hpp: -------------------------------------------------------------------------------- 1 | template 2 | struct Thing { 3 | struct Inner { 4 | T *ptr; 5 | }; 6 | 7 | struct AnotherInner : Inner { 8 | }; 9 | }; 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1554.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --default-enum-style rust_non_exhaustive --rust-target nightly --raw-line '#![cfg(feature = "nightly")]' --raw-line '#![feature(non_exhaustive)]' 2 | 3 | enum Planet { 4 | earth, 5 | mars 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1599-opaque-typedef-to-enum.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --opaque-type d 2 | 3 | typedef enum a { b, c } d; 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1676-macro-namespace-prefix.hpp: -------------------------------------------------------------------------------- 1 | #define nssv_inline_ns inline 2 | nssv_inline_ns namespace literals {} 3 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1947.h: -------------------------------------------------------------------------------- 1 | typedef unsigned char U8; 2 | typedef unsigned short U16; 3 | 4 | typedef struct { 5 | U16 MADZ : 10, MAI0 : 2, MAI1 : 2, MAI2 : 2; 6 | U8 MADK, MABR; 7 | U16 MATH : 10, MATE : 4, MATW : 2; 8 | U8 MASW : 4, MABW : 3, MAXN : 1, _rB_; 9 | } V56AMDY; 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1977-larger-arrays.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | // 3 | struct S { 4 | char large_array[33]; 5 | }; 6 | 7 | template struct ST { 8 | T large_array[33]; 9 | }; 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-1995.h: -------------------------------------------------------------------------------- 1 | /// This is a constant that has a docstring 2 | /// 3 | /// And expected to be found in generated bindings code too. 4 | const int FOO = 1; 5 | 6 | /// This is a constant that has a docstring 7 | /// 8 | /// And expected to be found in generated bindings code too. 9 | struct Bar 10 | { 11 | int baz; 12 | }; -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-2019.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --disable-nested-struct-naming 2 | 3 | struct A { 4 | static A make(); 5 | int a; 6 | }; 7 | struct B { 8 | static B make(); 9 | int b; 10 | }; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-2239-template-dependent-bit-width.hpp: -------------------------------------------------------------------------------- 1 | template class b { 2 | typedef a td; 3 | using ta = a; 4 | struct foo { 5 | a foo : sizeof(a); 6 | a : sizeof(a); 7 | td : sizeof(td); 8 | ta : sizeof(ta); 9 | }; 10 | }; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-2556.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-cxx-namespaces -- -x c++ -Itests/headers -include tests/headers/issue-2556/nsStyleStruct.h -include tests/headers/issue-2556/LayoutConstants.h 2 | 3 | #include "issue-2556/nsSize.h" 4 | #include "issue-2556/nsStyleStruct.h" 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-2556/LayoutConstants.h: -------------------------------------------------------------------------------- 1 | #include "nsSize.h" 2 | 3 | namespace foo { 4 | 5 | static constexpr nsSize kFallbackIntrinsicSize(0, 0); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-2556/nsSize.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct nsSize { 4 | int width, height; 5 | constexpr nsSize(int aWidth, int aHeight) : width(aWidth), height(aHeight) {} 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-2556/nsStyleStruct.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "nsSize.h" 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-2566-cstr.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --generate-cstr 2 | 3 | /// We should _not_ generate a cstr for this because cstr shouldn't have interior nulls. 4 | #define FOO "a\0b" 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-2566.h: -------------------------------------------------------------------------------- 1 | #define FOO "a\0b" 2 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-2695.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --explicit-padding 2 | 3 | #pragma pack(2) 4 | 5 | struct Test { 6 | unsigned long x; 7 | char a; 8 | char b; 9 | char c; 10 | }; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-2966.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --default-alias-style=new_type 2 | // bindgen-parse-callbacks: type-visibility 3 | 4 | typedef const char * pub_var1; 5 | typedef const char * pubcrate_var2; 6 | typedef const char * private_var3; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-3027.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-cxx-namespaces 2 | 3 | namespace regression { 4 | template class A { char c[N]; }; 5 | class C { A<3> a; }; 6 | } 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-358.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++11 2 | namespace JS { 3 | template class PersistentRooted; 4 | } 5 | template class a { a *b; }; 6 | namespace JS { 7 | template class PersistentRooted : a> {}; 8 | } 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-410.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-cxx-namespaces --allowlist-type JS::Value --rustified-enum ".*" 2 | 3 | namespace JS { 4 | class Value; 5 | } 6 | typedef enum {} JSWhyMagic; 7 | namespace JS { 8 | class Value { 9 | public: 10 | void a(JSWhyMagic); 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-446.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++14 2 | 3 | template 4 | class List { 5 | List *next; 6 | }; 7 | 8 | template 9 | class PersistentRooted { 10 | List> root_list; 11 | }; 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-511.h: -------------------------------------------------------------------------------- 1 | char * a; 2 | const char * b; 3 | char * const c; 4 | const char * const d; -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-544-stylo-creduce.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++14 2 | 3 | template class a; 4 | template class a { a(const a &); }; 5 | template a::a(const a &) {} 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-573-layout-test-failures.hpp: -------------------------------------------------------------------------------- 1 | template 2 | struct UnusedIntTemplateParam {}; 3 | 4 | template 5 | class Outer { 6 | static const long SIZE = 1; 7 | UnusedIntTemplateParam i; 8 | }; 9 | 10 | class AutoIdVector { 11 | Outer ar; 12 | }; 13 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-574-assertion-failure-in-codegen.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++14 2 | 3 | template class a {}; 4 | class { 5 | a ar; 6 | } AutoIdVector; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-638-stylo-cannot-find-T-in-this-scope.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++14 2 | 3 | template 4 | class RefPtr { 5 | T use_of_t; 6 | }; 7 | 8 | template 9 | class UsesRefPtrWithAliasedTypeParam { 10 | using V = U; 11 | RefPtr member; 12 | }; 13 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-639-typedef-anon-field.hpp: -------------------------------------------------------------------------------- 1 | class Foo { 2 | public: 3 | typedef struct { 4 | int abc; 5 | } Bar; 6 | 7 | Bar bar; 8 | }; 9 | 10 | class Baz { 11 | public: 12 | typedef struct { 13 | int abc; 14 | } Bar; 15 | }; 16 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-643-inner-struct.h: -------------------------------------------------------------------------------- 1 | struct rte_ring { 2 | struct rte_memzone *memzone; 3 | 4 | struct prod { 5 | unsigned watermark; 6 | } prod; 7 | 8 | struct cons { 9 | unsigned sc_dequeue; 10 | } cons; 11 | 12 | void *ring[]; 13 | }; 14 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-645-cannot-find-type-T-in-this-scope.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --blocklist-type RefPtr --raw-line "#[derive(Clone, Copy, Debug)] pub struct RefPtr(T);" --allowlist-type "HasRefPtr" -- -std=c++14 2 | 3 | template class RefPtr {}; 4 | 5 | template 6 | class HasRefPtr { 7 | typedef T TypedefOfT; 8 | RefPtr refptr_member; 9 | }; 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-654-struct-fn-collision.h: -------------------------------------------------------------------------------- 1 | struct foo; 2 | int foo(void); 3 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-662-cannot-find-T-in-this-scope.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- --std=c++14 2 | 3 | template class RefPtr { T a; }; 4 | template class nsMainThreadPtrHolder { T a; }; 5 | template class nsMainThreadPtrHandle { 6 | RefPtr> mPtr; 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-674-1.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-cxx-namespaces --allowlist-type CapturingContentInfo --opaque-type 'mozilla::Maybe' -- -std=c++14 2 | 3 | namespace mozilla { 4 | template class Maybe { using ValueType = T; }; 5 | } 6 | struct CapturingContentInfo { 7 | mozilla::Maybe a; 8 | }; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-674-2.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-cxx-namespaces --allowlist-type StaticRefPtr --opaque-type 'JS::Rooted' -- -std=c++14 2 | 3 | namespace JS { 4 | template class Rooted { using ElementType = T; }; 5 | } 6 | class c { 7 | JS::Rooted b; 8 | }; 9 | class B { 10 | c a; 11 | }; 12 | template class StaticRefPtr {}; 13 | struct { 14 | StaticRefPtr d; 15 | } e; 16 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-674-3.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-cxx-namespaces --allowlist-type nsCSSValue --opaque-type 'nsRefPtrHashtable' -- -std=c++14 2 | 3 | template class nsRefPtrHashtable { 4 | typedef PtrType *UserDataType; 5 | }; 6 | struct a { 7 | nsRefPtrHashtable b; 8 | }; 9 | class nsCSSValue { 10 | a c; 11 | }; 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-677-nested-ns-specifier.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-cxx-namespaces -- -std=c++14 2 | 3 | namespace foo::bar { 4 | typedef int bar; 5 | } 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-691-template-parameter-virtual.hpp: -------------------------------------------------------------------------------- 1 | class VirtualMethods { 2 | virtual void foo(); 3 | }; 4 | 5 | template 6 | class Set { 7 | int bar; 8 | }; 9 | 10 | class ServoElementSnapshotTable 11 | : public Set 12 | {}; 13 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-710-must-use-type.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --must-use-type A 2 | 3 | struct A; 4 | 5 | /**
*/ 6 | struct B; 7 | 8 | struct C; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-739-pointer-wide-bitfield.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --raw-line '#![cfg(not(target_os="windows"))]' 2 | #define POINTER_WIDTH (sizeof(void*) * 8) 3 | 4 | struct Foo { 5 | unsigned long m_bitfield: POINTER_WIDTH; 6 | unsigned long m_bar: POINTER_WIDTH; 7 | unsigned long foo: 1; 8 | unsigned long bar: POINTER_WIDTH; 9 | }; 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-753.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --clang-macro-fallback 2 | 3 | #ifndef ISSUE_753_H 4 | #define ISSUE_753_H 5 | 6 | #define UINT32_C(c) c ## U 7 | 8 | #define CONST UINT32_C(5) 9 | #define OTHER_CONST UINT32_C(6) 10 | #define LARGE_CONST UINT32_C(6 << 8) 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-769-bad-instantiation-test.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-cxx-namespaces --allowlist-type Rooted 2 | 3 | template 4 | class Rooted { 5 | T member; 6 | }; 7 | 8 | class AutoValueVector : Rooted { 9 | using Alias = int; 10 | using RootedAlias = Rooted; 11 | }; 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-801-opaque-sloppiness.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --opaque-type "B" --allowlist-type "C" --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | 3 | class A; 4 | 5 | class B { 6 | static A a; 7 | }; 8 | 9 | class C { 10 | B b; 11 | }; 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-820-unused-template-param-in-alias.hpp: -------------------------------------------------------------------------------- 1 | template 2 | class Foo { 3 | typedef Foo self_type; 4 | E mBar; 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-826-generating-methods-when-asked-not-to.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --ignore-methods -- --target=i686-pc-win32 2 | 3 | struct Foo { 4 | void test(); 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-833-1.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --generate functions --allowlist-function func --raw-line "#[repr(C)] pub struct nsTArray { pub hdr: *const () }" 2 | 3 | template 4 | class nsTArray { 5 | static T* sFoo; 6 | }; 7 | 8 | extern "C" nsTArray* func(); 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-833-2.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --raw-line "// If the output of this changes, please ensure issue-833-1.hpp changes too" 2 | 3 | template 4 | class nsTArray { 5 | static T* sFoo; 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-833.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --generate functions --allowlist-function func --raw-line "#[repr(C)] pub struct nsTArray { pub hdr: *const T }" 2 | 3 | template 4 | class nsTArray { 5 | T* mHeader; 6 | }; 7 | 8 | extern "C" nsTArray* func(); 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-834.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --allowlist-type U --generate types 2 | 3 | struct T {}; 4 | struct U { 5 | void test(T a); 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-848-replacement-system-include.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -Itests/headers/issue-848 2 | 3 | #include "an-include.h" 4 | 5 | extern "C" { 6 | nsTArray* func(); 7 | } 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-888-enum-var-decl-jump.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-cxx-namespaces --rustified-enum ".*" 2 | 3 | namespace Halide { 4 | struct Type; 5 | } 6 | typedef enum {} a; 7 | namespace Halide { 8 | struct Type { 9 | static a b; 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-944-derive-copy-and-blocklisting.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --blocklist-type BlocklistMe --raw-line 'pub struct BlocklistMe(u8);' 2 | 3 | struct BlocklistMe {}; 4 | 5 | /** 6 | * Because this type contains a blocklisted type, it should not derive Copy. 7 | */ 8 | struct ShouldNotBeCopy { 9 | BlocklistMe a; 10 | }; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue-946.h: -------------------------------------------------------------------------------- 1 | struct foo { }; 2 | 3 | typedef struct foo bar; 4 | 5 | typedef bar foo; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue_311.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-cxx-namespaces 2 | 3 | struct jsval_layout { 4 | struct {}; 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/issue_315.hpp: -------------------------------------------------------------------------------- 1 | ///
2 | template using b = a; 3 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/layout.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: \-\-rust-target=1.33 2 | // 3 | // FIXME: https://github.com/rust-lang/rust-bindgen/issues/1498 4 | 5 | 6 | #if 0 7 | struct header 8 | { 9 | char proto; 10 | unsigned int size __attribute__ ((packed)); 11 | unsigned char data[] __attribute__ ((aligned(8))); 12 | } __attribute__ ((aligned, packed)); 13 | #endif 14 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/long_double.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: \-\-rust-target=1.33 2 | 3 | struct foo { 4 | long double bar; 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/macro-expr-basic.h: -------------------------------------------------------------------------------- 1 | #define FOO 1 2 | #define BAR 4 3 | #define BAZ (FOO + BAR) 4 | 5 | #define MIN (1 << 63) 6 | 7 | #define BARR (1 << 0) 8 | #define BAZZ ((1 << 1) + BAZ) 9 | #define I_RAN_OUT_OF_DUMB_NAMES (BARR | BAZZ) 10 | 11 | /* I haz a comment */ 12 | #define HAZ_A_COMMENT BARR 13 | 14 | #define HAZ_A_COMMENT_INSIDE (/* comment for real */ BARR + FOO) 15 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/macro-expr-uncommon-token.h: -------------------------------------------------------------------------------- 1 | 2 | // Commenting this out & removing the usage before `foo` results in the correct 3 | // bindings 4 | #define MODBUS_API 5 | #define MODBUS_WOOT 3 6 | 7 | MODBUS_API void foo(); 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/macro-redef.h: -------------------------------------------------------------------------------- 1 | #define FOO 4 2 | #define BAR (1 + FOO) 3 | #undef FOO 4 | #define FOO 5 5 | #define BAZ (1 + FOO) 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/macro_const.h: -------------------------------------------------------------------------------- 1 | #define foo "bar" 2 | #define CHAR 'b' 3 | #define CHARR '\0' 4 | #define FLOAT 5.09f 5 | #define FLOAT_EXPR (5 / 1000.0f) 6 | #define LONG 3L 7 | 8 | #define INVALID_UTF8 "\xf0\x28\x8c\x28" 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/maddness-is-avoidable.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --blocklist-type RefPtr_Proxy_member_function 2 | 3 | template 4 | class RefPtr { 5 | template 6 | class Proxy { 7 | typedef R (T::*member_function)(Args...); 8 | }; 9 | }; 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/mangling-ios.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- --target=x86_64-apple-ios 2 | 3 | void foo(); 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/mangling-linux32.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- --target=i586-unknown-linux 2 | 3 | extern "C" void foo(); 4 | 5 | struct Foo { 6 | static bool sBar; 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/mangling-linux64.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- --target=x86_64-unknown-linux 2 | 3 | extern "C" void foo(); 4 | 5 | struct Foo { 6 | static bool sBar; 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/mangling-macos.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- --target=x86_64-apple-darwin 2 | 3 | extern "C" void foo(); 4 | 5 | struct Foo { 6 | static bool sBar; 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/mangling-win64.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- --target=x86_64-pc-win32 2 | 3 | extern "C" void foo(); 4 | 5 | struct Foo { 6 | static bool sBar; 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/merge_extern_blocks_post_1_82.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --merge-extern-blocks --enable-cxx-namespaces --rust-target=1.82 -- --target=x86_64-unknown-linux 2 | int foo(); 3 | typedef struct Point { 4 | int x; 5 | } Point; 6 | int bar(); 7 | 8 | namespace ns { 9 | int foo(); 10 | typedef struct Point { 11 | int x; 12 | } Point; 13 | int bar(); 14 | } 15 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/merge_extern_blocks_pre_1_82.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --merge-extern-blocks --enable-cxx-namespaces --rust-target=1.81 -- --target=x86_64-unknown-linux 2 | int foo(); 3 | typedef struct Point { 4 | int x; 5 | } Point; 6 | int bar(); 7 | 8 | namespace ns { 9 | int foo(); 10 | typedef struct Point { 11 | int x; 12 | } Point; 13 | int bar(); 14 | } 15 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/method-mangling.hpp: -------------------------------------------------------------------------------- 1 | 2 | class Foo { 3 | public: 4 | int type(); 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/module-allowlisted.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-cxx-namespaces 2 | struct Test {}; 3 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/msvc-no-usr.hpp: -------------------------------------------------------------------------------- 1 | 2 | typedef unsigned long long size_t; 3 | 4 | class A { 5 | const size_t foo; 6 | 7 | A() : foo(5) {} 8 | }; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/multiple-inherit-empty-correct-layout.hpp: -------------------------------------------------------------------------------- 1 | struct Foo {}; 2 | struct Bar {}; 3 | struct Baz : public Foo, public Bar {}; 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/mutable.hpp: -------------------------------------------------------------------------------- 1 | class C { 2 | mutable int m_member; 3 | int m_other; 4 | }; 5 | 6 | class NonCopiable { 7 | mutable int m_member; 8 | 9 | ~NonCopiable() {}; 10 | }; 11 | 12 | class NonCopiableWithNonCopiableMutableMember { 13 | mutable NonCopiable m_member; 14 | }; 15 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/namespace/nsbegin.h: -------------------------------------------------------------------------------- 1 | namespace faraway { 2 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/namespace/nsdefine.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define BEGIN_NAMESPACE namespace repro { inline namespace __1 { 4 | #define END_NAMESPACE } } 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/namespace/nsend.h: -------------------------------------------------------------------------------- 1 | } 2 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/nested-template-typedef.hpp: -------------------------------------------------------------------------------- 1 | template 2 | class Foo { 3 | public: 4 | template 5 | struct Bar { 6 | typedef Foo FooU; 7 | }; 8 | }; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/nested.hpp: -------------------------------------------------------------------------------- 1 | 2 | class Calc { 3 | int w; 4 | }; 5 | 6 | class Test { 7 | public: 8 | struct Size; 9 | friend struct Size; 10 | struct Size { 11 | struct Dimension : public Calc { 12 | }; 13 | Dimension mWidth, mHeight; 14 | }; 15 | }; 16 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/nested_vtable.hpp: -------------------------------------------------------------------------------- 1 | class nsISupports { 2 | public: 3 | virtual nsISupports* QueryInterface(); 4 | }; 5 | 6 | class nsIRunnable : public nsISupports {}; 7 | 8 | class Runnable : public nsIRunnable {}; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/nested_within_namespace.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-cxx-namespaces 2 | 3 | namespace foo { 4 | class Bar { 5 | int foo; 6 | 7 | class Baz { 8 | int foo; 9 | }; 10 | }; 11 | 12 | class Baz { 13 | int baz; 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/newtype-enum.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --newtype-enum "Foo" \-\-rust-target=1.33 -- -std=c++11 2 | 3 | enum Foo { 4 | Bar = 1 << 1, 5 | Baz = 1 << 2, 6 | Duplicated = 1 << 2, 7 | Negative = -3, 8 | }; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/newtype-global-enum.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --newtype-global-enum "Foo" \-\-rust-target=1.33 -- -std=c++11 2 | 3 | enum Foo { 4 | Bar = 1 << 1, 5 | Baz = 1 << 2, 6 | Duplicated = 1 << 2, 7 | Negative = -3, 8 | }; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/no-comments.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --no-doc-comments 2 | 3 | struct Foo { 4 | int s; /*!< Including this will prevent rustc for compiling it */ 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/no-hash-allowlisted.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --allowlist-type "NoHash" --no-hash "NoHash" 2 | 3 | class NoHash { 4 | int i; 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/no-hash-opaque.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --opaque-type "NoHash" --no-hash "NoHash" 2 | 3 | class NoHash { 4 | int i; 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/no-partialeq-allowlisted.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-partialeq --allowlist-type "NoPartialEq" --no-partialeq "NoPartialEq" 2 | 3 | class NoPartialEq { 4 | int i; 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/no-partialeq-opaque.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-partialeq --opaque-type "NoPartialEq" --no-partialeq "NoPartialEq" 2 | 3 | class NoPartialEq { 4 | int i; 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/no-recursive-allowlisting.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --no-recursive-allowlist --allowlist-type "Foo" --raw-line "pub enum Bar {}" --rustified-enum ".*" 2 | 3 | struct Bar; 4 | 5 | struct Foo { 6 | struct Bar* baz; 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/no-std.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --ctypes-prefix "libc" --use-core --raw-line "#![no_std]" --raw-line "mod libc { pub type c_int = i32; pub enum c_void {} }" --rustified-enum ".*" 2 | struct foo { 3 | int a, b; 4 | void* bar; 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/no_copy.hpp: -------------------------------------------------------------------------------- 1 | 2 | /**
*/ 3 | template 4 | class CopiableButWait { 5 | int whatever; 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/no_copy_allowlisted.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --allowlist-type "NoCopy" --no-copy "NoCopy" 2 | 3 | class NoCopy { 4 | int i; 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/no_copy_opaque.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --opaque-type "NoCopy" --no-copy "NoCopy" 2 | 3 | class NoCopy { 4 | int i; 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/no_debug.hpp: -------------------------------------------------------------------------------- 1 | 2 | /**
*/ 3 | template 4 | class DebugButWait { 5 | int whatever; 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/no_debug_allowlisted.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --allowlist-type "NoDebug" --no-debug "NoDebug" 2 | 3 | class NoDebug { 4 | int i; 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/no_debug_bypass_impl_debug.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --no-debug "NoDebug" --impl-debug --rust-target 1.40 2 | 3 | template 4 | class Generic { 5 | T t[40]; 6 | }; 7 | 8 | template 9 | class NoDebug { 10 | T t[40]; 11 | }; 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/no_debug_opaque.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --opaque-type "NoDebug" --no-debug "NoDebug" 2 | 3 | class NoDebug { 4 | int i; 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/no_default.hpp: -------------------------------------------------------------------------------- 1 | 2 | /**
*/ 3 | template 4 | class DefaultButWait { 5 | int whatever; 6 | }; 7 | 8 | template 9 | class DefaultButWaitDerived { 10 | DefaultButWait whatever; 11 | }; 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/no_default_allowlisted.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --allowlist-type "NoDefault" --no-default "NoDefault" 2 | 3 | class NoDefault { 4 | int i; 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/no_default_bypass_derive_default.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --no-default "NoDefault" --rust-target 1.40 2 | 3 | template 4 | class Generic { 5 | T t[40]; 6 | }; 7 | 8 | template 9 | class NoDefault { 10 | T t[40]; 11 | }; 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/no_default_opaque.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --opaque-type "NoDefault" --no-default "NoDefault" 2 | 3 | class NoDefault { 4 | int i; 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/no_size_t_is_usize.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --no-size_t-is-usize 2 | 3 | typedef unsigned long size_t; 4 | typedef long ssize_t; 5 | 6 | struct A { 7 | size_t len; 8 | ssize_t offset; 9 | struct A* next; 10 | }; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/noreturn.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-function-attribute-detection -- -std=c++11 2 | _Noreturn void f(void); 3 | __attribute__((noreturn)) void g(void); 4 | [[noreturn]] void h(void); 5 | void i(__attribute__((noreturn)) void (*arg)(void)); 6 | __attribute__((noreturn)) void j(__attribute__((noreturn)) void (*arg)(void)); 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/objc_blocklist.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --objc-extern-crate --blocklist-item ISomeClass::class_ambiguouslyBlockedMethod --blocklist-item ISomeClass::blockedInstanceMethod -- -x objective-c 2 | // bindgen-osx-only 3 | 4 | @interface SomeClass 5 | + (void)ambiguouslyBlockedMethod; 6 | - (void)ambiguouslyBlockedMethod; 7 | - (void)instanceMethod; 8 | - (void)blockedInstanceMethod; 9 | @end 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/objc_category.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -x objective-c 2 | // bindgen-osx-only 3 | 4 | @interface Foo 5 | -(void)method; 6 | @end 7 | 8 | @interface Foo (BarCategory) 9 | -(void)categoryMethod; 10 | @end 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/objc_class.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -x objective-c 2 | // bindgen-osx-only 3 | 4 | @class Foo; 5 | 6 | Foo* fooVar; 7 | 8 | @interface Foo 9 | -(void)method; 10 | @end 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/objc_class_method.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -x objective-c 2 | // bindgen-osx-only 3 | 4 | @interface Foo 5 | + (void)method; 6 | + (void)methodWithInt:(int)foo; 7 | + (void)methodWithFoo:(Foo*)foo; 8 | + (int)methodReturningInt; 9 | + (Foo*)methodReturningFoo; 10 | + (void)methodWithArg1:(int)intvalue andArg2:(char*)ptr andArg3:(float)floatvalue; 11 | @end 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/objc_escape.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -x objective-c 2 | // bindgen-osx-only 3 | 4 | @interface A 5 | -(void)f:(int)arg1 as:(int)arg2; 6 | -(void)crate:(int)self; 7 | @end 8 | 9 | @interface B 10 | 11 | @property(nonatomic, retain) id type; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/objc_inheritance.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -x objective-c 2 | // bindgen-osx-only 3 | 4 | @interface Foo 5 | @end 6 | 7 | @interface Bar: Foo 8 | @end 9 | 10 | @interface Baz: Bar 11 | @end 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/objc_interface.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -x objective-c 2 | // bindgen-osx-only 3 | 4 | @interface Foo 5 | @end 6 | 7 | @protocol bar 8 | @end 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/objc_interface_type.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -x objective-c 2 | // bindgen-osx-only 3 | 4 | @interface Foo 5 | @end 6 | 7 | struct FooStruct { 8 | Foo *foo; 9 | }; 10 | 11 | void fooFunc(Foo *foo); 12 | 13 | static const Foo *kFoo; 14 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/objc_method_clash.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -x objective-c 2 | // bindgen-osx-only 3 | 4 | @interface Foo 5 | + (void)foo; 6 | - (void)foo; 7 | @end 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/objc_pointer_return_types.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -x objective-c 2 | // bindgen-osx-only 3 | 4 | @interface Bar 5 | @end 6 | 7 | @interface Foo 8 | + (Bar*)methodReturningBar; 9 | - (void)methodUsingBar:(Bar *)my_bar; 10 | @end 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/objc_property_fnptr.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -x objective-c 2 | // bindgen-osx-only 3 | 4 | @interface Foo 5 | @property int (*func)(char, short, float); 6 | @end 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/objc_protocol.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -x objective-c 2 | // bindgen-osx-only 3 | 4 | @protocol Foo 5 | @end 6 | 7 | @interface Foo 8 | @end 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/objc_protocol_inheritance.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -x objective-c 2 | // bindgen-osx-only 3 | 4 | @protocol Foo 5 | @end 6 | 7 | @interface Foo 8 | @end 9 | 10 | @interface Bar : Foo 11 | @end 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/objc_sel_and_id.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -x objective-c 2 | // bindgen-osx-only 3 | 4 | id object; 5 | SEL selector; 6 | 7 | void f(id object, SEL selector); 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/objc_template.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -x objective-c 2 | // bindgen-osx-only 3 | 4 | @interface Foo<__covariant ObjectType> 5 | - (ObjectType)get; 6 | @end 7 | 8 | @interface FooMultiGeneric<__covariant KeyType, __covariant ObjectType> 9 | - (nullable ObjectType)objectForKey:(KeyType)key; 10 | @end 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/only_bitfields.hpp: -------------------------------------------------------------------------------- 1 | class C { 2 | bool a: 1; 3 | bool b: 7; 4 | }; 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/opaque_in_struct.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | 3 | 4 | /**
*/ 5 | typedef struct opaque { 6 | int waht; 7 | } opaque; 8 | 9 | struct container { 10 | opaque contained; 11 | }; 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/opencl_vector.h: -------------------------------------------------------------------------------- 1 | typedef float float4 __attribute__((ext_vector_type(4))); 2 | typedef float float2 __attribute__((ext_vector_type(2))); 3 | 4 | float4 foo(float2 a, float2 b) { 5 | float4 c; 6 | c.xz = a; 7 | c.yw = b; 8 | return c; 9 | } -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/operator.hpp: -------------------------------------------------------------------------------- 1 | int operator_information(void); 2 | 3 | class Foo; 4 | int operator<<(const Foo&, int); 5 | 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/operator_equals.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --represent-cxx-operators --generate-inline-functions -- -x c++ 2 | // bindgen-parse-callbacks: operator-rename 3 | 4 | class SomeClass { 5 | public: 6 | bool operator=(const SomeClass& another) { 7 | return false; 8 | } 9 | }; 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/ord-enum.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --rustified-enum ".*" --with-derive-ord 2 | 3 | enum A { 4 | A0 = 0, 5 | A1 = 1, 6 | A2 = 2, 7 | A3 = A0 - 1, 8 | }; 9 | 10 | enum B { 11 | B0 = 1, 12 | B1 = B0 + 3, 13 | B2 = B0 + 2, 14 | B3 = B0 - 2, 15 | }; 16 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/overflowed_enum.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --rustified-enum ".*" -- -std=c++11 -Wno-narrowing 2 | 3 | enum Foo { 4 | BAP_ARM = 0x93fcb9, 5 | BAP_X86 = 0xb67eed, 6 | BAP_X86_64 = 0xba7b274f, 7 | }; 8 | 9 | enum Bar: unsigned short { 10 | One = 1, 11 | Big = 65538, 12 | }; 13 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/overloading.hpp: -------------------------------------------------------------------------------- 1 | extern bool Evaluate(char r); 2 | extern bool Evaluate(int x, int y); 3 | 4 | namespace foo { 5 | extern void MyFunction(); 6 | } 7 | namespace bar { 8 | extern void MyFunction(); 9 | } 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/packed-bitfield.h: -------------------------------------------------------------------------------- 1 | struct Date { 2 | unsigned char day: 5; 3 | unsigned char month: 4; 4 | signed short year: 15; 5 | } __attribute__((packed)); 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/packed-n-with-padding.h: -------------------------------------------------------------------------------- 1 | #pragma pack(push, 2) 2 | struct Packed { 3 | char a; 4 | short b; 5 | char c; 6 | int d; 7 | }; 8 | #pragma pack(pop) 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/packed-vtable.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --raw-line '#![cfg(feature = "nightly")]' --rust-target 1.33 -- -x c++ -std=c++11 2 | 3 | #pragma pack(1) 4 | 5 | // This should be packed. 6 | struct PackedVtable { 7 | virtual ~PackedVtable(); 8 | }; 9 | 10 | #pragma pack() 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/parm-union.hpp: -------------------------------------------------------------------------------- 1 | struct Struct 2 | { 3 | void Function(union Union&); 4 | }; 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/parsecb-anonymous-enum-variant-rename.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --allowlist-var ^MyVal$ 2 | // bindgen-parse-callbacks: enum-variant-rename 3 | 4 | enum { 5 | MyVal = 0, 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/pointer-attr.h: -------------------------------------------------------------------------------- 1 | void a(const char __attribute__((btf_type_tag("a"))) *); 2 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/prefix-link-name-c.h: -------------------------------------------------------------------------------- 1 | // bindgen-parse-callbacks: prefix-link-name-foo_ 2 | // bindgen-flags: --prefix-link-name foo_ 3 | 4 | int bar(void); 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/prefix-link-name-cpp.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-parse-callbacks: prefix-link-name-foo_ 2 | // bindgen-flags: --prefix-link-name foo_ 3 | 4 | namespace baz { 5 | 6 | int foo(); 7 | 8 | } // end namespace baz 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/prepend-enum-constified-variant.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --no-prepend-enum-name --rustified-enum ".*" 2 | 3 | enum AVCodecID { 4 | AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, 5 | AV_CODEC_ID_TTF = 0x18000, 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/prepend_enum_name.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --no-prepend-enum-name 2 | 3 | enum foo { 4 | FOO_BAR, 5 | FOO_BAZ, 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/ptr32-has-different-size.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -fms-extensions 2 | typedef struct TEST_STRUCT { 3 | void* __ptr32 ptr_32bit; 4 | } TEST; 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/public-dtor.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace cv { 3 | class Foo { 4 | public: 5 | ~Foo(); 6 | }; 7 | 8 | Foo::~Foo() {} 9 | 10 | class Bar { 11 | public: 12 | ~Bar(); 13 | }; 14 | 15 | inline 16 | Bar::~Bar() {} 17 | 18 | } 19 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/redeclaration.hpp: -------------------------------------------------------------------------------- 1 | extern "C" { 2 | void foo(); 3 | } 4 | 5 | extern "C" { 6 | void foo(); 7 | } 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/ref_argument_array.hpp: -------------------------------------------------------------------------------- 1 | 2 | #define NSID_LENGTH 10 3 | class nsID { 4 | public: 5 | virtual void ToProvidedString(char (&aDest)[NSID_LENGTH]); 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/reparented_replacement.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-cxx-namespaces 2 | 3 | namespace foo { 4 | struct Bar { 5 | int baz; 6 | }; 7 | } 8 | 9 | namespace bar { 10 | ///
11 | struct Bar_Replacement { 12 | int bazz; 13 | }; 14 | }; 15 | 16 | typedef foo::Bar ReferencesBar; 17 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/replace_use.hpp: -------------------------------------------------------------------------------- 1 | template 2 | struct nsTArray { 3 | int x; 4 | }; 5 | /** 6 | *
7 | */ 8 | template 9 | struct nsTArray_Simple { 10 | unsigned int y; 11 | }; 12 | 13 | struct Test { 14 | nsTArray a; 15 | }; 16 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/repr-align.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --raw-line '#![cfg(feature = "nightly")]' \-\-rust-target=1.33 -- -std=c++11 2 | 3 | struct alignas(8) a { 4 | int b; 5 | int c; 6 | }; 7 | 8 | struct alignas(double) b { 9 | int b; 10 | int c; 11 | }; 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/resolved_type_def_function.h: -------------------------------------------------------------------------------- 1 | typedef void (FuncType) (); 2 | extern FuncType Func; -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/same_struct_name_in_different_namespaces.hpp: -------------------------------------------------------------------------------- 1 | namespace JS { 2 | 3 | struct Zone; 4 | 5 | namespace shadow { 6 | 7 | struct Zone { 8 | int x; 9 | int y; 10 | }; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/size_t_template.hpp: -------------------------------------------------------------------------------- 1 | template 2 | class Array { 3 | T inner[N]; 4 | }; 5 | 6 | class C { 7 | Array arr; 8 | }; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/special-members.hpp: -------------------------------------------------------------------------------- 1 | class A { 2 | public: 3 | A(); 4 | A(A&); 5 | A(A&&); 6 | ~A(); 7 | }; -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/specific_receiver.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --use-specific-virtual-function-receiver --generate-inline-functions -- -x c++ -std=c++14 2 | 3 | class Fish { 4 | public: 5 | virtual void swim() { 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/stdint_typedef.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --allowlist-type="Struct" --allowlist-function="fun" 2 | 3 | // no typedef should be emitted for `__uint64_t` 4 | typedef unsigned long long __uint64_t; 5 | typedef __uint64_t uint64_t; 6 | 7 | uint64_t fun(); 8 | struct Struct { 9 | uint64_t field; 10 | }; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/strings_array.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: \-\-rust-target=1.33 2 | 3 | const char* MY_STRING_UTF8 = "Hello, world!"; 4 | const char* MY_STRING_INTERIOR_NULL = "Hello,\0World!"; 5 | const char* MY_STRING_NON_UTF8 = "ABCDE\xFF"; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/strings_cstr.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --rust-target=1.59 --generate-cstr 2 | 3 | const char* MY_STRING_UTF8 = "Hello, world!"; 4 | const char* MY_STRING_INTERIOR_NULL = "Hello,\0World!"; 5 | const char* MY_STRING_NON_UTF8 = "ABCDE\xFF"; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/strings_cstr2.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --rust-target=1.77 --generate-cstr 2 | 3 | const char* MY_STRING_UTF8 = "Hello, world!"; 4 | const char* MY_STRING_INTERIOR_NULL = "Hello,\0World!"; 5 | const char* MY_STRING_NON_UTF8 = "ABCDE\xFF"; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/strings_cstr2_2018.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --rust-target=1.77 --rust-edition=2018 --generate-cstr 2 | 3 | const char* MY_STRING_UTF8 = "Hello, world!"; 4 | const char* MY_STRING_INTERIOR_NULL = "Hello,\0World!"; 5 | const char* MY_STRING_NON_UTF8 = "ABCDE\xFF"; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/struct_containing_forward_declared_struct.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | struct a { 3 | struct b* val_a; 4 | }; 5 | 6 | struct b { 7 | int val_b; 8 | }; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/struct_with_anon_struct.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | // 3 | struct foo { 4 | struct { 5 | int a; 6 | int b; 7 | } bar; 8 | }; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/struct_with_anon_struct_array.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | // 3 | struct foo { 4 | struct { 5 | int a; 6 | int b; 7 | } bar[2]; 8 | struct { 9 | int a; 10 | int b; 11 | } baz[2][3][4]; 12 | }; 13 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/struct_with_anon_struct_pointer.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | struct foo { 3 | struct { 4 | int a; 5 | int b; 6 | } *bar; 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/struct_with_anon_union.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | // 3 | struct foo { 4 | union { 5 | unsigned int a; 6 | unsigned short b; 7 | } bar; 8 | }; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/struct_with_anon_unnamed_struct.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | struct foo { 3 | struct { 4 | unsigned int a; 5 | unsigned int b; 6 | }; 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/struct_with_anon_unnamed_union.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | struct foo { 3 | union { 4 | unsigned int a; 5 | unsigned short b; 6 | }; 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/struct_with_bitfields.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | // 3 | struct bitfield { 4 | unsigned short 5 | a :1, 6 | b :1, 7 | c :1, 8 | :1, 9 | :2, 10 | d :2; 11 | int e; 12 | unsigned int f : 2; 13 | unsigned int g : 32; 14 | }; 15 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/struct_with_derive_debug.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --rust-target 1.40 2 | // 3 | struct LittleArray { 4 | int a[32]; 5 | }; 6 | 7 | struct BigArray{ 8 | int a[33]; 9 | }; 10 | 11 | struct WithLittleArray { 12 | struct LittleArray a; 13 | }; 14 | 15 | struct WithBigArray { 16 | struct BigArray a; 17 | }; 18 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/struct_with_large_array.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --rust-target 1.40 2 | // 3 | struct S { 4 | char large_array[33]; 5 | }; 6 | 7 | template struct ST { 8 | T large_array[33]; 9 | }; 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/struct_with_packing.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | // 3 | struct a { 4 | char b; 5 | short c; 6 | } __attribute__((packed)); 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/struct_with_struct.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | // 3 | struct foo { 4 | struct { 5 | unsigned int x; 6 | unsigned int y; 7 | } bar; 8 | }; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/struct_with_typedef_template_arg.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | template 3 | struct Proxy { 4 | typedef void (*foo)(T* bar); 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/template-param-usage-0.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++14 2 | 3 | template 4 | class UsesTemplateParameter { 5 | T t; 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/template-param-usage-1.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++14 2 | 3 | template 4 | class DoesNotUseTemplateParameter { 5 | int x; 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/template-param-usage-10.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++14 2 | 3 | template 4 | class DoublyIndirectUsage { 5 | using Aliased = T; 6 | typedef U Typedefed; 7 | 8 | class IndirectUsage { 9 | Aliased member; 10 | Typedefed another; 11 | }; 12 | 13 | IndirectUsage doubly_indirect; 14 | }; 15 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/template-param-usage-11.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++14 2 | 3 | template 4 | class DoesNotUseT { 5 | static T but_static_member_does; 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/template-param-usage-12.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++14 2 | 3 | template 4 | class BaseUsesT { 5 | T* t; 6 | }; 7 | 8 | template 9 | class CrtpUsesU : public BaseUsesT> { 10 | U usage; 11 | }; 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/template-param-usage-13.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++14 2 | 3 | template 4 | class BaseIgnoresT { 5 | int x; 6 | }; 7 | 8 | template 9 | class CrtpUsesU : public BaseIgnoresT> { 10 | U usage; 11 | }; 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/template-param-usage-14.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++14 2 | 3 | template 4 | class BaseIgnoresT { 5 | int x; 6 | }; 7 | 8 | template 9 | class CrtpIgnoresU : public BaseIgnoresT> { 10 | int y; 11 | }; 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/template-param-usage-15.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++14 2 | 3 | template 4 | class BaseUsesT { 5 | T* usage; 6 | }; 7 | 8 | template 9 | class CrtpIgnoresU : public BaseUsesT> { 10 | int y; 11 | }; 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/template-param-usage-2.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++14 2 | 3 | template 4 | class UsesTemplateParameter { 5 | T t; 6 | 7 | class AlsoUsesTemplateParameter { 8 | T also; 9 | }; 10 | }; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/template-param-usage-3.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++14 2 | 3 | template 4 | class UsesTemplateParameter { 5 | T t; 6 | 7 | template 8 | class AlsoUsesTemplateParameterAndMore { 9 | T also; 10 | U more; 11 | }; 12 | }; 13 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/template-param-usage-4.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++14 2 | 3 | template 4 | class UsesTemplateParameter { 5 | T t; 6 | 7 | template 8 | class DoesNotUseTemplateParameters { 9 | int x; 10 | }; 11 | }; 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/template-param-usage-5.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++14 2 | 3 | template 4 | class IndirectlyUsesTemplateParameter { 5 | using Aliased = T; 6 | 7 | Aliased aliased; 8 | }; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/template-param-usage-6.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++14 2 | 3 | template 4 | class DoesNotUseTemplateParameter { 5 | using ButAliasDoesUseIt = T; 6 | 7 | int x; 8 | }; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/template-param-usage-7.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++14 2 | 3 | template 4 | class DoesNotUseU { 5 | T t; 6 | V v; 7 | }; 8 | 9 | // The bool should go away because U is not used. 10 | using Alias = DoesNotUseU; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/template-param-usage-8.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++14 2 | 3 | template 4 | class IndirectUsage { 5 | typedef T Typedefed; 6 | using Aliased = U; 7 | 8 | Typedefed member1; 9 | Aliased member2; 10 | }; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/template-param-usage-9.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++14 2 | 3 | template 4 | class DoesNotUse { 5 | using Aliased = T; 6 | typedef U Typedefed; 7 | 8 | class IndirectUsage { 9 | Aliased member; 10 | Typedefed another; 11 | }; 12 | }; 13 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/template-with-var.hpp: -------------------------------------------------------------------------------- 1 | template 2 | class TemplateWithVar { 3 | // We shouldn't generate bindings for this because there are potentially 4 | // many instantiations of this variable, but we can't know which ones exist 5 | // or don't. 6 | static T var = 0; 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/template_alias.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq -- -std=c++14 2 | 3 | namespace JS { 4 | namespace detail { 5 | template 6 | using Wrapped = T; 7 | } 8 | 9 | template 10 | struct Rooted { 11 | detail::Wrapped ptr; 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/template_alias_basic.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++11 2 | 3 | template 4 | using Wrapped = T; 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/template_alias_namespace.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --enable-cxx-namespaces -- -std=c++14 2 | 3 | namespace JS { 4 | namespace detail { 5 | template 6 | using Wrapped = T; 7 | } 8 | 9 | template 10 | struct Rooted { 11 | detail::Wrapped ptr; 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/template_fun.hpp: -------------------------------------------------------------------------------- 1 | // this will be ignored 2 | template 3 | void foo() {} 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/template_partial_specification.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- --target=x86_64-pc-win32 2 | 3 | template 4 | struct nsRunnableMethodTraits; 5 | 6 | template 7 | struct nsRunnableMethodTraits 8 | { 9 | static const bool can_cancel = Cancelable; 10 | }; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/template_typedef_transitive_param.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | template 3 | struct Wrapper { 4 | struct Wrapped { 5 | T t; 6 | }; 7 | using Type = Wrapped; 8 | }; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/template_typedefs.hpp: -------------------------------------------------------------------------------- 1 | typedef void (*foo)(int); 2 | 3 | template 4 | class Foo { 5 | typedef T Char; 6 | typedef Char* FooPtrTypedef; 7 | typedef bool (*nsCOMArrayEnumFunc)(T* aElement, void* aData); 8 | }; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/templateref_opaque.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | 3 | namespace detail { 4 | template 5 | struct PointerType { 6 | typedef T* Type; 7 | }; 8 | } 9 | template 10 | class UniquePtr { 11 | typedef typename detail::PointerType Pointer; 12 | }; 13 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/templatized-bitfield.hpp: -------------------------------------------------------------------------------- 1 | /// We don't get a layout for this bitfield, since we don't know what `T` will 2 | /// be, so we cannot allocate bitfield units. The best thing we can do is make 3 | /// the struct opaque. 4 | template 5 | class TemplatizedBitfield { 6 | T t : 6; 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/timex.h: -------------------------------------------------------------------------------- 1 | struct timex { 2 | int tai; 3 | 4 | int :32; int :32; int :32; int :32; 5 | int :32; int :32; int :32; int :32; 6 | int :32; int :32; int :32; 7 | }; 8 | 9 | struct timex_named { 10 | int tai; 11 | 12 | int a:32; int b:32; int c:32; int d:32; 13 | int e:32; int f:32; int g:32; int h:32; 14 | int i:32; int j:32; int k:32; 15 | }; 16 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/type-referenced-by-allowlisted-function.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --allowlist-function dl_iterate_phdr 2 | 3 | struct dl_phdr_info { 4 | int x; 5 | }; 6 | 7 | int dl_iterate_phdr(struct dl_phdr_info *); 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/type_alias_empty.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --allowlist-type bool_constant -- -std=c++11 2 | 3 | // NB: The --allowlist-type is done to trigger the traversal of the types on 4 | // codegen in order to trigger #67. 5 | 6 | template 7 | struct integral_constant {}; 8 | 9 | template 10 | using bool_constant = integral_constant; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/type_alias_partial_template_especialization.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++14 2 | template using MaybeWrapped = A; 3 | 4 | template 5 | class Rooted { 6 | MaybeWrapped ptr; 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/type_alias_template_specialized.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --allowlist-type Rooted -- -std=c++14 2 | 3 | template using MaybeWrapped = a; 4 | class Rooted { 5 | MaybeWrapped ptr; 6 | }; 7 | 8 | ///
9 | template using replaces_MaybeWrapped = a; 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/typedefd-array-as-function-arg.h: -------------------------------------------------------------------------------- 1 | // foo.h 2 | typedef float myVector3[3]; 3 | void modifyVectorFunc(myVector3 v); 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/uncallable_functions.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --generate-deleted-functions --generate-private-functions --generate-pure-virtual-functions --generate-inline-functions -- -x c++ -std=c++14 2 | 3 | class Test { 4 | public: 5 | virtual void a() = 0; 6 | void b() = delete; 7 | private: 8 | void c() {} 9 | }; 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/underscore.hpp: -------------------------------------------------------------------------------- 1 | const int _ = 10; 2 | 3 | typedef struct { unsigned char _[8]; } ptr_t; -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/union-align.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: \-\-rust-target=1.33 2 | 3 | union Bar { 4 | unsigned char foo; 5 | } __attribute__ ((__aligned__ (16))); 6 | 7 | 8 | union Baz { 9 | union Bar bar; 10 | }; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/union-in-ns.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --enable-cxx-namespaces 2 | 3 | union bar { 4 | int baz; 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/union_bitfield.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --impl-partialeq 2 | 3 | union U4 { 4 | unsigned derp : 1; 5 | }; 6 | 7 | union B { 8 | unsigned foo : 31; 9 | unsigned char bar : 1; 10 | }; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/union_dtor.hpp: -------------------------------------------------------------------------------- 1 | union UnionWithDtor { 2 | ~UnionWithDtor(); 3 | int mFoo; 4 | void* mBar; 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/union_fields.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | // 3 | typedef union { 4 | int mInt; 5 | float mFloat; 6 | void* mPointer; 7 | } nsStyleUnion; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/union_with_anon_struct.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | // 3 | union foo { 4 | struct { 5 | unsigned int a; 6 | unsigned int b; 7 | } bar; 8 | }; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/union_with_anon_struct_bitfield.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | // 3 | union foo { 4 | int a; 5 | struct { 6 | int b : 7; 7 | int c : 25; 8 | }; 9 | }; 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/union_with_anon_union.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | // 3 | union foo { 4 | union { 5 | unsigned int a; 6 | unsigned short b; 7 | } bar; 8 | }; 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/union_with_anon_unnamed_struct.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | // 3 | union pixel { 4 | unsigned int rgba; 5 | struct { 6 | unsigned char r; 7 | unsigned char g; 8 | unsigned char b; 9 | unsigned char a; 10 | }; 11 | }; 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/union_with_anon_unnamed_union.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | // 3 | union foo { 4 | unsigned int a; 5 | union { 6 | unsigned short b; 7 | unsigned char c; 8 | }; 9 | }; 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/union_with_big_member.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | // 3 | union WithBigArray { 4 | int a; 5 | int b[33]; 6 | }; 7 | 8 | union WithBigArray2 { 9 | int a; 10 | char b[33]; 11 | }; 12 | 13 | union WithBigMember { 14 | int a; 15 | union WithBigArray b; 16 | }; 17 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/union_with_nesting.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | // 3 | union foo { 4 | unsigned int a; 5 | struct { 6 | union { 7 | unsigned short b1; 8 | unsigned short b2; 9 | }; 10 | 11 | union { 12 | unsigned short c1; 13 | unsigned short c2; 14 | }; 15 | }; 16 | }; 17 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/union_with_zero_sized_array.h: -------------------------------------------------------------------------------- 1 | union U { 2 | char d0[0]; 3 | char d1[1]; 4 | char d2[2]; 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/unknown_attr.h: -------------------------------------------------------------------------------- 1 | typedef struct { 2 | long long __clang_max_align_nonce1 3 | __attribute__((__aligned__(__alignof__(long long)))); 4 | long long __clang_max_align_nonce2 5 | __attribute__((__aligned__(__alignof__(long double)))); 6 | } max_align_t; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/unsorted-items.h: -------------------------------------------------------------------------------- 1 | int foo(); 2 | typedef int number; 3 | int bar(number x); 4 | struct Point 5 | { 6 | number x; 7 | number y; 8 | }; 9 | struct Angle 10 | { 11 | number a; 12 | number b; 13 | }; 14 | int baz(struct Point point); 15 | const number NUMBER = 42; 16 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/use-core.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --use-core --raw-line '#![cfg(not(target_os="windows"))] extern crate core;' --with-derive-hash --with-derive-partialeq --with-derive-eq 2 | 3 | struct foo { 4 | int a, b; 5 | void* bar; 6 | }; 7 | 8 | union { 9 | int bar; 10 | long baz; 11 | } bazz; 12 | 13 | typedef void (*fooFunction)(int bar); 14 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/using.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++11 2 | 3 | template 4 | class Point { 5 | T x; 6 | T y; 7 | }; 8 | 9 | typedef Point IntPoint2D; 10 | 11 | using IntVec2D = Point; 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/va_list_aarch64_linux.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- --target=aarch64-unknown-linux-gnu 2 | 3 | typedef __builtin_va_list va_list; 4 | int vprintf(const char* format, va_list vlist); 5 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/var-tracing.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --allowlist-type Baz 2 | 3 | struct Bar { 4 | const int m_baz; 5 | Bar(int baz); 6 | }; 7 | 8 | class Baz { 9 | static const Bar FOO[]; 10 | }; 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/variadic-method.hpp: -------------------------------------------------------------------------------- 1 | 2 | void foo(const char* fmt, ...); 3 | 4 | struct Bar { 5 | void foo(const char* fmt, ...); 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/variadic_template_function.hpp: -------------------------------------------------------------------------------- 1 | 2 | template 3 | class VariadicFunctionObject { 4 | public: 5 | int add_em_up(T count,...); 6 | }; 7 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/vector.hpp: -------------------------------------------------------------------------------- 1 | struct foo { 2 | __attribute__((__vector_size__(1 * sizeof(long long)))) long long mMember; 3 | }; 4 | 5 | typedef float __m128 __attribute__ ((__vector_size__ (16))); 6 | typedef double __m128d __attribute__((__vector_size__(16))); 7 | typedef long long __m128i __attribute__((__vector_size__(16))); 8 | 9 | __m128 foo(__m128i, __m128d); 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/virtual_dtor.hpp: -------------------------------------------------------------------------------- 1 | struct nsSlots { 2 | virtual ~nsSlots(); 3 | }; 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/virtual_inheritance.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --no-layout-tests 2 | // FIXME: Enable layout tests when #465 is fixed. 3 | class A { 4 | int foo; 5 | }; 6 | 7 | class B: public virtual A { 8 | int bar; 9 | }; 10 | 11 | class C: public virtual A { 12 | int baz; 13 | }; 14 | 15 | class D: public C, public B { 16 | int bazz; 17 | }; 18 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/virtual_overloaded.hpp: -------------------------------------------------------------------------------- 1 | class C { 2 | public: 3 | virtual void do_thing(char); 4 | virtual void do_thing(int); 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/void_typedef.h: -------------------------------------------------------------------------------- 1 | typedef void VOID; 2 | 3 | typedef VOID ALSO_VOID; 4 | 5 | void this_api_returns_nothing(void); 6 | 7 | VOID this_api_also_returns_nothing(VOID); 8 | 9 | ALSO_VOID this_other_api_also_returns_nothing(ALSO_VOID); 10 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/vtable_recursive_sig.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: -- -std=c++11 2 | 3 | class Derived; 4 | class Base { 5 | public: 6 | virtual Derived* AsDerived(); 7 | }; 8 | 9 | class Derived final : public Base { 10 | virtual Derived* AsDerived() override; 11 | }; 12 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/wasm-constructor-returns.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --generate constructors,types -- -fvisibility=default --target=wasm32-unknown-emscripten 2 | 3 | class Foo { 4 | public: 5 | Foo(int var); 6 | }; 7 | 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/wasm-import-module.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --wasm-import-module-name test-module 2 | 3 | void test_function(); -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/win32-thiscall.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: \-\-rust-target=1.33 -- --target=i686-pc-windows-msvc 2 | 3 | class Foo { 4 | public: 5 | void test(); 6 | int test2(int var); 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/win32-thiscall_1_73.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --rust-target=1.73 --raw-line '#![cfg(target = "i686-pc-windows-msvc")]' -- --target=i686-pc-windows-msvc 2 | 3 | class Foo { 4 | public: 5 | void test(); 6 | int test2(int var); 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/win32-thiscall_nightly.hpp: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --rust-target nightly --raw-line '#![cfg(feature = "nightly")]' --raw-line '#![feature(abi_thiscall)]' -- --target=i686-pc-windows-msvc 2 | 3 | class Foo { 4 | public: 5 | void test(); 6 | int test2(int var); 7 | }; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/win32-vectorcall-nightly.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --rust-target nightly --raw-line '#![cfg(feature = "nightly")]' --raw-line '#![feature(abi_vectorcall)]' -- --target=x86_64-pc-windows-msvc 2 | 3 | int __vectorcall test_vectorcall(int a, int b); 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/win32-vectorcall.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: \-\-rust-target=1.33 -- --target=x86_64-pc-windows-msvc 2 | 3 | int __vectorcall test_vectorcall(int a, int b); 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/with_array_pointers_arguments.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --use-array-pointers-in-arguments 2 | 3 | int test_fn(float a, int arr[20]); 4 | 5 | int test_fn2(const float arr[20], int b); 6 | 7 | typedef char defArr[20]; 8 | typedef void foo(defArr a); 9 | 10 | void bar(defArr a); -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/without_array_pointers_arguments.h: -------------------------------------------------------------------------------- 1 | 2 | int test_fn(float a, int arr[20]); 3 | 4 | int test_fn2(const float arr[20], int b); 5 | 6 | typedef char defArr[20]; 7 | typedef void foo(defArr a); 8 | 9 | void bar(defArr a); -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/wrap_unsafe_ops_dynamic_loading_simple.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --dynamic-loading TestLib --wrap-unsafe-ops 2 | 3 | int foo(int x, int y); 4 | int bar(void *x); 5 | int baz(); 6 | 7 | const int FLUX; 8 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/wrap_unsafe_ops_objc_class.h: -------------------------------------------------------------------------------- 1 | // bindgen-flags: --wrap-unsafe-ops -- -x objective-c 2 | // bindgen-osx-only 3 | 4 | @class Foo; 5 | 6 | Foo* fooVar; 7 | 8 | @interface Foo 9 | -(void)method; 10 | @end 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/headers/zero-size-array-align.h: -------------------------------------------------------------------------------- 1 | struct dm_deps { 2 | unsigned count; 3 | unsigned filler; 4 | unsigned long long device[0]; 5 | }; 6 | -------------------------------------------------------------------------------- /bindgen-tests/tests/macro_fallback_test_headers/another_header.h: -------------------------------------------------------------------------------- 1 | #ifndef ANOTHER_HEADER_H 2 | #define ANOTHER_HEADER_H 3 | 4 | #include 5 | 6 | #define SHOULD_NOT_GENERATE UINT64_C(~0) 7 | #define MY_CONST UINT32_C(69) 8 | #define NEGATIVE ~0 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /bindgen-tests/tests/macro_fallback_test_headers/one_header.h: -------------------------------------------------------------------------------- 1 | #ifndef ONE_HEADER_H 2 | #define ONE_HEADER_H 3 | 4 | #include 5 | 6 | #define THE_CONST UINT32_C(28) 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /bindgen-tests/tests/parse_callbacks/item_discovery_callback/header_item_discovery.hpp: -------------------------------------------------------------------------------- 1 | // Methods 2 | 3 | class SomeClass { 4 | public: 5 | void named_method(); 6 | }; -------------------------------------------------------------------------------- /bindgen-tests/tests/quickchecking/.gitignore: -------------------------------------------------------------------------------- 1 | Cargo.lock 2 | -------------------------------------------------------------------------------- /bindgen-tests/tests/rustfmt.toml: -------------------------------------------------------------------------------- 1 | normalize_doc_attributes = true 2 | max_width = 80 3 | binop_separator = "back" 4 | -------------------------------------------------------------------------------- /bindgen-tests/tests/uses/.gitignore: -------------------------------------------------------------------------------- 1 | *.c 2 | *.cpp 3 | -------------------------------------------------------------------------------- /bindgen/LICENSE: -------------------------------------------------------------------------------- 1 | ../LICENSE -------------------------------------------------------------------------------- /book/.gitignore: -------------------------------------------------------------------------------- 1 | book 2 | -------------------------------------------------------------------------------- /book/book.toml: -------------------------------------------------------------------------------- 1 | [book] 2 | title = "The bindgen User Guide" 3 | description = "`bindgen` automatically generates Rust FFI bindings to C and C++ libraries." 4 | 5 | [output.html] 6 | git-repository-url = "https://github.com/rust-lang/rust-bindgen" 7 | edit-url-template = "https://github.com/rust-lang/rust-bindgen/edit/main/book/{path}" 8 | search.use-boolean-and = true 9 | -------------------------------------------------------------------------------- /ci/assert-no-diff.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | cd "%~dp0.." 4 | 5 | git add -u 6 | git diff @ 7 | git diff-index --quiet HEAD 8 | -------------------------------------------------------------------------------- /clippy.toml: -------------------------------------------------------------------------------- 1 | disallowed-methods = [ 2 | { path = "clang_sys::CXCursor_TranslationUnit", reason = "This value was changed in clang 15"}, 3 | { path = "clang_sys::CXCursor_LastStmt", reason = "This value was changed in clang 15"} 4 | ] 5 | missing-docs-in-crate-items = true 6 | -------------------------------------------------------------------------------- /example-graphviz-ir.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rust-lang/rust-bindgen/763c8b956808c850660c521059d4588bf4be05df/example-graphviz-ir.png -------------------------------------------------------------------------------- /releases/friends.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | set -o pipefail 5 | 6 | cd "$(dirname $0)" 7 | 8 | if [[ -z "${1+x}" ]]; then 9 | read -p "List friends since which commit/tag? " since 10 | echo 11 | else 12 | since=$1 13 | fi 14 | 15 | git shortlog -s -n "$since.." \ 16 | | cut -f 2- \ 17 | | sort -u \ 18 | | grep -v bors\-servo \ 19 | | xargs -I{} echo "- {}" 20 | -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- 1 | max_width = 80 2 | binop_separator = "back" 3 | --------------------------------------------------------------------------------