diff options
58 files changed, 181 insertions, 78 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index 2a0891d9..8c113f5a 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -2645,15 +2645,28 @@ impl CodeGenerator for Enum { }; let existing_variant_name = entry.get(); - add_constant( - ctx, - enum_ty, - &ident, - &*mangled_name, - existing_variant_name, - enum_rust_ty.clone(), - result, - ); + // Use associated constants for named enums. + if enum_ty.name().is_some() && + ctx.options().rust_features().associated_const { + let enum_canonical_name = &ident; + let variant_name = ctx.rust_ident_raw(&*mangled_name); + result.push(quote! { + impl #enum_rust_ty { + pub const #variant_name : #enum_rust_ty = + #enum_canonical_name :: #existing_variant_name ; + } + }); + } else { + add_constant( + ctx, + enum_ty, + &ident, + &*mangled_name, + existing_variant_name, + enum_rust_ty.clone(), + result, + ); + } } else { builder = builder.with_variant( ctx, diff --git a/src/ir/context.rs b/src/ir/context.rs index a85f70ba..30c45dcc 100644 --- a/src/ir/context.rs +++ b/src/ir/context.rs @@ -562,7 +562,12 @@ impl BindgenContext { &clang_args, &options.input_unsaved_files, parse_options, - ).expect("TranslationUnit::parse failed") + ).expect("libclang error; possible causes include: +- Invalid flag syntax +- Unrecognized flags +- Invalid flag arguments +- File I/O errors +If you encounter an error missing from this list, please file an issue or a PR!") }; let target_info = clang::TargetInfo::new(&translation_unit); diff --git a/src/ir/template.rs b/src/ir/template.rs index 61654fe8..14deb6c5 100644 --- a/src/ir/template.rs +++ b/src/ir/template.rs @@ -99,7 +99,7 @@ use parse::ClangItemParser; /// ... |Wtf | ... | [T] | /// ... |Qux | ... | [] | /// ----+------+-----+----------------------+ -pub trait TemplateParameters { +pub trait TemplateParameters : Sized { /// Get the set of `ItemId`s that make up this template declaration's free /// template parameters. /// @@ -108,8 +108,7 @@ pub trait TemplateParameters { /// parameters. Of course, Rust does not allow generic parameters to be /// anything but types, so we must treat them as opaque, and avoid /// instantiating them. - fn self_template_params(&self, ctx: &BindgenContext) - -> Vec<TypeId>; + fn self_template_params(&self, ctx: &BindgenContext) -> Vec<TypeId>; /// Get the number of free template parameters this template declaration /// has. diff --git a/tests/expectations/tests/anon_enum_trait.rs b/tests/expectations/tests/anon_enum_trait.rs index 6eb9f440..e109c90d 100644 --- a/tests/expectations/tests/anon_enum_trait.rs +++ b/tests/expectations/tests/anon_enum_trait.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] diff --git a/tests/expectations/tests/anon_union.rs b/tests/expectations/tests/anon_union.rs index 446cd589..a9b60292 100644 --- a/tests/expectations/tests/anon_union.rs +++ b/tests/expectations/tests/anon_union.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct TErrorResult { @@ -9,8 +14,9 @@ pub struct TErrorResult { pub mMightHaveUnreported: bool, pub mUnionState: TErrorResult_UnionState, } -pub const TErrorResult_UnionState_HasException: TErrorResult_UnionState = - TErrorResult_UnionState::HasMessage; +impl TErrorResult_UnionState { + pub const HasException: TErrorResult_UnionState = TErrorResult_UnionState::HasMessage; +} #[repr(i32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum TErrorResult_UnionState { diff --git a/tests/expectations/tests/constify-enum.rs b/tests/expectations/tests/constify-enum.rs index 07279cf3..a1744a2a 100644 --- a/tests/expectations/tests/constify-enum.rs +++ b/tests/expectations/tests/constify-enum.rs @@ -1,11 +1,17 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub const nsCSSPropertyID_eCSSProperty_COUNT_unexistingVariantValue: nsCSSPropertyID = nsCSSPropertyID::eCSSProperty_COUNT_unexistingVariantValue; -pub const nsCSSPropertyID_eCSSProperty_COUNT: nsCSSPropertyID = - nsCSSPropertyID::eCSSPropertyAlias_aa; +impl nsCSSPropertyID { + pub const eCSSProperty_COUNT: nsCSSPropertyID = nsCSSPropertyID::eCSSPropertyAlias_aa; +} #[repr(u32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum nsCSSPropertyID { diff --git a/tests/expectations/tests/dupe-enum-variant-in-namespace.rs b/tests/expectations/tests/dupe-enum-variant-in-namespace.rs new file mode 100644 index 00000000..b93100b2 --- /dev/null +++ b/tests/expectations/tests/dupe-enum-variant-in-namespace.rs @@ -0,0 +1,30 @@ +/* automatically generated by rust-bindgen */ + +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] + +#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] +pub mod root { + #[allow(unused_imports)] + use self::super::root; + pub mod foo { + #[allow(unused_imports)] + use self::super::super::root; + impl root::foo::Bar { + pub const Foo1: root::foo::Bar = Bar::Foo; + } + impl root::foo::Bar { + pub const Foo3: root::foo::Bar = Bar::Foo2; + } + #[repr(u32)] + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] + pub enum Bar { + Foo = 0, + Foo2 = 1, + } + } +} diff --git a/tests/expectations/tests/enum_dupe.rs b/tests/expectations/tests/enum_dupe.rs index 29bd7502..8462f6d2 100644 --- a/tests/expectations/tests/enum_dupe.rs +++ b/tests/expectations/tests/enum_dupe.rs @@ -1,8 +1,15 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] -pub const Foo_Dupe: Foo = Foo::Bar; +impl Foo { + pub const Dupe: Foo = Foo::Bar; +} #[repr(u32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum Foo { diff --git a/tests/expectations/tests/enum_in_template_with_typedef.rs b/tests/expectations/tests/enum_in_template_with_typedef.rs index a3b4e776..91c22fcd 100644 --- a/tests/expectations/tests/enum_in_template_with_typedef.rs +++ b/tests/expectations/tests/enum_in_template_with_typedef.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -8,8 +13,9 @@ pub struct std_fbstring_core { pub _address: u8, } pub type std_fbstring_core_category_type = u8; -pub const std_fbstring_core_Category_Bar: std_fbstring_core_Category = - std_fbstring_core_Category::Foo; +impl std_fbstring_core_Category { + pub const Bar: std_fbstring_core_Category = std_fbstring_core_Category::Foo; +} #[repr(u8)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum std_fbstring_core_Category { diff --git a/tests/expectations/tests/issue-1198-alias-rust-enum.rs b/tests/expectations/tests/issue-1198-alias-rust-enum.rs index b2902c89..1659e29e 100644 --- a/tests/expectations/tests/issue-1198-alias-rust-enum.rs +++ b/tests/expectations/tests/issue-1198-alias-rust-enum.rs @@ -1,15 +1,24 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] -pub const MyDupeEnum_A_alias: MyDupeEnum = MyDupeEnum::A; +impl MyDupeEnum { + pub const A_alias: MyDupeEnum = MyDupeEnum::A; +} #[repr(u32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum MyDupeEnum { A = 0, B = 1, } -pub const MyOtherDupeEnum_C_alias: MyOtherDupeEnum = MyOtherDupeEnum::C; +impl MyOtherDupeEnum { + pub const C_alias: MyOtherDupeEnum = MyOtherDupeEnum::C; +} #[repr(u32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum MyOtherDupeEnum { diff --git a/tests/expectations/tests/prepend-enum-constified-variant.rs b/tests/expectations/tests/prepend-enum-constified-variant.rs index 7f3b6746..d0323e12 100644 --- a/tests/expectations/tests/prepend-enum-constified-variant.rs +++ b/tests/expectations/tests/prepend-enum-constified-variant.rs @@ -1,8 +1,15 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] -pub const AV_CODEC_ID_TTF: AVCodecID = AVCodecID::AV_CODEC_ID_FIRST_UNKNOWN; +impl AVCodecID { + pub const AV_CODEC_ID_TTF: AVCodecID = AVCodecID::AV_CODEC_ID_FIRST_UNKNOWN; +} #[repr(u32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum AVCodecID { diff --git a/tests/headers/anon_enum.hpp b/tests/headers/anon_enum.hpp index 23dc5ceb..bbd52240 100644 --- a/tests/headers/anon_enum.hpp +++ b/tests/headers/anon_enum.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum .* +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum ".*" struct Test { int foo; float bar; diff --git a/tests/headers/anon_enum_trait.hpp b/tests/headers/anon_enum_trait.hpp index 6383c748..cc0cd389 100644 --- a/tests/headers/anon_enum_trait.hpp +++ b/tests/headers/anon_enum_trait.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum .* +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum ".*" template<typename _Tp> class DataType { diff --git a/tests/headers/anon_enum_whitelist.h b/tests/headers/anon_enum_whitelist.h index fc4810e0..a35e4886 100644 --- a/tests/headers/anon_enum_whitelist.h +++ b/tests/headers/anon_enum_whitelist.h @@ -1,4 +1,4 @@ -// bindgen-flags: --whitelist-var NODE_.* --rustified-enum .* +// bindgen-flags: --whitelist-var "NODE_.*" --rustified-enum ".*" enum { NODE_FLAG_FOO, diff --git a/tests/headers/anon_union.hpp b/tests/headers/anon_union.hpp index 19c478d1..e4be25bc 100644 --- a/tests/headers/anon_union.hpp +++ b/tests/headers/anon_union.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum .* +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum ".*" template<typename T> struct TErrorResult { enum UnionState { diff --git a/tests/headers/anon_union_1_0.hpp b/tests/headers/anon_union_1_0.hpp index 314215bf..3d9ae3dd 100644 --- a/tests/headers/anon_union_1_0.hpp +++ b/tests/headers/anon_union_1_0.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum .* +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum ".*" template<typename T> struct TErrorResult { diff --git a/tests/headers/bitfield-enum-basic.hpp b/tests/headers/bitfield-enum-basic.hpp index c03f0e70..339fb4d5 100644 --- a/tests/headers/bitfield-enum-basic.hpp +++ b/tests/headers/bitfield-enum-basic.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --bitfield-enum "Foo|Buz|NS_.*|DUMMY_.*" --rustified-enum .* -- -std=c++11 +// bindgen-flags: --bitfield-enum "Foo|Buz|NS_.*|DUMMY_.*" --rustified-enum ".*" -- -std=c++11 enum Foo { Bar = 1 << 1, diff --git a/tests/headers/bitfield_align_2.h b/tests/headers/bitfield_align_2.h index 31d37f76..b6a6cd28 100644 --- a/tests/headers/bitfield_align_2.h +++ b/tests/headers/bitfield_align_2.h @@ -1,4 +1,4 @@ -// bindgen-flags: --rustified-enum .* +// bindgen-flags: --rustified-enum ".*" enum MyEnum { ONE, TWO, diff --git a/tests/headers/class_with_inner_struct.hpp b/tests/headers/class_with_inner_struct.hpp index 66c2bd3f..fd195fb7 100644 --- a/tests/headers/class_with_inner_struct.hpp +++ b/tests/headers/class_with_inner_struct.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum .* +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum ".*" // bindgen-flags: -- -std=c++11 class A { diff --git a/tests/headers/class_with_inner_struct_1_0.hpp b/tests/headers/class_with_inner_struct_1_0.hpp index 1bae249f..34ed96e7 100644 --- a/tests/headers/class_with_inner_struct_1_0.hpp +++ b/tests/headers/class_with_inner_struct_1_0.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum .* +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum ".*" // bindgen-flags: -- -std=c++11 class A { diff --git a/tests/headers/const_enum_unnamed.hpp b/tests/headers/const_enum_unnamed.hpp index bdd9700f..cee87e64 100644 --- a/tests/headers/const_enum_unnamed.hpp +++ b/tests/headers/const_enum_unnamed.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --rustified-enum .* +// bindgen-flags: --rustified-enum ".*" enum { FOO_BAR, diff --git a/tests/headers/constant-evaluate.h b/tests/headers/constant-evaluate.h index ee9cfaa5..e8d0a5ba 100644 --- a/tests/headers/constant-evaluate.h +++ b/tests/headers/constant-evaluate.h @@ -1,5 +1,5 @@ // bindgen-unstable -// bindgen-flags: --rustified-enum .* +// bindgen-flags: --rustified-enum ".*" enum { foo = 4, diff --git a/tests/headers/constify-enum.h b/tests/headers/constify-enum.h index 9a9058d3..b8e0be3e 100644 --- a/tests/headers/constify-enum.h +++ b/tests/headers/constify-enum.h @@ -1,4 +1,4 @@ -// bindgen-flags: --rustified-enum .* +// bindgen-flags: --rustified-enum ".*" enum nsCSSPropertyID { eCSSProperty_a, diff --git a/tests/headers/constify-module-enums-types.hpp b/tests/headers/constify-module-enums-types.hpp index 2c652499..decf935a 100644 --- a/tests/headers/constify-module-enums-types.hpp +++ b/tests/headers/constify-module-enums-types.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --constified-enum-module .* +// bindgen-flags: --constified-enum-module ".*" typedef enum foo { THIS, @@ -75,4 +75,4 @@ class Thing { }; foo func3(Thing<foo> arg1); -foo func4(Thing< Thing<foo> > arg1);
\ No newline at end of file +foo func4(Thing< Thing<foo> > arg1); diff --git a/tests/headers/dupe-enum-variant-in-namespace.h b/tests/headers/dupe-enum-variant-in-namespace.h new file mode 100644 index 00000000..6d72437d --- /dev/null +++ b/tests/headers/dupe-enum-variant-in-namespace.h @@ -0,0 +1,10 @@ +// bindgen-flags: --rustified-enum ".*" --enable-cxx-namespaces -- -x c++ + +namespace foo { + enum class Bar : unsigned { + Foo = 0, + Foo1 = 0, + Foo2, + Foo3 = Foo2, + }; +} diff --git a/tests/headers/enum.h b/tests/headers/enum.h index 38ce4eee..f04c213e 100644 --- a/tests/headers/enum.h +++ b/tests/headers/enum.h @@ -1,4 +1,4 @@ -// bindgen-flags: --rustified-enum .* +// bindgen-flags: --rustified-enum ".*" enum Foo { Bar = 0, diff --git a/tests/headers/enum_alias.hpp b/tests/headers/enum_alias.hpp index c3ecc351..8ddb25c3 100644 --- a/tests/headers/enum_alias.hpp +++ b/tests/headers/enum_alias.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --rustified-enum .* -- -std=c++11 +// bindgen-flags: --rustified-enum ".*" -- -std=c++11 typedef unsigned char uint8_t; diff --git a/tests/headers/enum_and_vtable_mangling.hpp b/tests/headers/enum_and_vtable_mangling.hpp index e332fc57..659a8bd1 100644 --- a/tests/headers/enum_and_vtable_mangling.hpp +++ b/tests/headers/enum_and_vtable_mangling.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --rustified-enum .* +// bindgen-flags: --rustified-enum ".*" enum { match, diff --git a/tests/headers/enum_dupe.h b/tests/headers/enum_dupe.h index 826568fb..b8d9689a 100644 --- a/tests/headers/enum_dupe.h +++ b/tests/headers/enum_dupe.h @@ -1,4 +1,4 @@ -// bindgen-flags: --rustified-enum .* +// bindgen-flags: --rustified-enum ".*" enum Foo { Bar = 1, diff --git a/tests/headers/enum_explicit_type.hpp b/tests/headers/enum_explicit_type.hpp index 3cb93138..d9713471 100644 --- a/tests/headers/enum_explicit_type.hpp +++ b/tests/headers/enum_explicit_type.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --rustified-enum .* -- -std=c++11 +// bindgen-flags: --rustified-enum ".*" -- -std=c++11 enum Foo: unsigned char { Bar = 0, diff --git a/tests/headers/enum_in_template_with_typedef.hpp b/tests/headers/enum_in_template_with_typedef.hpp index 244d916c..87290ece 100644 --- a/tests/headers/enum_in_template_with_typedef.hpp +++ b/tests/headers/enum_in_template_with_typedef.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --rustified-enum .* -- -std=c++11 +// bindgen-flags: --rustified-enum ".*" -- -std=c++11 namespace std { template <typename Char> class fbstring_core; diff --git a/tests/headers/enum_negative.h b/tests/headers/enum_negative.h index 267f799f..0fa0df97 100644 --- a/tests/headers/enum_negative.h +++ b/tests/headers/enum_negative.h @@ -1,4 +1,4 @@ -// bindgen-flags: --rustified-enum .* +// bindgen-flags: --rustified-enum ".*" enum Foo { Bar = -2, diff --git a/tests/headers/enum_packed.h b/tests/headers/enum_packed.h index 1c89b992..cc70c816 100644 --- a/tests/headers/enum_packed.h +++ b/tests/headers/enum_packed.h @@ -1,4 +1,4 @@ -// bindgen-flags: --rustified-enum .* +// bindgen-flags: --rustified-enum ".*" enum __attribute__((packed)) Foo { Bar = 0, diff --git a/tests/headers/forward-enum-decl.hpp b/tests/headers/forward-enum-decl.hpp index a3df8584..81a0eee7 100644 --- a/tests/headers/forward-enum-decl.hpp +++ b/tests/headers/forward-enum-decl.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --rustified-enum .* -- -std=c++11 +// bindgen-flags: --rustified-enum ".*" -- -std=c++11 enum class CSSPseudoClassType : int; diff --git a/tests/headers/func_ptr_in_struct.h b/tests/headers/func_ptr_in_struct.h index dd608549..ef075df7 100644 --- a/tests/headers/func_ptr_in_struct.h +++ b/tests/headers/func_ptr_in_struct.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum .* +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum ".*" // enum baz; diff --git a/tests/headers/issue-372.hpp b/tests/headers/issue-372.hpp index de144776..7127be2c 100644 --- a/tests/headers/issue-372.hpp +++ b/tests/headers/issue-372.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --enable-cxx-namespaces --rustified-enum .* +// bindgen-flags: --enable-cxx-namespaces --rustified-enum ".*" template <typename a, int b> class c { a e[b]; }; class d; template <typename g, g f> class C { c<d, f> h; }; diff --git a/tests/headers/issue-410.hpp b/tests/headers/issue-410.hpp index c91c83d1..b5d502f3 100644 --- a/tests/headers/issue-410.hpp +++ b/tests/headers/issue-410.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --enable-cxx-namespaces --whitelist-type JS::Value --rustified-enum .* +// bindgen-flags: --enable-cxx-namespaces --whitelist-type JS::Value --rustified-enum ".*" namespace JS { class Value; diff --git a/tests/headers/issue-493.hpp b/tests/headers/issue-493.hpp index 280b8736..8b122ceb 100644 --- a/tests/headers/issue-493.hpp +++ b/tests/headers/issue-493.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum .* +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum ".*" template<class _CharT, class _Traits, class _Allocator> class basic_string { diff --git a/tests/headers/issue-493_1_0.hpp b/tests/headers/issue-493_1_0.hpp index 7406d893..af6fd47c 100644 --- a/tests/headers/issue-493_1_0.hpp +++ b/tests/headers/issue-493_1_0.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum .* +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum ".*" template<class _CharT, class _Traits, class _Allocator> class basic_string diff --git a/tests/headers/issue-569-non-type-template-params-causing-layout-test-failures.hpp b/tests/headers/issue-569-non-type-template-params-causing-layout-test-failures.hpp index 964b69cb..297d1112 100644 --- a/tests/headers/issue-569-non-type-template-params-causing-layout-test-failures.hpp +++ b/tests/headers/issue-569-non-type-template-params-causing-layout-test-failures.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --rustified-enum .* -- -std=c++14 +// bindgen-flags: --rustified-enum ".*" -- -std=c++14 // Generated by C-Reduce, cleaned up and given names for readability. diff --git a/tests/headers/issue-888-enum-var-decl-jump.hpp b/tests/headers/issue-888-enum-var-decl-jump.hpp index d7182c3c..fa4ba56b 100644 --- a/tests/headers/issue-888-enum-var-decl-jump.hpp +++ b/tests/headers/issue-888-enum-var-decl-jump.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --enable-cxx-namespaces --rustified-enum .* +// bindgen-flags: --enable-cxx-namespaces --rustified-enum ".*" namespace Halide { struct Type; diff --git a/tests/headers/jsval_layout_opaque.hpp b/tests/headers/jsval_layout_opaque.hpp index 7a1957cf..ef13b85b 100644 --- a/tests/headers/jsval_layout_opaque.hpp +++ b/tests/headers/jsval_layout_opaque.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum .* +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum ".*" // bindgen-flags: -- -std=c++11 /** diff --git a/tests/headers/jsval_layout_opaque_1_0.hpp b/tests/headers/jsval_layout_opaque_1_0.hpp index dcf6274d..c8e66551 100644 --- a/tests/headers/jsval_layout_opaque_1_0.hpp +++ b/tests/headers/jsval_layout_opaque_1_0.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum .* +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum ".*" // bindgen-flags: -- -std=c++11 /** diff --git a/tests/headers/layout_array_too_long.h b/tests/headers/layout_array_too_long.h index 1d8b1b63..d0d34ba0 100644 --- a/tests/headers/layout_array_too_long.h +++ b/tests/headers/layout_array_too_long.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --impl-partialeq --rustified-enum .* +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --impl-partialeq --rustified-enum ".*" typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; diff --git a/tests/headers/layout_cmdline_token.h b/tests/headers/layout_cmdline_token.h index 68dd53b8..da1bfc2e 100644 --- a/tests/headers/layout_cmdline_token.h +++ b/tests/headers/layout_cmdline_token.h @@ -1,4 +1,4 @@ -// bindgen-flags: --rustified-enum .* +// bindgen-flags: --rustified-enum ".*" /** * Stores a pointer to the ops struct, and the offset: the place to @@ -61,4 +61,4 @@ struct cmdline_token_num { struct cmdline_token_hdr hdr; struct cmdline_token_num_data num_data; }; -typedef struct cmdline_token_num cmdline_parse_token_num_t;
\ No newline at end of file +typedef struct cmdline_token_num cmdline_parse_token_num_t; diff --git a/tests/headers/layout_eth_conf.h b/tests/headers/layout_eth_conf.h index 71a430bf..93ab8408 100644 --- a/tests/headers/layout_eth_conf.h +++ b/tests/headers/layout_eth_conf.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum .* +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum ".*" typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; diff --git a/tests/headers/layout_eth_conf_1_0.h b/tests/headers/layout_eth_conf_1_0.h index cf6fa6ad..48ba39ff 100644 --- a/tests/headers/layout_eth_conf_1_0.h +++ b/tests/headers/layout_eth_conf_1_0.h @@ -1,4 +1,4 @@ -// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum .* +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum ".*" typedef unsigned char uint8_t; typedef unsigned short uint16_t; diff --git a/tests/headers/layout_large_align_field.h b/tests/headers/layout_large_align_field.h index 5e87c2a1..f292bb70 100644 --- a/tests/headers/layout_large_align_field.h +++ b/tests/headers/layout_large_align_field.h @@ -1,4 +1,4 @@ -// bindgen-flags: --rustified-enum .* +// bindgen-flags: --rustified-enum ".*" typedef unsigned char uint8_t; typedef unsigned short uint16_t; diff --git a/tests/headers/no-recursive-whitelisting.h b/tests/headers/no-recursive-whitelisting.h index 8eb8afea..c94cc491 100644 --- a/tests/headers/no-recursive-whitelisting.h +++ b/tests/headers/no-recursive-whitelisting.h @@ -1,4 +1,4 @@ -// bindgen-flags: --no-recursive-whitelist --whitelist-type "Foo" --raw-line "pub enum Bar {}" --rustified-enum .* +// bindgen-flags: --no-recursive-whitelist --whitelist-type "Foo" --raw-line "pub enum Bar {}" --rustified-enum ".*" struct Bar; diff --git a/tests/headers/no-std.h b/tests/headers/no-std.h index 9248cc3d..d98abced 100644 --- a/tests/headers/no-std.h +++ b/tests/headers/no-std.h @@ -1,4 +1,4 @@ -// 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 .* +// 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 ".*" struct foo { int a, b; void* bar; diff --git a/tests/headers/nsStyleAutoArray.hpp b/tests/headers/nsStyleAutoArray.hpp index 2a0bc216..3049ea21 100644 --- a/tests/headers/nsStyleAutoArray.hpp +++ b/tests/headers/nsStyleAutoArray.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --rustified-enum .* +// bindgen-flags: --rustified-enum ".*" template<typename T> class nsTArray { diff --git a/tests/headers/opaque-tracing.hpp b/tests/headers/opaque-tracing.hpp index 326ebbe7..9f7319cc 100644 --- a/tests/headers/opaque-tracing.hpp +++ b/tests/headers/opaque-tracing.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --opaque-type=.* --whitelist-function=foo --with-derive-hash --with-derive-partialeq --with-derive-eq +// bindgen-flags: --opaque-type ".*" --whitelist-function=foo --with-derive-hash --with-derive-partialeq --with-derive-eq class Container; diff --git a/tests/headers/overflowed_enum.hpp b/tests/headers/overflowed_enum.hpp index 53a05ddf..18d3fe41 100644 --- a/tests/headers/overflowed_enum.hpp +++ b/tests/headers/overflowed_enum.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --rustified-enum .* -- -std=c++11 -Wno-narrowing +// bindgen-flags: --rustified-enum ".*" -- -std=c++11 -Wno-narrowing enum Foo { BAP_ARM = 0x93fcb9, diff --git a/tests/headers/prepend-enum-constified-variant.h b/tests/headers/prepend-enum-constified-variant.h index 06ae264f..e9ba0e73 100644 --- a/tests/headers/prepend-enum-constified-variant.h +++ b/tests/headers/prepend-enum-constified-variant.h @@ -1,4 +1,4 @@ -// bindgen-flags: --no-prepend-enum-name --rustified-enum .* +// bindgen-flags: --no-prepend-enum-name --rustified-enum ".*" enum AVCodecID { AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, diff --git a/tests/headers/short-enums.hpp b/tests/headers/short-enums.hpp index 0b517d6f..14f833de 100644 --- a/tests/headers/short-enums.hpp +++ b/tests/headers/short-enums.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --rustified-enum .* -- -std=c++11 -fshort-enums +// bindgen-flags: --rustified-enum ".*" -- -std=c++11 -fshort-enums typedef enum { SOME_VALUE = 0x1, diff --git a/tests/headers/struct_typedef.h b/tests/headers/struct_typedef.h index e996b28f..2ed7aabd 100644 --- a/tests/headers/struct_typedef.h +++ b/tests/headers/struct_typedef.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum .* +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --rustified-enum ".*" // typedef struct { _Bool has_name; diff --git a/tests/headers/struct_typedef_ns.hpp b/tests/headers/struct_typedef_ns.hpp index a5a8f9a6..40a7c680 100644 --- a/tests/headers/struct_typedef_ns.hpp +++ b/tests/headers/struct_typedef_ns.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --enable-cxx-namespaces --rustified-enum .* +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --enable-cxx-namespaces --rustified-enum ".*" namespace whatever { typedef struct { diff --git a/tests/headers/weird_bitfields.hpp b/tests/headers/weird_bitfields.hpp index 7236d60a..b2761a80 100644 --- a/tests/headers/weird_bitfields.hpp +++ b/tests/headers/weird_bitfields.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --rustified-enum .* +// bindgen-flags: --rustified-enum ".*" // You can guess where this is taken from... enum nsStyleSVGOpacitySource { |