Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
gabiganam authored Jun 26, 2024
2 parents be05b8e + 9d5991b commit c950a83
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@
- Add a complex macro fallback API (#2779).
- Add option to use DST structs for flexible arrays (--flexarray-dst, #2772).
- Add option to dynamically load variables (#2812).
- Add option in CLI to use rustified non-exhaustive enums (--rustified-non-exhaustive-enum, #2847).
## Changed
- Remove which and lazy-static dependencies (#2809, #2817).
- Generate compile-time layout tests (#2787).
Expand Down
8 changes: 8 additions & 0 deletions bindgen-cli/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ struct BindgenCommand {
/// Mark any enum whose name matches REGEX as a Rust enum.
#[arg(long, value_name = "REGEX")]
rustified_enum: Vec<String>,
/// Mark any enum whose name matches REGEX as a non-exhaustive Rust enum.
#[arg(long, value_name = "REGEX")]
rustified_non_exhaustive_enum: Vec<String>,
/// Mark any enum whose name matches REGEX as a series of constants.
#[arg(long, value_name = "REGEX")]
constified_enum: Vec<String>,
Expand Down Expand Up @@ -469,6 +472,7 @@ where
newtype_enum,
newtype_global_enum,
rustified_enum,
rustified_non_exhaustive_enum,
constified_enum,
constified_enum_module,
default_macro_constant_type,
Expand Down Expand Up @@ -635,6 +639,10 @@ where
builder = builder.rustified_enum(regex);
}

for regex in rustified_non_exhaustive_enum {
builder = builder.rustified_non_exhaustive_enum(regex);
}

for regex in constified_enum {
builder = builder.constified_enum(regex);
}
Expand Down
1 change: 1 addition & 0 deletions bindgen/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ impl std::fmt::Display for Formatter {
/// 2. [`bitfield_enum()`](#method.bitfield_enum)
/// 3. [`newtype_enum()`](#method.newtype_enum)
/// 4. [`rustified_enum()`](#method.rustified_enum)
/// 5. [`rustified_non_exhaustive_enum()`](#method.rustified_non_exhaustive_enum)
///
/// For each C enum, bindgen tries to match the pattern in the following order:
///
Expand Down

0 comments on commit c950a83

Please sign in to comment.